Add update to ServiceManager of Themes from ThemeManager

This commit is contained in:
Tim Bentley 2009-04-23 19:22:54 +01:00
parent a3e2bce831
commit 4696564c09
3 changed files with 18 additions and 10 deletions

View File

@ -87,6 +87,7 @@ class MainWindow(object):
log.info(u'Load Themes')
self.ThemeManagerContents.setEventManager(self.EventManager)
self.ThemeManagerContents.setRenderManager(self.RenderManager)
self.ThemeManagerContents.setServiceManager(self.ServiceManagerContents)
self.ThemeManagerContents.loadThemes()
def setupUi(self):

View File

@ -128,9 +128,6 @@ class ServiceManager(QWidget):
self.Toolbar.addSeparator()
self.ThemeComboBox = QtGui.QComboBox(self.Toolbar)
self.ThemeComboBox.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToContents)
self.ThemeComboBox.addItem(QtCore.QString())
self.ThemeComboBox.addItem(QtCore.QString())
self.ThemeComboBox.addItem(QtCore.QString())
self.ThemeWidget = QtGui.QWidgetAction(self.Toolbar)
self.ThemeWidget.setDefaultWidget(self.ThemeComboBox)
self.Toolbar.addAction(self.ThemeWidget)
@ -189,3 +186,8 @@ class ServiceManager(QWidget):
oosfile.write(self.oos_as_text)
oosfile.write("# END OOS\n")
oosfile.close()
def updateThemeList(self, theme_list):
self.ThemeComboBox.clear()
for theme in theme_list:
self.ThemeComboBox.addItem(theme)

View File

@ -31,6 +31,7 @@ from PyQt4.QtCore import *
from PyQt4.QtGui import *
from openlp.core.ui import AmendThemeForm
from openlp.core.ui import ServiceManager
from openlp.core import translate
from openlp.core.theme import Theme
from openlp.core.lib import Event
@ -41,7 +42,6 @@ from openlp.core.lib import ThemeXML
from openlp.core.lib import Renderer
from openlp.core.utils import ConfigHelper
import logging
class ThemeData(QAbstractItemModel):
@ -190,6 +190,9 @@ class ThemeManager(QWidget):
def setRenderManager(self, renderManager):
self.renderManager = renderManager
def setServiceManager(self, serviceManager):
self.serviceManager = serviceManager
def onAddTheme(self):
self.amendThemeForm.loadTheme(None)
self.amendThemeForm.exec_()
@ -240,6 +243,7 @@ class ThemeManager(QWidget):
self.Theme_data.addRow(os.path.join(self.path, name))
self.eventManager.post_event(Event(EventType.ThemeListChanged))
self.serviceManager.updateThemeList(self.getThemes())
def getThemes(self):
return self.Theme_data.getList()
@ -323,6 +327,7 @@ class ThemeManager(QWidget):
return newtheme.extract_xml()
def saveTheme(self, name, theme_xml) :
log.debug(u'saveTheme %s %s', name, theme_xml)
self.generateAndSaveImage(self.path, name, theme_xml)
theme_dir = os.path.join(self.path, name)
if os.path.exists(theme_dir) == False: