From e00eaba8841d786aaa328cd58eaf94ad328818ea Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Tue, 12 Apr 2011 18:45:32 +0100 Subject: [PATCH 01/13] Settings Cleanup part1 --- openlp/core/lib/plugin.py | 12 +- openlp/core/lib/pluginmanager.py | 3 +- openlp/core/lib/settingstab.py | 4 +- openlp/core/ui/advancedtab.py | 1 + openlp/core/ui/generaltab.py | 1 + openlp/core/ui/settingsdialog.py | 11 +- openlp/core/ui/settingsform.py | 28 +- openlp/core/ui/themestab.py | 3 +- openlp/plugins/alerts/lib/alertstab.py | 4 +- openlp/plugins/bibles/lib/biblestab.py | 4 +- openlp/plugins/custom/lib/customtab.py | 4 +- openlp/plugins/media/lib/mediatab.py | 4 +- .../presentations/lib/presentationtab.py | 4 +- .../presentations/presentationplugin.py | 3 +- openlp/plugins/remotes/lib/remotetab.py | 4 +- openlp/plugins/songs/lib/songstab.py | 4 +- resources/forms/settings.ui | 595 ++---------------- 17 files changed, 94 insertions(+), 595 deletions(-) diff --git a/openlp/core/lib/plugin.py b/openlp/core/lib/plugin.py index eda8ecfa1..99247c4b9 100644 --- a/openlp/core/lib/plugin.py +++ b/openlp/core/lib/plugin.py @@ -116,7 +116,7 @@ class Plugin(QtCore.QObject): log.info(u'loaded') def __init__(self, name, pluginHelpers=None, mediaItemClass=None, - settingsTabClass=None, version=None): + settings_tab_class=None, version=None): """ This is the constructor for the plugin object. This provides an easy way for descendent plugins to populate common data. This method *must* @@ -138,7 +138,7 @@ class Plugin(QtCore.QObject): ``mediaItemClass`` The class name of the plugin's media item. - ``settingsTabClass`` + ``settings_tab_class`` The class name of the plugin's settings tab. """ QtCore.QObject.__init__(self) @@ -153,7 +153,7 @@ class Plugin(QtCore.QObject): self.settingsSection = self.name.lower() self.icon = None self.mediaItemClass = mediaItemClass - self.settingsTabClass = settingsTabClass + self.settings_tab_class = settings_tab_class self.weight = 0 self.status = PluginStatus.Inactive # Set up logging @@ -248,9 +248,9 @@ class Plugin(QtCore.QObject): Create a tab for the settings window to display the configurable options for this plugin to the user. """ - if self.settingsTabClass: - return self.settingsTabClass(self.name, - self.getString(StringContent.VisibleName)[u'title']) + if self.settings_tab_class: + return self.settings_tab_class(self.name, + self.getString(StringContent.VisibleName)[u'title'], self.icon_path) return None def addToMenu(self, menubar): diff --git a/openlp/core/lib/pluginmanager.py b/openlp/core/lib/pluginmanager.py index 9289084c6..ef8287ba7 100644 --- a/openlp/core/lib/pluginmanager.py +++ b/openlp/core/lib/pluginmanager.py @@ -153,8 +153,7 @@ class PluginManager(object): if plugin.settings_tab: log.debug(u'Inserting settings tab item from %s' % visible_title[u'title']) - settingsform.addTab(visible_title[u'title'], - plugin.settings_tab) + settingsform.insertTab(plugin.settings_tab, plugin.weight) else: log.debug( u'No tab settings in %s' % visible_title[u'title']) diff --git a/openlp/core/lib/settingstab.py b/openlp/core/lib/settingstab.py index 1c2ad5fe4..32d7dc912 100644 --- a/openlp/core/lib/settingstab.py +++ b/openlp/core/lib/settingstab.py @@ -31,7 +31,7 @@ class SettingsTab(QtGui.QWidget): SettingsTab is a helper widget for plugins to define Tabs for the settings dialog. """ - def __init__(self, title, visible_title=None): + def __init__(self, title, visible_title=None, icon_path=None): """ Constructor to create the Settings tab item. @@ -45,6 +45,8 @@ class SettingsTab(QtGui.QWidget): self.tabTitle = title self.tabTitleVisible = visible_title self.settingsSection = self.tabTitle.lower() + if icon_path: + self.icon_path = icon_path self.setupUi() self.retranslateUi() self.initialise() diff --git a/openlp/core/ui/advancedtab.py b/openlp/core/ui/advancedtab.py index 07eff396e..cf4c5b9d5 100644 --- a/openlp/core/ui/advancedtab.py +++ b/openlp/core/ui/advancedtab.py @@ -44,6 +44,7 @@ class AdvancedTab(SettingsTab): SettingsTab.__init__(self, u'Advanced') self.default_image = u':/graphics/openlp-splash-screen.png' self.default_color = u'#ffffff' + self.icon_path = u':/icon/openlp-logo-16x16.png' def setupUi(self): """ diff --git a/openlp/core/ui/generaltab.py b/openlp/core/ui/generaltab.py index d249dd4e0..279cd8c26 100644 --- a/openlp/core/ui/generaltab.py +++ b/openlp/core/ui/generaltab.py @@ -44,6 +44,7 @@ class GeneralTab(SettingsTab): self.monitorNumber = 0 # 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') def preLoad(self): diff --git a/openlp/core/ui/settingsdialog.py b/openlp/core/ui/settingsdialog.py index 70f83f4fa..9359ff54c 100644 --- a/openlp/core/ui/settingsdialog.py +++ b/openlp/core/ui/settingsdialog.py @@ -32,16 +32,19 @@ from openlp.core.lib.ui import create_accept_reject_button_box class Ui_SettingsDialog(object): def setupUi(self, settingsDialog): settingsDialog.setObjectName(u'settingsDialog') - settingsDialog.resize(700, 500) + settingsDialog.resize(800, 500) settingsDialog.setWindowIcon( build_icon(u':/system/system_settings.png')) - self.settingsLayout = QtGui.QVBoxLayout(settingsDialog) + self.settingsLayout = QtGui.QGridLayout(settingsDialog) self.settingsLayout.setObjectName(u'settingsLayout') + self.settingListWidget = QtGui.QListWidget(settingsDialog) + 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) + self.settingsLayout.addWidget(self.settingsTabWidget, 0, 1, 1, 1) self.buttonBox = create_accept_reject_button_box(settingsDialog, True) - self.settingsLayout.addWidget(self.buttonBox) + self.settingsLayout.addWidget(self.buttonBox, 1, 1, 1, 1) self.retranslateUi(settingsDialog) QtCore.QMetaObject.connectSlotsByName(settingsDialog) diff --git a/openlp/core/ui/settingsform.py b/openlp/core/ui/settingsform.py index cf66ad090..c145224be 100644 --- a/openlp/core/ui/settingsform.py +++ b/openlp/core/ui/settingsform.py @@ -28,9 +28,9 @@ The :mod:`settingsform` provides a user interface for the OpenLP settings """ import logging -from PyQt4 import QtGui +from PyQt4 import QtGui, QtCore -from openlp.core.lib import Receiver +from openlp.core.lib import Receiver, build_icon from openlp.core.ui import AdvancedTab, GeneralTab, ThemesTab from settingsdialog import Ui_SettingsDialog @@ -48,20 +48,20 @@ class SettingsForm(QtGui.QDialog, Ui_SettingsDialog): self.setupUi(self) # General tab generalTab = GeneralTab(screens) - self.addTab(u'General', generalTab) + self.insertTab(generalTab, 1) # Themes tab themesTab = ThemesTab(mainWindow) - self.addTab(u'Themes', themesTab) + self.insertTab(themesTab, 2) # Advanced tab advancedTab = AdvancedTab() - self.addTab(u'Advanced', advancedTab) + self.insertTab(advancedTab, 3) + + def exec_(self): + # load all the settings + for tabIndex in range(0, self.settingsTabWidget.count()): + self.settingsTabWidget.widget(tabIndex).load() + return QtGui.QDialog.exec_(self) - def addTab(self, name, tab): - """ - Add a tab to the form - """ - log.info(u'Adding %s tab' % tab.tabTitle) - self.settingsTabWidget.addTab(tab, tab.tabTitleVisible) def insertTab(self, tab, location): """ @@ -71,6 +71,12 @@ class SettingsForm(QtGui.QDialog, Ui_SettingsDialog): # 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) def removeTab(self, tab): """ diff --git a/openlp/core/ui/themestab.py b/openlp/core/ui/themestab.py index 1415c6810..5d07d0cf7 100644 --- a/openlp/core/ui/themestab.py +++ b/openlp/core/ui/themestab.py @@ -37,6 +37,7 @@ class ThemesTab(SettingsTab): def __init__(self, parent): self.parent = parent SettingsTab.__init__(self, u'Themes') + self.icon_path = u':/themes/theme_new.png' def setupUi(self): self.setObjectName(u'ThemesTab') @@ -201,4 +202,4 @@ class ThemesTab(SettingsTab): if not preview.isNull(): preview = preview.scaled(300, 255, QtCore.Qt.KeepAspectRatio, QtCore.Qt.SmoothTransformation) - self.DefaultListView.setPixmap(preview) \ No newline at end of file + self.DefaultListView.setPixmap(preview) diff --git a/openlp/plugins/alerts/lib/alertstab.py b/openlp/plugins/alerts/lib/alertstab.py index 64a9801ca..2e97d27d3 100644 --- a/openlp/plugins/alerts/lib/alertstab.py +++ b/openlp/plugins/alerts/lib/alertstab.py @@ -33,8 +33,8 @@ class AlertsTab(SettingsTab): """ AlertsTab is the alerts settings tab in the settings dialog. """ - def __init__(self, name, visible_title): - SettingsTab.__init__(self, name, visible_title) + def __init__(self, name, visible_title, icon_path): + SettingsTab.__init__(self, name, visible_title, icon_path) def setupUi(self): self.setObjectName(u'AlertsTab') diff --git a/openlp/plugins/bibles/lib/biblestab.py b/openlp/plugins/bibles/lib/biblestab.py index 914377e35..c2e05363e 100644 --- a/openlp/plugins/bibles/lib/biblestab.py +++ b/openlp/plugins/bibles/lib/biblestab.py @@ -40,11 +40,11 @@ class BiblesTab(SettingsTab): """ log.info(u'Bible Tab loaded') - def __init__(self, title, visible_title): + def __init__(self, title, visible_title, icon_path): self.paragraph_style = True self.show_new_chapters = False self.display_style = 0 - SettingsTab.__init__(self, title, visible_title) + SettingsTab.__init__(self, title, visible_title, icon_path) def setupUi(self): self.setObjectName(u'BiblesTab') diff --git a/openlp/plugins/custom/lib/customtab.py b/openlp/plugins/custom/lib/customtab.py index 8ab7ade51..006295410 100644 --- a/openlp/plugins/custom/lib/customtab.py +++ b/openlp/plugins/custom/lib/customtab.py @@ -32,8 +32,8 @@ class CustomTab(SettingsTab): """ CustomTab is the Custom settings tab in the settings dialog. """ - def __init__(self, title, visible_title): - SettingsTab.__init__(self, title, visible_title) + def __init__(self, title, visible_title, icon_path): + SettingsTab.__init__(self, title, visible_title, icon_path) def setupUi(self): self.setObjectName(u'CustomTab') diff --git a/openlp/plugins/media/lib/mediatab.py b/openlp/plugins/media/lib/mediatab.py index 2679ad64f..72085158c 100644 --- a/openlp/plugins/media/lib/mediatab.py +++ b/openlp/plugins/media/lib/mediatab.py @@ -32,8 +32,8 @@ class MediaTab(SettingsTab): """ MediaTab is the Media settings tab in the settings dialog. """ - def __init__(self, title, visible_title): - SettingsTab.__init__(self, title, visible_title) + def __init__(self, title, visible_title, icon_path): + SettingsTab.__init__(self, title, visible_title, icon_path) def setupUi(self): self.setObjectName(u'MediaTab') diff --git a/openlp/plugins/presentations/lib/presentationtab.py b/openlp/plugins/presentations/lib/presentationtab.py index 25ad04f82..c7a143006 100644 --- a/openlp/plugins/presentations/lib/presentationtab.py +++ b/openlp/plugins/presentations/lib/presentationtab.py @@ -33,12 +33,12 @@ class PresentationTab(SettingsTab): """ PresentationsTab is the Presentations settings tab in the settings dialog. """ - def __init__(self, title, visible_title, controllers): + def __init__(self, title, visible_title, controllers, icon_path): """ Constructor """ self.controllers = controllers - SettingsTab.__init__(self, title, visible_title) + SettingsTab.__init__(self, title, visible_title, icon_path) def setupUi(self): """ diff --git a/openlp/plugins/presentations/presentationplugin.py b/openlp/plugins/presentations/presentationplugin.py index 3575bbacd..1da9fe511 100644 --- a/openlp/plugins/presentations/presentationplugin.py +++ b/openlp/plugins/presentations/presentationplugin.py @@ -62,7 +62,7 @@ class PresentationPlugin(Plugin): """ visible_name = self.getString(StringContent.VisibleName) return PresentationTab(self.name, visible_name[u'title'], - self.controllers) + self.controllers, self.icon_path) def initialise(self): """ @@ -71,7 +71,6 @@ class PresentationPlugin(Plugin): """ log.info(u'Presentations Initialising') Plugin.initialise(self) - self.insertToolboxItem() for controller in self.controllers: if self.controllers[controller].enabled(): try: diff --git a/openlp/plugins/remotes/lib/remotetab.py b/openlp/plugins/remotes/lib/remotetab.py index 6d782b503..97aedc9cd 100644 --- a/openlp/plugins/remotes/lib/remotetab.py +++ b/openlp/plugins/remotes/lib/remotetab.py @@ -32,8 +32,8 @@ class RemoteTab(SettingsTab): """ RemoteTab is the Remotes settings tab in the settings dialog. """ - def __init__(self, title, visible_title): - SettingsTab.__init__(self, title, visible_title) + def __init__(self, title, visible_title, icon_path): + SettingsTab.__init__(self, title, visible_title, icon_path) def setupUi(self): self.setObjectName(u'RemoteTab') diff --git a/openlp/plugins/songs/lib/songstab.py b/openlp/plugins/songs/lib/songstab.py index 14aacefdc..092c6af29 100644 --- a/openlp/plugins/songs/lib/songstab.py +++ b/openlp/plugins/songs/lib/songstab.py @@ -32,8 +32,8 @@ class SongsTab(SettingsTab): """ SongsTab is the Songs settings tab in the settings dialog. """ - def __init__(self, title, visible_title): - SettingsTab.__init__(self, title, visible_title) + def __init__(self, title, visible_title, icon_path): + SettingsTab.__init__(self, title, visible_title, icon_path) def setupUi(self): self.setObjectName(u'SongsTab') diff --git a/resources/forms/settings.ui b/resources/forms/settings.ui index 6ad75e1e5..0c378e125 100644 --- a/resources/forms/settings.ui +++ b/resources/forms/settings.ui @@ -14,565 +14,52 @@ Settings - + :/icon/openlp.org-icon-32.bmp:/icon/openlp.org-icon-32.bmp - - - 8 + + + + 10 + 30 + 681 + 441 + - - 8 - - - - - 2 - - - - General - - - - 8 - - - 8 - - - - - - - - Monitors - - - - 8 - - - 8 - - - - - Select monitor for output display: - - - - - - - - Monitor 1 on X11 Windowing System - - - - - Monitor 2 on X11 Windowing System - - - - - - - - - - - Blank Screen - - - - 8 - - - 8 - - - - - Show warning on startup - - - - - - - - - - Auto Open Last Service - - - - - - Automatically open the last service at startup - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - - - 8 - - - 0 - - - - - CCLI Details - - - - 8 - - - 8 - - - - - CCLI Number: - - - - - - - - - - SongSelect Username: - - - - - - - - - - SongSelect Password: - - - - - - - QLineEdit::Password - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - + + + + + + + + - - - Themes - - - - 8 - - - 8 - - - - - Global theme - - - - 8 - - - 8 - - - - - - African Sunset - - - - - Snowy Mountains - - - - - Wilderness - - - - - - - - - - - - - - Theme level - - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - 8 - - - 8 - - - 8 - - - - - Song level - - - - - - - Use the theme from each song in the database. If a song doesn't have a theme associated with it, then use the service's theme. If the service doesn't have a theme, then use the global theme. - - - true - - - - - - - Service level - - - - - - - Use the theme from the service, overriding any of the individual songs' themes. If the service doesn't have a theme, then use the global theme. - - - true - - - - - - - true - - - Global level - - - - - - - Use the global theme, overriding any themes associated with either the service or the songs. - - - true - - - - - - - + + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + - - - Alerts - - - - 8 - - - 8 - - - - - - 8 - - - 0 - - - - - Font - - - - 8 - - - 8 - - - - - Font Name: - - - - - - - - - - - - - Font Color: - - - - - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Background Color: - - - - - - - - - - - - - - - - - - 8 - - - 0 - - - - - Display length: - - - - - - - 5 - - - s - - - 180 - - - - - - - Qt::Horizontal - - - - 147 - 20 - - - - - - - - - - - - - - Qt::Vertical - - - - 20 - 94 - - - - - - - - - - - - 8 - - - 0 - - - - - - 0 - 0 - - - - Preview - - - - 8 - - - 8 - - - - - - 16777215 - 64 - - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - + + + From 20fbe4d28d99ad0d291e460a68c32ae1bc94bd36 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Tue, 12 Apr 2011 20:32:17 +0100 Subject: [PATCH 02/13] Settings Cleanup part2 --- openlp/core/lib/plugin.py | 23 ++++--------- openlp/core/lib/pluginmanager.py | 2 -- openlp/core/ui/advancedtab.py | 3 +- openlp/core/ui/generaltab.py | 3 +- openlp/core/ui/mediadockmanager.py | 2 +- openlp/core/ui/settingsdialog.py | 11 ++++-- openlp/core/ui/settingsform.py | 47 +++++++++++++++----------- openlp/core/ui/themestab.py | 3 +- openlp/plugins/alerts/alertsplugin.py | 5 +-- openlp/plugins/remotes/remoteplugin.py | 7 ++-- 10 files changed, 54 insertions(+), 52 deletions(-) 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): From 6474c99a85cffb7b13692561a335fd35600eebe1 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Wed, 13 Apr 2011 05:55:00 +0100 Subject: [PATCH 03/13] Settings Layout Ok ish --- openlp/core/ui/settingsdialog.py | 6 ++++-- openlp/core/ui/settingsform.py | 3 ++- resources/forms/settings.ui | 37 ++++++++++++++++++++++++++------ 3 files changed, 36 insertions(+), 10 deletions(-) diff --git a/openlp/core/ui/settingsdialog.py b/openlp/core/ui/settingsdialog.py index e66defac3..45a68c321 100644 --- a/openlp/core/ui/settingsdialog.py +++ b/openlp/core/ui/settingsdialog.py @@ -37,8 +37,11 @@ class Ui_SettingsDialog(object): build_icon(u':/system/system_settings.png')) self.settingsLayout = QtGui.QGridLayout(settingsDialog) self.settingsLayout.setObjectName(u'settingsLayout') + self.settingsLayout.setMargin(0) self.settingListWidget = QtGui.QListWidget(settingsDialog) - self.settingListWidget.setIconSize(QtCore.QSize(32, 32)) + self.settingListWidget.setMinimumSize(QtCore.QSize(150, 0)) + self.settingListWidget.setHorizontalScrollBarPolicy( + QtCore.Qt.ScrollBarAlwaysOff) self.settingListWidget.setObjectName(u'settingListWidget') self.settingsLayout.addWidget(self.settingListWidget, 0, 0, 1, 1) self.stackedLayout = QtGui.QStackedLayout() @@ -47,7 +50,6 @@ class Ui_SettingsDialog(object): 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)'), diff --git a/openlp/core/ui/settingsform.py b/openlp/core/ui/settingsform.py index 6de2a14d8..1e71bc985 100644 --- a/openlp/core/ui/settingsform.py +++ b/openlp/core/ui/settingsform.py @@ -74,7 +74,6 @@ class SettingsForm(QtGui.QDialog, Ui_SettingsDialog): 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 @@ -84,6 +83,8 @@ class SettingsForm(QtGui.QDialog, Ui_SettingsDialog): icon = build_icon(tab.icon_path) item_name.setIcon(icon) self.settingListWidget.insertItem(14 + location, item_name) + self.stackedLayout.addWidget(tab) + self.stackedLayout.setCurrentIndex(0) def removeTab(self, tab): """ diff --git a/resources/forms/settings.ui b/resources/forms/settings.ui index 0c378e125..06e55a00d 100644 --- a/resources/forms/settings.ui +++ b/resources/forms/settings.ui @@ -17,26 +17,49 @@ :/icon/openlp.org-icon-32.bmp:/icon/openlp.org-icon-32.bmp - + 10 30 - 681 + 691 441 - - - - + + + 500 + 0 + + + + + + + 0 + 0 + 211 + 409 + + + + + 200 + 0 + + + + Qt::ScrollBarAlwaysOff + + + - + From 5f228a69d101b83d404989b86fb8e8d9e6985ce0 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Wed, 13 Apr 2011 06:12:31 +0100 Subject: [PATCH 04/13] Minor fixes and Bible Label corrections --- openlp/core/lib/ui.py | 3 ++- openlp/plugins/bibles/lib/biblestab.py | 3 +-- openlp/plugins/bibles/lib/mediaitem.py | 7 ++----- openlp/plugins/remotes/remoteplugin.py | 3 ++- 4 files changed, 7 insertions(+), 9 deletions(-) diff --git a/openlp/core/lib/ui.py b/openlp/core/lib/ui.py index 4f6951d13..fa0bc8afa 100644 --- a/openlp/core/lib/ui.py +++ b/openlp/core/lib/ui.py @@ -62,6 +62,7 @@ class UiStrings(object): Hours = translate('OpenLP.Ui', 'h', 'The abbreviated unit for hours') Image = translate('OpenLP.Ui', 'Image') Import = translate('OpenLP.Ui', 'Import') + LayoutStyle = translate('OpenLP.Ui', 'Layout style:') LengthTime = unicode(translate('OpenLP.Ui', 'Length %s')) Live = translate('OpenLP.Ui', 'Live') LiveBGError = translate('OpenLP.Ui', 'Live Background Error') @@ -335,4 +336,4 @@ def find_and_set_in_combo_box(combo_box, value_to_find): if index == -1: # Not Found. index = 0 - combo_box.setCurrentIndex(index) \ No newline at end of file + combo_box.setCurrentIndex(index) diff --git a/openlp/plugins/bibles/lib/biblestab.py b/openlp/plugins/bibles/lib/biblestab.py index c2e05363e..1d87d20cb 100644 --- a/openlp/plugins/bibles/lib/biblestab.py +++ b/openlp/plugins/bibles/lib/biblestab.py @@ -118,8 +118,7 @@ class BiblesTab(SettingsTab): self.newChaptersCheckBox.setText( translate('BiblesPlugin.BiblesTab', 'Only show new chapter numbers')) - self.layoutStyleLabel.setText( - translate('BiblesPlugin.BiblesTab', 'Layout style:')) + self.layoutStyleLabel.setText(UiStrings.LayoutStyle) self.displayStyleLabel.setText(UiStrings.DisplayStyle) self.bibleThemeLabel.setText( translate('BiblesPlugin.BiblesTab', 'Bible theme:')) diff --git a/openlp/plugins/bibles/lib/mediaitem.py b/openlp/plugins/bibles/lib/mediaitem.py index 73ed0c9bd..89ca69e33 100644 --- a/openlp/plugins/bibles/lib/mediaitem.py +++ b/openlp/plugins/bibles/lib/mediaitem.py @@ -279,7 +279,7 @@ class BibleMediaItem(MediaManagerItem): translate('BiblesPlugin.MediaItem', 'Clear')) self.advancedClearComboBox.addItem( translate('BiblesPlugin.MediaItem', 'Keep')) - self.quickLayoutLabel.setText(UiStrings.DisplayStyle) + self.quickLayoutLabel.setText(UiStrings.LayoutStyle) self.quickLayoutComboBox.setItemText(LayoutStyle.VersePerSlide, UiStrings.VersePerSlide) self.quickLayoutComboBox.setItemText(LayoutStyle.VersePerLine, @@ -835,9 +835,6 @@ class BibleMediaItem(MediaManagerItem): return u'{su}%s{/su}' % verse_text def onlayoutStyleComboBoxChanged(self): - self.settings.layout_style = self.quickLayoutComboBox.currentIndex() - self.settings.layoutStyleComboBox.setCurrentIndex( - self.settings.layout_style) QtCore.QSettings().setValue( self.settingsSection + u'/verse layout style', - QtCore.QVariant(self.settings.layout_style)) \ No newline at end of file + QtCore.QVariant(self.settings.layout_style)) diff --git a/openlp/plugins/remotes/remoteplugin.py b/openlp/plugins/remotes/remoteplugin.py index fea9e5170..d3b50e36b 100644 --- a/openlp/plugins/remotes/remoteplugin.py +++ b/openlp/plugins/remotes/remoteplugin.py @@ -38,7 +38,8 @@ class RemotesPlugin(Plugin): """ remotes constructor """ - Plugin.__init__(self, u'Remotes', plugin_helpers) + Plugin.__init__(self, u'Remotes', plugin_helpers, + settings_tab_class=RemoteTab) self.icon_path = u':/plugins/plugin_remote.png' self.icon = build_icon(self.icon_path) self.weight = -1 From a22bb2e0bc4ebbc9f21ddb990d9e4079b5b93f6f Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Wed, 13 Apr 2011 19:14:38 +0100 Subject: [PATCH 05/13] Active/inactive fixes --- openlp/core/lib/pluginmanager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/core/lib/pluginmanager.py b/openlp/core/lib/pluginmanager.py index 3b73750fe..6854cb53c 100644 --- a/openlp/core/lib/pluginmanager.py +++ b/openlp/core/lib/pluginmanager.py @@ -150,7 +150,7 @@ class PluginManager(object): if plugin.status is not PluginStatus.Disabled: plugin.settings_tab = plugin.getSettingsTab() visible_title = plugin.getString(StringContent.VisibleName) - if plugin.settings_tab: + if plugin.settings_tab and plugin.isActive(): log.debug(u'Inserting settings tab item from %s' % visible_title[u'title']) settingsform.insertTab(plugin.settings_tab, plugin.weight) From 79ed96648faa71539e85297edfbade42de4d66c4 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Wed, 13 Apr 2011 19:40:09 +0100 Subject: [PATCH 06/13] More cleanups --- openlp/core/ui/settingsdialog.py | 12 ++++++------ openlp/core/ui/settingsform.py | 6 ++---- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/openlp/core/ui/settingsdialog.py b/openlp/core/ui/settingsdialog.py index 45a68c321..3f5f12bd2 100644 --- a/openlp/core/ui/settingsdialog.py +++ b/openlp/core/ui/settingsdialog.py @@ -35,20 +35,20 @@ class Ui_SettingsDialog(object): settingsDialog.resize(800, 500) settingsDialog.setWindowIcon( build_icon(u':/system/system_settings.png')) - self.settingsLayout = QtGui.QGridLayout(settingsDialog) - self.settingsLayout.setObjectName(u'settingsLayout') - self.settingsLayout.setMargin(0) + self.dialogLayout = QtGui.QGridLayout(settingsDialog) + self.dialogLayout.setObjectName(u'dialogLayout') + self.dialogLayout.setMargin(0) self.settingListWidget = QtGui.QListWidget(settingsDialog) self.settingListWidget.setMinimumSize(QtCore.QSize(150, 0)) self.settingListWidget.setHorizontalScrollBarPolicy( QtCore.Qt.ScrollBarAlwaysOff) self.settingListWidget.setObjectName(u'settingListWidget') - self.settingsLayout.addWidget(self.settingListWidget, 0, 0, 1, 1) + self.dialogLayout.addWidget(self.settingListWidget, 0, 0, 1, 1) self.stackedLayout = QtGui.QStackedLayout() self.stackedLayout.setObjectName(u'stackedLayout') - self.settingsLayout.addLayout(self.stackedLayout, 0, 1, 1, 1) + self.dialogLayout.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.dialogLayout.addWidget(self.buttonBox, 1, 1, 1, 1) self.retranslateUi(settingsDialog) QtCore.QMetaObject.connectSlotsByName(settingsDialog) QtCore.QObject.connect(self.settingListWidget, diff --git a/openlp/core/ui/settingsform.py b/openlp/core/ui/settingsform.py index 1e71bc985..3415f3ec8 100644 --- a/openlp/core/ui/settingsform.py +++ b/openlp/core/ui/settingsform.py @@ -60,9 +60,9 @@ class SettingsForm(QtGui.QDialog, Ui_SettingsDialog): # load all the settings for tabIndex in range(0, self.stackedLayout.count()): self.stackedLayout.widget(tabIndex).load() + self.settingListWidget.setCurrentRow(0) return QtGui.QDialog.exec_(self) - def insertTab(self, tab, location): """ Add a tab to the form at a specific location @@ -78,13 +78,11 @@ class SettingsForm(QtGui.QDialog, Ui_SettingsDialog): match = True break if not match: - self.stackedLayout.addWidget(tab) + pos = 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) - self.stackedLayout.addWidget(tab) - self.stackedLayout.setCurrentIndex(0) def removeTab(self, tab): """ From 9e88d0bff4c3a3a761ea974acc5e1a2e9aa2b0da Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Wed, 13 Apr 2011 20:53:05 +0200 Subject: [PATCH 07/13] clean ups --- openlp/plugins/bibles/lib/db.py | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/openlp/plugins/bibles/lib/db.py b/openlp/plugins/bibles/lib/db.py index 85ab98de1..ec63dc02f 100644 --- a/openlp/plugins/bibles/lib/db.py +++ b/openlp/plugins/bibles/lib/db.py @@ -177,10 +177,7 @@ class BibleDB(QtCore.QObject, Manager): Returns the version name of the Bible. """ version_name = self.get_object(BibleMeta, u'Version') - if version_name: - self.name = version_name.value - else: - self.name = None + self.name = version_name.value if version_name else None return self.name def clean_filename(self, old_filename): @@ -256,10 +253,10 @@ class BibleDB(QtCore.QObject, Manager): # Text list has book and chapter as first two elements of the array. for verse_number, verse_text in textlist.iteritems(): verse = Verse.populate( - book_id = book_id, - chapter = chapter, - verse = verse_number, - text = verse_text + book_id=book_id, + chapter=chapter, + verse=verse_number, + text=verse_text ) self.session.add(verse) self.session.commit() @@ -383,15 +380,13 @@ class BibleDB(QtCore.QObject, Manager): log.debug(u'BibleDB.verse_search("%s")', text) verses = self.session.query(Verse) if text.find(u',') > -1: - or_clause = [] - keywords = [u'%%%s%%' % keyword.strip() - for keyword in text.split(u',')] - for keyword in keywords: - or_clause.append(Verse.text.like(keyword)) + keywords = \ + [u'%%%s%%' % keyword.strip() for keyword in text.split(u',')] + or_clause = [Verse.text.like(keyword) for keyword in keywords] verses = verses.filter(or_(*or_clause)) else: - keywords = [u'%%%s%%' % keyword.strip() - for keyword in text.split(u' ')] + keywords = \ + [u'%%%s%%' % keyword.strip() for keyword in text.split(u' ')] for keyword in keywords: verses = verses.filter(Verse.text.like(keyword)) verses = verses.all() From 6454b88a83aea140d4c19bad077768d4b93443e2 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Wed, 13 Apr 2011 20:12:47 +0100 Subject: [PATCH 08/13] Fix Tab parentage --- openlp/core/lib/plugin.py | 4 ++-- openlp/core/lib/pluginmanager.py | 2 +- openlp/core/lib/settingstab.py | 4 ++-- openlp/core/ui/advancedtab.py | 4 ++-- openlp/core/ui/generaltab.py | 4 ++-- openlp/core/ui/settingsdialog.py | 1 + openlp/core/ui/settingsform.py | 6 +++--- openlp/core/ui/themestab.py | 14 +++++++------- openlp/plugins/alerts/lib/alertstab.py | 4 ++-- openlp/plugins/bibles/lib/biblestab.py | 4 ++-- openlp/plugins/custom/lib/customtab.py | 4 ++-- openlp/plugins/media/lib/mediatab.py | 4 ++-- .../plugins/presentations/lib/presentationtab.py | 4 ++-- openlp/plugins/presentations/presentationplugin.py | 4 ++-- openlp/plugins/remotes/lib/remotetab.py | 4 ++-- openlp/plugins/songs/lib/songstab.py | 4 ++-- 16 files changed, 36 insertions(+), 35 deletions(-) diff --git a/openlp/core/lib/plugin.py b/openlp/core/lib/plugin.py index ef89e6424..e4359f6b0 100644 --- a/openlp/core/lib/plugin.py +++ b/openlp/core/lib/plugin.py @@ -244,13 +244,13 @@ class Plugin(QtCore.QObject): """ pass - def getSettingsTab(self): + def getSettingsTab(self, parent): """ Create a tab for the settings window to display the configurable options for this plugin to the user. """ if self.settings_tab_class: - return self.settings_tab_class(self.name, + return self.settings_tab_class(parent, self.name, self.getString(StringContent.VisibleName)[u'title'], self.icon_path) return None diff --git a/openlp/core/lib/pluginmanager.py b/openlp/core/lib/pluginmanager.py index 6854cb53c..6f1222276 100644 --- a/openlp/core/lib/pluginmanager.py +++ b/openlp/core/lib/pluginmanager.py @@ -148,7 +148,7 @@ class PluginManager(object): """ for plugin in self.plugins: if plugin.status is not PluginStatus.Disabled: - plugin.settings_tab = plugin.getSettingsTab() + plugin.settings_tab = plugin.getSettingsTab(settingsform) visible_title = plugin.getString(StringContent.VisibleName) if plugin.settings_tab and plugin.isActive(): log.debug(u'Inserting settings tab item from %s' % diff --git a/openlp/core/lib/settingstab.py b/openlp/core/lib/settingstab.py index 32d7dc912..e1396d984 100644 --- a/openlp/core/lib/settingstab.py +++ b/openlp/core/lib/settingstab.py @@ -31,7 +31,7 @@ class SettingsTab(QtGui.QWidget): SettingsTab is a helper widget for plugins to define Tabs for the settings dialog. """ - def __init__(self, title, visible_title=None, icon_path=None): + def __init__(self, parent, title, visible_title=None, icon_path=None): """ Constructor to create the Settings tab item. @@ -41,7 +41,7 @@ class SettingsTab(QtGui.QWidget): ``visible_title`` The title of the tab, which is usually displayed on the tab. """ - QtGui.QWidget.__init__(self) + QtGui.QWidget.__init__(self, parent) self.tabTitle = title self.tabTitleVisible = visible_title self.settingsSection = self.tabTitle.lower() diff --git a/openlp/core/ui/advancedtab.py b/openlp/core/ui/advancedtab.py index 6041382b8..3d9321fe1 100644 --- a/openlp/core/ui/advancedtab.py +++ b/openlp/core/ui/advancedtab.py @@ -37,12 +37,12 @@ class AdvancedTab(SettingsTab): The :class:`AdvancedTab` manages the advanced settings tab including the UI and the loading and saving of the displayed settings. """ - def __init__(self): + def __init__(self, parent): """ Initialise the settings tab """ generalTranslated = translate('AdvancedTab', 'Advanced') - SettingsTab.__init__(self, u'Advanced', generalTranslated) + SettingsTab.__init__(self, parent ,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 d566244b8..cfde7810c 100644 --- a/openlp/core/ui/generaltab.py +++ b/openlp/core/ui/generaltab.py @@ -36,7 +36,7 @@ class GeneralTab(SettingsTab): """ GeneralTab is the general settings tab in the settings dialog. """ - def __init__(self, screens): + def __init__(self, parent, screens): """ Initialise the general settings tab """ @@ -46,7 +46,7 @@ class GeneralTab(SettingsTab): self.overrideChanged = True self.icon_path = u':/icon/openlp-logo-16x16.png' generalTranslated = translate('GeneralTab', 'General') - SettingsTab.__init__(self, u'General', generalTranslated) + SettingsTab.__init__(self, parent, u'General', generalTranslated) def preLoad(self): """ diff --git a/openlp/core/ui/settingsdialog.py b/openlp/core/ui/settingsdialog.py index 3f5f12bd2..485cb9c5f 100644 --- a/openlp/core/ui/settingsdialog.py +++ b/openlp/core/ui/settingsdialog.py @@ -39,6 +39,7 @@ class Ui_SettingsDialog(object): self.dialogLayout.setObjectName(u'dialogLayout') self.dialogLayout.setMargin(0) self.settingListWidget = QtGui.QListWidget(settingsDialog) + self.settingListWidget.setUniformItemSizes(True) self.settingListWidget.setMinimumSize(QtCore.QSize(150, 0)) self.settingListWidget.setHorizontalScrollBarPolicy( QtCore.Qt.ScrollBarAlwaysOff) diff --git a/openlp/core/ui/settingsform.py b/openlp/core/ui/settingsform.py index 3415f3ec8..72e1b7fa4 100644 --- a/openlp/core/ui/settingsform.py +++ b/openlp/core/ui/settingsform.py @@ -47,13 +47,13 @@ class SettingsForm(QtGui.QDialog, Ui_SettingsDialog): QtGui.QDialog.__init__(self, parent) self.setupUi(self) # General tab - generalTab = GeneralTab(screens) + generalTab = GeneralTab(self, screens) self.insertTab(generalTab, 1) # Themes tab - themesTab = ThemesTab(mainWindow) + themesTab = ThemesTab(self, mainWindow) self.insertTab(themesTab, 2) # Advanced tab - advancedTab = AdvancedTab() + advancedTab = AdvancedTab(self, ) self.insertTab(advancedTab, 3) def exec_(self): diff --git a/openlp/core/ui/themestab.py b/openlp/core/ui/themestab.py index b5fcce1ec..372ee0cc8 100644 --- a/openlp/core/ui/themestab.py +++ b/openlp/core/ui/themestab.py @@ -34,10 +34,10 @@ class ThemesTab(SettingsTab): """ ThemesTab is the theme settings tab in the settings dialog. """ - def __init__(self, parent): - self.parent = parent + def __init__(self, parent, mainwindow): + self.mainwindow = mainwindow generalTranslated = translate('ThemeTab', 'Themes') - SettingsTab.__init__(self, u'Themes', generalTranslated) + SettingsTab.__init__(self, parent, u'Themes', generalTranslated) self.icon_path = u':/themes/theme_new.png' def setupUi(self): @@ -149,7 +149,7 @@ class ThemesTab(SettingsTab): settings.setValue(u'global theme', QtCore.QVariant(self.global_theme)) settings.endGroup() - self.parent.renderManager.set_global_theme( + self.mainwindow.renderManager.set_global_theme( self.global_theme, self.theme_level) Receiver.send_message(u'theme_update_global', self.global_theme) @@ -167,7 +167,7 @@ class ThemesTab(SettingsTab): def onDefaultComboBoxChanged(self, value): self.global_theme = unicode(self.DefaultComboBox.currentText()) - self.parent.renderManager.set_global_theme( + self.mainwindow.renderManager.set_global_theme( self.global_theme, self.theme_level) self.__previewGlobalTheme() @@ -188,7 +188,7 @@ class ThemesTab(SettingsTab): for theme in theme_list: self.DefaultComboBox.addItem(theme) find_and_set_in_combo_box(self.DefaultComboBox, self.global_theme) - self.parent.renderManager.set_global_theme( + self.mainwindow.renderManager.set_global_theme( self.global_theme, self.theme_level) if self.global_theme is not u'': self.__previewGlobalTheme() @@ -197,7 +197,7 @@ class ThemesTab(SettingsTab): """ Utility method to update the global theme preview image. """ - image = self.parent.themeManagerContents.getPreviewImage( + image = self.mainwindow.themeManagerContents.getPreviewImage( self.global_theme) preview = QtGui.QPixmap(unicode(image)) if not preview.isNull(): diff --git a/openlp/plugins/alerts/lib/alertstab.py b/openlp/plugins/alerts/lib/alertstab.py index 2e97d27d3..3b6c50a10 100644 --- a/openlp/plugins/alerts/lib/alertstab.py +++ b/openlp/plugins/alerts/lib/alertstab.py @@ -33,8 +33,8 @@ class AlertsTab(SettingsTab): """ AlertsTab is the alerts settings tab in the settings dialog. """ - def __init__(self, name, visible_title, icon_path): - SettingsTab.__init__(self, name, visible_title, icon_path) + def __init__(self, parent, name, visible_title, icon_path): + SettingsTab.__init__(self, parent, name, visible_title, icon_path) def setupUi(self): self.setObjectName(u'AlertsTab') diff --git a/openlp/plugins/bibles/lib/biblestab.py b/openlp/plugins/bibles/lib/biblestab.py index 1d87d20cb..b013c402a 100644 --- a/openlp/plugins/bibles/lib/biblestab.py +++ b/openlp/plugins/bibles/lib/biblestab.py @@ -40,11 +40,11 @@ class BiblesTab(SettingsTab): """ log.info(u'Bible Tab loaded') - def __init__(self, title, visible_title, icon_path): + def __init__(self, parent, title, visible_title, icon_path): self.paragraph_style = True self.show_new_chapters = False self.display_style = 0 - SettingsTab.__init__(self, title, visible_title, icon_path) + SettingsTab.__init__(self, parent, title, visible_title, icon_path) def setupUi(self): self.setObjectName(u'BiblesTab') diff --git a/openlp/plugins/custom/lib/customtab.py b/openlp/plugins/custom/lib/customtab.py index 006295410..9de294418 100644 --- a/openlp/plugins/custom/lib/customtab.py +++ b/openlp/plugins/custom/lib/customtab.py @@ -32,8 +32,8 @@ class CustomTab(SettingsTab): """ CustomTab is the Custom settings tab in the settings dialog. """ - def __init__(self, title, visible_title, icon_path): - SettingsTab.__init__(self, title, visible_title, icon_path) + def __init__(self, parent, title, visible_title, icon_path): + SettingsTab.__init__(self, parent, title, visible_title, icon_path) def setupUi(self): self.setObjectName(u'CustomTab') diff --git a/openlp/plugins/media/lib/mediatab.py b/openlp/plugins/media/lib/mediatab.py index 72085158c..f54aa02fa 100644 --- a/openlp/plugins/media/lib/mediatab.py +++ b/openlp/plugins/media/lib/mediatab.py @@ -32,8 +32,8 @@ class MediaTab(SettingsTab): """ MediaTab is the Media settings tab in the settings dialog. """ - def __init__(self, title, visible_title, icon_path): - SettingsTab.__init__(self, title, visible_title, icon_path) + def __init__(self, parent, title, visible_title, icon_path): + SettingsTab.__init__(self, parent, title, visible_title, icon_path) def setupUi(self): self.setObjectName(u'MediaTab') diff --git a/openlp/plugins/presentations/lib/presentationtab.py b/openlp/plugins/presentations/lib/presentationtab.py index c7a143006..8e3a98031 100644 --- a/openlp/plugins/presentations/lib/presentationtab.py +++ b/openlp/plugins/presentations/lib/presentationtab.py @@ -33,12 +33,12 @@ class PresentationTab(SettingsTab): """ PresentationsTab is the Presentations settings tab in the settings dialog. """ - def __init__(self, title, visible_title, controllers, icon_path): + def __init__(self, parent, title, visible_title, controllers, icon_path): """ Constructor """ self.controllers = controllers - SettingsTab.__init__(self, title, visible_title, icon_path) + SettingsTab.__init__(self, parent, title, visible_title, icon_path) def setupUi(self): """ diff --git a/openlp/plugins/presentations/presentationplugin.py b/openlp/plugins/presentations/presentationplugin.py index 1da9fe511..f217e6023 100644 --- a/openlp/plugins/presentations/presentationplugin.py +++ b/openlp/plugins/presentations/presentationplugin.py @@ -56,12 +56,12 @@ class PresentationPlugin(Plugin): self.icon_path = u':/plugins/plugin_presentations.png' self.icon = build_icon(self.icon_path) - def getSettingsTab(self): + def getSettingsTab(self, parent): """ Create the settings Tab """ visible_name = self.getString(StringContent.VisibleName) - return PresentationTab(self.name, visible_name[u'title'], + return PresentationTab(parent, self.name, visible_name[u'title'], self.controllers, self.icon_path) def initialise(self): diff --git a/openlp/plugins/remotes/lib/remotetab.py b/openlp/plugins/remotes/lib/remotetab.py index 97aedc9cd..297437d93 100644 --- a/openlp/plugins/remotes/lib/remotetab.py +++ b/openlp/plugins/remotes/lib/remotetab.py @@ -32,8 +32,8 @@ class RemoteTab(SettingsTab): """ RemoteTab is the Remotes settings tab in the settings dialog. """ - def __init__(self, title, visible_title, icon_path): - SettingsTab.__init__(self, title, visible_title, icon_path) + def __init__(self, parent, title, visible_title, icon_path): + SettingsTab.__init__(self, parent, title, visible_title, icon_path) def setupUi(self): self.setObjectName(u'RemoteTab') diff --git a/openlp/plugins/songs/lib/songstab.py b/openlp/plugins/songs/lib/songstab.py index 092c6af29..e39c22be7 100644 --- a/openlp/plugins/songs/lib/songstab.py +++ b/openlp/plugins/songs/lib/songstab.py @@ -32,8 +32,8 @@ class SongsTab(SettingsTab): """ SongsTab is the Songs settings tab in the settings dialog. """ - def __init__(self, title, visible_title, icon_path): - SettingsTab.__init__(self, title, visible_title, icon_path) + def __init__(self, parent, title, visible_title, icon_path): + SettingsTab.__init__(self, parent, title, visible_title, icon_path) def setupUi(self): self.setObjectName(u'SongsTab') From 206cd90639eac949f23198347f482c1e3b718b2d Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Thu, 14 Apr 2011 19:30:53 +0100 Subject: [PATCH 09/13] Finished --- openlp/core/lib/plugin.py | 4 -- openlp/core/lib/pluginmanager.py | 13 ++---- openlp/core/ui/settingsform.py | 55 +++++++++++--------------- openlp/plugins/bibles/lib/mediaitem.py | 3 ++ 4 files changed, 28 insertions(+), 47 deletions(-) diff --git a/openlp/core/lib/plugin.py b/openlp/core/lib/plugin.py index e4359f6b0..a6cc5df63 100644 --- a/openlp/core/lib/plugin.py +++ b/openlp/core/lib/plugin.py @@ -290,8 +290,6 @@ class Plugin(QtCore.QObject): if self.mediaItem: self.mediaItem.initialise() 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): """ @@ -299,8 +297,6 @@ class Plugin(QtCore.QObject): """ if self.mediaItem: self.mediadock.remove_dock(self.mediaItem) - if self.settings_tab: - self.settingsForm.removeTab(self.settings_tab) def usesTheme(self, theme): """ diff --git a/openlp/core/lib/pluginmanager.py b/openlp/core/lib/pluginmanager.py index 6f1222276..0fddc75c4 100644 --- a/openlp/core/lib/pluginmanager.py +++ b/openlp/core/lib/pluginmanager.py @@ -137,7 +137,7 @@ class PluginManager(object): if plugin.status is not PluginStatus.Disabled: plugin.mediaItem = plugin.getMediaManagerItem() - def hook_settings_tabs(self, settingsform=None): + def hook_settings_tabs(self, settings_form=None): """ Loop through all the plugins. If a plugin has a valid settings tab item, add it to the settings tab. @@ -148,15 +148,8 @@ class PluginManager(object): """ for plugin in self.plugins: if plugin.status is not PluginStatus.Disabled: - plugin.settings_tab = plugin.getSettingsTab(settingsform) - visible_title = plugin.getString(StringContent.VisibleName) - if plugin.settings_tab and plugin.isActive(): - log.debug(u'Inserting settings tab item from %s' % - visible_title[u'title']) - settingsform.insertTab(plugin.settings_tab, plugin.weight) - else: - log.debug( - u'No tab settings in %s' % visible_title[u'title']) + plugin.settings_tab = plugin.getSettingsTab(settings_form) + settings_form.plugins = self.plugins def hook_import_menu(self, import_menu): """ diff --git a/openlp/core/ui/settingsform.py b/openlp/core/ui/settingsform.py index 72e1b7fa4..6d1680b53 100644 --- a/openlp/core/ui/settingsform.py +++ b/openlp/core/ui/settingsform.py @@ -30,7 +30,7 @@ import logging from PyQt4 import QtGui, QtCore -from openlp.core.lib import Receiver, build_icon +from openlp.core.lib import Receiver, build_icon, PluginStatus from openlp.core.ui import AdvancedTab, GeneralTab, ThemesTab from settingsdialog import Ui_SettingsDialog @@ -47,53 +47,42 @@ class SettingsForm(QtGui.QDialog, Ui_SettingsDialog): QtGui.QDialog.__init__(self, parent) self.setupUi(self) # General tab - generalTab = GeneralTab(self, screens) - self.insertTab(generalTab, 1) + self.generalTab = GeneralTab(self, screens) # Themes tab - themesTab = ThemesTab(self, mainWindow) - self.insertTab(themesTab, 2) + self.themesTab = ThemesTab(self, mainWindow) # Advanced tab - advancedTab = AdvancedTab(self, ) - self.insertTab(advancedTab, 3) + self.advancedTab = AdvancedTab(self) def exec_(self): # load all the settings - for tabIndex in range(0, self.stackedLayout.count()): - self.stackedLayout.widget(tabIndex).load() + self.settingListWidget.clear() + for tabIndex in range(0, self.stackedLayout.count() + 1): + # take at 0 and the rest shuffell up. + self.stackedLayout.takeAt(0) + self.insertTab(self.generalTab, 0, PluginStatus.Active) + self.insertTab(self.themesTab, 1, PluginStatus.Active) + self.insertTab(self.advancedTab, 2, PluginStatus.Active) + count = 3 + for plugin in self.plugins: + if plugin.settings_tab: + self.insertTab(plugin.settings_tab, count, plugin.status) + count += 1 self.settingListWidget.setCurrentRow(0) return QtGui.QDialog.exec_(self) - def insertTab(self, tab, location): + def insertTab(self, tab, location, is_active): """ Add a tab to the form at a specific location """ log.debug(u'Inserting %s tab' % tab.tabTitle) - # 14 : There are 3 tables currently and locations starts at -10 - match = False - for tabIndex in range(0, self.stackedLayout.count()): - if self.stackedLayout.widget(tabIndex): - if self.stackedLayout.widget(tabIndex).tabTitleVisible == \ - tab.tabTitleVisible: - self.stackedLayout.widget(tabIndex).setHidden(False) - match = True - break - if not match: - pos = self.stackedLayout.addWidget(tab) + pos = self.stackedLayout.addWidget(tab) + if is_active: 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.stackedLayout.count()): - if self.stackedLayout.widget(tabIndex): - if self.stackedLayout.widget(tabIndex).tabTitleVisible == \ - tab.tabTitleVisible: - self.settingListWidget.item(tabIndex).setHidden(True) + self.settingListWidget.insertItem(location, item_name) + else: + self.stackedLayout.takeAt(location) def accept(self): """ diff --git a/openlp/plugins/bibles/lib/mediaitem.py b/openlp/plugins/bibles/lib/mediaitem.py index b3ffff87c..736d3d82e 100644 --- a/openlp/plugins/bibles/lib/mediaitem.py +++ b/openlp/plugins/bibles/lib/mediaitem.py @@ -836,6 +836,9 @@ class BibleMediaItem(MediaManagerItem): return u'{su}%s{/su}' % verse_text def onlayoutStyleComboBoxChanged(self): + self.settings.layout_style = self.quickLayoutComboBox.currentIndex() + self.settings.layoutStyleComboBox.setCurrentIndex( + self.settings.layout_style) QtCore.QSettings().setValue( self.settingsSection + u'/verse layout style', QtCore.QVariant(self.settings.layout_style)) From 4dd70d454ff6c097f0afd002cfcd465c08bfcabe Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Thu, 14 Apr 2011 19:55:41 +0100 Subject: [PATCH 10/13] Fix Postsetup --- openlp/core/ui/settingsform.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/openlp/core/ui/settingsform.py b/openlp/core/ui/settingsform.py index 6d1680b53..949d907b4 100644 --- a/openlp/core/ui/settingsform.py +++ b/openlp/core/ui/settingsform.py @@ -106,5 +106,9 @@ class SettingsForm(QtGui.QDialog, Ui_SettingsDialog): """ Run any post-setup code for the tabs on the form """ - for tabIndex in range(0, self.stackedLayout.count()): - self.stackedLayout.widget(tabIndex).postSetUp() + self.generalTab.postSetUp() + self.themesTab.postSetUp() + self.advancedTab.postSetUp() + for plugin in self.plugins: + if plugin.settings_tab: + plugin.settings_tab.postSetUp() From 77559e021071bef7bae19337ac2edbc7d58d8813 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Thu, 14 Apr 2011 23:32:21 +0200 Subject: [PATCH 11/13] started to implement #746243 Fixes: https://launchpad.net/bugs/746243 --- openlp/core/lib/searchedit.py | 14 ++++++++++++++ openlp/plugins/songs/lib/mediaitem.py | 9 +++++++++ 2 files changed, 23 insertions(+) diff --git a/openlp/core/lib/searchedit.py b/openlp/core/lib/searchedit.py index d32961ef9..00e0f3ed3 100644 --- a/openlp/core/lib/searchedit.py +++ b/openlp/core/lib/searchedit.py @@ -110,6 +110,20 @@ class SearchEdit(QtGui.QLineEdit): """ return self._currentSearchType + def setCurrentSearchType(self, identifier): + """ + Set a new current search type. + + ``identifier`` + The search type identifier (int). + """ + menu = self.menuButton.menu() + for action in menu.actions(): + if identifier == action.data().toInt()[0]: + self.menuButton.setDefaultAction(action) + self._currentSearchType = identifier + return True + def setSearchTypes(self, items): """ A list of tuples to be used in the search type menu. The first item in diff --git a/openlp/plugins/songs/lib/mediaitem.py b/openlp/plugins/songs/lib/mediaitem.py index e2882ed29..2ce2478cb 100644 --- a/openlp/plugins/songs/lib/mediaitem.py +++ b/openlp/plugins/songs/lib/mediaitem.py @@ -156,8 +156,17 @@ class SongMediaItem(MediaManagerItem): (SongSearch.Themes, u':/slides/slide_theme.png', UiStrings.Themes) ]) self.configUpdated() + # FIXME: Saved search type need to be considered when loading the list. + self.searchTextEdit.setCurrentSearchType(QtCore.QSettings().value( + u'%s/last search type' % self.settingsSection, + QtCore.QVariant(SongSearch.Entire)).toInt()[0]) def onSearchTextButtonClick(self): + # Save the current search type to the config. so it can be restored. + QtCore.QSettings().setValue(u'%s/last search type' % + self.settingsSection, + QtCore.QVariant(self.searchTextEdit.currentSearchType())) + # Reload the list considering the new search type. search_keywords = unicode(self.searchTextEdit.displayText()) search_results = [] search_type = self.searchTextEdit.currentSearchType() From 14a2e8e4c2c332984bafe52a2a63ccfd52cfe914 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Fri, 15 Apr 2011 14:55:56 +0200 Subject: [PATCH 12/13] finished work on restoring current search methods --- openlp/core/lib/searchedit.py | 1 + openlp/plugins/bibles/lib/mediaitem.py | 21 ++++++++++++++------- openlp/plugins/songs/lib/mediaitem.py | 5 ++--- openlp/plugins/songs/songsplugin.py | 2 -- 4 files changed, 17 insertions(+), 12 deletions(-) diff --git a/openlp/core/lib/searchedit.py b/openlp/core/lib/searchedit.py index 00e0f3ed3..94152ef2f 100644 --- a/openlp/core/lib/searchedit.py +++ b/openlp/core/lib/searchedit.py @@ -122,6 +122,7 @@ class SearchEdit(QtGui.QLineEdit): if identifier == action.data().toInt()[0]: self.menuButton.setDefaultAction(action) self._currentSearchType = identifier + self.emit(QtCore.SIGNAL(u'searchTypeChanged(int)'), identifier) return True def setSearchTypes(self, items): diff --git a/openlp/plugins/bibles/lib/mediaitem.py b/openlp/plugins/bibles/lib/mediaitem.py index 118bdfc66..241854985 100644 --- a/openlp/plugins/bibles/lib/mediaitem.py +++ b/openlp/plugins/bibles/lib/mediaitem.py @@ -99,12 +99,6 @@ class BibleMediaItem(MediaManagerItem): self.quickSearchEdit = SearchEdit(self.quickTab) self.quickSearchEdit.setObjectName(u'quickSearchEdit') self.quickSearchLabel.setBuddy(self.quickSearchEdit) - self.quickSearchEdit.setSearchTypes([ - (BibleSearch.Reference, u':/bibles/bibles_search_reference.png', - translate('BiblesPlugin.MediaItem', 'Scripture Reference')), - (BibleSearch.Text, u':/bibles/bibles_search_text.png', - translate('BiblesPlugin.MediaItem', 'Text Search')) - ]) self.quickLayout.addRow(self.quickSearchLabel, self.quickSearchEdit) self.quickLayoutLabel = QtGui.QLabel(self.quickTab) self.quickLayoutLabel.setObjectName(u'quickClearLabel') @@ -295,7 +289,15 @@ class BibleMediaItem(MediaManagerItem): self.settingsSection + u'/quick bible', QtCore.QVariant( self.quickVersionComboBox.currentText())).toString() find_and_set_in_combo_box(self.quickVersionComboBox, bible) - self.updateAutoCompleter() + self.quickSearchEdit.setSearchTypes([ + (BibleSearch.Reference, u':/bibles/bibles_search_reference.png', + translate('BiblesPlugin.MediaItem', 'Scripture Reference')), + (BibleSearch.Text, u':/bibles/bibles_search_text.png', + translate('BiblesPlugin.MediaItem', 'Text Search')) + ]) + self.quickSearchEdit.setCurrentSearchType(QtCore.QSettings().value( + u'%s/last search type' % self.settingsSection, + QtCore.QVariant(BibleSearch.Reference)).toInt()[0]) self.configUpdated() log.debug(u'bible manager initialise complete') @@ -386,6 +388,11 @@ class BibleMediaItem(MediaManagerItem): completion depends on the bible. It is only updated when we are doing a reference search, otherwise the auto completion list is removed. """ + # Save the current search type to the configuration. + QtCore.QSettings().setValue(u'%s/last search type' % + self.settingsSection, + QtCore.QVariant(self.quickSearchEdit.currentSearchType())) + # Save the current bible to the configuration. QtCore.QSettings().setValue(self.settingsSection + u'/quick bible', QtCore.QVariant(self.quickVersionComboBox.currentText())) books = [] diff --git a/openlp/plugins/songs/lib/mediaitem.py b/openlp/plugins/songs/lib/mediaitem.py index 2ce2478cb..5890fc76d 100644 --- a/openlp/plugins/songs/lib/mediaitem.py +++ b/openlp/plugins/songs/lib/mediaitem.py @@ -155,14 +155,13 @@ class SongMediaItem(MediaManagerItem): SongStrings.Authors), (SongSearch.Themes, u':/slides/slide_theme.png', UiStrings.Themes) ]) - self.configUpdated() - # FIXME: Saved search type need to be considered when loading the list. self.searchTextEdit.setCurrentSearchType(QtCore.QSettings().value( u'%s/last search type' % self.settingsSection, QtCore.QVariant(SongSearch.Entire)).toInt()[0]) + self.configUpdated() def onSearchTextButtonClick(self): - # Save the current search type to the config. so it can be restored. + # Save the current search type to the configuration. QtCore.QSettings().setValue(u'%s/last search type' % self.settingsSection, QtCore.QVariant(self.searchTextEdit.currentSearchType())) diff --git a/openlp/plugins/songs/songsplugin.py b/openlp/plugins/songs/songsplugin.py index af50f3f94..4fc098949 100644 --- a/openlp/plugins/songs/songsplugin.py +++ b/openlp/plugins/songs/songsplugin.py @@ -70,8 +70,6 @@ class SongsPlugin(Plugin): action_list.add_action(self.SongImportItem, UiStrings.Import) action_list.add_action(self.SongExportItem, UiStrings.Export) action_list.add_action(self.toolsReindexItem, UiStrings.Tools) - self.mediaItem.displayResultsSong( - self.manager.get_all_objects(Song, order_by_ref=Song.search_title)) def addImportMenuItem(self, import_menu): """ From 269c4fa044ef9093793027f0371aed005ab06336 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Fri, 15 Apr 2011 18:17:51 +0100 Subject: [PATCH 13/13] Fixups --- openlp/core/lib/plugin.py | 28 ++++++++++++++-------------- openlp/core/ui/advancedtab.py | 2 +- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/openlp/core/lib/plugin.py b/openlp/core/lib/plugin.py index a6cc5df63..2ec1045bb 100644 --- a/openlp/core/lib/plugin.py +++ b/openlp/core/lib/plugin.py @@ -115,7 +115,7 @@ class Plugin(QtCore.QObject): """ log.info(u'loaded') - def __init__(self, name, pluginHelpers=None, mediaItemClass=None, + def __init__(self, name, plugin_helpers=None, media_item_class=None, settings_tab_class=None, version=None): """ This is the constructor for the plugin object. This provides an easy @@ -132,10 +132,10 @@ class Plugin(QtCore.QObject): ``version`` Defaults to *None*. The version of the plugin. - ``pluginHelpers`` + ``plugin_helpers`` Defaults to *None*. A list of helper objects. - ``mediaItemClass`` + ``media_item_class`` The class name of the plugin's media item. ``settings_tab_class`` @@ -153,20 +153,20 @@ class Plugin(QtCore.QObject): self.version = get_application_version()[u'version'] self.settingsSection = self.name.lower() self.icon = None - self.mediaItemClass = mediaItemClass + self.media_item_class = media_item_class self.settings_tab_class = settings_tab_class self.weight = 0 self.status = PluginStatus.Inactive # Set up logging self.log = logging.getLogger(self.name) - self.previewController = pluginHelpers[u'preview'] - self.liveController = pluginHelpers[u'live'] - self.renderManager = pluginHelpers[u'render'] - self.serviceManager = pluginHelpers[u'service'] - self.settingsForm = pluginHelpers[u'settings form'] - self.mediadock = pluginHelpers[u'toolbox'] - self.pluginManager = pluginHelpers[u'pluginmanager'] - self.formparent = pluginHelpers[u'formparent'] + self.previewController = plugin_helpers[u'preview'] + self.liveController = plugin_helpers[u'live'] + self.renderManager = plugin_helpers[u'render'] + self.serviceManager = plugin_helpers[u'service'] + self.settingsForm = plugin_helpers[u'settings form'] + self.mediadock = plugin_helpers[u'toolbox'] + self.pluginManager = plugin_helpers[u'pluginmanager'] + self.formparent = plugin_helpers[u'formparent'] QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'%s_add_service_item' % self.name), self.processAddServiceEvent) @@ -213,8 +213,8 @@ class Plugin(QtCore.QObject): Construct a MediaManagerItem object with all the buttons and things you need, and return it for integration into openlp.org. """ - if self.mediaItemClass: - return self.mediaItemClass(self, self, self.icon) + if self.media_item_class: + return self.media_item_class(self, self, self.icon) return None def addImportMenuItem(self, importMenu): diff --git a/openlp/core/ui/advancedtab.py b/openlp/core/ui/advancedtab.py index 3d9321fe1..199ebff60 100644 --- a/openlp/core/ui/advancedtab.py +++ b/openlp/core/ui/advancedtab.py @@ -45,7 +45,7 @@ class AdvancedTab(SettingsTab): SettingsTab.__init__(self, parent ,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' + self.icon_path = u':/system/system_settings.png' def setupUi(self): """