diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index 6834c8df8..82a49cc54 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -37,7 +37,8 @@ from openlp.core.lib import OpenLPToolbar, ServiceItem, Receiver, build_icon, \ ItemCapabilities, SettingsManager, translate from openlp.core.lib.theme import ThemeLevel from openlp.core.lib.ui import UiStrings, critical_error_message_box, \ - context_menu_action, context_menu_separator, find_and_set_in_combo_box + context_menu_action, context_menu_separator, find_and_set_in_combo_box, \ + checkable_action from openlp.core.ui import ServiceNoteForm, ServiceItemEditForm, StartTimeForm from openlp.core.ui.printserviceform import PrintServiceForm from openlp.core.utils import AppLocation, delete_file, file_is_unicode, \ @@ -676,8 +677,19 @@ class ServiceManager(QtGui.QWidget): .is_capable(ItemCapabilities.AllowsVariableStartTime): self.timeAction.setVisible(True) self.themeMenu.menuAction().setVisible(False) - if serviceItem[u'service_item'].is_text(): + if serviceItem[u'service_item'].is_text() and \ + len(self.themeMenu.actions()) > 1: self.themeMenu.menuAction().setVisible(True) + if serviceItem[u'service_item'].theme is None: + themeAction = self.themeMenu.findChild(QtGui.QAction, u'Sunrise') + else: + themeAction = self.themeMenu.findChild(QtGui.QAction, u'Sunrise') + if themeAction is not None: + themeAction.setChecked(True) + print self.mainwindow.renderer.global_theme + for themeAction in self.themeMenu.actions(): + themeAction.setChecked( + themeAction.text() == serviceItem[u'service_item'].theme) action = self.menu.exec_(self.serviceManagerList.mapToGlobal(point)) def onServiceItemNoteForm(self): @@ -1276,10 +1288,16 @@ class ServiceManager(QtGui.QWidget): self.themeComboBox.clear() self.themeMenu.clear() self.themeComboBox.addItem(u'') + themeGroup = QtGui.QActionGroup(self.themeMenu) + themeGroup.setExclusive(True) + themeGroup.setObjectName(u'themeGroup') for theme in theme_list: self.themeComboBox.addItem(theme) - context_menu_action(self.themeMenu, None, theme, + themeAction = context_menu_action(self.themeMenu, None, theme, self.onThemeChangeAction) + themeAction.setObjectName(theme) + themeAction.setCheckable(True) + themeGroup.addAction(themeAction) find_and_set_in_combo_box(self.themeComboBox, self.service_theme) self.mainwindow.renderer.set_service_theme(self.service_theme) self.regenerateServiceItems()