diff --git a/openlp/core/lib/plugin.py b/openlp/core/lib/plugin.py index 99247c4b9..ef89e6424 100644 --- a/openlp/core/lib/plugin.py +++ b/openlp/core/lib/plugin.py @@ -141,6 +141,7 @@ class Plugin(QtCore.QObject): ``settings_tab_class`` The class name of the plugin's settings tab. """ + log.debug(u'Plugin %s initialised' % name) QtCore.QObject.__init__(self) self.name = name self.textStrings = {} @@ -250,7 +251,8 @@ class Plugin(QtCore.QObject): """ if self.settings_tab_class: return self.settings_tab_class(self.name, - self.getString(StringContent.VisibleName)[u'title'], self.icon_path) + self.getString(StringContent.VisibleName)[u'title'], + self.icon_path) return None def addToMenu(self, menubar): @@ -287,32 +289,19 @@ class Plugin(QtCore.QObject): """ if self.mediaItem: self.mediaItem.initialise() - self.insertToolboxItem() + self.mediadock.insert_dock(self.mediaItem, self.icon, self.weight) + if self.settings_tab: + self.settingsForm.insertTab(self.settings_tab, self.weight) def finalise(self): """ Called by the plugin Manager to cleanup things. """ - self.removeToolboxItem() - - def removeToolboxItem(self): - """ - Called by the plugin to remove toolbar - """ if self.mediaItem: self.mediadock.remove_dock(self.mediaItem) if self.settings_tab: self.settingsForm.removeTab(self.settings_tab) - def insertToolboxItem(self): - """ - Called by plugin to replace toolbar - """ - if self.mediaItem: - self.mediadock.insert_dock(self.mediaItem, self.icon, self.weight) - if self.settings_tab: - self.settingsForm.insertTab(self.settings_tab, self.weight) - def usesTheme(self, theme): """ Called to find out if a plugin is currently using a theme. diff --git a/openlp/core/lib/pluginmanager.py b/openlp/core/lib/pluginmanager.py index ef8287ba7..3b73750fe 100644 --- a/openlp/core/lib/pluginmanager.py +++ b/openlp/core/lib/pluginmanager.py @@ -206,8 +206,6 @@ class PluginManager(object): if plugin.isActive(): plugin.initialise() log.info(u'Initialisation Complete for %s ' % plugin.name) - if not plugin.isActive(): - plugin.removeToolboxItem() log.info(u'Initialise Plugins - Finished') def finalise_plugins(self): diff --git a/openlp/core/ui/advancedtab.py b/openlp/core/ui/advancedtab.py index cf4c5b9d5..6041382b8 100644 --- a/openlp/core/ui/advancedtab.py +++ b/openlp/core/ui/advancedtab.py @@ -41,7 +41,8 @@ class AdvancedTab(SettingsTab): """ Initialise the settings tab """ - SettingsTab.__init__(self, u'Advanced') + generalTranslated = translate('AdvancedTab', 'Advanced') + SettingsTab.__init__(self, u'Advanced', generalTranslated) self.default_image = u':/graphics/openlp-splash-screen.png' self.default_color = u'#ffffff' self.icon_path = u':/icon/openlp-logo-16x16.png' diff --git a/openlp/core/ui/generaltab.py b/openlp/core/ui/generaltab.py index 279cd8c26..d566244b8 100644 --- a/openlp/core/ui/generaltab.py +++ b/openlp/core/ui/generaltab.py @@ -45,7 +45,8 @@ class GeneralTab(SettingsTab): # Set to True to allow PostSetup to work on application start up self.overrideChanged = True self.icon_path = u':/icon/openlp-logo-16x16.png' - SettingsTab.__init__(self, u'General') + generalTranslated = translate('GeneralTab', 'General') + SettingsTab.__init__(self, u'General', generalTranslated) def preLoad(self): """ diff --git a/openlp/core/ui/mediadockmanager.py b/openlp/core/ui/mediadockmanager.py index ef4bc62e0..ca4f4d442 100644 --- a/openlp/core/ui/mediadockmanager.py +++ b/openlp/core/ui/mediadockmanager.py @@ -84,5 +84,5 @@ class MediaDockManager(object): if self.media_dock.widget(dock_index): if self.media_dock.widget(dock_index).settingsSection == \ media_item.plugin.name.lower(): - self.media_dock.widget(dock_index).hide() + self.media_dock.widget(dock_index).setVisible(False) self.media_dock.removeItem(dock_index) diff --git a/openlp/core/ui/settingsdialog.py b/openlp/core/ui/settingsdialog.py index 9359ff54c..e66defac3 100644 --- a/openlp/core/ui/settingsdialog.py +++ b/openlp/core/ui/settingsdialog.py @@ -38,15 +38,20 @@ class Ui_SettingsDialog(object): self.settingsLayout = QtGui.QGridLayout(settingsDialog) self.settingsLayout.setObjectName(u'settingsLayout') self.settingListWidget = QtGui.QListWidget(settingsDialog) + self.settingListWidget.setIconSize(QtCore.QSize(32, 32)) self.settingListWidget.setObjectName(u'settingListWidget') self.settingsLayout.addWidget(self.settingListWidget, 0, 0, 1, 1) - self.settingsTabWidget = QtGui.QTabWidget(settingsDialog) - self.settingsTabWidget.setObjectName(u'settingsTabWidget') - self.settingsLayout.addWidget(self.settingsTabWidget, 0, 1, 1, 1) + self.stackedLayout = QtGui.QStackedLayout() + self.stackedLayout.setObjectName(u'stackedLayout') + self.settingsLayout.addLayout(self.stackedLayout, 0, 1, 1, 1) self.buttonBox = create_accept_reject_button_box(settingsDialog, True) self.settingsLayout.addWidget(self.buttonBox, 1, 1, 1, 1) self.retranslateUi(settingsDialog) + self.stackedLayout.setCurrentIndex(0) QtCore.QMetaObject.connectSlotsByName(settingsDialog) + QtCore.QObject.connect(self.settingListWidget, + QtCore.SIGNAL(u'currentRowChanged(int)'), + self.stackedLayout.setCurrentIndex) def retranslateUi(self, settingsDialog): settingsDialog.setWindowTitle(translate('OpenLP.SettingsForm', diff --git a/openlp/core/ui/settingsform.py b/openlp/core/ui/settingsform.py index c145224be..6de2a14d8 100644 --- a/openlp/core/ui/settingsform.py +++ b/openlp/core/ui/settingsform.py @@ -58,8 +58,8 @@ class SettingsForm(QtGui.QDialog, Ui_SettingsDialog): def exec_(self): # load all the settings - for tabIndex in range(0, self.settingsTabWidget.count()): - self.settingsTabWidget.widget(tabIndex).load() + for tabIndex in range(0, self.stackedLayout.count()): + self.stackedLayout.widget(tabIndex).load() return QtGui.QDialog.exec_(self) @@ -69,32 +69,39 @@ class SettingsForm(QtGui.QDialog, Ui_SettingsDialog): """ log.debug(u'Inserting %s tab' % tab.tabTitle) # 14 : There are 3 tables currently and locations starts at -10 - self.settingsTabWidget.insertTab( - location + 14, tab, tab.tabTitleVisible) - print tab.tabTitleVisible - item_name = QtGui.QListWidgetItem(tab.tabTitleVisible) - icon = build_icon(tab.icon_path) - pixmap = icon.pixmap(QtCore.QSize(88, 50)) - item_name.setIcon(icon) - self.settingListWidget.insertItem(14 + location, item_name) + match = False + for tabIndex in range(0, self.stackedLayout.count()): + if self.stackedLayout.widget(tabIndex): + if self.stackedLayout.widget(tabIndex).tabTitleVisible == \ + tab.tabTitleVisible: + print tab.tabTitleVisible + self.stackedLayout.widget(tabIndex).setHidden(False) + match = True + break + if not match: + self.stackedLayout.addWidget(tab) + item_name = QtGui.QListWidgetItem(tab.tabTitleVisible) + icon = build_icon(tab.icon_path) + item_name.setIcon(icon) + self.settingListWidget.insertItem(14 + location, item_name) def removeTab(self, tab): """ Remove a tab from the form """ log.debug(u'remove %s tab' % tab.tabTitleVisible) - for tabIndex in range(0, self.settingsTabWidget.count()): - if self.settingsTabWidget.widget(tabIndex): - if self.settingsTabWidget.widget(tabIndex).tabTitleVisible == \ + for tabIndex in range(0, self.stackedLayout.count()): + if self.stackedLayout.widget(tabIndex): + if self.stackedLayout.widget(tabIndex).tabTitleVisible == \ tab.tabTitleVisible: - self.settingsTabWidget.removeTab(tabIndex) + self.settingListWidget.item(tabIndex).setHidden(True) def accept(self): """ Process the form saving the settings """ - for tabIndex in range(0, self.settingsTabWidget.count()): - self.settingsTabWidget.widget(tabIndex).save() + for tabIndex in range(0, self.stackedLayout.count()): + self.stackedLayout.widget(tabIndex).save() # Must go after all settings are save Receiver.send_message(u'config_updated') return QtGui.QDialog.accept(self) @@ -103,13 +110,13 @@ class SettingsForm(QtGui.QDialog, Ui_SettingsDialog): """ Process the form saving the settings """ - for tabIndex in range(0, self.settingsTabWidget.count()): - self.settingsTabWidget.widget(tabIndex).cancel() + for tabIndex in range(0, self.stackedLayout.count()): + self.stackedLayout.widget(tabIndex).cancel() return QtGui.QDialog.reject(self) def postSetUp(self): """ Run any post-setup code for the tabs on the form """ - for tabIndex in range(0, self.settingsTabWidget.count()): - self.settingsTabWidget.widget(tabIndex).postSetUp() + for tabIndex in range(0, self.stackedLayout.count()): + self.stackedLayout.widget(tabIndex).postSetUp() diff --git a/openlp/core/ui/themestab.py b/openlp/core/ui/themestab.py index 5d07d0cf7..b5fcce1ec 100644 --- a/openlp/core/ui/themestab.py +++ b/openlp/core/ui/themestab.py @@ -36,7 +36,8 @@ class ThemesTab(SettingsTab): """ def __init__(self, parent): self.parent = parent - SettingsTab.__init__(self, u'Themes') + generalTranslated = translate('ThemeTab', 'Themes') + SettingsTab.__init__(self, u'Themes', generalTranslated) self.icon_path = u':/themes/theme_new.png' def setupUi(self): diff --git a/openlp/plugins/alerts/alertsplugin.py b/openlp/plugins/alerts/alertsplugin.py index db0ba3b7e..df7823ed5 100644 --- a/openlp/plugins/alerts/alertsplugin.py +++ b/openlp/plugins/alerts/alertsplugin.py @@ -41,9 +41,10 @@ class AlertsPlugin(Plugin): def __init__(self, plugin_helpers): Plugin.__init__(self, u'Alerts', plugin_helpers, - settingsTabClass=AlertsTab) + settings_tab_class=AlertsTab) self.weight = -3 - self.icon = build_icon(u':/plugins/plugin_alerts.png') + self.icon_path = u':/plugins/plugin_alerts.png' + self.icon = build_icon(self.icon_path) self.alertsmanager = AlertsManager(self) self.manager = Manager(u'alerts', init_schema) self.alertForm = AlertForm(self) diff --git a/openlp/plugins/remotes/remoteplugin.py b/openlp/plugins/remotes/remoteplugin.py index 41346dbab..fea9e5170 100644 --- a/openlp/plugins/remotes/remoteplugin.py +++ b/openlp/plugins/remotes/remoteplugin.py @@ -38,9 +38,9 @@ class RemotesPlugin(Plugin): """ remotes constructor """ - Plugin.__init__(self, u'Remotes', plugin_helpers, - settingsTabClass=RemoteTab) - self.icon = build_icon(u':/plugins/plugin_remote.png') + Plugin.__init__(self, u'Remotes', plugin_helpers) + self.icon_path = u':/plugins/plugin_remote.png' + self.icon = build_icon(self.icon_path) self.weight = -1 self.server = None @@ -50,7 +50,6 @@ class RemotesPlugin(Plugin): """ log.debug(u'initialise') Plugin.initialise(self) - self.insertToolboxItem() self.server = HttpServer(self) def finalise(self):