This commit is contained in:
Jonathan Corwin 2011-04-15 22:10:11 +01:00
commit 8e3b085f36
26 changed files with 246 additions and 714 deletions

View File

@ -115,8 +115,8 @@ class Plugin(QtCore.QObject):
"""
log.info(u'loaded')
def __init__(self, name, pluginHelpers=None, mediaItemClass=None,
settingsTabClass=None, version=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
way for descendent plugins to populate common data. This method *must*
@ -132,15 +132,16 @@ 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.
``settingsTabClass``
``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 = {}
@ -152,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.settingsTabClass = settingsTabClass
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)
@ -212,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):
@ -243,14 +244,15 @@ 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.settingsTabClass:
return self.settingsTabClass(self.name,
self.getString(StringContent.VisibleName)[u'title'])
if self.settings_tab_class:
return self.settings_tab_class(parent, self.name,
self.getString(StringContent.VisibleName)[u'title'],
self.icon_path)
return None
def addToMenu(self, menubar):
@ -287,31 +289,14 @@ class Plugin(QtCore.QObject):
"""
if self.mediaItem:
self.mediaItem.initialise()
self.insertToolboxItem()
self.mediadock.insert_dock(self.mediaItem, self.icon, 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):
"""

View File

@ -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,16 +148,8 @@ class PluginManager(object):
"""
for plugin in self.plugins:
if plugin.status is not PluginStatus.Disabled:
plugin.settings_tab = plugin.getSettingsTab()
visible_title = plugin.getString(StringContent.VisibleName)
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)
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):
"""
@ -207,8 +199,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):

View File

@ -110,6 +110,21 @@ 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
self.emit(QtCore.SIGNAL(u'searchTypeChanged(int)'), identifier)
return True
def setSearchTypes(self, items):
"""
A list of tuples to be used in the search type menu. The first item in

View File

@ -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, parent, title, visible_title=None, icon_path=None):
"""
Constructor to create the Settings tab item.
@ -41,10 +41,12 @@ 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()
if icon_path:
self.icon_path = icon_path
self.setupUi()
self.retranslateUi()
self.initialise()

View File

@ -65,6 +65,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')
@ -329,7 +330,7 @@ def context_menu_action(base, icon, text, slot, shortcuts=None, category=None,
``category``
The category the shortcut should be listed in the shortcut dialog. If
left to None, then the action will be hidden in the shortcut dialog.
``context``
The context the shortcut is valid.
"""

View File

@ -37,13 +37,15 @@ 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
"""
SettingsTab.__init__(self, u'Advanced')
generalTranslated = translate('AdvancedTab', 'Advanced')
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':/system/system_settings.png'
def setupUi(self):
"""

View File

@ -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
"""
@ -44,7 +44,9 @@ class GeneralTab(SettingsTab):
self.monitorNumber = 0
# Set to True to allow PostSetup to work on application start up
self.overrideChanged = True
SettingsTab.__init__(self, u'General')
self.icon_path = u':/icon/openlp-logo-16x16.png'
generalTranslated = translate('GeneralTab', 'General')
SettingsTab.__init__(self, parent, u'General', generalTranslated)
def preLoad(self):
"""

View File

@ -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)

View File

@ -32,18 +32,29 @@ 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.setObjectName(u'settingsLayout')
self.settingsTabWidget = QtGui.QTabWidget(settingsDialog)
self.settingsTabWidget.setObjectName(u'settingsTabWidget')
self.settingsLayout.addWidget(self.settingsTabWidget)
self.dialogLayout = QtGui.QGridLayout(settingsDialog)
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)
self.settingListWidget.setObjectName(u'settingListWidget')
self.dialogLayout.addWidget(self.settingListWidget, 0, 0, 1, 1)
self.stackedLayout = QtGui.QStackedLayout()
self.stackedLayout.setObjectName(u'stackedLayout')
self.dialogLayout.addLayout(self.stackedLayout, 0, 1, 1, 1)
self.buttonBox = create_accept_reject_button_box(settingsDialog, True)
self.settingsLayout.addWidget(self.buttonBox)
self.dialogLayout.addWidget(self.buttonBox, 1, 1, 1, 1)
self.retranslateUi(settingsDialog)
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',

View File

@ -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, PluginStatus
from openlp.core.ui import AdvancedTab, GeneralTab, ThemesTab
from settingsdialog import Ui_SettingsDialog
@ -47,48 +47,49 @@ class SettingsForm(QtGui.QDialog, Ui_SettingsDialog):
QtGui.QDialog.__init__(self, parent)
self.setupUi(self)
# General tab
generalTab = GeneralTab(screens)
self.addTab(u'General', generalTab)
self.generalTab = GeneralTab(self, screens)
# Themes tab
themesTab = ThemesTab(mainWindow)
self.addTab(u'Themes', themesTab)
self.themesTab = ThemesTab(self, mainWindow)
# Advanced tab
advancedTab = AdvancedTab()
self.addTab(u'Advanced', advancedTab)
self.advancedTab = AdvancedTab(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 exec_(self):
# load all the settings
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
self.settingsTabWidget.insertTab(
location + 14, tab, tab.tabTitleVisible)
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 == \
tab.tabTitleVisible:
self.settingsTabWidget.removeTab(tabIndex)
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(location, item_name)
else:
self.stackedLayout.takeAt(location)
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)
@ -97,13 +98,17 @@ 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()
self.generalTab.postSetUp()
self.themesTab.postSetUp()
self.advancedTab.postSetUp()
for plugin in self.plugins:
if plugin.settings_tab:
plugin.settings_tab.postSetUp()

View File

@ -34,9 +34,11 @@ class ThemesTab(SettingsTab):
"""
ThemesTab is the theme settings tab in the settings dialog.
"""
def __init__(self, parent):
self.parent = parent
SettingsTab.__init__(self, u'Themes')
def __init__(self, parent, mainwindow):
self.mainwindow = mainwindow
generalTranslated = translate('ThemeTab', 'Themes')
SettingsTab.__init__(self, parent, u'Themes', generalTranslated)
self.icon_path = u':/themes/theme_new.png'
def setupUi(self):
self.setObjectName(u'ThemesTab')
@ -147,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)
@ -165,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()
@ -186,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()
@ -195,10 +197,10 @@ 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():
preview = preview.scaled(300, 255, QtCore.Qt.KeepAspectRatio,
QtCore.Qt.SmoothTransformation)
self.DefaultListView.setPixmap(preview)
self.DefaultListView.setPixmap(preview)

View File

@ -43,9 +43,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)

View File

@ -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, parent, name, visible_title, icon_path):
SettingsTab.__init__(self, parent, name, visible_title, icon_path)
def setupUi(self):
self.setObjectName(u'AlertsTab')

View File

@ -40,11 +40,11 @@ class BiblesTab(SettingsTab):
"""
log.info(u'Bible Tab loaded')
def __init__(self, title, visible_title):
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)
SettingsTab.__init__(self, parent, title, visible_title, icon_path)
def setupUi(self):
self.setObjectName(u'BiblesTab')
@ -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:'))

View File

@ -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()

View File

@ -100,12 +100,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')
@ -280,7 +274,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,
@ -296,7 +290,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')
@ -387,6 +389,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 = []

View File

@ -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, parent, title, visible_title, icon_path):
SettingsTab.__init__(self, parent, title, visible_title, icon_path)
def setupUi(self):
self.setObjectName(u'CustomTab')

View File

@ -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, parent, title, visible_title, icon_path):
SettingsTab.__init__(self, parent, title, visible_title, icon_path)
def setupUi(self):
self.setObjectName(u'MediaTab')

View File

@ -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, parent, title, visible_title, controllers, icon_path):
"""
Constructor
"""
self.controllers = controllers
SettingsTab.__init__(self, title, visible_title)
SettingsTab.__init__(self, parent, title, visible_title, icon_path)
def setupUi(self):
"""

View File

@ -56,13 +56,13 @@ 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'],
self.controllers)
return PresentationTab(parent, self.name, visible_name[u'title'],
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:

View File

@ -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, parent, title, visible_title, icon_path):
SettingsTab.__init__(self, parent, title, visible_title, icon_path)
def setupUi(self):
self.setObjectName(u'RemoteTab')

View File

@ -39,8 +39,9 @@ class RemotesPlugin(Plugin):
remotes constructor
"""
Plugin.__init__(self, u'Remotes', plugin_helpers,
settingsTabClass=RemoteTab)
self.icon = build_icon(u':/plugins/plugin_remote.png')
settings_tab_class=RemoteTab)
self.icon_path = u':/plugins/plugin_remote.png'
self.icon = build_icon(self.icon_path)
self.weight = -1
self.server = None
@ -50,7 +51,6 @@ class RemotesPlugin(Plugin):
"""
log.debug(u'initialise')
Plugin.initialise(self)
self.insertToolboxItem()
self.server = HttpServer(self)
def finalise(self):

View File

@ -155,9 +155,17 @@ class SongMediaItem(MediaManagerItem):
SongStrings.Authors),
(SongSearch.Themes, u':/slides/slide_theme.png', UiStrings.Themes)
])
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 configuration.
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()

View File

@ -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, parent, title, visible_title, icon_path):
SettingsTab.__init__(self, parent, title, visible_title, icon_path)
def setupUi(self):
self.setObjectName(u'SongsTab')

View File

@ -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):
"""

View File

@ -14,565 +14,75 @@
<string>Settings</string>
</property>
<property name="windowIcon">
<iconset resource="../images/openlp-2.qrc">
<iconset>
<normaloff>:/icon/openlp.org-icon-32.bmp</normaloff>:/icon/openlp.org-icon-32.bmp</iconset>
</property>
<layout class="QVBoxLayout" name="SettingsLayout">
<property name="spacing">
<number>8</number>
<widget class="QWidget" name="layoutWidget">
<property name="geometry">
<rect>
<x>10</x>
<y>30</y>
<width>691</width>
<height>441</height>
</rect>
</property>
<property name="margin">
<number>8</number>
</property>
<item>
<widget class="QTabWidget" name="SettingsTabWidget">
<property name="currentIndex">
<number>2</number>
</property>
<widget class="QWidget" name="GeneralTab">
<attribute name="title">
<string>General</string>
</attribute>
<layout class="QHBoxLayout" name="GeneralLayout">
<property name="spacing">
<number>8</number>
</property>
<property name="margin">
<number>8</number>
</property>
<item>
<widget class="QWidget" name="GeneralLeftWidget" native="true">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QGroupBox" name="MonitorGroupBox">
<property name="title">
<string>Monitors</string>
</property>
<layout class="QVBoxLayout" name="MonitorLayout">
<property name="spacing">
<number>8</number>
</property>
<property name="margin">
<number>8</number>
</property>
<item>
<widget class="QLabel" name="MonitorLabel">
<property name="text">
<string>Select monitor for output display:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="MonitorComboBox">
<item>
<property name="text">
<string>Monitor 1 on X11 Windowing System</string>
</property>
</item>
<item>
<property name="text">
<string>Monitor 2 on X11 Windowing System</string>
</property>
</item>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="BlankScreenGroupBox">
<property name="title">
<string>Blank Screen</string>
</property>
<layout class="QVBoxLayout" name="BlankScreenLayout">
<property name="spacing">
<number>8</number>
</property>
<property name="margin">
<number>8</number>
</property>
<item>
<widget class="QCheckBox" name="WarningCheckBox">
<property name="text">
<string>Show warning on startup</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="AutoOpenGroupBox">
<property name="title">
<string>Auto Open Last Service</string>
</property>
<layout class="QVBoxLayout" name="AutoOpenLayout">
<item>
<widget class="QCheckBox" name="AutoOpenCheckBox">
<property name="text">
<string>Automatically open the last service at startup</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="GeneralLeftSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QWidget" name="GeneralRightWidget" native="true">
<layout class="QVBoxLayout" name="GeneralRightLayout">
<property name="spacing">
<number>8</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QGroupBox" name="CCLIGroupBox">
<property name="title">
<string>CCLI Details</string>
</property>
<layout class="QGridLayout" name="CCLILayout">
<property name="margin">
<number>8</number>
</property>
<property name="spacing">
<number>8</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="NumberLabel">
<property name="text">
<string>CCLI Number:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="NumberEdit"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="UsernameLabel">
<property name="text">
<string>SongSelect Username:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="UsernameEdit"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="PasswordLabel">
<property name="text">
<string>SongSelect Password:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="PasswordEdit">
<property name="echoMode">
<enum>QLineEdit::Password</enum>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="GeneralRightSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
</layout>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QStackedWidget" name="tagStackedWidget">
<property name="minimumSize">
<size>
<width>500</width>
<height>0</height>
</size>
</property>
<widget class="QWidget" name="page">
<widget class="QListWidget" name="settingListWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>211</width>
<height>409</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>200</width>
<height>0</height>
</size>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
</widget>
</widget>
<widget class="QWidget" name="page_2"/>
</widget>
<widget class="QWidget" name="ThemesTab">
<attribute name="title">
<string>Themes</string>
</attribute>
<layout class="QHBoxLayout" name="ThemesTabLayout">
<property name="spacing">
<number>8</number>
</property>
<property name="margin">
<number>8</number>
</property>
<item>
<widget class="QGroupBox" name="GlobalGroupBox">
<property name="title">
<string>Global theme</string>
</property>
<layout class="QVBoxLayout" name="GlobalGroupBoxLayout">
<property name="spacing">
<number>8</number>
</property>
<property name="margin">
<number>8</number>
</property>
<item>
<widget class="QComboBox" name="DefaultComboBox">
<item>
<property name="text">
<string>African Sunset</string>
</property>
</item>
<item>
<property name="text">
<string>Snowy Mountains</string>
</property>
</item>
<item>
<property name="text">
<string>Wilderness</string>
</property>
</item>
</widget>
</item>
<item>
<widget class="QListView" name="DefaultListView"/>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="LevelGroupBox">
<property name="title">
<string>Theme level</string>
</property>
<layout class="QFormLayout" name="formLayout">
<property name="labelAlignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<property name="formAlignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<property name="horizontalSpacing">
<number>8</number>
</property>
<property name="verticalSpacing">
<number>8</number>
</property>
<property name="margin">
<number>8</number>
</property>
<item row="0" column="0">
<widget class="QRadioButton" name="SongLevelRadioButton">
<property name="text">
<string>Song level</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="SongLevelLabel">
<property name="text">
<string>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.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QRadioButton" name="ServiceLevelRadioButton">
<property name="text">
<string>Service level</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="ServiceLevelLabel">
<property name="text">
<string>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.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QRadioButton" name="GlobalLevelRadioButton">
<property name="checked">
<bool>true</bool>
</property>
<property name="text">
<string>Global level</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="GlobalLevelLabel">
<property name="text">
<string>Use the global theme, overriding any themes associated with either the service or the songs.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<widget class="QDialogButtonBox" name="ButtonsBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
<widget class="QWidget" name="AlertsTab">
<attribute name="title">
<string>Alerts</string>
</attribute>
<layout class="QHBoxLayout" name="AlertsLayout">
<property name="spacing">
<number>8</number>
</property>
<property name="margin">
<number>8</number>
</property>
<item>
<widget class="QWidget" name="AlertLeftColumn" native="true">
<layout class="QVBoxLayout" name="SlideLeftLayout">
<property name="spacing">
<number>8</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QGroupBox" name="FontGroupBox">
<property name="title">
<string>Font</string>
</property>
<layout class="QVBoxLayout" name="FontLayout">
<property name="spacing">
<number>8</number>
</property>
<property name="margin">
<number>8</number>
</property>
<item>
<widget class="QLabel" name="FontLabel">
<property name="text">
<string>Font Name:</string>
</property>
</widget>
</item>
<item>
<widget class="QFontComboBox" name="FontComboBox"/>
</item>
<item>
<widget class="QWidget" name="ColorWidget" native="true">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="FontColorLabel">
<property name="text">
<string>Font Color:</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="FontColourButton">
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<spacer name="ColorSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="BackgroundColorLabel">
<property name="text">
<string>Background Color:</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="BackgroundColourButton">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QWidget" name="LengthWidget" native="true">
<layout class="QHBoxLayout" name="LengthLayout">
<property name="spacing">
<number>8</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="LengthLabel">
<property name="text">
<string>Display length:</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="LengthSpinBox">
<property name="value">
<number>5</number>
</property>
<property name="suffix">
<string>s</string>
</property>
<property name="maximum">
<number>180</number>
</property>
</widget>
</item>
<item>
<spacer name="LengthSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>147</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="SlideLeftSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>94</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QWidget" name="SlideRightColumn" native="true">
<layout class="QVBoxLayout" name="SlideRightLayout">
<property name="spacing">
<number>8</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QGroupBox" name="PreviewGroupBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Preview</string>
</property>
<layout class="QVBoxLayout" name="PreviewLayout">
<property name="spacing">
<number>8</number>
</property>
<property name="margin">
<number>8</number>
</property>
<item>
<widget class="QGraphicsView" name="FontPreview">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>64</height>
</size>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="SlideRightSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="ButtonsBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
<resources>
<include location="../images/openlp-2.qrc"/>