This commit is contained in:
Andreas Preikschat 2011-04-16 07:49:51 +02:00
commit 45850efad7
33 changed files with 405 additions and 796 deletions

View File

@ -274,8 +274,8 @@ def check_directory_exists(dir):
from listwidgetwithdnd import ListWidgetWithDnD
from displaytags import DisplayTags
from spelltextedit import SpellTextEdit
from eventreceiver import Receiver
from spelltextedit import SpellTextEdit
from imagemanager import ImageManager
from settingsmanager import SettingsManager
from plugin import PluginStatus, StringContent, Plugin

View File

@ -307,7 +307,7 @@ sup {
</head>
<body>
<img id="bgimage" class="size" %s />
<img id="image" class="size" style="display:none" />
<img id="image" class="size" %s />
<video id="video1" class="size" style="visibility:hidden" autobuffer preload>
</video>
<video id="video2" class="size" style="visibility:hidden" autobuffer preload>
@ -320,7 +320,7 @@ sup {
</html>
"""
def build_html(item, screen, alert, islive, background):
def build_html(item, screen, alert, islive, background, image=None):
"""
Build the full web paged structure for display
@ -332,6 +332,10 @@ def build_html(item, screen, alert, islive, background):
Alert display display information
`islive`
Item is going live, rather than preview/theme building
`background`
Theme background image - bytes
`image`
Image media item - bytes
"""
width = screen[u'size'].width()
height = screen[u'size'].height()
@ -339,11 +343,15 @@ def build_html(item, screen, alert, islive, background):
webkitvers = webkit_version()
# Image generated and poked in
if background:
image = u'src="data:image/png;base64,%s"' % background
bgimage_src = u'src="data:image/png;base64,%s"' % background
elif item.bg_image_bytes:
image = u'src="data:image/png;base64,%s"' % item.bg_image_bytes
bgimage_src = u'src="data:image/png;base64,%s"' % item.bg_image_bytes
else:
image = u'style="display:none;"'
bgimage_src = u'style="display:none;"'
if image:
image_src = u'src="data:image/png;base64,%s"' % image
else:
image_src = u'style="display:none;"'
html = HTMLSRC % (build_background_css(item, width, height),
width, height,
build_alert_css(alert, width),
@ -351,7 +359,7 @@ def build_html(item, screen, alert, islive, background):
build_lyrics_css(item, webkitvers),
u'true' if theme and theme.display_slide_transition and islive \
else u'false',
image,
bgimage_src, image_src,
build_lyrics_html(item, webkitvers))
return html

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

@ -36,7 +36,9 @@ except ImportError:
# http://john.nachtimwald.com/2009/08/22/qplaintextedit-with-in-line-spell-check
from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate, DisplayTags
from openlp.core.lib.ui import checkable_action
log = logging.getLogger(__name__)
@ -80,6 +82,19 @@ class SpellTextEdit(QtGui.QPlainTextEdit):
if not cursor.hasSelection():
cursor.select(QtGui.QTextCursor.WordUnderCursor)
self.setTextCursor(cursor)
# Add menu with available languages.
if ENCHANT_AVAILABLE:
lang_menu = QtGui.QMenu(
translate('OpenLP.SpellTextEdit', 'Language:'))
for lang in enchant.list_languages():
action = checkable_action(
lang_menu, lang, lang == self.dictionary.tag)
action.setText(lang)
lang_menu.addAction(action)
popupMenu.insertSeparator(popupMenu.actions()[0])
popupMenu.insertMenu(popupMenu.actions()[0], lang_menu)
QtCore.QObject.connect(lang_menu,
QtCore.SIGNAL(u'triggered(QAction*)'), self.setLanguage)
# Check if the selected word is misspelled and offer spelling
# suggestions if it is.
if ENCHANT_AVAILABLE and self.textCursor().hasSelection():
@ -93,19 +108,30 @@ class SpellTextEdit(QtGui.QPlainTextEdit):
spell_menu.addAction(action)
# Only add the spelling suggests to the menu if there are
# suggestions.
if len(spell_menu.actions()) != 0:
popupMenu.insertSeparator(popupMenu.actions()[0])
if len(spell_menu.actions()):
popupMenu.insertMenu(popupMenu.actions()[0], spell_menu)
tagMenu = QtGui.QMenu(translate('OpenLP.SpellTextEdit',
'Formatting Tags'))
for html in DisplayTags.get_html_tags():
action = SpellAction( html[u'desc'], tagMenu)
action = SpellAction(html[u'desc'], tagMenu)
action.correct.connect(self.htmlTag)
tagMenu.addAction(action)
popupMenu.insertSeparator(popupMenu.actions()[0])
popupMenu.insertMenu(popupMenu.actions()[0], tagMenu)
popupMenu.exec_(event.globalPos())
def setLanguage(self, action):
"""
Changes the language for this spelltextedit.
``action``
The action.
"""
self.dictionary = enchant.Dict(action.text())
self.highlighter.spellingDictionary = self.dictionary
self.highlighter.highlightBlock(self.toPlainText())
self.highlighter.rehighlight()
def correctWord(self, word):
"""
Replaces the selected text with word.

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')
@ -87,7 +88,6 @@ class UiStrings(object):
OpenService = translate('OpenLP.Ui', 'Open Service')
Preview = translate('OpenLP.Ui', 'Preview')
PreviewPanel = translate('OpenLP.Ui', 'Preview Panel')
PreviewToolbar = translate('OpenLP.Ui', 'Preview Toolbar')
PrintServiceOrder = translate('OpenLP.Ui', 'Print Service Order')
ReplaceBG = translate('OpenLP.Ui', 'Replace Background')
ReplaceLiveBG = translate('OpenLP.Ui', 'Replace Live Background')
@ -330,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.
"""
@ -427,4 +427,4 @@ def find_and_set_in_combo_box(combo_box, value_to_find):
if index == -1:
# Not Found.
index = 0
combo_box.setCurrentIndex(index)
combo_box.setCurrentIndex(index)

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

@ -453,7 +453,7 @@ class MainDisplay(DisplayWidget):
painter.end()
return preview
def buildHtml(self, serviceItem):
def buildHtml(self, serviceItem, image=None):
"""
Store the serviceItem and build the new HTML from it. Add the
HTML to the display
@ -480,8 +480,12 @@ class MainDisplay(DisplayWidget):
if self.serviceItem.themedata.background_filename:
self.serviceItem.bg_image_bytes = self.imageManager. \
get_image_bytes(self.serviceItem.themedata.theme_name)
if image:
image_bytes = self.imageManager.get_image_bytes(image)
else:
image_bytes = None
html = build_html(self.serviceItem, self.screen, self.alertTab,
self.isLive, background)
self.isLive, background, image_bytes)
log.debug(u'buildHtml - pre setHtml')
self.webView.setHtml(html)
log.debug(u'buildHtml - post setHtml')

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

@ -222,6 +222,7 @@ class PrintServiceForm(QtGui.QDialog, Ui_PrintServiceDialog):
unicode(datetime.timedelta(seconds=tme)), title)
# Add the custom service notes:
if self.footerTextEdit.toPlainText():
div = self._addChildToParent(u'div', parent=html_data.body)
self._addChildToParent(u'span', translate('OpenLP.ServiceManager',
u'Custom Service Notes:'), div, u'class', u'customNotesTitle')
self._addChildToParent(

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

@ -365,22 +365,20 @@ class SlideController(QtGui.QWidget):
QtCore.SIGNAL(u'config_screen_changed'), self.screenSizeChanged)
def setPreviewHotkeys(self, parent=None):
self.previousItem.setObjectName(u'previousItemPreview')
self.previousItem.setObjectName(u'previousItemPreview')
self.nextItem.setObjectName(u'nextItemPreview')
action_list = ActionList.get_instance()
action_list.add_category(
UiStrings.PreviewToolbar, CategoryOrder.standardToolbar)
action_list.add_action(self.previousItem, UiStrings.PreviewToolbar)
action_list.add_action(self.nextItem, UiStrings.PreviewToolbar)
action_list.add_action(self.previousItem)
action_list.add_action(self.nextItem)
def setLiveHotkeys(self, parent=None):
self.previousItem.setObjectName(u'previousItemLive')
self.previousItem.setObjectName(u'previousItemLive')
self.nextItem.setObjectName(u'nextItemLive')
action_list = ActionList.get_instance()
action_list.add_category(
UiStrings.LiveToolbar, CategoryOrder.standardToolbar)
action_list.add_action(self.previousItem, UiStrings.LiveToolbar)
action_list.add_action(self.nextItem, UiStrings.LiveToolbar)
action_list.add_action(self.previousItem)
action_list.add_action(self.nextItem)
self.previousService = shortcut_action(parent, u'previousService',
[QtCore.Qt.Key_Left], self.servicePrevious, UiStrings.LiveToolbar)
self.previousService.setShortcutContext(QtCore.Qt.WidgetWithChildrenShortcut)
@ -467,7 +465,7 @@ class SlideController(QtGui.QWidget):
request = unicode(self.sender().text())
slideno = self.slideList[request]
self.__updatePreviewSelection(slideno)
self.onSlideSelected()
self.slideSelected()
def receiveSpinDelay(self, value):
"""
@ -563,7 +561,7 @@ class SlideController(QtGui.QWidget):
# If service item is the same as the current on only change slide
if item.__eq__(self.serviceItem):
self.__checkUpdateSelectedSlide(slideno)
self.onSlideSelected()
self.slideSelected()
return
self._processItem(item, slideno)
@ -574,24 +572,15 @@ class SlideController(QtGui.QWidget):
"""
log.debug(u'processManagerItem live = %s' % self.isLive)
self.onStopLoop()
# If old item was a command tell it to stop
if self.serviceItem:
if self.serviceItem.is_command():
Receiver.send_message(u'%s_stop' %
self.serviceItem.name.lower(), [serviceItem, self.isLive])
if self.serviceItem.is_media():
self.onMediaClose()
if self.isLive:
if serviceItem.is_capable(ItemCapabilities.ProvidesOwnDisplay):
self._forceUnblank()
blanked = self.blankScreen.isChecked()
else:
blanked = False
old_item = self.serviceItem
self.serviceItem = serviceItem
if old_item and self.isLive and old_item.is_capable(
ItemCapabilities.ProvidesOwnDisplay):
self._resetBlank()
Receiver.send_message(u'%s_start' % serviceItem.name.lower(),
[serviceItem, self.isLive, blanked, slideno])
[serviceItem, self.isLive, self.hideMode(), slideno])
self.slideList = {}
width = self.parent.controlSplitter.sizes()[self.split]
self.serviceItem = serviceItem
self.previewListWidget.clear()
self.previewListWidget.setRowCount(0)
self.previewListWidget.setColumnWidth(0, width)
@ -650,12 +639,25 @@ class SlideController(QtGui.QWidget):
self.previewListWidget.viewport().size().width())
self.__updatePreviewSelection(slideno)
self.enableToolBar(serviceItem)
# Pass to display for viewing
self.display.buildHtml(self.serviceItem)
# Pass to display for viewing.
# Postpone image build, we need to do this later to avoid the theme
# flashing on the screen
if not self.serviceItem.is_image():
self.display.buildHtml(self.serviceItem)
if serviceItem.is_media():
self.onMediaStart(serviceItem)
self.onSlideSelected()
self.slideSelected(True)
self.previewListWidget.setFocus()
if old_item:
# Close the old item after the new one is opened
# This avoids the service theme/desktop flashing on screen
# However opening a new item of the same type will automatically
# close the previous, so make sure we don't close the new one.
if old_item.is_command() and not serviceItem.is_command():
Receiver.send_message(u'%s_stop' %
old_item.name.lower(), [old_item, self.isLive])
if old_item.is_media() and not serviceItem.is_media():
self.onMediaClose()
Receiver.send_message(u'slidecontroller_%s_started' % self.typePrefix,
[serviceItem])
@ -702,7 +704,7 @@ class SlideController(QtGui.QWidget):
self.updatePreview()
else:
self.previewListWidget.selectRow(0)
self.onSlideSelected()
self.slideSelected()
def onSlideSelectedIndex(self, message):
"""
@ -717,7 +719,7 @@ class SlideController(QtGui.QWidget):
self.updatePreview()
else:
self.__checkUpdateSelectedSlide(index)
self.onSlideSelected()
self.slideSelected()
def mainDisplaySetBackground(self):
"""
@ -760,15 +762,13 @@ class SlideController(QtGui.QWidget):
self.themeScreen.setChecked(False)
self.desktopScreen.setChecked(False)
if checked:
Receiver.send_message(u'maindisplay_hide', HideMode.Blank)
QtCore.QSettings().setValue(
self.parent.generalSettingsSection + u'/screen blank',
QtCore.QVariant(u'blanked'))
else:
Receiver.send_message(u'maindisplay_show')
QtCore.QSettings().remove(
self.parent.generalSettingsSection + u'/screen blank')
self.blankPlugin(checked)
self.blankPlugin()
self.updatePreview()
def onThemeDisplay(self, checked=None):
@ -783,15 +783,13 @@ class SlideController(QtGui.QWidget):
self.themeScreen.setChecked(checked)
self.desktopScreen.setChecked(False)
if checked:
Receiver.send_message(u'maindisplay_hide', HideMode.Theme)
QtCore.QSettings().setValue(
self.parent.generalSettingsSection + u'/screen blank',
QtCore.QVariant(u'themed'))
else:
Receiver.send_message(u'maindisplay_show')
QtCore.QSettings().remove(
self.parent.generalSettingsSection + u'/screen blank')
self.blankPlugin(checked)
self.blankPlugin()
self.updatePreview()
def onHideDisplay(self, checked=None):
@ -806,28 +804,31 @@ class SlideController(QtGui.QWidget):
self.themeScreen.setChecked(False)
self.desktopScreen.setChecked(checked)
if checked:
Receiver.send_message(u'maindisplay_hide', HideMode.Screen)
QtCore.QSettings().setValue(
self.parent.generalSettingsSection + u'/screen blank',
QtCore.QVariant(u'hidden'))
else:
Receiver.send_message(u'maindisplay_show')
QtCore.QSettings().remove(
self.parent.generalSettingsSection + u'/screen blank')
self.hidePlugin(checked)
self.updatePreview()
def blankPlugin(self, blank):
def blankPlugin(self):
"""
Blank the display screen within a plugin if required.
Blank/Hide the display screen within a plugin if required.
"""
log.debug(u'blankPlugin %s ', blank)
hide_mode = self.hideMode()
log.debug(u'blankPlugin %s ', hide_mode)
if self.serviceItem is not None:
if blank:
if hide_mode:
if not self.serviceItem.is_command():
Receiver.send_message(u'maindisplay_hide', hide_mode)
Receiver.send_message(u'%s_blank'
% self.serviceItem.name.lower(),
[self.serviceItem, self.isLive])
[self.serviceItem, self.isLive, hide_mode])
else:
if not self.serviceItem.is_command():
Receiver.send_message(u'maindisplay_show')
Receiver.send_message(u'%s_unblank'
% self.serviceItem.name.lower(),
[self.serviceItem, self.isLive])
@ -839,15 +840,24 @@ class SlideController(QtGui.QWidget):
log.debug(u'hidePlugin %s ', hide)
if self.serviceItem is not None:
if hide:
Receiver.send_message(u'maindisplay_hide', HideMode.Screen)
Receiver.send_message(u'%s_hide'
% self.serviceItem.name.lower(),
[self.serviceItem, self.isLive])
else:
if not self.serviceItem.is_command():
Receiver.send_message(u'maindisplay_show')
Receiver.send_message(u'%s_unblank'
% self.serviceItem.name.lower(),
[self.serviceItem, self.isLive])
def onSlideSelected(self):
def onSlideSelected(self, start=False):
"""
Slide selected in controller
"""
self.slideSelected()
def slideSelected(self, start=False):
"""
Generate the preview when you click on a slide.
if this is the Live Controller also display on the screen
@ -856,7 +866,7 @@ class SlideController(QtGui.QWidget):
self.selectedRow = 0
if row > -1 and row < self.previewListWidget.rowCount():
if self.serviceItem.is_command():
if self.isLive:
if self.isLive and not start:
Receiver.send_message(
u'%s_slide' % self.serviceItem.name.lower(),
[self.serviceItem, self.isLive, row])
@ -866,7 +876,11 @@ class SlideController(QtGui.QWidget):
if self.serviceItem.is_text():
frame = self.display.text(toDisplay)
else:
frame = self.display.image(toDisplay)
if start:
self.display.buildHtml(self.serviceItem, toDisplay)
frame = self.display.preview()
else:
frame = self.display.image(toDisplay)
# reset the store used to display first image
self.serviceItem.bg_image_bytes = None
self.slidePreview.setPixmap(QtGui.QPixmap.fromImage(frame))
@ -932,7 +946,7 @@ class SlideController(QtGui.QWidget):
Receiver.send_message('servicemanager_next_item')
return
self.__checkUpdateSelectedSlide(row)
self.onSlideSelected()
self.slideSelected()
def onSlideSelectedPreviousNoloop(self):
self.onSlideSelectedPrevious(False)
@ -955,7 +969,7 @@ class SlideController(QtGui.QWidget):
else:
row = 0
self.__checkUpdateSelectedSlide(row)
self.onSlideSelected()
self.slideSelected()
def __checkUpdateSelectedSlide(self, row):
if row + 1 < self.previewListWidget.rowCount():
@ -976,7 +990,7 @@ class SlideController(QtGui.QWidget):
else:
self.previewListWidget.selectRow(
self.previewListWidget.rowCount() - 1)
self.onSlideSelected()
self.slideSelected()
def onStartLoop(self):
"""
@ -1108,20 +1122,32 @@ class SlideController(QtGui.QWidget):
self.slidePreview.clear()
self.slidePreview.show()
def _forceUnblank(self):
def _resetBlank(self):
"""
Used by command items which provide their own displays to reset the
screen hide attributes
"""
blank = None
if self.blankScreen.isChecked:
blank = self.blankScreen
if self.themeScreen.isChecked:
blank = self.themeScreen
if self.desktopScreen.isChecked:
blank = self.desktopScreen
if blank:
blank.setChecked(False)
self.hideMenu.setDefaultAction(blank)
QtCore.QSettings().remove(
self.parent.generalSettingsSection + u'/screen blank')
hide_mode = self.hideMode()
if hide_mode == HideMode.Blank:
self.onBlankDisplay(True)
elif hide_mode == HideMode.Theme:
self.onThemeDisplay(True)
elif hide_mode == HideMode.Screen:
self.onHideDisplay(True)
else:
self.hidePlugin(False)
def hideMode(self):
"""
Determine what the hide mode should be according to the blank button
"""
if not self.isLive:
return None
elif self.blankScreen.isChecked():
return HideMode.Blank
elif self.themeScreen.isChecked():
return HideMode.Theme
elif self.desktopScreen.isChecked():
return HideMode.Screen
else:
return None

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

@ -58,6 +58,7 @@ class BibleMediaItem(MediaManagerItem):
MediaManagerItem.__init__(self, parent, plugin, icon)
# Place to store the search results for both bibles.
self.settings = self.parent.settings_tab
self.quickPreviewAllowed = True
self.search_results = {}
self.second_search_results = {}
QtCore.QObject.connect(Receiver.get_receiver(),
@ -99,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')
@ -279,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,
@ -295,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')
@ -386,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

@ -49,7 +49,7 @@ class Controller(object):
self.doc = None
log.info(u'%s controller loaded' % live)
def add_handler(self, controller, file, is_blank):
def add_handler(self, controller, file, hide_mode, slide_no):
"""
Add a handler, which is an instance of a presentation and
slidecontroller combination. If the slidecontroller has a display
@ -64,12 +64,21 @@ class Controller(object):
# Display error message to user
# Inform slidecontroller that the action failed?
return
self.doc.slidenumber = slide_no
if self.is_live:
self.doc.start_presentation()
if is_blank:
self.blank()
Receiver.send_message(u'maindisplay_hide', HideMode.Screen)
self.doc.slidenumber = 0
if hide_mode == HideMode.Screen:
Receiver.send_message(u'maindisplay_hide', HideMode.Screen)
self.stop()
elif hide_mode == HideMode.Theme:
self.blank(hide_mode)
elif hide_mode == HideMode.Blank:
self.blank(hide_mode)
else:
self.doc.start_presentation()
Receiver.send_message(u'maindisplay_hide', HideMode.Screen)
self.doc.slidenumber = 0
if slide_no > 1:
self.slide(slide_no)
def activate(self):
"""
@ -164,14 +173,10 @@ class Controller(object):
Based on the handler passed at startup triggers slide show to shut down
"""
log.debug(u'Live = %s, shutdown' % self.is_live)
if self.is_live:
Receiver.send_message(u'maindisplay_show')
self.doc.close_presentation()
self.doc = None
#self.doc.slidenumber = 0
#self.timer.stop()
def blank(self):
def blank(self, hide_mode):
"""
Instruct the controller to blank the presentation
"""
@ -182,6 +187,8 @@ class Controller(object):
return
if not self.doc.is_active():
return
if hide_mode == HideMode.Theme:
Receiver.send_message(u'maindisplay_hide', HideMode.Theme)
self.doc.blank_screen()
def stop(self):
@ -261,7 +268,7 @@ class MessageListener(object):
is_live = message[1]
item = message[0]
log.debug(u'Startup called with message %s' % message)
is_blank = message[2]
hide_mode = message[2]
file = os.path.join(item.get_frame_path(),
item.get_frame_title())
self.handler = item.title
@ -273,7 +280,8 @@ class MessageListener(object):
controller = self.live_handler
else:
controller = self.preview_handler
controller.add_handler(self.controllers[self.handler], file, is_blank)
controller.add_handler(self.controllers[self.handler], file, hide_mode,
message[3])
def slide(self, message):
"""
@ -333,7 +341,6 @@ class MessageListener(object):
"""
is_live = message[1]
if is_live:
Receiver.send_message(u'maindisplay_show')
self.live_handler.shutdown()
else:
self.preview_handler.shutdown()
@ -351,8 +358,9 @@ class MessageListener(object):
React to the message to blank the display
"""
is_live = message[1]
hide_mode = message[2]
if is_live:
self.live_handler.blank()
self.live_handler.blank(hide_mode)
def unblank(self, message):
"""

View File

@ -251,14 +251,13 @@ class PowerpointDocument(PresentationDocument):
win32ui.GetForegroundWindow().GetDC().GetDeviceCaps(88)
except win32ui.error:
dpi = 96
self.presentation.SlideShowSettings.Run()
self.presentation.SlideShowWindow.View.GotoSlide(1)
rendermanager = self.controller.plugin.renderManager
rect = rendermanager.screens.current[u'size']
self.presentation.SlideShowWindow.Top = rect.y() * 72 / dpi
self.presentation.SlideShowWindow.Height = rect.height() * 72 / dpi
self.presentation.SlideShowWindow.Left = rect.x() * 72 / dpi
self.presentation.SlideShowWindow.Width = rect.width() * 72 / dpi
ppt_window = self.presentation.SlideShowSettings.Run()
ppt_window.Top = rect.y() * 72 / dpi
ppt_window.Height = rect.height() * 72 / dpi
ppt_window.Left = rect.x() * 72 / dpi
ppt_window.Width = rect.width() * 72 / dpi
def get_slide_number(self):
"""

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"/>