Fix bug #596541 hide theme combo for global themes

This commit is contained in:
Tim Bentley 2010-06-26 08:19:30 +01:00
parent 4820d5d15f
commit b59b2bdafa
3 changed files with 26 additions and 14 deletions

View File

@ -33,7 +33,7 @@ log = logging.getLogger(__name__)
from PyQt4 import QtCore, QtGui
from openlp.core.lib import OpenLPToolbar, ServiceItem, context_menu_action, \
Receiver, build_icon, ItemCapabilities, SettingsManager, translate
Receiver, build_icon, ItemCapabilities, SettingsManager, translate, ThemeLevel
from openlp.core.ui import ServiceNoteForm, ServiceItemEditForm
from openlp.core.utils import AppLocation
@ -134,15 +134,13 @@ class ServiceManager(QtGui.QWidget):
self.ThemeLabel = QtGui.QLabel(translate('ServiceManager', 'Theme:'),
self)
self.ThemeLabel.setMargin(3)
self.Toolbar.addWidget(self.ThemeLabel)
self.Toolbar.addToolbarWidget(u'ThemeLabel', self.ThemeLabel)
self.ThemeComboBox = QtGui.QComboBox(self.Toolbar)
self.ThemeComboBox.setToolTip(translate('ServiceManager',
'Select a theme for the service'))
self.ThemeComboBox.setSizeAdjustPolicy(
QtGui.QComboBox.AdjustToContents)
self.ThemeWidget = QtGui.QWidgetAction(self.Toolbar)
self.ThemeWidget.setDefaultWidget(self.ThemeComboBox)
self.Toolbar.addAction(self.ThemeWidget)
self.Toolbar.addToolbarWidget(u'ThemeWidget', self.ThemeComboBox)
self.Layout.addWidget(self.Toolbar)
# Create the service manager list
self.ServiceManagerList = ServiceManagerList(self)
@ -214,6 +212,8 @@ class ServiceManager(QtGui.QWidget):
QtCore.SIGNAL(u'servicemanager_list_request'), self.listRequest)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'config_updated'), self.regenerateServiceItems)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'theme_update_global'), self.themeChange)
# Last little bits of setting up
self.service_theme = unicode(QtCore.QSettings().value(
self.parent.serviceSettingsSection + u'/service theme',
@ -756,6 +756,18 @@ class ServiceManager(QtGui.QWidget):
QtCore.QVariant(self.service_theme))
self.regenerateServiceItems()
def themeChange(self):
"""
The theme may have changed in the settings dialog so make
sure the theme combo box is in the correct state.
"""
if self.parent.RenderManager.theme_level == ThemeLevel.Global:
self.Toolbar.actions[u'ThemeLabel'].setVisible(False)
self.Toolbar.actions[u'ThemeWidget'].setVisible(False)
else:
self.Toolbar.actions[u'ThemeLabel'].setVisible(True)
self.Toolbar.actions[u'ThemeWidget'].setVisible(True)
def regenerateServiceItems(self):
"""
Rebuild the service list as things have changed and a

View File

@ -513,21 +513,21 @@ class SlideController(QtGui.QWidget):
"""
log.debug(u'processManagerItem')
self.onStopLoop()
#If old item was a command tell it to stop
#If old item was a command tell it to stop
if self.serviceItem:
if self.serviceItem.is_command():
Receiver.send_message(u'%s_stop' %
Receiver.send_message(u'%s_stop' %
self.serviceItem.name.lower(), [serviceItem, self.isLive])
if self.serviceItem.is_media():
self.onMediaStop()
if serviceItem.is_media():
self.onMediaStart(serviceItem)
if self.isLive:
blanked = self.blankButton.isChecked()
else:
blanked = False
Receiver.send_message(u'%s_start' % serviceItem.name.lower(),
[serviceItem, self.isLive, blanked, slideno])
# if self.isLive:
# blanked = self.blankButton.isChecked()
# else:
# blanked = False
# Receiver.send_message(u'%s_start' % serviceItem.name.lower(),
# [serviceItem, self.isLive, blanked, slideno])
self.slideList = {}
width = self.parent.ControlSplitter.sizes()[self.split]
#Set pointing cursor when we have somthing to point at

View File

@ -150,9 +150,9 @@ class ThemesTab(SettingsTab):
settings.setValue(u'global theme',
QtCore.QVariant(self.global_theme))
settings.endGroup()
Receiver.send_message(u'theme_update_global', self.global_theme)
self.parent.RenderManager.set_global_theme(
self.global_theme, self.theme_level)
Receiver.send_message(u'theme_update_global', self.global_theme)
def postSetUp(self):
Receiver.send_message(u'theme_update_global', self.global_theme)