More fixes

This commit is contained in:
Tim Bentley 2013-03-11 19:11:46 +00:00
parent 5f1db14ba4
commit 46fe786f8b
4 changed files with 15 additions and 29 deletions

View File

@ -653,11 +653,10 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
self.activePlugin.app_startup()
else:
self.activePlugin.toggleStatus(PluginStatus.Inactive)
self.themeManagerContents.config_updated()
self.themeManagerContents.change_global_from_tab()
self.themeManagerContents.load_themes(True)
Registry().execute(u'theme_update_global', self.themeManagerContents.global_theme)
# Check if any Bibles downloaded. If there are, they will be
# processed.
# Check if any Bibles downloaded. If there are, they will be processed.
Registry().execute(u'bibles_load_list', True)
self.application.set_normal_cursor()
@ -1105,11 +1104,12 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
"""
self.statusBar.showMessage(message)
def default_theme_changed(self, theme):
def default_theme_changed(self):
"""
Update the default theme indicator in the status bar
"""
self.defaultThemeLabel.setText(translate('OpenLP.MainWindow', 'Default Theme: %s') % theme)
self.defaultThemeLabel.setText(translate('OpenLP.MainWindow', 'Default Theme: %s') %
Settings().value(u'themes/global theme'))
def toggleMediaManager(self):
"""

View File

@ -267,7 +267,6 @@ class ServiceManagerDialog(object):
self.service_manager_list.collapse
])
Registry().register_function(u'theme_update_list', self.update_theme_list)
Registry().register_function(u'config_updated', self.config_updated)
Registry().register_function(u'config_screen_changed', self.regenerate_service_Items)
Registry().register_function(u'theme_update_global', self.theme_change)
Registry().register_function(u'mediaitem_suffix_reset', self.reset_supported_suffixes)
@ -301,7 +300,6 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
self.service_items = []
self.suffixes = []
self.drop_position = 0
self.expand_tabs = False
self.service_id = 0
# is a new service and has not been saved
self._modified = False
@ -315,7 +313,6 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
self.layout.setSpacing(0)
self.layout.setMargin(0)
self.setup_ui(self)
self.config_updated()
def set_modified(self, modified=True):
"""
@ -355,12 +352,6 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
"""
return split_filename(self._file_name)[1]
def config_updated(self):
"""
Triggered when Config dialog is updated.
"""
self.expand_tabs = Settings().value(u'advanced/expand service item')
def reset_supported_suffixes(self):
"""
Resets the Suffixes list.
@ -1136,7 +1127,9 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
"""
item = self.find_service_item()[0]
if item != -1:
print self.service_items
self.service_items.remove(self.service_items[item])
print self.service_items
self.repaint_service_list(item - 1, -1)
self.set_modified()
@ -1162,6 +1155,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
self.service_has_all_original_files = False
# Repaint the screen
self.service_manager_list.clear()
self.service_manager_list.clearSelection()
for item_count, item in enumerate(self.service_items):
serviceitem = item[u'service_item']
treewidgetitem = QtGui.QTreeWidgetItem(self.service_manager_list)
@ -1323,7 +1317,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
"""
# if not passed set to config value
if expand is None:
expand = self.expand_tabs
expand = Settings().value(u'advanced/expand service item')
item.from_service = True
if replace:
sitem, child = self.find_service_item()

View File

@ -132,7 +132,6 @@ class ThemeManager(QtGui.QWidget):
self.theme_list_widget.doubleClicked.connect(self.change_global_from_screen)
self.theme_list_widget.currentItemChanged.connect(self.check_list_state)
Registry().register_function(u'theme_update_global', self.change_global_from_tab)
Registry().register_function(u'config_updated', self.config_updated)
# Variables
self.theme_list = []
self.path = AppLocation.get_section_data_path(self.settingsSection)
@ -143,14 +142,7 @@ class ThemeManager(QtGui.QWidget):
self.oldBackgroundImage = None
self.badV1NameChars = re.compile(r'[%+\[\]]')
# Last little bits of setting up
self.config_updated()
def config_updated(self):
"""
Triggered when Config dialog is updated.
"""
log.debug(u'config_updated')
self.global_theme = Settings().value(self.settingsSection + u'/global theme')
self.change_global_from_tab()
def check_list_state(self, item):
"""
@ -182,11 +174,12 @@ class ThemeManager(QtGui.QWidget):
self.global_action.setVisible(visible)
self.menu.exec_(self.theme_list_widget.mapToGlobal(point))
def change_global_from_tab(self, theme_name):
def change_global_from_tab(self):
"""
Change the global theme when it is changed through the Themes settings tab
"""
log.debug(u'change_global_from_tab %s', theme_name)
self.global_theme = Settings().value(self.settingsSection + u'/global theme')
log.debug(u'change_global_from_tab %s', self.global_theme)
for count in range(0, self.theme_list_widget.count()):
# reset the old name
item = self.theme_list_widget.item(count)
@ -195,7 +188,7 @@ class ThemeManager(QtGui.QWidget):
if old_name != new_name:
self.theme_list_widget.item(count).setText(new_name)
# Set the new name
if theme_name == new_name:
if self.global_theme == new_name:
name = translate('OpenLP.ThemeManager', '%s (default)') % new_name
self.theme_list_widget.item(count).setText(name)
self.deleteToolbarAction.setVisible(item not in self.theme_list_widget.selectedItems())
@ -219,7 +212,7 @@ class ThemeManager(QtGui.QWidget):
name = translate('OpenLP.ThemeManager', '%s (default)') % self.global_theme
self.theme_list_widget.item(count).setText(name)
Settings().setValue(self.settingsSection + u'/global theme', self.global_theme)
Registry().execute(u'theme_update_global', self.global_theme)
Registry().execute(u'theme_update_global')
self._push_themes()
def onAddTheme(self):

View File

@ -153,7 +153,6 @@ class AlertsPlugin(Plugin):
visible=False, can_shortcuts=True, triggers=self.onAlertsTrigger)
self.main_window.tools_menu.addAction(self.toolsAlertItem)
def initialise(self):
log.info(u'Alerts Initialising')
Plugin.initialise(self)