forked from openlp/openlp
Allow existing themes to be edited (well at least viewed)
This commit is contained in:
parent
61dbab1899
commit
6b4a5ff5d9
@ -18,10 +18,12 @@ this program; if not, write to the Free Software Foundation, Inc., 59 Temple
|
||||
Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
"""
|
||||
import logging
|
||||
import os, os.path
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
from PyQt4.QtGui import QColor, QFont
|
||||
from openlp.core.lib import ThemeXML
|
||||
from openlp.core import fileToXML
|
||||
from openlp.core import Renderer
|
||||
from openlp.core import translate
|
||||
|
||||
@ -60,12 +62,17 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
|
||||
def accept(self):
|
||||
return QtGui.QDialog.accept(self)
|
||||
|
||||
def themePath(self, path):
|
||||
self.path = path
|
||||
|
||||
def loadTheme(self, theme):
|
||||
self.theme = ThemeXML()
|
||||
if theme == None:
|
||||
self.theme = ThemeXML()
|
||||
self.theme.parse(self.baseTheme())
|
||||
else:
|
||||
pass
|
||||
xml_file = os.path.join(self.path, theme, theme+u'.xml')
|
||||
xml = fileToXML(xml_file)
|
||||
self.theme.parse(xml)
|
||||
self.paintUi(self.theme)
|
||||
self.generateImage(self.theme)
|
||||
|
||||
|
@ -128,7 +128,11 @@ class ThemeData(QAbstractItemModel):
|
||||
for i in self.items:
|
||||
yield i
|
||||
|
||||
def item(self, row):
|
||||
def getValue(self, index):
|
||||
row = index.row()
|
||||
return self.items[row]
|
||||
|
||||
def getItem(self, row):
|
||||
log.info(u'Get Item:%d -> %s' %(row, str(self.items)))
|
||||
return self.items[row]
|
||||
|
||||
@ -177,6 +181,7 @@ class ThemeManager(QWidget):
|
||||
self.themelist= []
|
||||
self.path = os.path.join(ConfigHelper.get_data_path(), u'themes')
|
||||
self.checkThemesExists(self.path)
|
||||
self.amendThemeForm.themePath(self.path)
|
||||
|
||||
def setEventManager(self, eventManager):
|
||||
self.eventManager = eventManager
|
||||
@ -186,7 +191,10 @@ class ThemeManager(QWidget):
|
||||
self.amendThemeForm.exec_()
|
||||
|
||||
def onEditTheme(self):
|
||||
self.amendThemeForm.loadTheme(theme)
|
||||
items = self.ThemeListView.selectedIndexes()
|
||||
for item in items:
|
||||
data = self.Theme_data.getValue(item)
|
||||
self.amendThemeForm.loadTheme(data[3])
|
||||
self.amendThemeForm.exec_()
|
||||
|
||||
def onDeleteTheme(self):
|
||||
|
Loading…
Reference in New Issue
Block a user