forked from openlp/openlp
Add update to ServiceManager of Themes from ThemeManager
This commit is contained in:
parent
a3e2bce831
commit
4696564c09
@ -87,6 +87,7 @@ class MainWindow(object):
|
|||||||
log.info(u'Load Themes')
|
log.info(u'Load Themes')
|
||||||
self.ThemeManagerContents.setEventManager(self.EventManager)
|
self.ThemeManagerContents.setEventManager(self.EventManager)
|
||||||
self.ThemeManagerContents.setRenderManager(self.RenderManager)
|
self.ThemeManagerContents.setRenderManager(self.RenderManager)
|
||||||
|
self.ThemeManagerContents.setServiceManager(self.ServiceManagerContents)
|
||||||
self.ThemeManagerContents.loadThemes()
|
self.ThemeManagerContents.loadThemes()
|
||||||
|
|
||||||
def setupUi(self):
|
def setupUi(self):
|
||||||
|
@ -128,9 +128,6 @@ class ServiceManager(QWidget):
|
|||||||
self.Toolbar.addSeparator()
|
self.Toolbar.addSeparator()
|
||||||
self.ThemeComboBox = QtGui.QComboBox(self.Toolbar)
|
self.ThemeComboBox = QtGui.QComboBox(self.Toolbar)
|
||||||
self.ThemeComboBox.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToContents)
|
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 = QtGui.QWidgetAction(self.Toolbar)
|
||||||
self.ThemeWidget.setDefaultWidget(self.ThemeComboBox)
|
self.ThemeWidget.setDefaultWidget(self.ThemeComboBox)
|
||||||
self.Toolbar.addAction(self.ThemeWidget)
|
self.Toolbar.addAction(self.ThemeWidget)
|
||||||
@ -189,3 +186,8 @@ class ServiceManager(QWidget):
|
|||||||
oosfile.write(self.oos_as_text)
|
oosfile.write(self.oos_as_text)
|
||||||
oosfile.write("# END OOS\n")
|
oosfile.write("# END OOS\n")
|
||||||
oosfile.close()
|
oosfile.close()
|
||||||
|
|
||||||
|
def updateThemeList(self, theme_list):
|
||||||
|
self.ThemeComboBox.clear()
|
||||||
|
for theme in theme_list:
|
||||||
|
self.ThemeComboBox.addItem(theme)
|
||||||
|
@ -31,6 +31,7 @@ from PyQt4.QtCore import *
|
|||||||
from PyQt4.QtGui import *
|
from PyQt4.QtGui import *
|
||||||
|
|
||||||
from openlp.core.ui import AmendThemeForm
|
from openlp.core.ui import AmendThemeForm
|
||||||
|
from openlp.core.ui import ServiceManager
|
||||||
from openlp.core import translate
|
from openlp.core import translate
|
||||||
from openlp.core.theme import Theme
|
from openlp.core.theme import Theme
|
||||||
from openlp.core.lib import Event
|
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.lib import Renderer
|
||||||
from openlp.core.utils import ConfigHelper
|
from openlp.core.utils import ConfigHelper
|
||||||
|
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
class ThemeData(QAbstractItemModel):
|
class ThemeData(QAbstractItemModel):
|
||||||
@ -190,6 +190,9 @@ class ThemeManager(QWidget):
|
|||||||
def setRenderManager(self, renderManager):
|
def setRenderManager(self, renderManager):
|
||||||
self.renderManager = renderManager
|
self.renderManager = renderManager
|
||||||
|
|
||||||
|
def setServiceManager(self, serviceManager):
|
||||||
|
self.serviceManager = serviceManager
|
||||||
|
|
||||||
def onAddTheme(self):
|
def onAddTheme(self):
|
||||||
self.amendThemeForm.loadTheme(None)
|
self.amendThemeForm.loadTheme(None)
|
||||||
self.amendThemeForm.exec_()
|
self.amendThemeForm.exec_()
|
||||||
@ -240,6 +243,7 @@ class ThemeManager(QWidget):
|
|||||||
self.Theme_data.addRow(os.path.join(self.path, name))
|
self.Theme_data.addRow(os.path.join(self.path, name))
|
||||||
|
|
||||||
self.eventManager.post_event(Event(EventType.ThemeListChanged))
|
self.eventManager.post_event(Event(EventType.ThemeListChanged))
|
||||||
|
self.serviceManager.updateThemeList(self.getThemes())
|
||||||
|
|
||||||
def getThemes(self):
|
def getThemes(self):
|
||||||
return self.Theme_data.getList()
|
return self.Theme_data.getList()
|
||||||
@ -323,6 +327,7 @@ class ThemeManager(QWidget):
|
|||||||
return newtheme.extract_xml()
|
return newtheme.extract_xml()
|
||||||
|
|
||||||
def saveTheme(self, name, theme_xml) :
|
def saveTheme(self, name, theme_xml) :
|
||||||
|
log.debug(u'saveTheme %s %s', name, theme_xml)
|
||||||
self.generateAndSaveImage(self.path, name, theme_xml)
|
self.generateAndSaveImage(self.path, name, theme_xml)
|
||||||
theme_dir = os.path.join(self.path, name)
|
theme_dir = os.path.join(self.path, name)
|
||||||
if os.path.exists(theme_dir) == False:
|
if os.path.exists(theme_dir) == False:
|
||||||
|
Loading…
Reference in New Issue
Block a user