Merge HEAD

This commit is contained in:
Arjan Schrijver 2013-03-18 15:11:58 +01:00
commit ec12b36665
44 changed files with 1663 additions and 1583 deletions

View File

@ -342,8 +342,7 @@ class Manager(object):
if try_count >= 2: if try_count >= 2:
raise raise
def get_all_objects(self, object_class, filter_clause=None, def get_all_objects(self, object_class, filter_clause=None, order_by_ref=None):
order_by_ref=None):
""" """
Returns all the objects from the database Returns all the objects from the database

View File

@ -28,8 +28,7 @@
############################################################################### ###############################################################################
""" """
Provide additional functionality required by OpenLP from the inherited Provide additional functionality required by OpenLP from the inherited QDockWidget.
QDockWidget.
""" """
import logging import logging
@ -56,8 +55,8 @@ class OpenLPDockWidget(QtGui.QDockWidget):
self.setWindowIcon(build_icon(icon)) self.setWindowIcon(build_icon(icon))
# Sort out the minimum width. # Sort out the minimum width.
screens = ScreenList() screens = ScreenList()
mainwindow_docbars = screens.current[u'size'].width() / 5 main_window_docbars = screens.current[u'size'].width() / 5
if mainwindow_docbars > 300: if main_window_docbars > 300:
self.setMinimumWidth(300) self.setMinimumWidth(300)
else: else:
self.setMinimumWidth(mainwindow_docbars) self.setMinimumWidth(main_window_docbars)

View File

@ -191,7 +191,7 @@ class ImageManager(QtCore.QObject):
self.image_thread = ImageThread(self) self.image_thread = ImageThread(self)
self._conversion_queue = PriorityQueue() self._conversion_queue = PriorityQueue()
self.stop_manager = False self.stop_manager = False
Registry().register_function(u'config_updated', self.process_updates) Registry().register_function(u'images_regenerate', self.process_updates)
def update_display(self): def update_display(self):
""" """

View File

@ -36,7 +36,7 @@ import re
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core.lib import OpenLPToolbar, ServiceItem, StringContent, ListWidgetWithDnD, \ from openlp.core.lib import OpenLPToolbar, ServiceItem, StringContent, ListWidgetWithDnD, \
ServiceItemContext, Settings, Registry, UiStrings, build_icon, translate ServiceItemContext, Settings, Registry, UiStrings, translate
from openlp.core.lib.searchedit import SearchEdit from openlp.core.lib.searchedit import SearchEdit
from openlp.core.lib.ui import create_widget_action, critical_error_message_box from openlp.core.lib.ui import create_widget_action, critical_error_message_box

View File

@ -214,7 +214,7 @@ class Plugin(QtCore.QObject):
you need, and return it for integration into OpenLP. you need, and return it for integration into OpenLP.
""" """
if self.mediaItemClass: if self.mediaItemClass:
self.mediaItem = self.mediaItemClass(self.main_window.mediaDockManager.media_dock, self) self.mediaItem = self.mediaItemClass(self.main_window.media_dock_manager.media_dock, self)
def upgrade_settings(self, settings): def upgrade_settings(self, settings):
""" """
@ -293,14 +293,14 @@ class Plugin(QtCore.QObject):
""" """
if self.mediaItem: if self.mediaItem:
self.mediaItem.initialise() self.mediaItem.initialise()
self.main_window.mediaDockManager.insert_dock(self.mediaItem, self.icon, self.weight) self.main_window.media_dock_manager.insert_dock(self.mediaItem, self.icon, self.weight)
def finalise(self): def finalise(self):
""" """
Called by the plugin Manager to cleanup things. Called by the plugin Manager to cleanup things.
""" """
if self.mediaItem: if self.mediaItem:
self.main_window.mediaDockManager.remove_dock(self.mediaItem) self.main_window.media_dock_manager.remove_dock(self.mediaItem)
def app_startup(self): def app_startup(self):
""" """
@ -398,9 +398,11 @@ class Plugin(QtCore.QObject):
def config_update(self): def config_update(self):
""" """
The plugin's config has changed Called when Config is changed to restart values dependent on configuration.
""" """
pass log.info(u'config update processed')
if self.mediaItem:
self.mediaItem.config_update()
def new_service_created(self): def new_service_created(self):
""" """

View File

@ -114,7 +114,7 @@ class Registry(object):
Register an event and associated function to be called Register an event and associated function to be called
``event`` ``event``
The function description like "config_updated" or "live_display_hide" where a number of places in the code The function description like "live_display_hide" where a number of places in the code
will/may need to respond to a single action and the caller does not need to understand or know about the will/may need to respond to a single action and the caller does not need to understand or know about the
recipients. recipients.

View File

@ -31,8 +31,8 @@ import logging
from PyQt4 import QtGui, QtCore, QtWebKit from PyQt4 import QtGui, QtCore, QtWebKit
from openlp.core.lib import FormattingTags, ImageSource, ItemCapabilities, Registry, ScreenList, ServiceItem, \ from openlp.core.lib import Settings, FormattingTags, ImageSource, ItemCapabilities, Registry, ScreenList, \
expand_tags, build_lyrics_format_css, build_lyrics_outline_css ServiceItem, expand_tags, build_lyrics_format_css, build_lyrics_outline_css
from openlp.core.lib.theme import ThemeLevel from openlp.core.lib.theme import ThemeLevel
from openlp.core.ui import MainDisplay from openlp.core.ui import MainDisplay
@ -171,13 +171,14 @@ class Renderer(object):
""" """
self.theme_level = theme_level self.theme_level = theme_level
def set_global_theme(self, global_theme_name): def set_global_theme(self):
""" """
Set the global-level theme name. Set the global-level theme name.
``global_theme_name`` ``global_theme_name``
The global-level theme's name. The global-level theme's name.
""" """
global_theme_name = Settings().value(u'themes/global theme')
self._set_theme(global_theme_name) self._set_theme(global_theme_name)
self.global_theme_name = global_theme_name self.global_theme_name = global_theme_name

View File

@ -36,10 +36,10 @@ from PyQt4 import QtGui
from openlp.core.lib import Registry from openlp.core.lib import Registry
class SettingsTab(QtGui.QWidget): class SettingsTab(QtGui.QWidget):
""" """
SettingsTab is a helper widget for plugins to define Tabs for the settings SettingsTab is a helper widget for plugins to define Tabs for the settings dialog.
dialog.
""" """
def __init__(self, parent, title, visible_title=None, icon_path=None): def __init__(self, parent, title, visible_title=None, icon_path=None):
""" """
@ -52,11 +52,12 @@ class SettingsTab(QtGui.QWidget):
The title of the tab, which is usually displayed on the tab. The title of the tab, which is usually displayed on the tab.
""" """
QtGui.QWidget.__init__(self, parent) QtGui.QWidget.__init__(self, parent)
self.tabTitle = title self.tab_title = title
self.tabTitleVisible = visible_title self.tab_title_visible = visible_title
self.settingsSection = self.tabTitle.lower() self.settings_section = self.tab_title.lower()
self.tab_visited = False
if icon_path: if icon_path:
self.iconPath = icon_path self.icon_path = icon_path
self.setupUi() self.setupUi()
self.retranslateUi() self.retranslateUi()
self.initialise() self.initialise()
@ -66,20 +67,20 @@ class SettingsTab(QtGui.QWidget):
""" """
Setup the tab's interface. Setup the tab's interface.
""" """
self.tabLayout = QtGui.QHBoxLayout(self) self.tab_layout = QtGui.QHBoxLayout(self)
self.tabLayout.setObjectName(u'tabLayout') self.tab_layout.setObjectName(u'tab_layout')
self.leftColumn = QtGui.QWidget(self) self.left_column = QtGui.QWidget(self)
self.leftColumn.setObjectName(u'leftColumn') self.left_column.setObjectName(u'left_column')
self.leftLayout = QtGui.QVBoxLayout(self.leftColumn) self.left_layout = QtGui.QVBoxLayout(self.left_column)
self.leftLayout.setMargin(0) self.left_layout.setMargin(0)
self.leftLayout.setObjectName(u'leftLayout') self.left_layout.setObjectName(u'left_layout')
self.tabLayout.addWidget(self.leftColumn) self.tab_layout.addWidget(self.left_column)
self.rightColumn = QtGui.QWidget(self) self.right_column = QtGui.QWidget(self)
self.rightColumn.setObjectName(u'rightColumn') self.right_column.setObjectName(u'right_column')
self.rightLayout = QtGui.QVBoxLayout(self.rightColumn) self.right_layout = QtGui.QVBoxLayout(self.right_column)
self.rightLayout.setMargin(0) self.right_layout.setMargin(0)
self.rightLayout.setObjectName(u'rightLayout') self.right_layout.setObjectName(u'right_layout')
self.tabLayout.addWidget(self.rightColumn) self.tab_layout.addWidget(self.right_column)
def resizeEvent(self, event=None): def resizeEvent(self, event=None):
""" """
@ -87,11 +88,11 @@ class SettingsTab(QtGui.QWidget):
""" """
if event: if event:
QtGui.QWidget.resizeEvent(self, event) QtGui.QWidget.resizeEvent(self, event)
width = self.width() - self.tabLayout.spacing() - \ width = self.width() - self.tab_layout.spacing() - \
self.tabLayout.contentsMargins().left() - self.tabLayout.contentsMargins().right() self.tab_layout.contentsMargins().left() - self.tab_layout.contentsMargins().right()
left_width = min(width - self.rightColumn.minimumSizeHint().width(), width / 2) left_width = min(width - self.right_column.minimumSizeHint().width(), width / 2)
left_width = max(left_width, self.leftColumn.minimumSizeHint().width()) left_width = max(left_width, self.left_column.minimumSizeHint().width())
self.leftColumn.setFixedWidth(left_width) self.left_column.setFixedWidth(left_width)
def retranslateUi(self): def retranslateUi(self):
""" """
@ -133,11 +134,11 @@ class SettingsTab(QtGui.QWidget):
""" """
pass pass
def tabVisible(self): def tab_visible(self):
""" """
Tab has just been made visible to the user Tab has just been made visible to the user
""" """
pass self.tab_visited = True
def _get_service_manager(self): def _get_service_manager(self):
""" """

View File

@ -55,7 +55,7 @@ class AdvancedTab(SettingsTab):
self.default_image = u':/graphics/openlp-splash-screen.png' self.default_image = u':/graphics/openlp-splash-screen.png'
self.default_color = u'#ffffff' self.default_color = u'#ffffff'
self.data_exists = False self.data_exists = False
self.iconPath = u':/system/system_settings.png' self.icon_path = u':/system/system_settings.png'
advanced_translated = translate('OpenLP.AdvancedTab', 'Advanced') advanced_translated = translate('OpenLP.AdvancedTab', 'Advanced')
SettingsTab.__init__(self, parent, u'Advanced', advanced_translated) SettingsTab.__init__(self, parent, u'Advanced', advanced_translated)
@ -65,7 +65,7 @@ class AdvancedTab(SettingsTab):
""" """
self.setObjectName(u'AdvancedTab') self.setObjectName(u'AdvancedTab')
SettingsTab.setupUi(self) SettingsTab.setupUi(self)
self.ui_group_box = QtGui.QGroupBox(self.leftColumn) self.ui_group_box = QtGui.QGroupBox(self.left_column)
self.ui_group_box.setObjectName(u'ui_group_box') self.ui_group_box.setObjectName(u'ui_group_box')
self.ui_layout = QtGui.QFormLayout(self.ui_group_box) self.ui_layout = QtGui.QFormLayout(self.ui_group_box)
self.ui_layout.setObjectName(u'ui_layout') self.ui_layout.setObjectName(u'ui_layout')
@ -90,9 +90,9 @@ class AdvancedTab(SettingsTab):
self.enable_auto_close_check_box = QtGui.QCheckBox(self.ui_group_box) self.enable_auto_close_check_box = QtGui.QCheckBox(self.ui_group_box)
self.enable_auto_close_check_box.setObjectName(u'enable_auto_close_check_box') self.enable_auto_close_check_box.setObjectName(u'enable_auto_close_check_box')
self.ui_layout.addRow(self.enable_auto_close_check_box) self.ui_layout.addRow(self.enable_auto_close_check_box)
self.leftLayout.addWidget(self.ui_group_box) self.left_layout.addWidget(self.ui_group_box)
# Default service name # Default service name
self.service_name_group_box = QtGui.QGroupBox(self.leftColumn) self.service_name_group_box = QtGui.QGroupBox(self.left_column)
self.service_name_group_box.setObjectName(u'service_name_group_box') self.service_name_group_box.setObjectName(u'service_name_group_box')
self.service_name_layout = QtGui.QFormLayout(self.service_name_group_box) self.service_name_layout = QtGui.QFormLayout(self.service_name_group_box)
self.service_name_check_box = QtGui.QCheckBox(self.service_name_group_box) self.service_name_check_box = QtGui.QCheckBox(self.service_name_group_box)
@ -129,9 +129,9 @@ class AdvancedTab(SettingsTab):
self.service_name_example = QtGui.QLabel(self.service_name_group_box) self.service_name_example = QtGui.QLabel(self.service_name_group_box)
self.service_name_example.setObjectName(u'service_name_example') self.service_name_example.setObjectName(u'service_name_example')
self.service_name_layout.addRow(self.service_name_example_label, self.service_name_example) self.service_name_layout.addRow(self.service_name_example_label, self.service_name_example)
self.leftLayout.addWidget(self.service_name_group_box) self.left_layout.addWidget(self.service_name_group_box)
# Data Directory # Data Directory
self.data_directory_group_box = QtGui.QGroupBox(self.leftColumn) self.data_directory_group_box = QtGui.QGroupBox(self.left_column)
self.data_directory_group_box.setObjectName(u'data_directory_group_box') self.data_directory_group_box.setObjectName(u'data_directory_group_box')
self.data_directory_layout = QtGui.QFormLayout(self.data_directory_group_box) self.data_directory_layout = QtGui.QFormLayout(self.data_directory_group_box)
self.data_directory_layout.setObjectName(u'data_directory_layout') self.data_directory_layout.setObjectName(u'data_directory_layout')
@ -172,10 +172,10 @@ class AdvancedTab(SettingsTab):
self.data_directory_layout.addRow(self.data_directory_new_label, self.new_data_directory_label_layout) self.data_directory_layout.addRow(self.data_directory_new_label, self.new_data_directory_label_layout)
self.data_directory_layout.addRow(self.data_directory_copy_check_layout) self.data_directory_layout.addRow(self.data_directory_copy_check_layout)
self.data_directory_layout.addRow(self.new_data_directory_has_files_label) self.data_directory_layout.addRow(self.new_data_directory_has_files_label)
self.leftLayout.addWidget(self.data_directory_group_box) self.left_layout.addWidget(self.data_directory_group_box)
self.leftLayout.addStretch() self.left_layout.addStretch()
# Default Image # Default Image
self.default_image_group_box = QtGui.QGroupBox(self.rightColumn) self.default_image_group_box = QtGui.QGroupBox(self.right_column)
self.default_image_group_box.setObjectName(u'default_image_group_box') self.default_image_group_box.setObjectName(u'default_image_group_box')
self.default_image_layout = QtGui.QFormLayout(self.default_image_group_box) self.default_image_layout = QtGui.QFormLayout(self.default_image_group_box)
self.default_image_layout.setObjectName(u'default_image_layout') self.default_image_layout.setObjectName(u'default_image_layout')
@ -200,18 +200,18 @@ class AdvancedTab(SettingsTab):
self.default_file_layout.addWidget(self.default_browse_button) self.default_file_layout.addWidget(self.default_browse_button)
self.default_file_layout.addWidget(self.default_revert_button) self.default_file_layout.addWidget(self.default_revert_button)
self.default_image_layout.addRow(self.default_file_label, self.default_file_layout) self.default_image_layout.addRow(self.default_file_label, self.default_file_layout)
self.rightLayout.addWidget(self.default_image_group_box) self.right_layout.addWidget(self.default_image_group_box)
# Hide mouse # Hide mouse
self.hide_mouse_group_box = QtGui.QGroupBox(self.rightColumn) self.hide_mouse_group_box = QtGui.QGroupBox(self.right_column)
self.hide_mouse_group_box.setObjectName(u'hide_mouse_group_box') self.hide_mouse_group_box.setObjectName(u'hide_mouse_group_box')
self.hide_mouse_layout = QtGui.QVBoxLayout(self.hide_mouse_group_box) self.hide_mouse_layout = QtGui.QVBoxLayout(self.hide_mouse_group_box)
self.hide_mouse_layout.setObjectName(u'hide_mouse_layout') self.hide_mouse_layout.setObjectName(u'hide_mouse_layout')
self.hide_mouse_check_box = QtGui.QCheckBox(self.hide_mouse_group_box) self.hide_mouse_check_box = QtGui.QCheckBox(self.hide_mouse_group_box)
self.hide_mouse_check_box.setObjectName(u'hide_mouse_check_box') self.hide_mouse_check_box.setObjectName(u'hide_mouse_check_box')
self.hide_mouse_layout.addWidget(self.hide_mouse_check_box) self.hide_mouse_layout.addWidget(self.hide_mouse_check_box)
self.rightLayout.addWidget(self.hide_mouse_group_box) self.right_layout.addWidget(self.hide_mouse_group_box)
# Service Item Slide Limits # Service Item Slide Limits
self.slide_group_box = QtGui.QGroupBox(self.rightColumn) self.slide_group_box = QtGui.QGroupBox(self.right_column)
self.slide_group_box.setObjectName(u'slide_group_box') self.slide_group_box.setObjectName(u'slide_group_box')
self.slide_layout = QtGui.QVBoxLayout(self.slide_group_box) self.slide_layout = QtGui.QVBoxLayout(self.slide_group_box)
self.slide_layout.setObjectName(u'slide_layout') self.slide_layout.setObjectName(u'slide_layout')
@ -227,9 +227,9 @@ class AdvancedTab(SettingsTab):
self.next_item_radio_button = QtGui.QRadioButton(self.slide_group_box) self.next_item_radio_button = QtGui.QRadioButton(self.slide_group_box)
self.next_item_radio_button.setObjectName(u'next_item_radio_button') self.next_item_radio_button.setObjectName(u'next_item_radio_button')
self.slide_layout.addWidget(self.next_item_radio_button) self.slide_layout.addWidget(self.next_item_radio_button)
self.rightLayout.addWidget(self.slide_group_box) self.right_layout.addWidget(self.slide_group_box)
# Display Workarounds # Display Workarounds
self.display_workaround_group_box = QtGui.QGroupBox(self.leftColumn) self.display_workaround_group_box = QtGui.QGroupBox(self.left_column)
self.display_workaround_group_box.setObjectName(u'display_workaround_group_box') self.display_workaround_group_box.setObjectName(u'display_workaround_group_box')
self.display_workaround_layout = QtGui.QVBoxLayout(self.display_workaround_group_box) self.display_workaround_layout = QtGui.QVBoxLayout(self.display_workaround_group_box)
self.display_workaround_layout.setObjectName(u'display_workaround_layout') self.display_workaround_layout.setObjectName(u'display_workaround_layout')
@ -239,8 +239,8 @@ class AdvancedTab(SettingsTab):
self.alternate_rows_check_box = QtGui.QCheckBox(self.display_workaround_group_box) self.alternate_rows_check_box = QtGui.QCheckBox(self.display_workaround_group_box)
self.alternate_rows_check_box.setObjectName(u'alternate_rows_check_box') self.alternate_rows_check_box.setObjectName(u'alternate_rows_check_box')
self.display_workaround_layout.addWidget(self.alternate_rows_check_box) self.display_workaround_layout.addWidget(self.alternate_rows_check_box)
self.rightLayout.addWidget(self.display_workaround_group_box) self.right_layout.addWidget(self.display_workaround_group_box)
self.rightLayout.addStretch() self.right_layout.addStretch()
self.should_update_service_name_example = False self.should_update_service_name_example = False
self.service_name_check_box.toggled.connect(self.service_name_check_box_toggled) self.service_name_check_box.toggled.connect(self.service_name_check_box_toggled)
self.service_name_day.currentIndexChanged.connect(self.on_service_name_day_changed) self.service_name_day.currentIndexChanged.connect(self.on_service_name_day_changed)
@ -259,7 +259,6 @@ class AdvancedTab(SettingsTab):
self.wrap_slide_radio_button.clicked.connect(self.on_wrap_slide_button_clicked) self.wrap_slide_radio_button.clicked.connect(self.on_wrap_slide_button_clicked)
self.next_item_radio_button.clicked.connect(self.on_next_item_button_clicked) self.next_item_radio_button.clicked.connect(self.on_next_item_button_clicked)
def retranslateUi(self): def retranslateUi(self):
""" """
Setup the interface translation strings. Setup the interface translation strings.
@ -334,7 +333,7 @@ class AdvancedTab(SettingsTab):
Load settings from disk. Load settings from disk.
""" """
settings = Settings() settings = Settings()
settings.beginGroup(self.settingsSection) settings.beginGroup(self.settings_section)
# The max recent files value does not have an interface and so never # The max recent files value does not have an interface and so never
# gets actually stored in the settings therefore the default value of # gets actually stored in the settings therefore the default value of
# 20 will always be used. # 20 will always be used.
@ -406,7 +405,7 @@ class AdvancedTab(SettingsTab):
Save settings to disk. Save settings to disk.
""" """
settings = Settings() settings = Settings()
settings.beginGroup(self.settingsSection) settings.beginGroup(self.settings_section)
settings.setValue(u'default service enabled', self.service_name_check_box.isChecked()) settings.setValue(u'default service enabled', self.service_name_check_box.isChecked())
service_name = self.service_name_edit.text() service_name = self.service_name_edit.text()
preset_is_valid = self.generate_service_name_example()[0] preset_is_valid = self.generate_service_name_example()[0]

View File

@ -86,6 +86,11 @@ try:
WEBKIT_VERSION = QtWebKit.qWebKitVersion() WEBKIT_VERSION = QtWebKit.qWebKitVersion()
except AttributeError: except AttributeError:
WEBKIT_VERSION = u'-' WEBKIT_VERSION = u'-'
try:
from openlp.core.ui.media.vlcplayer import VERSION
VLC_VERSION = VERSION
except ImportError:
VLC_VERSION = u'-'
from openlp.core.lib import UiStrings, Settings, translate from openlp.core.lib import UiStrings, Settings, translate
@ -138,12 +143,15 @@ class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog):
u'PyEnchant: %s\n' % ENCHANT_VERSION + \ u'PyEnchant: %s\n' % ENCHANT_VERSION + \
u'PySQLite: %s\n' % SQLITE_VERSION + \ u'PySQLite: %s\n' % SQLITE_VERSION + \
u'Mako: %s\n' % MAKO_VERSION + \ u'Mako: %s\n' % MAKO_VERSION + \
u'pyUNO bridge: %s\n' % UNO_VERSION u'pyUNO bridge: %s\n' % UNO_VERSION + \
u'VLC: %s\n' % VLC_VERSION
if platform.system() == u'Linux': if platform.system() == u'Linux':
if os.environ.get(u'KDE_FULL_SESSION') == u'true': if os.environ.get(u'KDE_FULL_SESSION') == u'true':
system += u'Desktop: KDE SC\n' system += u'Desktop: KDE SC\n'
elif os.environ.get(u'GNOME_DESKTOP_SESSION_ID'): elif os.environ.get(u'GNOME_DESKTOP_SESSION_ID'):
system += u'Desktop: GNOME\n' system += u'Desktop: GNOME\n'
elif os.environ.get(u'DESKTOP_SESSION') == u'xfce':
system += u'Desktop: Xfce\n'
return (openlp_version, description, traceback, system, libraries) return (openlp_version, description, traceback, system, libraries)
def on_save_report_button_clicked(self): def on_save_report_button_clicked(self):
@ -182,8 +190,7 @@ class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog):
def on_send_report_button_clicked(self): def on_send_report_button_clicked(self):
""" """
Opening systems default email client and inserting exception log and Opening systems default email client and inserting exception log and system information.
system informations.
""" """
body = translate('OpenLP.ExceptionForm', body = translate('OpenLP.ExceptionForm',
'*OpenLP Bug Report*\n' '*OpenLP Bug Report*\n'

View File

@ -47,9 +47,9 @@ class GeneralTab(SettingsTab):
Initialise the general settings tab Initialise the general settings tab
""" """
self.screens = ScreenList() self.screens = ScreenList()
self.iconPath = u':/icon/openlp-logo-16x16.png' self.icon_path = u':/icon/openlp-logo-16x16.png'
generalTranslated = translate('OpenLP.GeneralTab', 'General') general_translated = translate('OpenLP.GeneralTab', 'General')
SettingsTab.__init__(self, parent, u'General', generalTranslated) SettingsTab.__init__(self, parent, u'General', general_translated)
def setupUi(self): def setupUi(self):
""" """
@ -57,274 +57,272 @@ class GeneralTab(SettingsTab):
""" """
self.setObjectName(u'GeneralTab') self.setObjectName(u'GeneralTab')
SettingsTab.setupUi(self) SettingsTab.setupUi(self)
self.tabLayout.setStretch(1, 1) self.tab_layout.setStretch(1, 1)
# Monitors # Monitors
self.monitorGroupBox = QtGui.QGroupBox(self.leftColumn) self.monitor_group_box = QtGui.QGroupBox(self.left_column)
self.monitorGroupBox.setObjectName(u'monitorGroupBox') self.monitor_group_box.setObjectName(u'monitor_group_box')
self.monitorLayout = QtGui.QGridLayout(self.monitorGroupBox) self.monitor_layout = QtGui.QGridLayout(self.monitor_group_box)
self.monitorLayout.setObjectName(u'monitorLayout') self.monitor_layout.setObjectName(u'monitor_layout')
self.monitorRadioButton = QtGui.QRadioButton(self.monitorGroupBox) self.monitor_radio_button = QtGui.QRadioButton(self.monitor_group_box)
self.monitorRadioButton.setObjectName(u'monitorRadioButton') self.monitor_radio_button.setObjectName(u'monitor_radio_button')
self.monitorLayout.addWidget(self.monitorRadioButton, 0, 0, 1, 5) self.monitor_layout.addWidget(self.monitor_radio_button, 0, 0, 1, 5)
self.monitorComboBox = QtGui.QComboBox(self.monitorGroupBox) self.monitor_combo_box = QtGui.QComboBox(self.monitor_group_box)
self.monitorComboBox.setObjectName(u'monitorComboBox') self.monitor_combo_box.setObjectName(u'monitor_combo_box')
self.monitorLayout.addWidget(self.monitorComboBox, 1, 1, 1, 4) self.monitor_layout.addWidget(self.monitor_combo_box, 1, 1, 1, 4)
# Display Position # Display Position
self.overrideRadioButton = QtGui.QRadioButton(self.monitorGroupBox) self.override_radio_button = QtGui.QRadioButton(self.monitor_group_box)
self.overrideRadioButton.setObjectName(u'overrideRadioButton') self.override_radio_button.setObjectName(u'override_radio_button')
self.monitorLayout.addWidget(self.overrideRadioButton, 2, 0, 1, 5) self.monitor_layout.addWidget(self.override_radio_button, 2, 0, 1, 5)
# Custom position # Custom position
self.customXLabel = QtGui.QLabel(self.monitorGroupBox) self.custom_x_label = QtGui.QLabel(self.monitor_group_box)
self.customXLabel.setObjectName(u'customXLabel') self.custom_x_label.setObjectName(u'custom_x_label')
self.monitorLayout.addWidget(self.customXLabel, 3, 1) self.monitor_layout.addWidget(self.custom_x_label, 3, 1)
self.customXValueEdit = QtGui.QSpinBox(self.monitorGroupBox) self.custom_X_value_edit = QtGui.QSpinBox(self.monitor_group_box)
self.customXValueEdit.setObjectName(u'customXValueEdit') self.custom_X_value_edit.setObjectName(u'custom_X_value_edit')
self.customXValueEdit.setRange(-9999, 9999) self.custom_X_value_edit.setRange(-9999, 9999)
self.monitorLayout.addWidget(self.customXValueEdit, 4, 1) self.monitor_layout.addWidget(self.custom_X_value_edit, 4, 1)
self.customYLabel = QtGui.QLabel(self.monitorGroupBox) self.custom_y_label = QtGui.QLabel(self.monitor_group_box)
self.customYLabel.setObjectName(u'customYLabel') self.custom_y_label.setObjectName(u'custom_y_label')
self.monitorLayout.addWidget(self.customYLabel, 3, 2) self.monitor_layout.addWidget(self.custom_y_label, 3, 2)
self.customYValueEdit = QtGui.QSpinBox(self.monitorGroupBox) self.custom_Y_value_edit = QtGui.QSpinBox(self.monitor_group_box)
self.customYValueEdit.setObjectName(u'customYValueEdit') self.custom_Y_value_edit.setObjectName(u'custom_Y_value_edit')
self.customYValueEdit.setRange(-9999, 9999) self.custom_Y_value_edit.setRange(-9999, 9999)
self.monitorLayout.addWidget(self.customYValueEdit, 4, 2) self.monitor_layout.addWidget(self.custom_Y_value_edit, 4, 2)
self.customWidthLabel = QtGui.QLabel(self.monitorGroupBox) self.custom_width_label = QtGui.QLabel(self.monitor_group_box)
self.customWidthLabel.setObjectName(u'customWidthLabel') self.custom_width_label.setObjectName(u'custom_width_label')
self.monitorLayout.addWidget(self.customWidthLabel, 3, 3) self.monitor_layout.addWidget(self.custom_width_label, 3, 3)
self.customWidthValueEdit = QtGui.QSpinBox(self.monitorGroupBox) self.custom_width_value_edit = QtGui.QSpinBox(self.monitor_group_box)
self.customWidthValueEdit.setObjectName(u'customWidthValueEdit') self.custom_width_value_edit.setObjectName(u'custom_width_value_edit')
self.customWidthValueEdit.setMaximum(9999) self.custom_width_value_edit.setMaximum(9999)
self.monitorLayout.addWidget(self.customWidthValueEdit, 4, 3) self.monitor_layout.addWidget(self.custom_width_value_edit, 4, 3)
self.customHeightLabel = QtGui.QLabel(self.monitorGroupBox) self.custom_height_label = QtGui.QLabel(self.monitor_group_box)
self.customHeightLabel.setObjectName(u'customHeightLabel') self.custom_height_label.setObjectName(u'custom_height_label')
self.monitorLayout.addWidget(self.customHeightLabel, 3, 4) self.monitor_layout.addWidget(self.custom_height_label, 3, 4)
self.customHeightValueEdit = QtGui.QSpinBox(self.monitorGroupBox) self.custom_height_value_edit = QtGui.QSpinBox(self.monitor_group_box)
self.customHeightValueEdit.setObjectName(u'customHeightValueEdit') self.custom_height_value_edit.setObjectName(u'custom_height_value_edit')
self.customHeightValueEdit.setMaximum(9999) self.custom_height_value_edit.setMaximum(9999)
self.monitorLayout.addWidget(self.customHeightValueEdit, 4, 4) self.monitor_layout.addWidget(self.custom_height_value_edit, 4, 4)
self.displayOnMonitorCheck = QtGui.QCheckBox(self.monitorGroupBox) self.display_on_monitor_check = QtGui.QCheckBox(self.monitor_group_box)
self.displayOnMonitorCheck.setObjectName(u'monitorComboBox') self.display_on_monitor_check.setObjectName(u'monitor_combo_box')
self.monitorLayout.addWidget(self.displayOnMonitorCheck, 5, 0, 1, 5) self.monitor_layout.addWidget(self.display_on_monitor_check, 5, 0, 1, 5)
# Set up the stretchiness of each column, so that the first column # Set up the stretchiness of each column, so that the first column
# less stretchy (and therefore smaller) than the others # less stretchy (and therefore smaller) than the others
self.monitorLayout.setColumnStretch(0, 1) self.monitor_layout.setColumnStretch(0, 1)
self.monitorLayout.setColumnStretch(1, 3) self.monitor_layout.setColumnStretch(1, 3)
self.monitorLayout.setColumnStretch(2, 3) self.monitor_layout.setColumnStretch(2, 3)
self.monitorLayout.setColumnStretch(3, 3) self.monitor_layout.setColumnStretch(3, 3)
self.monitorLayout.setColumnStretch(4, 3) self.monitor_layout.setColumnStretch(4, 3)
self.leftLayout.addWidget(self.monitorGroupBox) self.left_layout.addWidget(self.monitor_group_box)
# CCLI Details # CCLI Details
self.ccliGroupBox = QtGui.QGroupBox(self.leftColumn) self.ccli_group_box = QtGui.QGroupBox(self.left_column)
self.ccliGroupBox.setObjectName(u'ccliGroupBox') self.ccli_group_box.setObjectName(u'ccli_group_box')
self.ccliLayout = QtGui.QFormLayout(self.ccliGroupBox) self.ccli_layout = QtGui.QFormLayout(self.ccli_group_box)
self.ccliLayout.setObjectName(u'ccliLayout') self.ccli_layout.setObjectName(u'ccli_layout')
self.numberLabel = QtGui.QLabel(self.ccliGroupBox) self.number_label = QtGui.QLabel(self.ccli_group_box)
self.numberLabel.setObjectName(u'numberLabel') self.number_label.setObjectName(u'number_label')
self.numberEdit = QtGui.QLineEdit(self.ccliGroupBox) self.number_edit = QtGui.QLineEdit(self.ccli_group_box)
self.numberEdit.setValidator(QtGui.QIntValidator()) self.number_edit.setValidator(QtGui.QIntValidator())
self.numberEdit.setObjectName(u'numberEdit') self.number_edit.setObjectName(u'number_edit')
self.ccliLayout.addRow(self.numberLabel, self.numberEdit) self.ccli_layout.addRow(self.number_label, self.number_edit)
self.usernameLabel = QtGui.QLabel(self.ccliGroupBox) self.username_label = QtGui.QLabel(self.ccli_group_box)
self.usernameLabel.setObjectName(u'usernameLabel') self.username_label.setObjectName(u'username_label')
self.usernameEdit = QtGui.QLineEdit(self.ccliGroupBox) self.username_edit = QtGui.QLineEdit(self.ccli_group_box)
self.usernameEdit.setObjectName(u'usernameEdit') self.username_edit.setObjectName(u'username_edit')
self.ccliLayout.addRow(self.usernameLabel, self.usernameEdit) self.ccli_layout.addRow(self.username_label, self.username_edit)
self.passwordLabel = QtGui.QLabel(self.ccliGroupBox) self.password_label = QtGui.QLabel(self.ccli_group_box)
self.passwordLabel.setObjectName(u'passwordLabel') self.password_label.setObjectName(u'password_label')
self.passwordEdit = QtGui.QLineEdit(self.ccliGroupBox) self.password_edit = QtGui.QLineEdit(self.ccli_group_box)
self.passwordEdit.setEchoMode(QtGui.QLineEdit.Password) self.password_edit.setEchoMode(QtGui.QLineEdit.Password)
self.passwordEdit.setObjectName(u'passwordEdit') self.password_edit.setObjectName(u'password_edit')
self.ccliLayout.addRow(self.passwordLabel, self.passwordEdit) self.ccli_layout.addRow(self.password_label, self.password_edit)
self.leftLayout.addWidget(self.ccliGroupBox) self.left_layout.addWidget(self.ccli_group_box)
# Background audio # Background audio
self.audioGroupBox = QtGui.QGroupBox(self.leftColumn) self.audio_group_box = QtGui.QGroupBox(self.left_column)
self.audioGroupBox.setObjectName(u'audioGroupBox') self.audio_group_box.setObjectName(u'audio_group_box')
self.audioLayout = QtGui.QVBoxLayout(self.audioGroupBox) self.audio_layout = QtGui.QVBoxLayout(self.audio_group_box)
self.audioLayout.setObjectName(u'audioLayout') self.audio_layout.setObjectName(u'audio_layout')
self.startPausedCheckBox = QtGui.QCheckBox(self.audioGroupBox) self.start_paused_check_box = QtGui.QCheckBox(self.audio_group_box)
self.startPausedCheckBox.setObjectName(u'startPausedCheckBox') self.start_paused_check_box.setObjectName(u'start_paused_check_box')
self.audioLayout.addWidget(self.startPausedCheckBox) self.audio_layout.addWidget(self.start_paused_check_box)
self.repeatListCheckBox = QtGui.QCheckBox(self.audioGroupBox) self.repeat_list_check_box = QtGui.QCheckBox(self.audio_group_box)
self.repeatListCheckBox.setObjectName(u'repeatListCheckBox') self.repeat_list_check_box.setObjectName(u'repeat_list_check_box')
self.audioLayout.addWidget(self.repeatListCheckBox) self.audio_layout.addWidget(self.repeat_list_check_box)
self.leftLayout.addWidget(self.audioGroupBox) self.left_layout.addWidget(self.audio_group_box)
self.leftLayout.addStretch() self.left_layout.addStretch()
# Application Startup # Application Startup
self.startupGroupBox = QtGui.QGroupBox(self.rightColumn) self.startup_group_box = QtGui.QGroupBox(self.right_column)
self.startupGroupBox.setObjectName(u'startupGroupBox') self.startup_group_box.setObjectName(u'startup_group_box')
self.startupLayout = QtGui.QVBoxLayout(self.startupGroupBox) self.startup_layout = QtGui.QVBoxLayout(self.startup_group_box)
self.startupLayout.setObjectName(u'startupLayout') self.startup_layout.setObjectName(u'startup_layout')
self.warningCheckBox = QtGui.QCheckBox(self.startupGroupBox) self.warning_check_box = QtGui.QCheckBox(self.startup_group_box)
self.warningCheckBox.setObjectName(u'warningCheckBox') self.warning_check_box.setObjectName(u'warning_check_box')
self.startupLayout.addWidget(self.warningCheckBox) self.startup_layout.addWidget(self.warning_check_box)
self.autoOpenCheckBox = QtGui.QCheckBox(self.startupGroupBox) self.auto_open_check_box = QtGui.QCheckBox(self.startup_group_box)
self.autoOpenCheckBox.setObjectName(u'autoOpenCheckBox') self.auto_open_check_box.setObjectName(u'auto_open_check_box')
self.startupLayout.addWidget(self.autoOpenCheckBox) self.startup_layout.addWidget(self.auto_open_check_box)
self.showSplashCheckBox = QtGui.QCheckBox(self.startupGroupBox) self.show_splash_check_box = QtGui.QCheckBox(self.startup_group_box)
self.showSplashCheckBox.setObjectName(u'showSplashCheckBox') self.show_splash_check_box.setObjectName(u'show_splash_check_box')
self.startupLayout.addWidget(self.showSplashCheckBox) self.startup_layout.addWidget(self.show_splash_check_box)
self.checkForUpdatesCheckBox = QtGui.QCheckBox(self.startupGroupBox) self.check_for_updates_check_box = QtGui.QCheckBox(self.startup_group_box)
self.checkForUpdatesCheckBox.setObjectName(u'checkForUpdatesCheckBox') self.check_for_updates_check_box.setObjectName(u'check_for_updates_check_box')
self.startupLayout.addWidget(self.checkForUpdatesCheckBox) self.startup_layout.addWidget(self.check_for_updates_check_box)
self.rightLayout.addWidget(self.startupGroupBox) self.right_layout.addWidget(self.startup_group_box)
# Application Settings # Application Settings
self.settingsGroupBox = QtGui.QGroupBox(self.rightColumn) self.settings_group_box = QtGui.QGroupBox(self.right_column)
self.settingsGroupBox.setObjectName(u'settingsGroupBox') self.settings_group_box.setObjectName(u'settings_group_box')
self.settingsLayout = QtGui.QFormLayout(self.settingsGroupBox) self.settings_layout = QtGui.QFormLayout(self.settings_group_box)
self.settingsLayout.setObjectName(u'settingsLayout') self.settings_layout.setObjectName(u'settings_layout')
self.saveCheckServiceCheckBox = QtGui.QCheckBox(self.settingsGroupBox) self.save_check_service_check_box = QtGui.QCheckBox(self.settings_group_box)
self.saveCheckServiceCheckBox.setObjectName(u'saveCheckServiceCheckBox') self.save_check_service_check_box.setObjectName(u'save_check_service_check_box')
self.settingsLayout.addRow(self.saveCheckServiceCheckBox) self.settings_layout.addRow(self.save_check_service_check_box)
self.autoUnblankCheckBox = QtGui.QCheckBox(self.settingsGroupBox) self.auto_unblank_check_box = QtGui.QCheckBox(self.settings_group_box)
self.autoUnblankCheckBox.setObjectName(u'autoUnblankCheckBox') self.auto_unblank_check_box.setObjectName(u'auto_unblank_check_box')
self.settingsLayout.addRow(self.autoUnblankCheckBox) self.settings_layout.addRow(self.auto_unblank_check_box)
self.autoPreviewCheckBox = QtGui.QCheckBox(self.settingsGroupBox) self.auto_preview_check_box = QtGui.QCheckBox(self.settings_group_box)
self.autoPreviewCheckBox.setObjectName(u'autoPreviewCheckBox') self.auto_preview_check_box.setObjectName(u'auto_preview_check_box')
self.settingsLayout.addRow(self.autoPreviewCheckBox) self.settings_layout.addRow(self.auto_preview_check_box)
# Moved here from image tab # Moved here from image tab
self.timeoutLabel = QtGui.QLabel(self.settingsGroupBox) self.timeout_label = QtGui.QLabel(self.settings_group_box)
self.timeoutLabel.setObjectName(u'timeoutLabel') self.timeout_label.setObjectName(u'timeout_label')
self.timeoutSpinBox = QtGui.QSpinBox(self.settingsGroupBox) self.timeout_spin_box = QtGui.QSpinBox(self.settings_group_box)
self.timeoutSpinBox.setObjectName(u'timeoutSpinBox') self.timeout_spin_box.setObjectName(u'timeout_spin_box')
self.timeoutSpinBox.setRange(1, 180) self.timeout_spin_box.setRange(1, 180)
self.settingsLayout.addRow(self.timeoutLabel, self.timeoutSpinBox) self.settings_layout.addRow(self.timeout_label, self.timeout_spin_box)
self.rightLayout.addWidget(self.settingsGroupBox) self.right_layout.addWidget(self.settings_group_box)
self.rightLayout.addStretch() self.right_layout.addStretch()
# Signals and slots # Signals and slots
self.overrideRadioButton.toggled.connect(self.onOverrideRadioButtonPressed) self.override_radio_button.toggled.connect(self.on_override_radio_button_pressed)
self.customHeightValueEdit.valueChanged.connect(self.onDisplayChanged) self.custom_height_value_edit.valueChanged.connect(self.on_display_changed)
self.customWidthValueEdit.valueChanged.connect(self.onDisplayChanged) self.custom_width_value_edit.valueChanged.connect(self.on_display_changed)
self.customYValueEdit.valueChanged.connect(self.onDisplayChanged) self.custom_Y_value_edit.valueChanged.connect(self.on_display_changed)
self.customXValueEdit.valueChanged.connect(self.onDisplayChanged) self.custom_X_value_edit.valueChanged.connect(self.on_display_changed)
self.monitorComboBox.currentIndexChanged.connect(self.onDisplayChanged) self.monitor_combo_box.currentIndexChanged.connect(self.on_display_changed)
# Reload the tab, as the screen resolution/count may have changed. # Reload the tab, as the screen resolution/count may have changed.
Registry().register_function(u'config_screen_changed', self.load) Registry().register_function(u'config_screen_changed', self.load)
# Remove for now # Remove for now
self.usernameLabel.setVisible(False) self.username_label.setVisible(False)
self.usernameEdit.setVisible(False) self.username_edit.setVisible(False)
self.passwordLabel.setVisible(False) self.password_label.setVisible(False)
self.passwordEdit.setVisible(False) self.password_edit.setVisible(False)
def retranslateUi(self): def retranslateUi(self):
""" """
Translate the general settings tab to the currently selected language Translate the general settings tab to the currently selected language
""" """
self.tabTitleVisible = translate('OpenLP.GeneralTab', 'General') self.tab_title_visible = translate('OpenLP.GeneralTab', 'General')
self.monitorGroupBox.setTitle(translate('OpenLP.GeneralTab', 'Monitors')) self.monitor_group_box.setTitle(translate('OpenLP.GeneralTab', 'Monitors'))
self.monitorRadioButton.setText(translate('OpenLP.GeneralTab', 'Select monitor for output display:')) self.monitor_radio_button.setText(translate('OpenLP.GeneralTab', 'Select monitor for output display:'))
self.displayOnMonitorCheck.setText(translate('OpenLP.GeneralTab', 'Display if a single screen')) self.display_on_monitor_check.setText(translate('OpenLP.GeneralTab', 'Display if a single screen'))
self.startupGroupBox.setTitle(translate('OpenLP.GeneralTab', 'Application Startup')) self.startup_group_box.setTitle(translate('OpenLP.GeneralTab', 'Application Startup'))
self.warningCheckBox.setText(translate('OpenLP.GeneralTab', 'Show blank screen warning')) self.warning_check_box.setText(translate('OpenLP.GeneralTab', 'Show blank screen warning'))
self.autoOpenCheckBox.setText(translate('OpenLP.GeneralTab', 'Automatically open the last service')) self.auto_open_check_box.setText(translate('OpenLP.GeneralTab', 'Automatically open the last service'))
self.showSplashCheckBox.setText(translate('OpenLP.GeneralTab', 'Show the splash screen')) self.show_splash_check_box.setText(translate('OpenLP.GeneralTab', 'Show the splash screen'))
self.checkForUpdatesCheckBox.setText(translate('OpenLP.GeneralTab', 'Check for updates to OpenLP')) self.check_for_updates_check_box.setText(translate('OpenLP.GeneralTab', 'Check for updates to OpenLP'))
self.settingsGroupBox.setTitle(translate('OpenLP.GeneralTab', 'Application Settings')) self.settings_group_box.setTitle(translate('OpenLP.GeneralTab', 'Application Settings'))
self.saveCheckServiceCheckBox.setText(translate('OpenLP.GeneralTab', self.save_check_service_check_box.setText(translate('OpenLP.GeneralTab',
'Prompt to save before starting a new service')) 'Prompt to save before starting a new service'))
self.autoUnblankCheckBox.setText(translate('OpenLP.GeneralTab', 'Unblank display when adding new live item')) self.auto_unblank_check_box.setText(translate('OpenLP.GeneralTab', 'Unblank display when adding new live item'))
self.autoPreviewCheckBox.setText(translate('OpenLP.GeneralTab', 'Automatically preview next item in service')) self.auto_preview_check_box.setText(translate('OpenLP.GeneralTab', 'Automatically preview next item in service'))
self.timeoutLabel.setText(translate('OpenLP.GeneralTab', 'Timed slide interval:')) self.timeout_label.setText(translate('OpenLP.GeneralTab', 'Timed slide interval:'))
self.timeoutSpinBox.setSuffix(translate('OpenLP.GeneralTab', ' sec')) self.timeout_spin_box.setSuffix(translate('OpenLP.GeneralTab', ' sec'))
self.ccliGroupBox.setTitle(translate('OpenLP.GeneralTab', 'CCLI Details')) self.ccli_group_box.setTitle(translate('OpenLP.GeneralTab', 'CCLI Details'))
self.numberLabel.setText(UiStrings().CCLINumberLabel) self.number_label.setText(UiStrings().CCLINumberLabel)
self.usernameLabel.setText(translate('OpenLP.GeneralTab', 'SongSelect username:')) self.username_label.setText(translate('OpenLP.GeneralTab', 'SongSelect username:'))
self.passwordLabel.setText(translate('OpenLP.GeneralTab', 'SongSelect password:')) self.password_label.setText(translate('OpenLP.GeneralTab', 'SongSelect password:'))
# Moved from display tab # Moved from display tab
self.overrideRadioButton.setText(translate('OpenLP.GeneralTab', 'Override display position:')) self.override_radio_button.setText(translate('OpenLP.GeneralTab', 'Override display position:'))
self.customXLabel.setText(translate('OpenLP.GeneralTab', 'X')) self.custom_x_label.setText(translate('OpenLP.GeneralTab', 'X'))
self.customYLabel.setText(translate('OpenLP.GeneralTab', 'Y')) self.custom_y_label.setText(translate('OpenLP.GeneralTab', 'Y'))
self.customHeightLabel.setText(translate('OpenLP.GeneralTab', 'Height')) self.custom_height_label.setText(translate('OpenLP.GeneralTab', 'Height'))
self.customWidthLabel.setText(translate('OpenLP.GeneralTab', 'Width')) self.custom_width_label.setText(translate('OpenLP.GeneralTab', 'Width'))
self.audioGroupBox.setTitle(translate('OpenLP.GeneralTab', 'Background Audio')) self.audio_group_box.setTitle(translate('OpenLP.GeneralTab', 'Background Audio'))
self.startPausedCheckBox.setText(translate('OpenLP.GeneralTab', 'Start background audio paused')) self.start_paused_check_box.setText(translate('OpenLP.GeneralTab', 'Start background audio paused'))
self.repeatListCheckBox.setText(translate('OpenLP.GeneralTab', 'Repeat track list')) self.repeat_list_check_box.setText(translate('OpenLP.GeneralTab', 'Repeat track list'))
def load(self): def load(self):
""" """
Load the settings to populate the form Load the settings to populate the form
""" """
settings = Settings() settings = Settings()
settings.beginGroup(self.settingsSection) settings.beginGroup(self.settings_section)
self.monitorComboBox.clear() self.monitor_combo_box.clear()
self.monitorComboBox.addItems(self.screens.get_screen_list()) self.monitor_combo_box.addItems(self.screens.get_screen_list())
monitorNumber = settings.value(u'monitor') monitorNumber = settings.value(u'monitor')
self.monitorComboBox.setCurrentIndex(monitorNumber) self.monitor_combo_box.setCurrentIndex(monitorNumber)
self.numberEdit.setText(settings.value(u'ccli number')) self.number_edit.setText(settings.value(u'ccli number'))
self.usernameEdit.setText(settings.value(u'songselect username')) self.username_edit.setText(settings.value(u'songselect username'))
self.passwordEdit.setText(settings.value(u'songselect password')) self.password_edit.setText(settings.value(u'songselect password'))
self.saveCheckServiceCheckBox.setChecked(settings.value(u'save prompt')) self.save_check_service_check_box.setChecked(settings.value(u'save prompt'))
self.autoUnblankCheckBox.setChecked(settings.value(u'auto unblank')) self.auto_unblank_check_box.setChecked(settings.value(u'auto unblank'))
self.displayOnMonitorCheck.setChecked(self.screens.display) self.display_on_monitor_check.setChecked(self.screens.display)
self.warningCheckBox.setChecked(settings.value(u'blank warning')) self.warning_check_box.setChecked(settings.value(u'blank warning'))
self.autoOpenCheckBox.setChecked(settings.value(u'auto open')) self.auto_open_check_box.setChecked(settings.value(u'auto open'))
self.showSplashCheckBox.setChecked(settings.value(u'show splash')) self.show_splash_check_box.setChecked(settings.value(u'show splash'))
self.checkForUpdatesCheckBox.setChecked(settings.value(u'update check')) self.check_for_updates_check_box.setChecked(settings.value(u'update check'))
self.autoPreviewCheckBox.setChecked(settings.value(u'auto preview')) self.auto_preview_check_box.setChecked(settings.value(u'auto preview'))
self.timeoutSpinBox.setValue(settings.value(u'loop delay')) self.timeout_spin_box.setValue(settings.value(u'loop delay'))
self.monitorRadioButton.setChecked(not settings.value(u'override position',)) self.monitor_radio_button.setChecked(not settings.value(u'override position',))
self.overrideRadioButton.setChecked(settings.value(u'override position')) self.override_radio_button.setChecked(settings.value(u'override position'))
self.customXValueEdit.setValue(settings.value(u'x position')) self.custom_X_value_edit.setValue(settings.value(u'x position'))
self.customYValueEdit.setValue(settings.value(u'y position')) self.custom_Y_value_edit.setValue(settings.value(u'y position'))
self.customHeightValueEdit.setValue(settings.value(u'height')) self.custom_height_value_edit.setValue(settings.value(u'height'))
self.customWidthValueEdit.setValue(settings.value(u'width')) self.custom_width_value_edit.setValue(settings.value(u'width'))
self.startPausedCheckBox.setChecked(settings.value(u'audio start paused')) self.start_paused_check_box.setChecked(settings.value(u'audio start paused'))
self.repeatListCheckBox.setChecked(settings.value(u'audio repeat list')) self.repeat_list_check_box.setChecked(settings.value(u'audio repeat list'))
settings.endGroup() settings.endGroup()
self.monitorComboBox.setDisabled(self.overrideRadioButton.isChecked()) self.monitor_combo_box.setDisabled(self.override_radio_button.isChecked())
self.customXValueEdit.setEnabled(self.overrideRadioButton.isChecked()) self.custom_X_value_edit.setEnabled(self.override_radio_button.isChecked())
self.customYValueEdit.setEnabled(self.overrideRadioButton.isChecked()) self.custom_Y_value_edit.setEnabled(self.override_radio_button.isChecked())
self.customHeightValueEdit.setEnabled(self.overrideRadioButton.isChecked()) self.custom_height_value_edit.setEnabled(self.override_radio_button.isChecked())
self.customWidthValueEdit.setEnabled(self.overrideRadioButton.isChecked()) self.custom_width_value_edit.setEnabled(self.override_radio_button.isChecked())
self.display_changed = False self.display_changed = False
settings.beginGroup(self.settingsSection)
def save(self): def save(self):
""" """
Save the settings from the form Save the settings from the form
""" """
settings = Settings() settings = Settings()
settings.beginGroup(self.settingsSection) settings.beginGroup(self.settings_section)
settings.setValue(u'monitor', self.monitorComboBox.currentIndex()) settings.setValue(u'monitor', self.monitor_combo_box.currentIndex())
settings.setValue(u'display on monitor', self.displayOnMonitorCheck.isChecked()) settings.setValue(u'display on monitor', self.display_on_monitor_check.isChecked())
settings.setValue(u'blank warning', self.warningCheckBox.isChecked()) settings.setValue(u'blank warning', self.warning_check_box.isChecked())
settings.setValue(u'auto open', self.autoOpenCheckBox.isChecked()) settings.setValue(u'auto open', self.auto_open_check_box.isChecked())
settings.setValue(u'show splash', self.showSplashCheckBox.isChecked()) settings.setValue(u'show splash', self.show_splash_check_box.isChecked())
settings.setValue(u'update check', self.checkForUpdatesCheckBox.isChecked()) settings.setValue(u'update check', self.check_for_updates_check_box.isChecked())
settings.setValue(u'save prompt', self.saveCheckServiceCheckBox.isChecked()) settings.setValue(u'save prompt', self.save_check_service_check_box.isChecked())
settings.setValue(u'auto unblank', self.autoUnblankCheckBox.isChecked()) settings.setValue(u'auto unblank', self.auto_unblank_check_box.isChecked())
settings.setValue(u'auto preview', self.autoPreviewCheckBox.isChecked()) settings.setValue(u'auto preview', self.auto_preview_check_box.isChecked())
settings.setValue(u'loop delay', self.timeoutSpinBox.value()) settings.setValue(u'loop delay', self.timeout_spin_box.value())
settings.setValue(u'ccli number', self.numberEdit.displayText()) settings.setValue(u'ccli number', self.number_edit.displayText())
settings.setValue(u'songselect username', self.usernameEdit.displayText()) settings.setValue(u'songselect username', self.username_edit.displayText())
settings.setValue(u'songselect password', self.passwordEdit.displayText()) settings.setValue(u'songselect password', self.password_edit.displayText())
settings.setValue(u'x position', self.customXValueEdit.value()) settings.setValue(u'x position', self.custom_X_value_edit.value())
settings.setValue(u'y position', self.customYValueEdit.value()) settings.setValue(u'y position', self.custom_Y_value_edit.value())
settings.setValue(u'height', self.customHeightValueEdit.value()) settings.setValue(u'height', self.custom_height_value_edit.value())
settings.setValue(u'width', self.customWidthValueEdit.value()) settings.setValue(u'width', self.custom_width_value_edit.value())
settings.setValue(u'override position', self.overrideRadioButton.isChecked()) settings.setValue(u'override position', self.override_radio_button.isChecked())
settings.setValue(u'audio start paused', self.startPausedCheckBox.isChecked()) settings.setValue(u'audio start paused', self.start_paused_check_box.isChecked())
settings.setValue(u'audio repeat list', self.repeatListCheckBox.isChecked()) settings.setValue(u'audio repeat list', self.repeat_list_check_box.isChecked())
settings.endGroup() settings.endGroup()
# On save update the screens as well # On save update the screens as well
self.post_set_up(True) self.post_set_up(True)
def post_set_up(self, postUpdate=False): def post_set_up(self, postUpdate=False):
""" """
Apply settings after settings tab has loaded and most of the Apply settings after settings tab has loaded and most of the system so must be delayed
system so must be delayed
""" """
self.settings_form.register_post_process(u'slidecontroller_live_spin_delay') self.settings_form.register_post_process(u'slidecontroller_live_spin_delay')
# Do not continue on start up. # Do not continue on start up.
if not postUpdate: if not postUpdate:
return return
self.screens.set_current_display(self.monitorComboBox.currentIndex()) self.screens.set_current_display(self.monitor_combo_box.currentIndex())
self.screens.display = self.displayOnMonitorCheck.isChecked() self.screens.display = self.display_on_monitor_check.isChecked()
self.screens.override[u'size'] = QtCore.QRect( self.screens.override[u'size'] = QtCore.QRect(
self.customXValueEdit.value(), self.custom_X_value_edit.value(),
self.customYValueEdit.value(), self.custom_Y_value_edit.value(),
self.customWidthValueEdit.value(), self.custom_width_value_edit.value(),
self.customHeightValueEdit.value()) self.custom_height_value_edit.value())
if self.overrideRadioButton.isChecked(): if self.override_radio_button.isChecked():
self.screens.set_override_display() self.screens.set_override_display()
else: else:
self.screens.reset_current_display() self.screens.reset_current_display()
@ -332,21 +330,21 @@ class GeneralTab(SettingsTab):
self.settings_form.register_post_process(u'config_screen_changed') self.settings_form.register_post_process(u'config_screen_changed')
self.display_changed = False self.display_changed = False
def onOverrideRadioButtonPressed(self, checked): def on_override_radio_button_pressed(self, checked):
""" """
Toggle screen state depending on check box state. Toggle screen state depending on check box state.
``checked`` ``checked``
The state of the check box (boolean). The state of the check box (boolean).
""" """
self.monitorComboBox.setDisabled(checked) self.monitor_combo_box.setDisabled(checked)
self.customXValueEdit.setEnabled(checked) self.custom_X_value_edit.setEnabled(checked)
self.customYValueEdit.setEnabled(checked) self.custom_Y_value_edit.setEnabled(checked)
self.customHeightValueEdit.setEnabled(checked) self.custom_height_value_edit.setEnabled(checked)
self.customWidthValueEdit.setEnabled(checked) self.custom_width_value_edit.setEnabled(checked)
self.display_changed = True self.display_changed = True
def onDisplayChanged(self): def on_display_changed(self):
""" """
Called when the width, height, x position or y position has changed. Called when the width, height, x position or y position has changed.
""" """

File diff suppressed because it is too large Load Diff

View File

@ -40,7 +40,7 @@ class MediaQCheckBox(QtGui.QCheckBox):
""" """
MediaQCheckBox adds an extra property, playerName to the QCheckBox class. MediaQCheckBox adds an extra property, playerName to the QCheckBox class.
""" """
def setPlayerName(self, name): def set_player_name(self, name):
""" """
Set the player name Set the player name
""" """
@ -56,8 +56,8 @@ class PlayerTab(SettingsTab):
Constructor Constructor
""" """
self.media_players = self.media_controller.media_players self.media_players = self.media_controller.media_players
self.savedUsedPlayers = None self.saved_used_players = None
self.iconPath = u':/media/multimedia-player.png' self.icon_path = u':/media/multimedia-player.png'
player_translated = translate('OpenLP.PlayerTab', 'Players') player_translated = translate('OpenLP.PlayerTab', 'Players')
SettingsTab.__init__(self, parent, u'Players', player_translated) SettingsTab.__init__(self, parent, u'Players', player_translated)
@ -67,163 +67,164 @@ class PlayerTab(SettingsTab):
""" """
self.setObjectName(u'MediaTab') self.setObjectName(u'MediaTab')
SettingsTab.setupUi(self) SettingsTab.setupUi(self)
self.bgColorGroupBox = QtGui.QGroupBox(self.leftColumn) self.background_color_group_box = QtGui.QGroupBox(self.left_column)
self.bgColorGroupBox.setObjectName(u'FontGroupBox') self.background_color_group_box.setObjectName(u'background_color_group_box')
self.formLayout = QtGui.QFormLayout(self.bgColorGroupBox) self.form_layout = QtGui.QFormLayout(self.background_color_group_box)
self.formLayout.setObjectName(u'FormLayout') self.form_layout.setObjectName(u'form_layout')
self.colorLayout = QtGui.QHBoxLayout() self.color_layout = QtGui.QHBoxLayout()
self.backgroundColorLabel = QtGui.QLabel(self.bgColorGroupBox) self.background_color_label = QtGui.QLabel(self.background_color_group_box)
self.backgroundColorLabel.setObjectName(u'BackgroundColorLabel') self.background_color_label.setObjectName(u'background_color_label')
self.colorLayout.addWidget(self.backgroundColorLabel) self.color_layout.addWidget(self.background_color_label)
self.backgroundColorButton = QtGui.QPushButton(self.bgColorGroupBox) self.background_color_button = QtGui.QPushButton(self.background_color_group_box)
self.backgroundColorButton.setObjectName(u'BackgroundColorButton') self.background_color_button.setObjectName(u'background_color_button')
self.colorLayout.addWidget(self.backgroundColorButton) self.color_layout.addWidget(self.background_color_button)
self.formLayout.addRow(self.colorLayout) self.form_layout.addRow(self.color_layout)
self.information_label = QtGui.QLabel(self.bgColorGroupBox) self.information_label = QtGui.QLabel(self.background_color_group_box)
self.information_label.setObjectName(u'information_label') self.information_label.setObjectName(u'information_label')
self.information_label.setWordWrap(True) self.information_label.setWordWrap(True)
self.formLayout.addRow(self.information_label) self.form_layout.addRow(self.information_label)
self.leftLayout.addWidget(self.bgColorGroupBox) self.left_layout.addWidget(self.background_color_group_box)
self.leftLayout.addStretch() self.left_layout.addStretch()
self.rightColumn.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred) self.right_column.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred)
self.rightLayout.addStretch() self.right_layout.addStretch()
self.mediaPlayerGroupBox = QtGui.QGroupBox(self.leftColumn) self.media_player_group_box = QtGui.QGroupBox(self.left_column)
self.mediaPlayerGroupBox.setObjectName(u'mediaPlayerGroupBox') self.media_player_group_box.setObjectName(u'media_player_group_box')
self.mediaPlayerLayout = QtGui.QVBoxLayout(self.mediaPlayerGroupBox) self.media_player_layout = QtGui.QVBoxLayout(self.media_player_group_box)
self.mediaPlayerLayout.setObjectName(u'mediaPlayerLayout') self.media_player_layout.setObjectName(u'media_player_layout')
self.playerCheckBoxes = {} self.player_check_boxes = {}
self.leftLayout.addWidget(self.mediaPlayerGroupBox) self.left_layout.addWidget(self.media_player_group_box)
self.playerOrderGroupBox = QtGui.QGroupBox(self.leftColumn) self.player_order_group_box = QtGui.QGroupBox(self.left_column)
self.playerOrderGroupBox.setObjectName(u'playerOrderGroupBox') self.player_order_group_box.setObjectName(u'player_order_group_box')
self.playerOrderLayout = QtGui.QHBoxLayout(self.playerOrderGroupBox) self.player_order_layout = QtGui.QHBoxLayout(self.player_order_group_box)
self.playerOrderLayout.setObjectName(u'playerOrderLayout') self.player_order_layout.setObjectName(u'player_order_layout')
self.playerOrderlistWidget = QtGui.QListWidget(self.playerOrderGroupBox) self.player_order_list_widget = QtGui.QListWidget(self.player_order_group_box)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(0) sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0) sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.playerOrderlistWidget.sizePolicy().hasHeightForWidth()) sizePolicy.setHeightForWidth(self.player_order_list_widget.sizePolicy().hasHeightForWidth())
self.playerOrderlistWidget.setSizePolicy(sizePolicy) self.player_order_list_widget.setSizePolicy(sizePolicy)
self.playerOrderlistWidget.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded) self.player_order_list_widget.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded)
self.playerOrderlistWidget.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) self.player_order_list_widget.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
self.playerOrderlistWidget.setEditTriggers(QtGui.QAbstractItemView.NoEditTriggers) self.player_order_list_widget.setEditTriggers(QtGui.QAbstractItemView.NoEditTriggers)
self.playerOrderlistWidget.setObjectName(u'playerOrderlistWidget') self.player_order_list_widget.setObjectName(u'player_order_list_widget')
self.playerOrderLayout.addWidget(self.playerOrderlistWidget) self.player_order_layout.addWidget(self.player_order_list_widget)
self.orderingButtonLayout = QtGui.QVBoxLayout() self.ordering_button_layout = QtGui.QVBoxLayout()
self.orderingButtonLayout.setObjectName(u'orderingButtonLayout') self.ordering_button_layout.setObjectName(u'ordering_button_layout')
self.orderingButtonLayout.addStretch(1) self.ordering_button_layout.addStretch(1)
self.orderingUpButton = create_button(self, u'orderingUpButton', role=u'up', click=self.onUpButtonClicked) self.ordering_up_button = create_button(self, u'ordering_up_button', role=u'up',
self.orderingDownButton = create_button(self, u'orderingDownButton', role=u'down', click=self.on_up_button_clicked)
click=self.onDownButtonClicked) self.ordering_down_button = create_button(self, u'ordering_down_button', role=u'down',
self.orderingButtonLayout.addWidget(self.orderingUpButton) click=self.on_down_button_clicked)
self.orderingButtonLayout.addWidget(self.orderingDownButton) self.ordering_button_layout.addWidget(self.ordering_up_button)
self.orderingButtonLayout.addStretch(1) self.ordering_button_layout.addWidget(self.ordering_down_button)
self.playerOrderLayout.addLayout(self.orderingButtonLayout) self.ordering_button_layout.addStretch(1)
self.leftLayout.addWidget(self.playerOrderGroupBox) self.player_order_layout.addLayout(self.ordering_button_layout)
self.leftLayout.addStretch() self.left_layout.addWidget(self.player_order_group_box)
self.rightLayout.addStretch() self.left_layout.addStretch()
self.right_layout.addStretch()
# Signals and slots # Signals and slots
self.backgroundColorButton.clicked.connect(self.onbackgroundColorButtonClicked) self.background_color_button.clicked.connect(self.on_background_color_button_clicked)
def retranslateUi(self): def retranslateUi(self):
""" """
Translate the UI on the fly Translate the UI on the fly
""" """
self.mediaPlayerGroupBox.setTitle(translate('OpenLP.PlayerTab', 'Available Media Players')) self.media_player_group_box.setTitle(translate('OpenLP.PlayerTab', 'Available Media Players'))
self.playerOrderGroupBox.setTitle(translate('OpenLP.PlayerTab', 'Player Search Order')) self.player_order_group_box.setTitle(translate('OpenLP.PlayerTab', 'Player Search Order'))
self.bgColorGroupBox.setTitle(UiStrings().BackgroundColor) self.background_color_group_box.setTitle(UiStrings().BackgroundColor)
self.backgroundColorLabel.setText(UiStrings().DefaultColor) self.background_color_label.setText(UiStrings().DefaultColor)
self.information_label.setText(translate('OpenLP.PlayerTab', self.information_label.setText(translate('OpenLP.PlayerTab',
'Visible background for videos with aspect ratio different to screen.')) 'Visible background for videos with aspect ratio different to screen.'))
self.retranslatePlayers() self.retranslatePlayers()
def onbackgroundColorButtonClicked(self): def on_background_color_button_clicked(self):
""" """
Set the background color Set the background color
""" """
new_color = QtGui.QColorDialog.getColor(QtGui.QColor(self.bg_color), self) new_color = QtGui.QColorDialog.getColor(QtGui.QColor(self.background_color), self)
if new_color.isValid(): if new_color.isValid():
self.bg_color = new_color.name() self.background_color = new_color.name()
self.backgroundColorButton.setStyleSheet(u'background-color: %s' % self.bg_color) self.background_color_button.setStyleSheet(u'background-color: %s' % self.background_color)
def onPlayerCheckBoxChanged(self, check_state): def on_player_check_box_changed(self, check_state):
""" """
Add or remove players depending on their status Add or remove players depending on their status
""" """
player = self.sender().playerName player = self.sender().playerName
if check_state == QtCore.Qt.Checked: if check_state == QtCore.Qt.Checked:
if player not in self.usedPlayers: if player not in self.used_players:
self.usedPlayers.append(player) self.used_players.append(player)
else: else:
if player in self.usedPlayers: if player in self.used_players:
self.usedPlayers.remove(player) self.used_players.remove(player)
self.updatePlayerList() self.update_player_list()
def updatePlayerList(self): def update_player_list(self):
""" """
Update the list of media players Update the list of media players
""" """
self.playerOrderlistWidget.clear() self.player_order_list_widget.clear()
for player in self.usedPlayers: for player in self.used_players:
if player in self.playerCheckBoxes.keys(): if player in self.player_check_boxes.keys():
if len(self.usedPlayers) == 1: if len(self.used_players) == 1:
# At least one media player has to stay active # At least one media player has to stay active
self.playerCheckBoxes[u'%s' % player].setEnabled(False) self.player_check_boxes[u'%s' % player].setEnabled(False)
else: else:
self.playerCheckBoxes[u'%s' % player].setEnabled(True) self.player_check_boxes[u'%s' % player].setEnabled(True)
self.playerOrderlistWidget.addItem(self.media_players[unicode(player)].original_name) self.player_order_list_widget.addItem(self.media_players[unicode(player)].original_name)
def onUpButtonClicked(self): def on_up_button_clicked(self):
""" """
Move a media player up in the order Move a media player up in the order
""" """
row = self.playerOrderlistWidget.currentRow() row = self.player_order_list_widget.currentRow()
if row <= 0: if row <= 0:
return return
item = self.playerOrderlistWidget.takeItem(row) item = self.player_order_list_widget.takeItem(row)
self.playerOrderlistWidget.insertItem(row - 1, item) self.player_order_list_widget.insertItem(row - 1, item)
self.playerOrderlistWidget.setCurrentRow(row - 1) self.player_order_list_widget.setCurrentRow(row - 1)
self.usedPlayers.insert(row - 1, self.usedPlayers.pop(row)) self.used_players.insert(row - 1, self.used_players.pop(row))
def onDownButtonClicked(self): def on_down_button_clicked(self):
""" """
Move a media player down in the order Move a media player down in the order
""" """
row = self.playerOrderlistWidget.currentRow() row = self.player_order_list_widget.currentRow()
if row == -1 or row > self.playerOrderlistWidget.count() - 1: if row == -1 or row > self.player_order_list_widget.count() - 1:
return return
item = self.playerOrderlistWidget.takeItem(row) item = self.player_order_list_widget.takeItem(row)
self.playerOrderlistWidget.insertItem(row + 1, item) self.player_order_list_widget.insertItem(row + 1, item)
self.playerOrderlistWidget.setCurrentRow(row + 1) self.player_order_list_widget.setCurrentRow(row + 1)
self.usedPlayers.insert(row + 1, self.usedPlayers.pop(row)) self.used_players.insert(row + 1, self.used_players.pop(row))
def load(self): def load(self):
""" """
Load the settings Load the settings
""" """
if self.savedUsedPlayers: if self.saved_used_players:
self.usedPlayers = self.savedUsedPlayers self.used_players = self.saved_used_players
self.usedPlayers = get_media_players()[0] self.used_players = get_media_players()[0]
self.savedUsedPlayers = self.usedPlayers self.saved_used_players = self.used_players
settings = Settings() settings = Settings()
settings.beginGroup(self.settingsSection) settings.beginGroup(self.settings_section)
self.updatePlayerList() self.update_player_list()
self.bg_color = settings.value(u'background color') self.background_color = settings.value(u'background color')
self.initial_color = self.bg_color self.initial_color = self.background_color
settings.endGroup() settings.endGroup()
self.backgroundColorButton.setStyleSheet(u'background-color: %s' % self.bg_color) self.background_color_button.setStyleSheet(u'background-color: %s' % self.background_color)
def save(self): def save(self):
""" """
Save the settings Save the settings
""" """
settings = Settings() settings = Settings()
settings.beginGroup(self.settingsSection) settings.beginGroup(self.settings_section)
settings.setValue(u'background color', self.bg_color) settings.setValue(u'background color', self.background_color)
settings.endGroup() settings.endGroup()
old_players, override_player = get_media_players() old_players, override_player = get_media_players()
if self.usedPlayers != old_players: if self.used_players != old_players:
# clean old Media stuff # clean old Media stuff
set_media_players(self.usedPlayers, override_player) set_media_players(self.used_players, override_player)
self.settings_form.register_post_process(u'mediaitem_suffix_reset') self.settings_form.register_post_process(u'mediaitem_suffix_reset')
self.settings_form.register_post_process(u'mediaitem_media_rebuild') self.settings_form.register_post_process(u'mediaitem_media_rebuild')
self.settings_form.register_post_process(u'config_screen_changed') self.settings_form.register_post_process(u'config_screen_changed')
@ -234,29 +235,29 @@ class PlayerTab(SettingsTab):
""" """
for key, player in self.media_players.iteritems(): for key, player in self.media_players.iteritems():
player = self.media_players[key] player = self.media_players[key]
checkbox = MediaQCheckBox(self.mediaPlayerGroupBox) checkbox = MediaQCheckBox(self.media_player_group_box)
checkbox.setEnabled(player.available) checkbox.setEnabled(player.available)
checkbox.setObjectName(player.name + u'CheckBox') checkbox.setObjectName(player.name + u'_check_box')
checkbox.setToolTip(player.get_info()) checkbox.setToolTip(player.get_info())
checkbox.setPlayerName(player.name) checkbox.set_player_name(player.name)
self.playerCheckBoxes[player.name] = checkbox self.player_check_boxes[player.name] = checkbox
checkbox.stateChanged.connect(self.onPlayerCheckBoxChanged) checkbox.stateChanged.connect(self.on_player_check_box_changed)
self.mediaPlayerLayout.addWidget(checkbox) self.media_player_layout.addWidget(checkbox)
if player.available and player.name in self.usedPlayers: if player.available and player.name in self.used_players:
checkbox.setChecked(True) checkbox.setChecked(True)
else: else:
checkbox.setChecked(False) checkbox.setChecked(False)
self.updatePlayerList() self.update_player_list()
self.retranslatePlayers() self.retranslatePlayers()
def retranslatePlayers(self): def retranslatePlayers(self):
""" """
Translations for players is dependent on their setup as well Translations for players is dependent on their setup as well
""" """
for key in self.media_players and self.playerCheckBoxes: for key in self.media_players and self.player_check_boxes:
player = self.media_players[key] player = self.media_players[key]
checkbox = self.playerCheckBoxes[player.name] checkbox = self.player_check_boxes[player.name]
checkbox.setPlayerName(player.name) checkbox.set_player_name(player.name)
if player.available: if player.available:
checkbox.setText(player.display_name) checkbox.setText(player.display_name)
else: else:

View File

@ -58,12 +58,12 @@ except OSError, e:
if VLC_AVAILABLE: if VLC_AVAILABLE:
try: try:
version = vlc.libvlc_get_version() VERSION = vlc.libvlc_get_version()
except: except:
version = u'0.0.0' VERSION = u'0.0.0'
if LooseVersion(version) < LooseVersion('1.1.0'): if LooseVersion(VERSION) < LooseVersion('1.1.0'):
VLC_AVAILABLE = False VLC_AVAILABLE = False
log.debug(u'VLC could not be loaded: %s' % version) log.debug(u'VLC could not be loaded, because the vlc version is too old: %s' % VERSION)
AUDIO_EXT = [u'*.mp3', u'*.wav', u'*.wma', u'*.ogg'] AUDIO_EXT = [u'*.mp3', u'*.wav', u'*.wma', u'*.ogg']

View File

@ -208,7 +208,7 @@ class ServiceManagerDialog(object):
self.service_manager_list.itemCollapsed.connect(self.collapsed) self.service_manager_list.itemCollapsed.connect(self.collapsed)
self.service_manager_list.itemExpanded.connect(self.expanded) self.service_manager_list.itemExpanded.connect(self.expanded)
# Last little bits of setting up # Last little bits of setting up
self.service_theme = Settings().value(self.main_window.serviceManagerSettingsSection + u'/service theme') self.service_theme = Settings().value(self.main_window.service_manager_settings_section + u'/service theme')
self.servicePath = AppLocation.get_section_data_path(u'servicemanager') self.servicePath = AppLocation.get_section_data_path(u'servicemanager')
# build the drag and drop context menu # build the drag and drop context menu
self.dndMenu = QtGui.QMenu() self.dndMenu = QtGui.QMenu()
@ -323,7 +323,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
self.service_id += 1 self.service_id += 1
self._modified = modified self._modified = modified
service_file = self.short_file_name() or translate('OpenLP.ServiceManager', 'Untitled Service') service_file = self.short_file_name() or translate('OpenLP.ServiceManager', 'Untitled Service')
self.main_window.setServiceModified(modified, service_file) self.main_window.set_service_modified(modified, service_file)
def is_modified(self): def is_modified(self):
""" """
@ -336,7 +336,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
Setter for service file. Setter for service file.
""" """
self._file_name = unicode(file_name) self._file_name = unicode(file_name)
self.main_window.setServiceModified(self.is_modified(), self.short_file_name()) self.main_window.set_service_modified(self.is_modified(), self.short_file_name())
Settings().setValue(u'servicemanager/last file', file_name) Settings().setValue(u'servicemanager/last file', file_name)
self._save_lite = self._file_name.endswith(u'.oszl') self._save_lite = self._file_name.endswith(u'.oszl')
@ -401,14 +401,14 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
file_name = QtGui.QFileDialog.getOpenFileName( file_name = QtGui.QFileDialog.getOpenFileName(
self.main_window, self.main_window,
translate('OpenLP.ServiceManager', 'Open File'), translate('OpenLP.ServiceManager', 'Open File'),
Settings().value(self.main_window.serviceManagerSettingsSection + u'/last directory'), Settings().value(self.main_window.service_manager_settings_section + u'/last directory'),
translate('OpenLP.ServiceManager', 'OpenLP Service Files (*.osz *.oszl)') translate('OpenLP.ServiceManager', 'OpenLP Service Files (*.osz *.oszl)')
) )
if not file_name: if not file_name:
return False return False
else: else:
file_name = load_file file_name = load_file
Settings().setValue(self.main_window.serviceManagerSettingsSection + u'/last directory', Settings().setValue(self.main_window.service_manager_settings_section + u'/last directory',
split_filename(file_name)[0]) split_filename(file_name)[0])
self.load_file(file_name) self.load_file(file_name)
@ -461,7 +461,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
base_name = os.path.splitext(file_name)[0] base_name = os.path.splitext(file_name)[0]
service_file_name = '%s.osd' % base_name service_file_name = '%s.osd' % base_name
log.debug(u'ServiceManager.save_file - %s', path_file_name) log.debug(u'ServiceManager.save_file - %s', path_file_name)
Settings().setValue(self.main_window.serviceManagerSettingsSection + u'/last directory', path) Settings().setValue(self.main_window.service_manager_settings_section + u'/last directory', path)
service = [] service = []
write_list = [] write_list = []
missing_list = [] missing_list = []
@ -469,7 +469,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
total_size = 0 total_size = 0
self.application.set_busy_cursor() self.application.set_busy_cursor()
# Number of items + 1 to zip it # Number of items + 1 to zip it
self.main_window.displayProgressBar(len(self.service_items) + 1) self.main_window.display_progress_bar(len(self.service_items) + 1)
# Get list of missing files, and list of files to write # Get list of missing files, and list of files to write
for item in self.service_items: for item in self.service_items:
if not item[u'service_item'].uses_file(): if not item[u'service_item'].uses_file():
@ -491,7 +491,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
answer = QtGui.QMessageBox.critical(self, title, message, answer = QtGui.QMessageBox.critical(self, title, message,
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok | QtGui.QMessageBox.Cancel)) QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok | QtGui.QMessageBox.Cancel))
if answer == QtGui.QMessageBox.Cancel: if answer == QtGui.QMessageBox.Cancel:
self.main_window.finishedProgressBar() self.main_window.finished_progress_bar()
return False return False
# Check if item contains a missing file. # Check if item contains a missing file.
for item in list(self.service_items): for item in list(self.service_items):
@ -551,14 +551,14 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
finally: finally:
if zip_file: if zip_file:
zip_file.close() zip_file.close()
self.main_window.finishedProgressBar() self.main_window.finished_progress_bar()
self.application.set_normal_cursor() self.application.set_normal_cursor()
if success: if success:
try: try:
shutil.copy(temp_file_name, path_file_name) shutil.copy(temp_file_name, path_file_name)
except shutil.Error: except shutil.Error:
return self.save_file_as() return self.save_file_as()
self.main_window.addRecentFile(path_file_name) self.main_window.add_recent_file(path_file_name)
self.set_modified(False) self.set_modified(False)
delete_file(temp_file_name) delete_file(temp_file_name)
return success return success
@ -579,11 +579,11 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
base_name = os.path.splitext(file_name)[0] base_name = os.path.splitext(file_name)[0]
service_file_name = '%s.osd' % base_name service_file_name = '%s.osd' % base_name
log.debug(u'ServiceManager.save_file - %s', path_file_name) log.debug(u'ServiceManager.save_file - %s', path_file_name)
Settings().setValue(self.main_window.serviceManagerSettingsSection + u'/last directory', path) Settings().setValue(self.main_window.service_manager_settings_section + u'/last directory', path)
service = [] service = []
self.application.set_busy_cursor() self.application.set_busy_cursor()
# Number of items + 1 to zip it # Number of items + 1 to zip it
self.main_window.displayProgressBar(len(self.service_items) + 1) self.main_window.display_progress_bar(len(self.service_items) + 1)
for item in self.service_items: for item in self.service_items:
self.main_window.increment_progress_bar() self.main_window.increment_progress_bar()
service_item = item[u'service_item'].get_service_repr(self._save_lite) service_item = item[u'service_item'].get_service_repr(self._save_lite)
@ -608,14 +608,14 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
finally: finally:
if zip_file: if zip_file:
zip_file.close() zip_file.close()
self.main_window.finishedProgressBar() self.main_window.finished_progress_bar()
self.application.set_normal_cursor() self.application.set_normal_cursor()
if success: if success:
try: try:
shutil.copy(temp_file_name, path_file_name) shutil.copy(temp_file_name, path_file_name)
except shutil.Error: except shutil.Error:
return self.save_file_as() return self.save_file_as()
self.main_window.addRecentFile(path_file_name) self.main_window.add_recent_file(path_file_name)
self.set_modified(False) self.set_modified(False)
delete_file(temp_file_name) delete_file(temp_file_name)
return success return success
@ -643,7 +643,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
default_file_name = format_time(default_pattern, local_time) default_file_name = format_time(default_pattern, local_time)
else: else:
default_file_name = u'' default_file_name = u''
directory = Settings().value(self.main_window.serviceManagerSettingsSection + u'/last directory') directory = Settings().value(self.main_window.service_manager_settings_section + u'/last directory')
path = os.path.join(directory, default_file_name) path = os.path.join(directory, default_file_name)
# SaveAs from osz to oszl is not valid as the files will be deleted # SaveAs from osz to oszl is not valid as the files will be deleted
# on exit which is not sensible or usable in the long term. # on exit which is not sensible or usable in the long term.
@ -712,7 +712,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
file_to.close() file_to.close()
self.new_file() self.new_file()
self.set_file_name(file_name) self.set_file_name(file_name)
self.main_window.displayProgressBar(len(items)) self.main_window.display_progress_bar(len(items))
for item in items: for item in items:
self.main_window.increment_progress_bar() self.main_window.increment_progress_bar()
service_item = ServiceItem() service_item = ServiceItem()
@ -730,7 +730,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
service_item.temporary_edit = self.load_item_temporary service_item.temporary_edit = self.load_item_temporary
self.add_service_item(service_item, repaint=False) self.add_service_item(service_item, repaint=False)
delete_file(p_file) delete_file(p_file)
self.main_window.addRecentFile(file_name) self.main_window.add_recent_file(file_name)
self.set_modified(False) self.set_modified(False)
Settings().setValue('servicemanager/last file', file_name) Settings().setValue('servicemanager/last file', file_name)
else: else:
@ -758,7 +758,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
file_to.close() file_to.close()
if zip_file: if zip_file:
zip_file.close() zip_file.close()
self.main_window.finishedProgressBar() self.main_window.finished_progress_bar()
self.application.set_normal_cursor() self.application.set_normal_cursor()
self.repaint_service_list(-1, -1) self.repaint_service_list(-1, -1)
@ -871,7 +871,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
self.auto_play_slides_loop.setChecked(False) self.auto_play_slides_loop.setChecked(False)
if service_item.auto_play_slides_once and service_item.timed_slide_interval == 0: if service_item.auto_play_slides_once and service_item.timed_slide_interval == 0:
service_item.timed_slide_interval = Settings().value( service_item.timed_slide_interval = Settings().value(
self.main_window.generalSettingsSection + u'/loop delay') self.main_window.general_settings_section + u'/loop delay')
self.set_modified() self.set_modified()
def toggle_auto_play_slides_loop(self): def toggle_auto_play_slides_loop(self):
@ -886,7 +886,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
self.auto_play_slides_once.setChecked(False) self.auto_play_slides_once.setChecked(False)
if service_item.auto_play_slides_loop and service_item.timed_slide_interval == 0: if service_item.auto_play_slides_loop and service_item.timed_slide_interval == 0:
service_item.timed_slide_interval = Settings().value( service_item.timed_slide_interval = Settings().value(
self.main_window.generalSettingsSection + u'/loop delay') self.main_window.general_settings_section + u'/loop delay')
self.set_modified() self.set_modified()
def on_timed_slide_interval(self): def on_timed_slide_interval(self):
@ -1228,10 +1228,10 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
log.debug(u'on_theme_combo_box_selected') log.debug(u'on_theme_combo_box_selected')
self.service_theme = self.theme_combo_box.currentText() self.service_theme = self.theme_combo_box.currentText()
self.renderer.set_service_theme(self.service_theme) self.renderer.set_service_theme(self.service_theme)
Settings().setValue(self.main_window.serviceManagerSettingsSection + u'/service theme', self.service_theme) Settings().setValue(self.main_window.service_manager_settings_section + u'/service theme', self.service_theme)
self.regenerate_service_Items(True) self.regenerate_service_Items(True)
def theme_change(self, global_theme): def theme_change(self):
""" """
The theme may have changed in the settings dialog so make The theme may have changed in the settings dialog so make
sure the theme combo box is in the correct state. sure the theme combo box is in the correct state.
@ -1397,7 +1397,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
self.application.set_busy_cursor() self.application.set_busy_cursor()
if self.service_items[item][u'service_item'].is_valid: if self.service_items[item][u'service_item'].is_valid:
self.live_controller.addServiceManagerItem(self.service_items[item][u'service_item'], child) self.live_controller.addServiceManagerItem(self.service_items[item][u'service_item'], child)
if Settings().value(self.main_window.generalSettingsSection + u'/auto preview'): if Settings().value(self.main_window.general_settings_section + u'/auto preview'):
item += 1 item += 1
if self.service_items and item < len(self.service_items) and \ if self.service_items and item < len(self.service_items) and \
self.service_items[item][u'service_item'].is_capable(ItemCapabilities.CanPreview): self.service_items[item][u'service_item'].is_capable(ItemCapabilities.CanPreview):

View File

@ -39,32 +39,32 @@ class Ui_SettingsDialog(object):
""" """
The UI widgets of the settings dialog. The UI widgets of the settings dialog.
""" """
def setupUi(self, settingsDialog): def setupUi(self, settings_dialog):
""" """
Set up the UI Set up the UI
""" """
settingsDialog.setObjectName(u'settingsDialog') settings_dialog.setObjectName(u'settings_dialog')
settingsDialog.resize(800, 500) settings_dialog.resize(800, 500)
settingsDialog.setWindowIcon(build_icon(u':/system/system_settings.png')) settings_dialog.setWindowIcon(build_icon(u':/system/system_settings.png'))
self.dialogLayout = QtGui.QGridLayout(settingsDialog) self.dialog_layout = QtGui.QGridLayout(settings_dialog)
self.dialogLayout.setObjectName(u'dialog_layout') self.dialog_layout.setObjectName(u'dialog_layout')
self.dialogLayout.setMargin(8) self.dialog_layout.setMargin(8)
self.settingListWidget = QtGui.QListWidget(settingsDialog) self.setting_list_widget = QtGui.QListWidget(settings_dialog)
self.settingListWidget.setUniformItemSizes(True) self.setting_list_widget.setUniformItemSizes(True)
self.settingListWidget.setMinimumSize(QtCore.QSize(150, 0)) self.setting_list_widget.setMinimumSize(QtCore.QSize(150, 0))
self.settingListWidget.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) self.setting_list_widget.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
self.settingListWidget.setObjectName(u'settingListWidget') self.setting_list_widget.setObjectName(u'setting_list_widget')
self.dialogLayout.addWidget(self.settingListWidget, 0, 0, 1, 1) self.dialog_layout.addWidget(self.setting_list_widget, 0, 0, 1, 1)
self.stackedLayout = QtGui.QStackedLayout() self.stacked_layout = QtGui.QStackedLayout()
self.stackedLayout.setObjectName(u'stackedLayout') self.stacked_layout.setObjectName(u'stacked_layout')
self.dialogLayout.addLayout(self.stackedLayout, 0, 1, 1, 1) self.dialog_layout.addLayout(self.stacked_layout, 0, 1, 1, 1)
self.button_box = create_button_box(settingsDialog, u'button_box', [u'cancel', u'ok']) self.button_box = create_button_box(settings_dialog, u'button_box', [u'cancel', u'ok'])
self.dialogLayout.addWidget(self.button_box, 1, 1, 1, 1) self.dialog_layout.addWidget(self.button_box, 1, 1, 1, 1)
self.retranslateUi(settingsDialog) self.retranslateUi(settings_dialog)
self.settingListWidget.currentRowChanged.connect(self.tabChanged) self.setting_list_widget.currentRowChanged.connect(self.tab_changed)
def retranslateUi(self, settingsDialog): def retranslateUi(self, settings_dialog):
""" """
Translate the UI on the fly Translate the UI on the fly
""" """
settingsDialog.setWindowTitle(translate('OpenLP.SettingsForm', 'Configure OpenLP')) settings_dialog.setWindowTitle(translate('OpenLP.SettingsForm', 'Configure OpenLP'))

View File

@ -60,50 +60,50 @@ class SettingsForm(QtGui.QDialog, Ui_SettingsDialog):
Execute the form Execute the form
""" """
# load all the settings # load all the settings
self.settingListWidget.clear() self.setting_list_widget.clear()
while self.stackedLayout.count(): while self.stacked_layout.count():
# take at 0 and the rest shuffle up. # take at 0 and the rest shuffle up.
self.stackedLayout.takeAt(0) self.stacked_layout.takeAt(0)
self.insertTab(self.generalTab, 0, PluginStatus.Active) self.insert_tab(self.general_tab, 0, PluginStatus.Active)
self.insertTab(self.themesTab, 1, PluginStatus.Active) self.insert_tab(self.themes_tab, 1, PluginStatus.Active)
self.insertTab(self.advancedTab, 2, PluginStatus.Active) self.insert_tab(self.advanced_tab, 2, PluginStatus.Active)
self.insertTab(self.playerTab, 3, PluginStatus.Active) self.insert_tab(self.player_tab, 3, PluginStatus.Active)
count = 4 count = 4
for plugin in self.plugin_manager.plugins: for plugin in self.plugin_manager.plugins:
if plugin.settingsTab: if plugin.settingsTab:
self.insertTab(plugin.settingsTab, count, plugin.status) self.insert_tab(plugin.settingsTab, count, plugin.status)
count += 1 count += 1
self.settingListWidget.setCurrentRow(0) self.setting_list_widget.setCurrentRow(0)
return QtGui.QDialog.exec_(self) return QtGui.QDialog.exec_(self)
def insertTab(self, tab, location, is_active): def insert_tab(self, tab, location, is_active):
""" """
Add a tab to the form at a specific location Add a tab to the form at a specific location
""" """
log.debug(u'Inserting %s tab' % tab.tabTitle) log.debug(u'Inserting %s tab' % tab.tab_title)
# add the tab to get it to display in the correct part of the screen # add the tab to get it to display in the correct part of the screen
pos = self.stackedLayout.addWidget(tab) pos = self.stacked_layout.addWidget(tab)
if is_active: if is_active:
item_name = QtGui.QListWidgetItem(tab.tabTitleVisible) item_name = QtGui.QListWidgetItem(tab.tab_title_visible)
icon = build_icon(tab.iconPath) icon = build_icon(tab.icon_path)
item_name.setIcon(icon) item_name.setIcon(icon)
self.settingListWidget.insertItem(location, item_name) self.setting_list_widget.insertItem(location, item_name)
else: else:
# then remove tab to stop the UI displaying it even if # then remove tab to stop the UI displaying it even if it is not required.
# it is not required. self.stacked_layout.takeAt(pos)
self.stackedLayout.takeAt(pos)
def accept(self): def accept(self):
""" """
Process the form saving the settings Process the form saving the settings
""" """
self.resetSuffixes = True for tabIndex in range(self.stacked_layout.count()):
for tabIndex in range(self.stackedLayout.count()): self.stacked_layout.widget(tabIndex).save()
self.stackedLayout.widget(tabIndex).save() # if the display of image background are changing we need to regenerate the image cache
# Must go after all settings are save if u'images_config_updated' in self.processes or u'config_screen_changed' in self.processes:
self.register_post_process(u'images_regenerate')
# Now lets process all the post save handlers
while self.processes: while self.processes:
Registry().execute(self.processes.pop(0)) Registry().execute(self.processes.pop(0))
Registry().execute(u'config_updated')
return QtGui.QDialog.accept(self) return QtGui.QDialog.accept(self)
def reject(self): def reject(self):
@ -111,8 +111,8 @@ class SettingsForm(QtGui.QDialog, Ui_SettingsDialog):
Process the form saving the settings Process the form saving the settings
""" """
self.processes = [] self.processes = []
for tabIndex in range(self.stackedLayout.count()): for tabIndex in range(self.stacked_layout.count()):
self.stackedLayout.widget(tabIndex).cancel() self.stacked_layout.widget(tabIndex).cancel()
return QtGui.QDialog.reject(self) return QtGui.QDialog.reject(self)
def post_set_up(self): def post_set_up(self):
@ -120,27 +120,27 @@ class SettingsForm(QtGui.QDialog, Ui_SettingsDialog):
Run any post-setup code for the tabs on the form Run any post-setup code for the tabs on the form
""" """
# General tab # General tab
self.generalTab = GeneralTab(self) self.general_tab = GeneralTab(self)
# Themes tab # Themes tab
self.themesTab = ThemesTab(self) self.themes_tab = ThemesTab(self)
# Advanced tab # Advanced tab
self.advancedTab = AdvancedTab(self) self.advanced_tab = AdvancedTab(self)
# Advanced tab # Advanced tab
self.playerTab = PlayerTab(self) self.player_tab = PlayerTab(self)
self.generalTab.post_set_up() self.general_tab.post_set_up()
self.themesTab.post_set_up() self.themes_tab.post_set_up()
self.advancedTab.post_set_up() self.advanced_tab.post_set_up()
self.playerTab.post_set_up() self.player_tab.post_set_up()
for plugin in self.plugin_manager.plugins: for plugin in self.plugin_manager.plugins:
if plugin.settingsTab: if plugin.settingsTab:
plugin.settingsTab.post_set_up() plugin.settingsTab.post_set_up()
def tabChanged(self, tabIndex): def tab_changed(self, tabIndex):
""" """
A different settings tab is selected A different settings tab is selected
""" """
self.stackedLayout.setCurrentIndex(tabIndex) self.stacked_layout.setCurrentIndex(tabIndex)
self.stackedLayout.currentWidget().tabVisible() self.stacked_layout.currentWidget().tab_visible()
def register_post_process(self, function): def register_post_process(self, function):
""" """

View File

@ -238,7 +238,7 @@ class SlideController(DisplayController):
self.play_slides_once = create_action(self, u'playSlidesOnce', text=UiStrings().PlaySlidesToEnd, self.play_slides_once = create_action(self, u'playSlidesOnce', text=UiStrings().PlaySlidesToEnd,
icon=u':/media/media_time.png', checked=False, can_shortcuts=True, icon=u':/media/media_time.png', checked=False, can_shortcuts=True,
category=self.category, triggers=self.onPlaySlidesOnce) category=self.category, triggers=self.onPlaySlidesOnce)
if Settings().value(self.main_window.advancedSettingsSection + u'/slide limits') == SlideLimits.Wrap: if Settings().value(self.main_window.advanced_settings_section + u'/slide limits') == SlideLimits.Wrap:
self.play_slides_menu.setDefaultAction(self.play_slides_loop) self.play_slides_menu.setDefaultAction(self.play_slides_loop)
else: else:
self.play_slides_menu.setDefaultAction(self.play_slides_once) self.play_slides_menu.setDefaultAction(self.play_slides_once)
@ -605,17 +605,17 @@ class SlideController(DisplayController):
self.__updatePreviewSelection(slide_no) self.__updatePreviewSelection(slide_no)
self.slideSelected() self.slideSelected()
def receive_spin_delay(self, value): def receive_spin_delay(self):
""" """
Adjusts the value of the ``delay_spin_box`` to the given one. Adjusts the value of the ``delay_spin_box`` to the given one.
""" """
self.delay_spin_box.setValue(int(value)) self.delay_spin_box.setValue(Settings().value(u'general/loop delay'))
def update_slide_limits(self): def update_slide_limits(self):
""" """
Updates the Slide Limits variable from the settings. Updates the Slide Limits variable from the settings.
""" """
self.slide_limits = Settings().value(self.main_window.advancedSettingsSection + u'/slide limits') self.slide_limits = Settings().value(self.main_window.advanced_settings_section + u'/slide limits')
def enableToolBar(self, item): def enableToolBar(self, item):
""" """
@ -644,7 +644,7 @@ class SlideController(DisplayController):
self.play_slides_loop.setChecked(False) self.play_slides_loop.setChecked(False)
self.play_slides_loop.setIcon(build_icon(u':/media/media_time.png')) self.play_slides_loop.setIcon(build_icon(u':/media/media_time.png'))
if item.is_text(): if item.is_text():
if Settings().value(self.main_window.songsSettingsSection + u'/display songbar') and self.slideList: if Settings().value(self.main_window.songs_settings_section + u'/display songbar') and self.slideList:
self.toolbar.set_widget_visible([u'song_menu'], True) self.toolbar.set_widget_visible([u'song_menu'], True)
if item.is_capable(ItemCapabilities.CanLoop) and len(item.get_frames()) > 1: if item.is_capable(ItemCapabilities.CanLoop) and len(item.get_frames()) > 1:
self.toolbar.set_widget_visible(self.loop_list) self.toolbar.set_widget_visible(self.loop_list)
@ -765,8 +765,8 @@ class SlideController(DisplayController):
action.setData(counter) action.setData(counter)
action.triggered.connect(self.onTrackTriggered) action.triggered.connect(self.onTrackTriggered)
self.display.audio_player.repeat = Settings().value( self.display.audio_player.repeat = Settings().value(
self.main_window.generalSettingsSection + u'/audio repeat list') self.main_window.general_settings_section + u'/audio repeat list')
if Settings().value(self.main_window.generalSettingsSection + u'/audio start paused'): if Settings().value(self.main_window.general_settings_section + u'/audio start paused'):
self.audio_pause_item.setChecked(True) self.audio_pause_item.setChecked(True)
self.display.audio_player.pause() self.display.audio_player.pause()
else: else:
@ -874,7 +874,7 @@ class SlideController(DisplayController):
Allow the main display to blank the main display at startup time Allow the main display to blank the main display at startup time
""" """
log.debug(u'mainDisplaySetBackground live = %s' % self.is_live) log.debug(u'mainDisplaySetBackground live = %s' % self.is_live)
display_type = Settings().value(self.main_window.generalSettingsSection + u'/screen blank') display_type = Settings().value(self.main_window.general_settings_section + u'/screen blank')
if self.screens.which_screen(self.window()) != self.screens.which_screen(self.display): if self.screens.which_screen(self.window()) != self.screens.which_screen(self.display):
# Order done to handle initial conversion # Order done to handle initial conversion
if display_type == u'themed': if display_type == u'themed':

View File

@ -62,8 +62,8 @@ class ThemeManager(QtGui.QWidget):
Registry().register_function(u'bootstrap_initialise', self.load_first_time_themes) Registry().register_function(u'bootstrap_initialise', self.load_first_time_themes)
Registry().register_function(u'bootstrap_post_set_up', self._push_themes) Registry().register_function(u'bootstrap_post_set_up', self._push_themes)
self.settingsSection = u'themes' self.settingsSection = u'themes'
self.themeForm = ThemeForm(self) self.theme_form = ThemeForm(self)
self.fileRenameForm = FileRenameForm() self.file_rename_form = FileRenameForm()
# start with the layout # start with the layout
self.layout = QtGui.QVBoxLayout(self) self.layout = QtGui.QVBoxLayout(self)
self.layout.setSpacing(0) self.layout.setSpacing(0)
@ -74,13 +74,13 @@ class ThemeManager(QtGui.QWidget):
self.toolbar.add_toolbar_action(u'newTheme', self.toolbar.add_toolbar_action(u'newTheme',
text=UiStrings().NewTheme, icon=u':/themes/theme_new.png', text=UiStrings().NewTheme, icon=u':/themes/theme_new.png',
tooltip=translate('OpenLP.ThemeManager', 'Create a new theme.'), tooltip=translate('OpenLP.ThemeManager', 'Create a new theme.'),
triggers=self.onAddTheme) triggers=self.on_add_theme)
self.toolbar.add_toolbar_action(u'editTheme', self.toolbar.add_toolbar_action(u'editTheme',
text=translate('OpenLP.ThemeManager', 'Edit Theme'), text=translate('OpenLP.ThemeManager', 'Edit Theme'),
icon=u':/themes/theme_edit.png', icon=u':/themes/theme_edit.png',
tooltip=translate('OpenLP.ThemeManager', 'Edit a theme.'), tooltip=translate('OpenLP.ThemeManager', 'Edit a theme.'),
triggers=self.on_edit_theme) triggers=self.on_edit_theme)
self.deleteToolbarAction = self.toolbar.add_toolbar_action(u'delete_theme', self.delete_toolbar_action = self.toolbar.add_toolbar_action(u'delete_theme',
text=translate('OpenLP.ThemeManager', 'Delete Theme'), text=translate('OpenLP.ThemeManager', 'Delete Theme'),
icon=u':/general/general_delete.png', icon=u':/general/general_delete.png',
tooltip=translate('OpenLP.ThemeManager', 'Delete a theme.'), tooltip=translate('OpenLP.ThemeManager', 'Delete a theme.'),
@ -137,11 +137,11 @@ class ThemeManager(QtGui.QWidget):
self.theme_list = [] self.theme_list = []
self.path = AppLocation.get_section_data_path(self.settingsSection) self.path = AppLocation.get_section_data_path(self.settingsSection)
check_directory_exists(self.path) check_directory_exists(self.path)
self.thumbPath = os.path.join(self.path, u'thumbnails') self.thumb_path = os.path.join(self.path, u'thumbnails')
check_directory_exists(self.thumbPath) check_directory_exists(self.thumb_path)
self.themeForm.path = self.path self.theme_form.path = self.path
self.oldBackgroundImage = None self.old_background_image = None
self.badV1NameChars = re.compile(r'[%+\[\]]') self.bad_v1_name_chars = re.compile(r'[%+\[\]]')
# Last little bits of setting up # Last little bits of setting up
self.global_theme = Settings().value(self.settingsSection + u'/global theme') self.global_theme = Settings().value(self.settingsSection + u'/global theme')
@ -155,9 +155,9 @@ class ThemeManager(QtGui.QWidget):
theme_name = item.text() theme_name = item.text()
# If default theme restrict actions # If default theme restrict actions
if real_theme_name == theme_name: if real_theme_name == theme_name:
self.deleteToolbarAction.setVisible(True) self.delete_toolbar_action.setVisible(True)
else: else:
self.deleteToolbarAction.setVisible(False) self.delete_toolbar_action.setVisible(False)
def context_menu(self, point): def context_menu(self, point):
""" """
@ -192,7 +192,7 @@ class ThemeManager(QtGui.QWidget):
if self.global_theme == new_name: if self.global_theme == new_name:
name = translate('OpenLP.ThemeManager', '%s (default)') % new_name name = translate('OpenLP.ThemeManager', '%s (default)') % new_name
self.theme_list_widget.item(count).setText(name) self.theme_list_widget.item(count).setText(name)
self.deleteToolbarAction.setVisible(item not in self.theme_list_widget.selectedItems()) self.delete_toolbar_action.setVisible(item not in self.theme_list_widget.selectedItems())
def change_global_from_screen(self, index=-1): def change_global_from_screen(self, index=-1):
""" """
@ -216,15 +216,15 @@ class ThemeManager(QtGui.QWidget):
Registry().execute(u'theme_update_global') Registry().execute(u'theme_update_global')
self._push_themes() self._push_themes()
def onAddTheme(self): def on_add_theme(self):
""" """
Loads a new theme with the default settings and then launches the theme Loads a new theme with the default settings and then launches the theme
editing form for the user to make their customisations. editing form for the user to make their customisations.
""" """
theme = ThemeXML() theme = ThemeXML()
theme.set_default_header_footer() theme.set_default_header_footer()
self.themeForm.theme = theme self.theme_form.theme = theme
self.themeForm.exec_() self.theme_form.exec_()
self.load_themes() self.load_themes()
def on_rename_theme(self): def on_rename_theme(self):
@ -236,14 +236,14 @@ class ThemeManager(QtGui.QWidget):
translate('OpenLP.ThemeManager', 'Rename %s theme?'), False, False): translate('OpenLP.ThemeManager', 'Rename %s theme?'), False, False):
item = self.theme_list_widget.currentItem() item = self.theme_list_widget.currentItem()
old_theme_name = item.data(QtCore.Qt.UserRole) old_theme_name = item.data(QtCore.Qt.UserRole)
self.fileRenameForm.file_name_edit.setText(old_theme_name) self.file_rename_form.file_name_edit.setText(old_theme_name)
if self.fileRenameForm.exec_(): if self.file_rename_form.exec_():
new_theme_name = self.fileRenameForm.file_name_edit.text() new_theme_name = self.file_rename_form.file_name_edit.text()
if old_theme_name == new_theme_name: if old_theme_name == new_theme_name:
return return
if self.check_if_theme_exists(new_theme_name): if self.check_if_theme_exists(new_theme_name):
old_theme_data = self.get_theme_data(old_theme_name) old_theme_data = self.get_theme_data(old_theme_name)
self.cloneThemeData(old_theme_data, new_theme_name) self.clone_theme_data(old_theme_data, new_theme_name)
self.delete_theme(old_theme_name) self.delete_theme(old_theme_name)
for plugin in self.plugin_manager.plugins: for plugin in self.plugin_manager.plugins:
if plugin.uses_theme(old_theme_name): if plugin.uses_theme(old_theme_name):
@ -257,19 +257,19 @@ class ThemeManager(QtGui.QWidget):
""" """
item = self.theme_list_widget.currentItem() item = self.theme_list_widget.currentItem()
old_theme_name = item.data(QtCore.Qt.UserRole) old_theme_name = item.data(QtCore.Qt.UserRole)
self.fileRenameForm.file_name_edit.setText(translate('OpenLP.ThemeManager', self.file_rename_form.file_name_edit.setText(translate('OpenLP.ThemeManager',
'Copy of %s', 'Copy of <theme name>') % old_theme_name) 'Copy of %s', 'Copy of <theme name>') % old_theme_name)
if self.fileRenameForm.exec_(True): if self.file_rename_form.exec_(True):
new_theme_name = self.fileRenameForm.file_name_edit.text() new_theme_name = self.file_rename_form.file_name_edit.text()
if self.check_if_theme_exists(new_theme_name): if self.check_if_theme_exists(new_theme_name):
theme_data = self.get_theme_data(old_theme_name) theme_data = self.get_theme_data(old_theme_name)
self.cloneThemeData(theme_data, new_theme_name) self.clone_theme_data(theme_data, new_theme_name)
def cloneThemeData(self, theme_data, new_theme_name): def clone_theme_data(self, theme_data, new_theme_name):
""" """
Takes a theme and makes a new copy of it as well as saving it. Takes a theme and makes a new copy of it as well as saving it.
""" """
log.debug(u'cloneThemeData') log.debug(u'clone_theme_data')
save_to = None save_to = None
save_from = None save_from = None
if theme_data.background_type == u'image': if theme_data.background_type == u'image':
@ -290,10 +290,10 @@ class ThemeManager(QtGui.QWidget):
item = self.theme_list_widget.currentItem() item = self.theme_list_widget.currentItem()
theme = self.get_theme_data(item.data(QtCore.Qt.UserRole)) theme = self.get_theme_data(item.data(QtCore.Qt.UserRole))
if theme.background_type == u'image': if theme.background_type == u'image':
self.oldBackgroundImage = theme.background_filename self.old_background_image = theme.background_filename
self.themeForm.theme = theme self.theme_form.theme = theme
self.themeForm.exec_(True) self.theme_form.exec_(True)
self.oldBackgroundImage = None self.old_background_image = None
self.renderer.update_theme(theme.theme_name) self.renderer.update_theme(theme.theme_name)
self.load_themes() self.load_themes()
@ -324,7 +324,7 @@ class ThemeManager(QtGui.QWidget):
self.theme_list.remove(theme) self.theme_list.remove(theme)
thumb = u'%s.png' % theme thumb = u'%s.png' % theme
delete_file(os.path.join(self.path, thumb)) delete_file(os.path.join(self.path, thumb))
delete_file(os.path.join(self.thumbPath, thumb)) delete_file(os.path.join(self.thumb_path, thumb))
try: try:
encoding = get_filesystem_encoding() encoding = get_filesystem_encoding()
shutil.rmtree(os.path.join(self.path, theme).encode(encoding)) shutil.rmtree(os.path.join(self.path, theme).encode(encoding))
@ -370,9 +370,8 @@ class ThemeManager(QtGui.QWidget):
def on_import_theme(self): def on_import_theme(self):
""" """
Opens a file dialog to select the theme file(s) to import before Opens a file dialog to select the theme file(s) to import before attempting to extract OpenLP themes from
attempting to extract OpenLP themes from those files. This process those files. This process will load both OpenLP version 1 and version 2 themes.
will load both OpenLP version 1 and version 2 themes.
""" """
files = QtGui.QFileDialog.getOpenFileNames(self, files = QtGui.QFileDialog.getOpenFileNames(self,
translate('OpenLP.ThemeManager', 'Select Theme Import File'), translate('OpenLP.ThemeManager', 'Select Theme Import File'),
@ -405,7 +404,6 @@ class ThemeManager(QtGui.QWidget):
theme.theme_name = UiStrings().Default theme.theme_name = UiStrings().Default
self._write_theme(theme, None, None) self._write_theme(theme, None, None)
Settings().setValue(self.settingsSection + u'/global theme', theme.theme_name) Settings().setValue(self.settingsSection + u'/global theme', theme.theme_name)
self.config_updated()
self.application.set_normal_cursor() self.application.set_normal_cursor()
self.load_themes() self.load_themes()
@ -431,7 +429,7 @@ class ThemeManager(QtGui.QWidget):
name = translate('OpenLP.ThemeManager', '%s (default)') % text_name name = translate('OpenLP.ThemeManager', '%s (default)') % text_name
else: else:
name = text_name name = text_name
thumb = os.path.join(self.thumbPath, u'%s.png' % text_name) thumb = os.path.join(self.thumb_path, u'%s.png' % text_name)
item_name = QtGui.QListWidgetItem(name) item_name = QtGui.QListWidgetItem(name)
if validate_thumb(theme, thumb): if validate_thumb(theme, thumb):
icon = build_icon(thumb) icon = build_icon(thumb)
@ -504,8 +502,8 @@ class ThemeManager(QtGui.QWidget):
xml_tree = ElementTree(element=XML(theme_zip.read(xml_file[0]))).getroot() xml_tree = ElementTree(element=XML(theme_zip.read(xml_file[0]))).getroot()
v1_background = xml_tree.find(u'BackgroundType') v1_background = xml_tree.find(u'BackgroundType')
if v1_background is not None: if v1_background is not None:
theme_name, file_xml, out_file, abort_import = self.unzip_version_122( theme_name, file_xml, out_file, abort_import = \
directory, theme_zip, xml_file[0], xml_tree, v1_background, out_file) self.unzip_version_122(directory, theme_zip, xml_file[0], xml_tree, v1_background, out_file)
else: else:
theme_name = xml_tree.find(u'name').text.strip() theme_name = xml_tree.find(u'name').text.strip()
theme_folder = os.path.join(directory, theme_name) theme_folder = os.path.join(directory, theme_name)
@ -571,7 +569,7 @@ class ThemeManager(QtGui.QWidget):
this method, please keep in mind, that some parameters are redundant. this method, please keep in mind, that some parameters are redundant.
""" """
theme_name = xml_tree.find(u'Name').text.strip() theme_name = xml_tree.find(u'Name').text.strip()
theme_name = self.badV1NameChars.sub(u'', theme_name) theme_name = self.bad_v1_name_chars.sub(u'', theme_name)
theme_folder = os.path.join(dir_name, theme_name) theme_folder = os.path.join(dir_name, theme_name)
theme_exists = os.path.exists(theme_folder) theme_exists = os.path.exists(theme_folder)
if theme_exists and not self.over_write_message_box(theme_name): if theme_exists and not self.over_write_message_box(theme_name):
@ -634,8 +632,8 @@ class ThemeManager(QtGui.QWidget):
theme_dir = os.path.join(self.path, name) theme_dir = os.path.join(self.path, name)
check_directory_exists(theme_dir) check_directory_exists(theme_dir)
theme_file = os.path.join(theme_dir, name + u'.xml') theme_file = os.path.join(theme_dir, name + u'.xml')
if self.oldBackgroundImage and image_to != self.oldBackgroundImage: if self.old_background_image and image_to != self.old_background_image:
delete_file(self.oldBackgroundImage) delete_file(self.old_background_image)
out_file = None out_file = None
try: try:
out_file = open(theme_file, u'w') out_file = open(theme_file, u'w')
@ -663,7 +661,7 @@ class ThemeManager(QtGui.QWidget):
if os.path.exists(sample_path_name): if os.path.exists(sample_path_name):
os.unlink(sample_path_name) os.unlink(sample_path_name)
frame.save(sample_path_name, u'png') frame.save(sample_path_name, u'png')
thumb = os.path.join(self.thumbPath, u'%s.png' % name) thumb = os.path.join(self.thumb_path, u'%s.png' % name)
create_thumb(sample_path_name, thumb, False) create_thumb(sample_path_name, thumb, False)
log.debug(u'Theme image written to %s', sample_path_name) log.debug(u'Theme image written to %s', sample_path_name)
@ -672,11 +670,11 @@ class ThemeManager(QtGui.QWidget):
Called to update the themes' preview images. Called to update the themes' preview images.
""" """
log.debug('update_preview_images') log.debug('update_preview_images')
self.main_window.displayProgressBar(len(self.theme_list)) self.main_window.display_progress_bar(len(self.theme_list))
for theme in self.theme_list: for theme in self.theme_list:
self.main_window.increment_progress_bar() self.main_window.increment_progress_bar()
self.generate_and_save_image(self.path, theme, self.get_theme_data(theme)) self.generate_and_save_image(self.path, theme, self.get_theme_data(theme))
self.main_window.finishedProgressBar() self.main_window.finished_progress_bar()
self.load_themes() self.load_themes()
def generate_image(self, theme_data, forcePage=False): def generate_image(self, theme_data, forcePage=False):
@ -759,7 +757,7 @@ class ThemeManager(QtGui.QWidget):
""" """
theme = Theme(xml_data) theme = Theme(xml_data)
new_theme = ThemeXML() new_theme = ThemeXML()
new_theme.theme_name = self.badV1NameChars.sub(u'', theme.Name) new_theme.theme_name = self.bad_v1_name_chars.sub(u'', theme.Name)
if theme.BackgroundType == BackgroundType.Solid: if theme.BackgroundType == BackgroundType.Solid:
new_theme.background_type = BackgroundType.to_string(BackgroundType.Solid) new_theme.background_type = BackgroundType.to_string(BackgroundType.Solid)
new_theme.background_color = unicode(theme.BackgroundParameter1.name()) new_theme.background_color = unicode(theme.BackgroundParameter1.name())

View File

@ -44,9 +44,9 @@ class ThemesTab(SettingsTab):
""" """
Constructor Constructor
""" """
generalTranslated = translate('OpenLP.ThemesTab', 'Themes') self.icon_path = u':/themes/theme_new.png'
SettingsTab.__init__(self, parent, u'Themes', generalTranslated) theme_translated = translate('OpenLP.ThemesTab', 'Themes')
self.iconPath = u':/themes/theme_new.png' SettingsTab.__init__(self, parent, u'Themes', theme_translated)
def setupUi(self): def setupUi(self):
""" """
@ -54,74 +54,74 @@ class ThemesTab(SettingsTab):
""" """
self.setObjectName(u'ThemesTab') self.setObjectName(u'ThemesTab')
SettingsTab.setupUi(self) SettingsTab.setupUi(self)
self.GlobalGroupBox = QtGui.QGroupBox(self.leftColumn) self.global_group_box = QtGui.QGroupBox(self.left_column)
self.GlobalGroupBox.setObjectName(u'GlobalGroupBox') self.global_group_box.setObjectName(u'global_group_box')
self.GlobalGroupBoxLayout = QtGui.QVBoxLayout(self.GlobalGroupBox) self.global_group_box_layout = QtGui.QVBoxLayout(self.global_group_box)
self.GlobalGroupBoxLayout.setObjectName(u'GlobalGroupBoxLayout') self.global_group_box_layout.setObjectName(u'global_group_box_layout')
self.DefaultComboBox = QtGui.QComboBox(self.GlobalGroupBox) self.default_combo_box = QtGui.QComboBox(self.global_group_box)
self.DefaultComboBox.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToMinimumContentsLength) self.default_combo_box.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToMinimumContentsLength)
self.DefaultComboBox.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed) self.default_combo_box.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
self.DefaultComboBox.setObjectName(u'DefaultComboBox') self.default_combo_box.setObjectName(u'default_combo_box')
self.GlobalGroupBoxLayout.addWidget(self.DefaultComboBox) self.global_group_box_layout.addWidget(self.default_combo_box)
self.DefaultListView = QtGui.QLabel(self.GlobalGroupBox) self.default_list_view = QtGui.QLabel(self.global_group_box)
self.DefaultListView.setObjectName(u'DefaultListView') self.default_list_view.setObjectName(u'default_list_view')
self.GlobalGroupBoxLayout.addWidget(self.DefaultListView) self.global_group_box_layout.addWidget(self.default_list_view)
self.leftLayout.addWidget(self.GlobalGroupBox) self.left_layout.addWidget(self.global_group_box)
self.leftLayout.addStretch() self.left_layout.addStretch()
self.LevelGroupBox = QtGui.QGroupBox(self.rightColumn) self.level_group_box = QtGui.QGroupBox(self.right_column)
self.LevelGroupBox.setObjectName(u'LevelGroupBox') self.level_group_box.setObjectName(u'level_group_box')
self.LevelLayout = QtGui.QFormLayout(self.LevelGroupBox) self.level_layout = QtGui.QFormLayout(self.level_group_box)
self.LevelLayout.setLabelAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignTop) self.level_layout.setLabelAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignTop)
self.LevelLayout.setFormAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignTop) self.level_layout.setFormAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignTop)
self.LevelLayout.setObjectName(u'LevelLayout') self.level_layout.setObjectName(u'level_layout')
self.SongLevelRadioButton = QtGui.QRadioButton(self.LevelGroupBox) self.song_level_radio_button = QtGui.QRadioButton(self.level_group_box)
self.SongLevelRadioButton.setObjectName(u'SongLevelRadioButton') self.song_level_radio_button.setObjectName(u'song_level_radio_button')
self.SongLevelLabel = QtGui.QLabel(self.LevelGroupBox) self.song_level_label = QtGui.QLabel(self.level_group_box)
self.SongLevelLabel.setObjectName(u'SongLevelLabel') self.song_level_label.setObjectName(u'song_level_label')
self.LevelLayout.addRow(self.SongLevelRadioButton, self.SongLevelLabel) self.level_layout.addRow(self.song_level_radio_button, self.song_level_label)
self.ServiceLevelRadioButton = QtGui.QRadioButton(self.LevelGroupBox) self.service_level_radio_button = QtGui.QRadioButton(self.level_group_box)
self.ServiceLevelRadioButton.setObjectName(u'ServiceLevelRadioButton') self.service_level_radio_button.setObjectName(u'service_level_radio_button')
self.ServiceLevelLabel = QtGui.QLabel(self.LevelGroupBox) self.service_level_label = QtGui.QLabel(self.level_group_box)
self.ServiceLevelLabel.setObjectName(u'ServiceLevelLabel') self.service_level_label.setObjectName(u'service_level_label')
self.LevelLayout.addRow(self.ServiceLevelRadioButton, self.ServiceLevelLabel) self.level_layout.addRow(self.service_level_radio_button, self.service_level_label)
self.GlobalLevelRadioButton = QtGui.QRadioButton(self.LevelGroupBox) self.global_level_radio_button = QtGui.QRadioButton(self.level_group_box)
self.GlobalLevelRadioButton.setObjectName(u'GlobalLevelRadioButton') self.global_level_radio_button.setObjectName(u'global_level_radio_button')
self.GlobalLevelLabel = QtGui.QLabel(self.LevelGroupBox) self.global_level_label = QtGui.QLabel(self.level_group_box)
self.GlobalLevelLabel.setObjectName(u'GlobalLevelLabel') self.global_level_label.setObjectName(u'global_level_label')
self.LevelLayout.addRow(self.GlobalLevelRadioButton, self.GlobalLevelLabel) self.level_layout.addRow(self.global_level_radio_button, self.global_level_label)
label_top_margin = (self.SongLevelRadioButton.sizeHint().height() - label_top_margin = (self.song_level_radio_button.sizeHint().height() -
self.SongLevelLabel.sizeHint().height()) / 2 self.song_level_label.sizeHint().height()) / 2
for label in [self.SongLevelLabel, self.ServiceLevelLabel, self.GlobalLevelLabel]: for label in [self.song_level_label, self.service_level_label, self.global_level_label]:
rect = label.rect() rect = label.rect()
rect.setTop(rect.top() + label_top_margin) rect.setTop(rect.top() + label_top_margin)
label.setFrameRect(rect) label.setFrameRect(rect)
label.setWordWrap(True) label.setWordWrap(True)
self.rightLayout.addWidget(self.LevelGroupBox) self.right_layout.addWidget(self.level_group_box)
self.rightLayout.addStretch() self.right_layout.addStretch()
self.SongLevelRadioButton.clicked.connect(self.onSongLevelButtonClicked) self.song_level_radio_button.clicked.connect(self.on_song_level_button_clicked)
self.ServiceLevelRadioButton.clicked.connect(self.onServiceLevelButtonClicked) self.service_level_radio_button.clicked.connect(self.on_service_level_button_clicked)
self.GlobalLevelRadioButton.clicked.connect(self.onGlobalLevelButtonClicked) self.global_level_radio_button.clicked.connect(self.on_global_level_button_clicked)
self.DefaultComboBox.activated.connect(self.onDefaultComboBoxChanged) self.default_combo_box.activated.connect(self.on_default_combo_box_changed)
Registry().register_function(u'theme_update_list', self.update_theme_list) Registry().register_function(u'theme_update_list', self.update_theme_list)
def retranslateUi(self): def retranslateUi(self):
""" """
Translate the UI on the fly Translate the UI on the fly
""" """
self.tabTitleVisible = UiStrings().Themes self.tab_title_visible = UiStrings().Themes
self.GlobalGroupBox.setTitle(translate('OpenLP.ThemesTab', 'Global Theme')) self.global_group_box.setTitle(translate('OpenLP.ThemesTab', 'Global Theme'))
self.LevelGroupBox.setTitle(translate('OpenLP.ThemesTab', 'Theme Level')) self.level_group_box.setTitle(translate('OpenLP.ThemesTab', 'Theme Level'))
self.SongLevelRadioButton.setText(translate('OpenLP.ThemesTab', 'S&ong Level')) self.song_level_radio_button.setText(translate('OpenLP.ThemesTab', 'S&ong Level'))
self.SongLevelLabel.setText(translate('OpenLP.ThemesTab', 'Use the theme from each song ' self.song_level_label.setText(translate('OpenLP.ThemesTab', 'Use the theme from each song '
'in the database. If a song doesn\'t have a theme associated with ' '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 ' 'it, then use the service\'s theme. If the service doesn\'t have '
'a theme, then use the global theme.')) 'a theme, then use the global theme.'))
self.ServiceLevelRadioButton.setText(translate('OpenLP.ThemesTab', '&Service Level')) self.service_level_radio_button.setText(translate('OpenLP.ThemesTab', '&Service Level'))
self.ServiceLevelLabel.setText(translate('OpenLP.ThemesTab', 'Use the theme from the service, ' self.service_level_label.setText(translate('OpenLP.ThemesTab', 'Use the theme from the service, '
'overriding any of the individual songs\' themes. If the ' 'overriding any of the individual songs\' themes. If the '
'service doesn\'t have a theme, then use the global theme.')) 'service doesn\'t have a theme, then use the global theme.'))
self.GlobalLevelRadioButton.setText(translate('OpenLP.ThemesTab', '&Global Level')) self.global_level_radio_button.setText(translate('OpenLP.ThemesTab', '&Global Level'))
self.GlobalLevelLabel.setText(translate('OpenLP.ThemesTab', 'Use the global theme, overriding ' self.global_level_label.setText(translate('OpenLP.ThemesTab', 'Use the global theme, overriding '
'any themes associated with either the service or the songs.')) 'any themes associated with either the service or the songs.'))
def load(self): def load(self):
@ -129,29 +129,30 @@ class ThemesTab(SettingsTab):
Load the theme settings into the tab Load the theme settings into the tab
""" """
settings = Settings() settings = Settings()
settings.beginGroup(self.settingsSection) settings.beginGroup(self.settings_section)
self.theme_level = settings.value(u'theme level') self.theme_level = settings.value(u'theme level')
self.global_theme = settings.value(u'global theme') self.global_theme = settings.value(u'global theme')
settings.endGroup() settings.endGroup()
if self.theme_level == ThemeLevel.Global: if self.theme_level == ThemeLevel.Global:
self.GlobalLevelRadioButton.setChecked(True) self.global_level_radio_button.setChecked(True)
elif self.theme_level == ThemeLevel.Service: elif self.theme_level == ThemeLevel.Service:
self.ServiceLevelRadioButton.setChecked(True) self.service_level_radio_button.setChecked(True)
else: else:
self.SongLevelRadioButton.setChecked(True) self.song_level_radio_button.setChecked(True)
def save(self): def save(self):
""" """
Save the settings Save the settings
""" """
settings = Settings() settings = Settings()
settings.beginGroup(self.settingsSection) settings.beginGroup(self.settings_section)
settings.setValue(u'theme level', self.theme_level) settings.setValue(u'theme level', self.theme_level)
settings.setValue(u'global theme', self.global_theme) settings.setValue(u'global theme', self.global_theme)
settings.endGroup() settings.endGroup()
self.renderer.set_global_theme(self.global_theme)
self.renderer.set_theme_level(self.theme_level) self.renderer.set_theme_level(self.theme_level)
self.settings_form.register_post_process(u'theme_update_global') if self.tab_visited:
self.settings_form.register_post_process(u'theme_update_global')
self.tab_visited = False
def post_set_up(self): def post_set_up(self):
""" """
@ -159,31 +160,31 @@ class ThemesTab(SettingsTab):
""" """
Registry().execute(u'theme_update_global') Registry().execute(u'theme_update_global')
def onSongLevelButtonClicked(self): def on_song_level_button_clicked(self):
""" """
Set the theme level Set the theme level
""" """
self.theme_level = ThemeLevel.Song self.theme_level = ThemeLevel.Song
def onServiceLevelButtonClicked(self): def on_service_level_button_clicked(self):
""" """
Set the theme level Set the theme level
""" """
self.theme_level = ThemeLevel.Service self.theme_level = ThemeLevel.Service
def onGlobalLevelButtonClicked(self): def on_global_level_button_clicked(self):
""" """
Set the theme level Set the theme level
""" """
self.theme_level = ThemeLevel.Global self.theme_level = ThemeLevel.Global
def onDefaultComboBoxChanged(self, value): def on_default_combo_box_changed(self, value):
""" """
Set the global default theme Set the global default theme
""" """
self.global_theme = self.DefaultComboBox.currentText() self.global_theme = self.default_combo_box.currentText()
self.renderer.set_global_theme(self.global_theme) self.renderer.set_global_theme()
self.__previewGlobalTheme() self._previewGlobalTheme()
def update_theme_list(self, theme_list): def update_theme_list(self, theme_list):
""" """
@ -195,16 +196,16 @@ class ThemesTab(SettingsTab):
[u'Bible Theme', u'Song Theme'] [u'Bible Theme', u'Song Theme']
""" """
# Reload as may have been triggered by the ThemeManager. # Reload as may have been triggered by the ThemeManager.
self.global_theme = Settings().value(self.settingsSection + u'/global theme') self.global_theme = Settings().value(self.settings_section + u'/global theme')
self.DefaultComboBox.clear() self.default_combo_box.clear()
self.DefaultComboBox.addItems(theme_list) self.default_combo_box.addItems(theme_list)
find_and_set_in_combo_box(self.DefaultComboBox, self.global_theme) find_and_set_in_combo_box(self.default_combo_box, self.global_theme)
self.renderer.set_global_theme(self.global_theme) self.renderer.set_global_theme()
self.renderer.set_theme_level(self.theme_level) self.renderer.set_theme_level(self.theme_level)
if self.global_theme is not u'': if self.global_theme is not u'':
self.__previewGlobalTheme() self._preview_global_theme()
def __previewGlobalTheme(self): def _preview_global_theme(self):
""" """
Utility method to update the global theme preview image. Utility method to update the global theme preview image.
""" """
@ -212,4 +213,4 @@ class ThemesTab(SettingsTab):
preview = QtGui.QPixmap(unicode(image)) preview = QtGui.QPixmap(unicode(image))
if not preview.isNull(): if not preview.isNull():
preview = preview.scaled(300, 255, QtCore.Qt.KeepAspectRatio, QtCore.Qt.SmoothTransformation) preview = preview.scaled(300, 255, QtCore.Qt.KeepAspectRatio, QtCore.Qt.SmoothTransformation)
self.DefaultListView.setPixmap(preview) self.default_list_view.setPixmap(preview)

View File

@ -210,7 +210,7 @@ class AlertsPlugin(Plugin):
""" """
align = VerticalType.Names[self.settingsTab.location] align = VerticalType.Names[self.settingsTab.location]
return CSS % (align, self.settingsTab.font_face, self.settingsTab.font_size, self.settingsTab.font_color, return CSS % (align, self.settingsTab.font_face, self.settingsTab.font_size, self.settingsTab.font_color,
self.settingsTab.bg_color) self.settingsTab.background_color)
def getDisplayHtml(self): def getDisplayHtml(self):
""" """
@ -228,4 +228,4 @@ class AlertsPlugin(Plugin):
align = VerticalType.Names[self.settingsTab.location] align = VerticalType.Names[self.settingsTab.location]
frame.evaluateJavaScript(u'update_css("%s", "%s", "%s", "%s", "%s")' % frame.evaluateJavaScript(u'update_css("%s", "%s", "%s", "%s", "%s")' %
(align, self.settingsTab.font_face, self.settingsTab.font_size, (align, self.settingsTab.font_face, self.settingsTab.font_size,
self.settingsTab.font_color, self.settingsTab.bg_color)) self.settingsTab.font_color, self.settingsTab.background_color))

View File

@ -43,145 +43,145 @@ class AlertsTab(SettingsTab):
def setupUi(self): def setupUi(self):
self.setObjectName(u'AlertsTab') self.setObjectName(u'AlertsTab')
SettingsTab.setupUi(self) SettingsTab.setupUi(self)
self.fontGroupBox = QtGui.QGroupBox(self.leftColumn) self.font_group_box = QtGui.QGroupBox(self.left_column)
self.fontGroupBox.setObjectName(u'fontGroupBox') self.font_group_box.setObjectName(u'font_group_box')
self.fontLayout = QtGui.QFormLayout(self.fontGroupBox) self.font_layout = QtGui.QFormLayout(self.font_group_box)
self.fontLayout.setObjectName(u'fontLayout') self.font_layout.setObjectName(u'font_layout')
self.fontLabel = QtGui.QLabel(self.fontGroupBox) self.font_label = QtGui.QLabel(self.font_group_box)
self.fontLabel.setObjectName(u'fontLabel') self.font_label.setObjectName(u'font_label')
self.fontComboBox = QtGui.QFontComboBox(self.fontGroupBox) self.font_combo_box = QtGui.QFontComboBox(self.font_group_box)
self.fontComboBox.setObjectName(u'fontComboBox') self.font_combo_box.setObjectName(u'font_combo_box')
self.fontLayout.addRow(self.fontLabel, self.fontComboBox) self.font_layout.addRow(self.font_label, self.font_combo_box)
self.fontColorLabel = QtGui.QLabel(self.fontGroupBox) self.font_color_label = QtGui.QLabel(self.font_group_box)
self.fontColorLabel.setObjectName(u'fontColorLabel') self.font_color_label.setObjectName(u'font_color_label')
self.colorLayout = QtGui.QHBoxLayout() self.color_layout = QtGui.QHBoxLayout()
self.colorLayout.setObjectName(u'colorLayout') self.color_layout.setObjectName(u'color_layout')
self.fontColorButton = QtGui.QPushButton(self.fontGroupBox) self.font_color_button = QtGui.QPushButton(self.font_group_box)
self.fontColorButton.setObjectName(u'fontColorButton') self.font_color_button.setObjectName(u'font_color_button')
self.colorLayout.addWidget(self.fontColorButton) self.color_layout.addWidget(self.font_color_button)
self.colorLayout.addSpacing(20) self.color_layout.addSpacing(20)
self.backgroundColorLabel = QtGui.QLabel(self.fontGroupBox) self.background_color_label = QtGui.QLabel(self.font_group_box)
self.backgroundColorLabel.setObjectName(u'backgroundColorLabel') self.background_color_label.setObjectName(u'background_color_label')
self.colorLayout.addWidget(self.backgroundColorLabel) self.color_layout.addWidget(self.background_color_label)
self.backgroundColorButton = QtGui.QPushButton(self.fontGroupBox) self.background_color_button = QtGui.QPushButton(self.font_group_box)
self.backgroundColorButton.setObjectName(u'backgroundColorButton') self.background_color_button.setObjectName(u'background_color_button')
self.colorLayout.addWidget(self.backgroundColorButton) self.color_layout.addWidget(self.background_color_button)
self.fontLayout.addRow(self.fontColorLabel, self.colorLayout) self.font_layout.addRow(self.font_color_label, self.color_layout)
self.fontSizeLabel = QtGui.QLabel(self.fontGroupBox) self.font_size_label = QtGui.QLabel(self.font_group_box)
self.fontSizeLabel.setObjectName(u'fontSizeLabel') self.font_size_label.setObjectName(u'font_size_label')
self.fontSizeSpinBox = QtGui.QSpinBox(self.fontGroupBox) self.font_size_spin_box = QtGui.QSpinBox(self.font_group_box)
self.fontSizeSpinBox.setObjectName(u'fontSizeSpinBox') self.font_size_spin_box.setObjectName(u'font_size_spin_box')
self.fontLayout.addRow(self.fontSizeLabel, self.fontSizeSpinBox) self.font_layout.addRow(self.font_size_label, self.font_size_spin_box)
self.timeoutLabel = QtGui.QLabel(self.fontGroupBox) self.timeout_label = QtGui.QLabel(self.font_group_box)
self.timeoutLabel.setObjectName(u'timeoutLabel') self.timeout_label.setObjectName(u'timeout_label')
self.timeoutSpinBox = QtGui.QSpinBox(self.fontGroupBox) self.timeout_spin_box = QtGui.QSpinBox(self.font_group_box)
self.timeoutSpinBox.setMaximum(180) self.timeout_spin_box.setMaximum(180)
self.timeoutSpinBox.setObjectName(u'timeoutSpinBox') self.timeout_spin_box.setObjectName(u'timeout_spin_box')
self.fontLayout.addRow(self.timeoutLabel, self.timeoutSpinBox) self.font_layout.addRow(self.timeout_label, self.timeout_spin_box)
self.verticalLabel, self.verticalComboBox = create_valign_selection_widgets(self.fontGroupBox) self.vertical_label, self.vertical_combo_box = create_valign_selection_widgets(self.font_group_box)
self.verticalLabel.setObjectName(u'verticalLabel') self.vertical_label.setObjectName(u'vertical_label')
self.verticalComboBox.setObjectName(u'verticalComboBox') self.vertical_combo_box.setObjectName(u'vertical_combo_box')
self.fontLayout.addRow(self.verticalLabel, self.verticalComboBox) self.font_layout.addRow(self.vertical_label, self.vertical_combo_box)
self.leftLayout.addWidget(self.fontGroupBox) self.left_layout.addWidget(self.font_group_box)
self.leftLayout.addStretch() self.left_layout.addStretch()
self.previewGroupBox = QtGui.QGroupBox(self.rightColumn) self.preview_group_box = QtGui.QGroupBox(self.right_column)
self.previewGroupBox.setObjectName(u'previewGroupBox') self.preview_group_box.setObjectName(u'preview_group_box')
self.previewLayout = QtGui.QVBoxLayout(self.previewGroupBox) self.preview_layout = QtGui.QVBoxLayout(self.preview_group_box)
self.previewLayout.setObjectName(u'previewLayout') self.preview_layout.setObjectName(u'preview_layout')
self.fontPreview = QtGui.QLineEdit(self.previewGroupBox) self.font_preview = QtGui.QLineEdit(self.preview_group_box)
self.fontPreview.setObjectName(u'fontPreview') self.font_preview.setObjectName(u'font_preview')
self.previewLayout.addWidget(self.fontPreview) self.preview_layout.addWidget(self.font_preview)
self.rightLayout.addWidget(self.previewGroupBox) self.right_layout.addWidget(self.preview_group_box)
self.rightLayout.addStretch() self.right_layout.addStretch()
# Signals and slots # Signals and slots
self.backgroundColorButton.clicked.connect(self.onBackgroundColorButtonClicked) self.background_color_button.clicked.connect(self.on_background_color_button_clicked)
self.fontColorButton.clicked.connect(self.onFontColorButtonClicked) self.font_color_button.clicked.connect(self.on_font_color_button_clicked)
self.fontComboBox.activated.connect(self.onFontComboBoxClicked) self.font_combo_box.activated.connect(self.on_font_combo_box_clicked)
self.timeoutSpinBox.valueChanged.connect(self.onTimeoutSpinBoxChanged) self.timeout_spin_box.valueChanged.connect(self.on_timeout_spin_box_changed)
self.fontSizeSpinBox.valueChanged.connect(self.onFontSizeSpinBoxChanged) self.font_size_spin_box.valueChanged.connect(self.on_font_size_spin_box_changed)
def retranslateUi(self): def retranslateUi(self):
self.fontGroupBox.setTitle(translate('AlertsPlugin.AlertsTab', 'Font')) self.font_group_box.setTitle(translate('AlertsPlugin.AlertsTab', 'Font'))
self.fontLabel.setText(translate('AlertsPlugin.AlertsTab', 'Font name:')) self.font_label.setText(translate('AlertsPlugin.AlertsTab', 'Font name:'))
self.fontColorLabel.setText(translate('AlertsPlugin.AlertsTab', 'Font color:')) self.font_color_label.setText(translate('AlertsPlugin.AlertsTab', 'Font color:'))
self.backgroundColorLabel.setText(translate('AlertsPlugin.AlertsTab', 'Background color:')) self.background_color_label.setText(translate('AlertsPlugin.AlertsTab', 'Background color:'))
self.fontSizeLabel.setText(translate('AlertsPlugin.AlertsTab', 'Font size:')) self.font_size_label.setText(translate('AlertsPlugin.AlertsTab', 'Font size:'))
self.fontSizeSpinBox.setSuffix(UiStrings().FontSizePtUnit) self.font_size_spin_box.setSuffix(UiStrings().FontSizePtUnit)
self.timeoutLabel.setText(translate('AlertsPlugin.AlertsTab', 'Alert timeout:')) self.timeout_label.setText(translate('AlertsPlugin.AlertsTab', 'Alert timeout:'))
self.timeoutSpinBox.setSuffix(UiStrings().Seconds) self.timeout_spin_box.setSuffix(UiStrings().Seconds)
self.previewGroupBox.setTitle(UiStrings().Preview) self.preview_group_box.setTitle(UiStrings().Preview)
self.fontPreview.setText(UiStrings().OLPV2x) self.font_preview.setText(UiStrings().OLPV2x)
def onBackgroundColorButtonClicked(self): def on_background_color_button_clicked(self):
new_color = QtGui.QColorDialog.getColor(QtGui.QColor(self.bg_color), self) new_color = QtGui.QColorDialog.getColor(QtGui.QColor(self.background_color), self)
if new_color.isValid(): if new_color.isValid():
self.bg_color = new_color.name() self.background_color = new_color.name()
self.backgroundColorButton.setStyleSheet(u'background-color: %s' % self.bg_color) self.background_color_button.setStyleSheet(u'background-color: %s' % self.background_color)
self.updateDisplay() self.update_display()
def onFontComboBoxClicked(self): def on_font_combo_box_clicked(self):
self.updateDisplay() self.update_display()
def onFontColorButtonClicked(self): def on_font_color_button_clicked(self):
new_color = QtGui.QColorDialog.getColor(QtGui.QColor(self.font_color), self) new_color = QtGui.QColorDialog.getColor(QtGui.QColor(self.font_color), self)
if new_color.isValid(): if new_color.isValid():
self.font_color = new_color.name() self.font_color = new_color.name()
self.fontColorButton.setStyleSheet(u'background-color: %s' % self.font_color) self.font_color_button.setStyleSheet(u'background-color: %s' % self.font_color)
self.updateDisplay() self.update_display()
def onTimeoutSpinBoxChanged(self): def on_timeout_spin_box_changed(self):
self.timeout = self.timeoutSpinBox.value() self.timeout = self.timeout_spin_box.value()
self.changed = True self.changed = True
def onFontSizeSpinBoxChanged(self): def on_font_size_spin_box_changed(self):
self.font_size = self.fontSizeSpinBox.value() self.font_size = self.font_size_spin_box.value()
self.updateDisplay() self.update_display()
def load(self): def load(self):
settings = Settings() settings = Settings()
settings.beginGroup(self.settingsSection) settings.beginGroup(self.settings_section)
self.timeout = settings.value(u'timeout') self.timeout = settings.value(u'timeout')
self.font_color = settings.value(u'font color') self.font_color = settings.value(u'font color')
self.font_size = settings.value(u'font size') self.font_size = settings.value(u'font size')
self.bg_color = settings.value(u'background color') self.background_color = settings.value(u'background color')
self.font_face = settings.value(u'font face') self.font_face = settings.value(u'font face')
self.location = settings.value(u'location') self.location = settings.value(u'location')
settings.endGroup() settings.endGroup()
self.fontSizeSpinBox.setValue(self.font_size) self.font_size_spin_box.setValue(self.font_size)
self.timeoutSpinBox.setValue(self.timeout) self.timeout_spin_box.setValue(self.timeout)
self.fontColorButton.setStyleSheet(u'background-color: %s' % self.font_color) self.font_color_button.setStyleSheet(u'background-color: %s' % self.font_color)
self.backgroundColorButton.setStyleSheet(u'background-color: %s' % self.bg_color) self.background_color_button.setStyleSheet(u'background-color: %s' % self.background_color)
self.verticalComboBox.setCurrentIndex(self.location) self.vertical_combo_box.setCurrentIndex(self.location)
font = QtGui.QFont() font = QtGui.QFont()
font.setFamily(self.font_face) font.setFamily(self.font_face)
self.fontComboBox.setCurrentFont(font) self.font_combo_box.setCurrentFont(font)
self.updateDisplay() self.update_display()
self.changed = False self.changed = False
def save(self): def save(self):
settings = Settings() settings = Settings()
settings.beginGroup(self.settingsSection) settings.beginGroup(self.settings_section)
# Check value has changed as no event handles this field # Check value has changed as no event handles this field
if settings.value(u'location') != self.verticalComboBox.currentIndex(): if settings.value(u'location') != self.vertical_combo_box.currentIndex():
self.changed = True self.changed = True
settings.setValue(u'background color', self.bg_color) settings.setValue(u'background color', self.background_color)
settings.setValue(u'font color', self.font_color) settings.setValue(u'font color', self.font_color)
settings.setValue(u'font size', self.font_size) settings.setValue(u'font size', self.font_size)
self.font_face = self.fontComboBox.currentFont().family() self.font_face = self.font_combo_box.currentFont().family()
settings.setValue(u'font face', self.font_face) settings.setValue(u'font face', self.font_face)
settings.setValue(u'timeout', self.timeout) settings.setValue(u'timeout', self.timeout)
self.location = self.verticalComboBox.currentIndex() self.location = self.vertical_combo_box.currentIndex()
settings.setValue(u'location', self.location) settings.setValue(u'location', self.location)
settings.endGroup() settings.endGroup()
if self.changed: if self.changed:
self.settings_form.register_post_process(u'update_display_css') self.settings_form.register_post_process(u'update_display_css')
self.changed = False self.changed = False
def updateDisplay(self): def update_display(self):
font = QtGui.QFont() font = QtGui.QFont()
font.setFamily(self.fontComboBox.currentFont().family()) font.setFamily(self.font_combo_box.currentFont().family())
font.setBold(True) font.setBold(True)
font.setPointSize(self.font_size) font.setPointSize(self.font_size)
self.fontPreview.setFont(font) self.font_preview.setFont(font)
self.fontPreview.setStyleSheet(u'background-color: %s; color: %s' % (self.bg_color, self.font_color)) self.font_preview.setStyleSheet(u'background-color: %s; color: %s' % (self.background_color, self.font_color))
self.changed = True self.changed = True

View File

@ -38,13 +38,14 @@ from openlp.plugins.bibles.lib import LayoutStyle, DisplayStyle, update_referenc
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
class BiblesTab(SettingsTab): class BiblesTab(SettingsTab):
""" """
BiblesTab is the Bibles settings tab in the settings dialog. BiblesTab is the Bibles settings tab in the settings dialog.
""" """
log.info(u'Bible Tab loaded') log.info(u'Bible Tab loaded')
def __init__(self, parent, title, visible_title, icon_path): def _init_(self, parent, title, visible_title, icon_path):
self.paragraph_style = True self.paragraph_style = True
self.show_new_chapters = False self.show_new_chapters = False
self.display_style = 0 self.display_style = 0
@ -53,331 +54,332 @@ class BiblesTab(SettingsTab):
def setupUi(self): def setupUi(self):
self.setObjectName(u'BiblesTab') self.setObjectName(u'BiblesTab')
SettingsTab.setupUi(self) SettingsTab.setupUi(self)
self.verseDisplayGroupBox = QtGui.QGroupBox(self.leftColumn) self.verse_display_group_box = QtGui.QGroupBox(self.left_column)
self.verseDisplayGroupBox.setObjectName(u'verseDisplayGroupBox') self.verse_display_group_box.setObjectName(u'verse_display_group_box')
self.verseDisplayLayout = QtGui.QFormLayout(self.verseDisplayGroupBox) self.verse_display_layout = QtGui.QFormLayout(self.verse_display_group_box)
self.verseDisplayLayout.setObjectName(u'verseDisplayLayout') self.verse_display_layout.setObjectName(u'verse_display_layout')
self.newChaptersCheckBox = QtGui.QCheckBox(self.verseDisplayGroupBox) self.new_chapters_check_box = QtGui.QCheckBox(self.verse_display_group_box)
self.newChaptersCheckBox.setObjectName(u'newChaptersCheckBox') self.new_chapters_check_box.setObjectName(u'new_chapters_check_box')
self.verseDisplayLayout.addRow(self.newChaptersCheckBox) self.verse_display_layout.addRow(self.new_chapters_check_box)
self.displayStyleLabel = QtGui.QLabel(self.verseDisplayGroupBox) self.display_style_label = QtGui.QLabel(self.verse_display_group_box)
self.displayStyleLabel.setObjectName(u'displayStyleLabel') self.display_style_label.setObjectName(u'display_style_label')
self.displayStyleComboBox = QtGui.QComboBox(self.verseDisplayGroupBox) self.display_style_combo_box = QtGui.QComboBox(self.verse_display_group_box)
self.displayStyleComboBox.addItems([u'', u'', u'', u'']) self.display_style_combo_box.addItems([u'', u'', u'', u''])
self.displayStyleComboBox.setObjectName(u'displayStyleComboBox') self.display_style_combo_box.setObjectName(u'display_style_combo_box')
self.verseDisplayLayout.addRow(self.displayStyleLabel, self.displayStyleComboBox) self.verse_display_layout.addRow(self.display_style_label, self.display_style_combo_box)
self.layoutStyleLabel = QtGui.QLabel(self.verseDisplayGroupBox) self.layout_style_label = QtGui.QLabel(self.verse_display_group_box)
self.layoutStyleLabel.setObjectName(u'layoutStyleLabel') self.layout_style_label.setObjectName(u'layout_style_label')
self.layoutStyleComboBox = QtGui.QComboBox(self.verseDisplayGroupBox) self.layout_style_combo_box = QtGui.QComboBox(self.verse_display_group_box)
self.layoutStyleComboBox.setObjectName(u'layoutStyleComboBox') self.layout_style_combo_box.setObjectName(u'layout_style_combo_box')
self.layoutStyleComboBox.addItems([u'', u'', u'']) self.layout_style_combo_box.addItems([u'', u'', u''])
self.verseDisplayLayout.addRow(self.layoutStyleLabel, self.layoutStyleComboBox) self.verse_display_layout.addRow(self.layout_style_label, self.layout_style_combo_box)
self.bibleSecondCheckBox = QtGui.QCheckBox(self.verseDisplayGroupBox) self.bible_second_check_box = QtGui.QCheckBox(self.verse_display_group_box)
self.bibleSecondCheckBox.setObjectName(u'bibleSecondCheckBox') self.bible_second_check_box.setObjectName(u'bible_second_check_box')
self.verseDisplayLayout.addRow(self.bibleSecondCheckBox) self.verse_display_layout.addRow(self.bible_second_check_box)
self.bibleThemeLabel = QtGui.QLabel(self.verseDisplayGroupBox) self.bible_theme_label = QtGui.QLabel(self.verse_display_group_box)
self.bibleThemeLabel.setObjectName(u'BibleThemeLabel') self.bible_theme_label.setObjectName(u'BibleTheme_label')
self.bibleThemeComboBox = QtGui.QComboBox(self.verseDisplayGroupBox) self.bible_theme_combo_box = QtGui.QComboBox(self.verse_display_group_box)
self.bibleThemeComboBox.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToMinimumContentsLength) self.bible_theme_combo_box.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToMinimumContentsLength)
self.bibleThemeComboBox.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed) self.bible_theme_combo_box.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
self.bibleThemeComboBox.addItem(u'') self.bible_theme_combo_box.addItem(u'')
self.bibleThemeComboBox.setObjectName(u'BibleThemeComboBox') self.bible_theme_combo_box.setObjectName(u'BibleThemecombo_box')
self.verseDisplayLayout.addRow(self.bibleThemeLabel, self.bibleThemeComboBox) self.verse_display_layout.addRow(self.bible_theme_label, self.bible_theme_combo_box)
self.changeNoteLabel = QtGui.QLabel(self.verseDisplayGroupBox) self.change_note_label = QtGui.QLabel(self.verse_display_group_box)
self.changeNoteLabel.setWordWrap(True) self.change_note_label.setWordWrap(True)
self.changeNoteLabel.setObjectName(u'changeNoteLabel') self.change_note_label.setObjectName(u'change_note_label')
self.verseDisplayLayout.addRow(self.changeNoteLabel) self.verse_display_layout.addRow(self.change_note_label)
self.leftLayout.addWidget(self.verseDisplayGroupBox) self.left_layout.addWidget(self.verse_display_group_box)
self.scriptureReferenceGroupBox = QtGui.QGroupBox(self.leftColumn) self.scripture_reference_group_box = QtGui.QGroupBox(self.left_column)
self.scriptureReferenceGroupBox.setObjectName(u'scriptureReferenceGroupBox') self.scripture_reference_group_box.setObjectName(u'scripture_reference_group_box')
self.scriptureReferenceLayout = QtGui.QGridLayout(self.scriptureReferenceGroupBox) self.scripture_reference_layout = QtGui.QGridLayout(self.scripture_reference_group_box)
self.verseSeparatorCheckBox = QtGui.QCheckBox(self.scriptureReferenceGroupBox) self.verse_separator_check_box = QtGui.QCheckBox(self.scripture_reference_group_box)
self.verseSeparatorCheckBox.setObjectName(u'verseSeparatorCheckBox') self.verse_separator_check_box.setObjectName(u'verse_separator_check_box')
self.scriptureReferenceLayout.addWidget(self.verseSeparatorCheckBox, 0, 0) self.scripture_reference_layout.addWidget(self.verse_separator_check_box, 0, 0)
self.verseSeparatorLineEdit = QtGui.QLineEdit(self.scriptureReferenceGroupBox) self.verse_separator_line_edit = QtGui.QLineEdit(self.scripture_reference_group_box)
# self.verseSeparatorLineEdit.setPalette self.verse_separator_line_edit.setObjectName(u'verse_separator_line_edit')
self.verseSeparatorLineEdit.setObjectName(u'verseSeparatorLineEdit') self.scripture_reference_layout.addWidget(self.verse_separator_line_edit, 0, 1)
self.scriptureReferenceLayout.addWidget(self.verseSeparatorLineEdit, 0, 1) self.range_separator_check_box = QtGui.QCheckBox(self.scripture_reference_group_box)
self.rangeSeparatorCheckBox = QtGui.QCheckBox(self.scriptureReferenceGroupBox) self.range_separator_check_box.setObjectName(u'range_separator_check_box')
self.rangeSeparatorCheckBox.setObjectName(u'rangeSeparatorCheckBox') self.scripture_reference_layout.addWidget(self.range_separator_check_box, 1, 0)
self.scriptureReferenceLayout.addWidget(self.rangeSeparatorCheckBox, 1, 0) self.range_separator_line_edit = QtGui.QLineEdit(self.scripture_reference_group_box)
self.rangeSeparatorLineEdit = QtGui.QLineEdit(self.scriptureReferenceGroupBox) self.range_separator_line_edit.setObjectName(u'range_separator_line_edit')
self.rangeSeparatorLineEdit.setObjectName(u'rangeSeparatorLineEdit') self.scripture_reference_layout.addWidget(self.range_separator_line_edit, 1, 1)
self.scriptureReferenceLayout.addWidget(self.rangeSeparatorLineEdit, 1, 1) self.list_separator_check_box = QtGui.QCheckBox(self.scripture_reference_group_box)
self.listSeparatorCheckBox = QtGui.QCheckBox(self.scriptureReferenceGroupBox) self.list_separator_check_box.setObjectName(u'list_separator_check_box')
self.listSeparatorCheckBox.setObjectName(u'listSeparatorCheckBox') self.scripture_reference_layout.addWidget(self.list_separator_check_box, 2, 0)
self.scriptureReferenceLayout.addWidget(self.listSeparatorCheckBox, 2, 0) self.list_separator_line_edit = QtGui.QLineEdit(self.scripture_reference_group_box)
self.listSeparatorLineEdit = QtGui.QLineEdit(self.scriptureReferenceGroupBox) self.list_separator_line_edit.setObjectName(u'list_separator_line_edit')
self.listSeparatorLineEdit.setObjectName(u'listSeparatorLineEdit') self.scripture_reference_layout.addWidget(self.list_separator_line_edit, 2, 1)
self.scriptureReferenceLayout.addWidget(self.listSeparatorLineEdit, 2, 1) self.end_separator_check_box = QtGui.QCheckBox(self.scripture_reference_group_box)
self.endSeparatorCheckBox = QtGui.QCheckBox(self.scriptureReferenceGroupBox) self.end_separator_check_box.setObjectName(u'end_separator_check_box')
self.endSeparatorCheckBox.setObjectName(u'endSeparatorCheckBox') self.scripture_reference_layout.addWidget(self.end_separator_check_box, 3, 0)
self.scriptureReferenceLayout.addWidget(self.endSeparatorCheckBox, 3, 0) self.end_separator_line_edit = QtGui.QLineEdit(self.scripture_reference_group_box)
self.endSeparatorLineEdit = QtGui.QLineEdit(self.scriptureReferenceGroupBox) self.end_separator_line_edit.setObjectName(u'end_separator_line_edit')
self.endSeparatorLineEdit.setObjectName(u'endSeparatorLineEdit') self.end_separator_line_edit.setValidator(QtGui.QRegExpValidator(QtCore.QRegExp(r'[^0-9]*'),
self.endSeparatorLineEdit.setValidator(QtGui.QRegExpValidator(QtCore.QRegExp(r'[^0-9]*'), self.end_separator_line_edit))
self.endSeparatorLineEdit)) self.scripture_reference_layout.addWidget(self.end_separator_line_edit, 3, 1)
self.scriptureReferenceLayout.addWidget(self.endSeparatorLineEdit, 3, 1) self.left_layout.addWidget(self.scripture_reference_group_box)
self.leftLayout.addWidget(self.scriptureReferenceGroupBox) self.right_column.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred)
self.rightColumn.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred) self.language_selection_group_box = QtGui.QGroupBox(self.right_column)
self.languageSelectionGroupBox = QtGui.QGroupBox(self.rightColumn) self.language_selection_group_box.setObjectName(u'language_selection_group_box')
self.languageSelectionGroupBox.setObjectName(u'languageSelectionGroupBox') self.language_selection_layout = QtGui.QVBoxLayout(self.language_selection_group_box)
self.languageSelectionLayout = QtGui.QVBoxLayout(self.languageSelectionGroupBox) self.language_selection_label = QtGui.QLabel(self.language_selection_group_box)
self.languageSelectionLabel = QtGui.QLabel(self.languageSelectionGroupBox) self.language_selection_label.setObjectName(u'language_selection_label')
self.languageSelectionLabel.setObjectName(u'languageSelectionLabel') self.language_selection_combo_box = QtGui.QComboBox(self.language_selection_group_box)
self.languageSelectionComboBox = QtGui.QComboBox(self.languageSelectionGroupBox) self.language_selection_combo_box.setObjectName(u'language_selection_combo_box')
self.languageSelectionComboBox.setObjectName(u'languageSelectionComboBox') self.language_selection_combo_box.addItems([u'', u'', u''])
self.languageSelectionComboBox.addItems([u'', u'', u'']) self.language_selection_layout.addWidget(self.language_selection_label)
self.languageSelectionLayout.addWidget(self.languageSelectionLabel) self.language_selection_layout.addWidget(self.language_selection_combo_box)
self.languageSelectionLayout.addWidget(self.languageSelectionComboBox) self.right_layout.addWidget(self.language_selection_group_box)
self.rightLayout.addWidget(self.languageSelectionGroupBox) self.left_layout.addStretch()
self.leftLayout.addStretch() self.right_layout.addStretch()
self.rightLayout.addStretch()
# Signals and slots # Signals and slots
self.newChaptersCheckBox.stateChanged.connect(self.onNewChaptersCheckBoxChanged) self.new_chapters_check_box.stateChanged.connect(self.on_new_chapters_check_box_changed)
self.displayStyleComboBox.activated.connect(self.onDisplayStyleComboBoxChanged) self.display_style_combo_box.activated.connect(self.on_display_style_combo_box_changed)
self.bibleThemeComboBox.activated.connect(self.onBibleThemeComboBoxChanged) self.bible_theme_combo_box.activated.connect(self.on_bible_theme_combo_box_changed)
self.layoutStyleComboBox.activated.connect(self.onLayoutStyleComboBoxChanged) self.layout_style_combo_box.activated.connect(self.on_layout_style_combo_boxChanged)
self.bibleSecondCheckBox.stateChanged.connect(self.onBibleSecondCheckBox) self.bible_second_check_box.stateChanged.connect(self.on_bible_second_check_box)
self.verseSeparatorCheckBox.clicked.connect(self.onVerseSeparatorCheckBoxClicked) self.verse_separator_check_box.clicked.connect(self.on_verse_separator_check_box_clicked)
self.verseSeparatorLineEdit.textEdited.connect(self.onVerseSeparatorLineEditEdited) self.verse_separator_line_edit.textEdited.connect(self.on_verse_separator_line_edit_edited)
self.verseSeparatorLineEdit.editingFinished.connect(self.onVerseSeparatorLineEditFinished) self.verse_separator_line_edit.editingFinished.connect(self.on_verse_separator_line_edit_finished)
self.rangeSeparatorCheckBox.clicked.connect(self.onRangeSeparatorCheckBoxClicked) self.range_separator_check_box.clicked.connect(self.on_range_separator_check_box_clicked)
self.rangeSeparatorLineEdit.textEdited.connect(self.onRangeSeparatorLineEditEdited) self.range_separator_line_edit.textEdited.connect(self.on_range_separator_line_edit_edited)
self.rangeSeparatorLineEdit.editingFinished.connect(self.onRangeSeparatorLineEditFinished) self.range_separator_line_edit.editingFinished.connect(self.on_range_separator_line_edit_finished)
self.listSeparatorCheckBox.clicked.connect(self.onListSeparatorCheckBoxClicked) self.list_separator_check_box.clicked.connect(self.on_list_separator_check_box_clicked)
self.listSeparatorLineEdit.textEdited.connect(self.onListSeparatorLineEditEdited) self.list_separator_line_edit.textEdited.connect(self.on_list_separator_line_edit_edited)
self.listSeparatorLineEdit.editingFinished.connect(self.onListSeparatorLineEditFinished) self.list_separator_line_edit.editingFinished.connect(self.on_list_separator_line_edit_finished)
self.endSeparatorCheckBox.clicked.connect(self.onEndSeparatorCheckBoxClicked) self.end_separator_check_box.clicked.connect(self.on_end_separator_check_box_clicked)
self.endSeparatorLineEdit.textEdited.connect(self.onEndSeparatorLineEditEdited) self.end_separator_line_edit.textEdited.connect(self.on_end_separator_line_edit_edited)
self.endSeparatorLineEdit.editingFinished.connect(self.onEndSeparatorLineEditFinished) self.end_separator_line_edit.editingFinished.connect(self.on_end_separator_line_edit_finished)
Registry().register_function(u'theme_update_list', self.update_theme_list) Registry().register_function(u'theme_update_list', self.update_theme_list)
self.languageSelectionComboBox.activated.connect(self.onLanguageSelectionComboBoxChanged) self.language_selection_combo_box.activated.connect(self.on_language_selection_combo_box_changed)
def retranslateUi(self): def retranslateUi(self):
self.verseDisplayGroupBox.setTitle(translate('BiblesPlugin.BiblesTab', 'Verse Display')) self.verse_display_group_box.setTitle(translate('BiblesPlugin.BiblesTab', 'Verse Display'))
self.newChaptersCheckBox.setText(translate('BiblesPlugin.BiblesTab', 'Only show new chapter numbers')) self.new_chapters_check_box.setText(translate('BiblesPlugin.BiblesTab', 'Only show new chapter numbers'))
self.layoutStyleLabel.setText(UiStrings().LayoutStyle) self.layout_style_label.setText(UiStrings().LayoutStyle)
self.displayStyleLabel.setText(UiStrings().DisplayStyle) self.display_style_label.setText(UiStrings().DisplayStyle)
self.bibleThemeLabel.setText(translate('BiblesPlugin.BiblesTab', 'Bible theme:')) self.bible_theme_label.setText(translate('BiblesPlugin.BiblesTab', 'Bible theme:'))
self.layoutStyleComboBox.setItemText(LayoutStyle.VersePerSlide, UiStrings().VersePerSlide) self.layout_style_combo_box.setItemText(LayoutStyle.VersePerSlide, UiStrings().VersePerSlide)
self.layoutStyleComboBox.setItemText(LayoutStyle.VersePerLine, UiStrings().VersePerLine) self.layout_style_combo_box.setItemText(LayoutStyle.VersePerLine, UiStrings().VersePerLine)
self.layoutStyleComboBox.setItemText(LayoutStyle.Continuous, UiStrings().Continuous) self.layout_style_combo_box.setItemText(LayoutStyle.Continuous, UiStrings().Continuous)
self.displayStyleComboBox.setItemText(DisplayStyle.NoBrackets, self.display_style_combo_box.setItemText(DisplayStyle.NoBrackets,
translate('BiblesPlugin.BiblesTab', 'No Brackets')) translate('BiblesPlugin.BiblesTab', 'No Brackets'))
self.displayStyleComboBox.setItemText(DisplayStyle.Round, self.display_style_combo_box.setItemText(DisplayStyle.Round,
translate('BiblesPlugin.BiblesTab', '( And )')) translate('BiblesPlugin.BiblesTab', '( And )'))
self.displayStyleComboBox.setItemText(DisplayStyle.Curly, self.display_style_combo_box.setItemText(DisplayStyle.Curly,
translate('BiblesPlugin.BiblesTab', '{ And }')) translate('BiblesPlugin.BiblesTab', '{ And }'))
self.displayStyleComboBox.setItemText(DisplayStyle.Square, self.display_style_combo_box.setItemText(DisplayStyle.Square,
translate('BiblesPlugin.BiblesTab', '[ And ]')) translate('BiblesPlugin.BiblesTab', '[ And ]'))
self.changeNoteLabel.setText(translate('BiblesPlugin.BiblesTab', self.change_note_label.setText(translate('BiblesPlugin.BiblesTab',
'Note:\nChanges do not affect verses already in the service.')) 'Note:\nChanges do not affect verses already in the service.'))
self.bibleSecondCheckBox.setText(translate('BiblesPlugin.BiblesTab', 'Display second Bible verses')) self.bible_second_check_box.setText(translate('BiblesPlugin.BiblesTab', 'Display second Bible verses'))
self.scriptureReferenceGroupBox.setTitle(translate('BiblesPlugin.BiblesTab', 'Custom Scripture References')) self.scripture_reference_group_box.setTitle(translate('BiblesPlugin.BiblesTab', 'Custom Scripture References'))
self.verseSeparatorCheckBox.setText(translate('BiblesPlugin.BiblesTab', 'Verse Separator:')) self.verse_separator_check_box.setText(translate('BiblesPlugin.BiblesTab', 'Verse Separator:'))
self.rangeSeparatorCheckBox.setText(translate('BiblesPlugin.BiblesTab', 'Range Separator:')) self.range_separator_check_box.setText(translate('BiblesPlugin.BiblesTab', 'Range Separator:'))
self.listSeparatorCheckBox.setText(translate('BiblesPlugin.BiblesTab', 'List Separator:')) self.list_separator_check_box.setText(translate('BiblesPlugin.BiblesTab', 'List Separator:'))
self.endSeparatorCheckBox.setText(translate('BiblesPlugin.BiblesTab', 'End Mark:')) self.end_separator_check_box.setText(translate('BiblesPlugin.BiblesTab', 'End Mark:'))
tip_text = translate('BiblesPlugin.BiblesTab', tip_text = translate('BiblesPlugin.BiblesTab',
'Multiple alternative verse separators may be defined.\nThey have to be separated by a vertical bar "|".' 'Multiple alternative verse separators may be defined.\nThey have to be separated by a vertical bar "|".'
'\nPlease clear this edit line to use the default value.') '\nPlease clear this edit line to use the default value.')
self.verseSeparatorLineEdit.setToolTip(tip_text) self.verse_separator_line_edit.setToolTip(tip_text)
self.rangeSeparatorLineEdit.setToolTip(tip_text) self.range_separator_line_edit.setToolTip(tip_text)
self.listSeparatorLineEdit.setToolTip(tip_text) self.list_separator_line_edit.setToolTip(tip_text)
self.endSeparatorLineEdit.setToolTip(tip_text) self.end_separator_line_edit.setToolTip(tip_text)
self.languageSelectionGroupBox.setTitle(translate('BiblesPlugin.BiblesTab', 'Default Bible Language')) self.language_selection_group_box.setTitle(translate('BiblesPlugin.BiblesTab', 'Default Bible Language'))
self.languageSelectionLabel.setText(translate('BiblesPlugin.BiblesTab', self.language_selection_label.setText(translate('BiblesPlugin.BiblesTab',
'Book name language in search field,\nsearch results and on display:')) 'Book name language in search field,\nsearch results and on display:'))
self.languageSelectionComboBox.setItemText(LanguageSelection.Bible, self.language_selection_combo_box.setItemText(LanguageSelection.Bible,
translate('BiblesPlugin.BiblesTab', 'Bible Language')) translate('BiblesPlugin.BiblesTab', 'Bible Language'))
self.languageSelectionComboBox.setItemText(LanguageSelection.Application, self.language_selection_combo_box.setItemText(LanguageSelection.Application,
translate('BiblesPlugin.BiblesTab', 'Application Language')) translate('BiblesPlugin.BiblesTab', 'Application Language'))
self.languageSelectionComboBox.setItemText(LanguageSelection.English, self.language_selection_combo_box.setItemText(LanguageSelection.English,
translate('BiblesPlugin.BiblesTab', 'English')) translate('BiblesPlugin.BiblesTab', 'English'))
def onBibleThemeComboBoxChanged(self): def on_bible_theme_combo_box_changed(self):
self.bible_theme = self.bibleThemeComboBox.currentText() self.bible_theme = self.bible_theme_combo_box.currentText()
def onDisplayStyleComboBoxChanged(self): def on_display_style_combo_box_changed(self):
self.display_style = self.displayStyleComboBox.currentIndex() self.display_style = self.display_style_combo_box.currentIndex()
def onLayoutStyleComboBoxChanged(self): def on_layout_style_combo_boxChanged(self):
self.layout_style = self.layoutStyleComboBox.currentIndex() self.layout_style = self.layout_style_combo_box.currentIndex()
def onLanguageSelectionComboBoxChanged(self): def on_language_selection_combo_box_changed(self):
self.language_selection = self.languageSelectionComboBox.currentIndex() self.language_selection = self.language_selectioncombo_box.currentIndex()
def onNewChaptersCheckBoxChanged(self, check_state): def on_new_chapters_check_box_changed(self, check_state):
self.show_new_chapters = False self.show_new_chapters = False
# We have a set value convert to True/False. # We have a set value convert to True/False.
if check_state == QtCore.Qt.Checked: if check_state == QtCore.Qt.Checked:
self.show_new_chapters = True self.show_new_chapters = True
def onBibleSecondCheckBox(self, check_state): def on_bible_second_check_box(self, check_state):
self.second_bibles = False self.second_bibles = False
# We have a set value convert to True/False. # We have a set value convert to True/False.
if check_state == QtCore.Qt.Checked: if check_state == QtCore.Qt.Checked:
self.second_bibles = True self.second_bibles = True
def onVerseSeparatorCheckBoxClicked(self, checked): def on_verse_separator_check_box_clicked(self, checked):
if checked: if checked:
self.verseSeparatorLineEdit.setFocus() self.verse_separator_line_edit.setFocus()
else: else:
self.verseSeparatorLineEdit.setText(get_reference_separator(u'sep_v_default')) self.verse_separator_line_edit.setText(get_reference_separator(u'sep_v_default'))
self.verseSeparatorLineEdit.setPalette(self.getGreyTextPalette(not checked)) self.verse_separator_line_edit.setPalette(self.getGreyTextPalette(not checked))
def onVerseSeparatorLineEditEdited(self, text): def on_verse_separator_line_edit_edited(self, text):
self.verseSeparatorCheckBox.setChecked(True) self.verse_separator_check_box.setChecked(True)
self.verseSeparatorLineEdit.setPalette(self.getGreyTextPalette(False)) self.verse_separator_line_edit.setPalette(self.getGreyTextPalette(False))
def onVerseSeparatorLineEditFinished(self): def on_verse_separator_line_edit_finished(self):
if self.verseSeparatorLineEdit.isModified(): if self.verse_separator_line_edit.isModified():
text = self.verseSeparatorLineEdit.text() text = self.verse_separator_line_edit.text()
if text == get_reference_separator(u'sep_v_default') or not text.replace(u'|', u''): if text == get_reference_separator(u'sep_v_default') or not text.replace(u'|', u''):
self.verseSeparatorCheckBox.setChecked(False) self.verse_separator_check_box.setChecked(False)
self.verseSeparatorLineEdit.setText(get_reference_separator(u'sep_v_default')) self.verse_separator_line_edit.setText(get_reference_separator(u'sep_v_default'))
self.verseSeparatorLineEdit.setPalette(self.getGreyTextPalette(True)) self.verse_separator_line_edit.setPalette(self.getGreyTextPalette(True))
def onRangeSeparatorCheckBoxClicked(self, checked): def on_range_separator_check_box_clicked(self, checked):
if checked: if checked:
self.rangeSeparatorLineEdit.setFocus() self.range_separator_line_edit.setFocus()
else: else:
self.rangeSeparatorLineEdit.setText(get_reference_separator(u'sep_r_default')) self.range_separator_line_edit.setText(get_reference_separator(u'sep_r_default'))
self.rangeSeparatorLineEdit.setPalette(self.getGreyTextPalette(not checked)) self.range_separator_line_edit.setPalette(self.getGreyTextPalette(not checked))
def onRangeSeparatorLineEditEdited(self, text): def on_range_separator_line_edit_edited(self, text):
self.rangeSeparatorCheckBox.setChecked(True) self.range_separator_check_box.setChecked(True)
self.rangeSeparatorLineEdit.setPalette(self.getGreyTextPalette(False)) self.range_separator_line_edit.setPalette(self.getGreyTextPalette(False))
def onRangeSeparatorLineEditFinished(self): def on_range_separator_line_edit_finished(self):
if self.rangeSeparatorLineEdit.isModified(): if self.range_separator_line_edit.isModified():
text = self.rangeSeparatorLineEdit.text() text = self.range_separator_line_edit.text()
if text == get_reference_separator(u'sep_r_default') or not text.replace(u'|', u''): if text == get_reference_separator(u'sep_r_default') or not text.replace(u'|', u''):
self.rangeSeparatorCheckBox.setChecked(False) self.range_separator_check_box.setChecked(False)
self.rangeSeparatorLineEdit.setText(get_reference_separator(u'sep_r_default')) self.range_separator_line_edit.setText(get_reference_separator(u'sep_r_default'))
self.rangeSeparatorLineEdit.setPalette(self.getGreyTextPalette(True)) self.range_separator_line_edit.setPalette(self.getGreyTextPalette(True))
def onListSeparatorCheckBoxClicked(self, checked): def on_list_separator_check_box_clicked(self, checked):
if checked: if checked:
self.listSeparatorLineEdit.setFocus() self.list_separator_line_edit.setFocus()
else: else:
self.listSeparatorLineEdit.setText(get_reference_separator(u'sep_l_default')) self.list_separator_line_edit.setText(get_reference_separator(u'sep_l_default'))
self.listSeparatorLineEdit.setPalette(self.getGreyTextPalette(not checked)) self.list_separator_line_edit.setPalette(self.getGreyTextPalette(not checked))
def onListSeparatorLineEditEdited(self, text): def on_list_separator_line_edit_edited(self, text):
self.listSeparatorCheckBox.setChecked(True) self.list_separator_check_box.setChecked(True)
self.listSeparatorLineEdit.setPalette(self.getGreyTextPalette(False)) self.list_separator_line_edit.setPalette(self.getGreyTextPalette(False))
def onListSeparatorLineEditFinished(self): def on_list_separator_line_edit_finished(self):
if self.listSeparatorLineEdit.isModified(): if self.list_separator_line_edit.isModified():
text = self.listSeparatorLineEdit.text() text = self.list_separator_line_edit.text()
if text == get_reference_separator(u'sep_l_default') or not text.replace(u'|', u''): if text == get_reference_separator(u'sep_l_default') or not text.replace(u'|', u''):
self.listSeparatorCheckBox.setChecked(False) self.list_separator_check_box.setChecked(False)
self.listSeparatorLineEdit.setText(get_reference_separator(u'sep_l_default')) self.list_separator_line_edit.setText(get_reference_separator(u'sep_l_default'))
self.listSeparatorLineEdit.setPalette(self.getGreyTextPalette(True)) self.list_separator_line_edit.setPalette(self.getGreyTextPalette(True))
def onEndSeparatorCheckBoxClicked(self, checked): def on_end_separator_check_box_clicked(self, checked):
if checked: if checked:
self.endSeparatorLineEdit.setFocus() self.end_separator_line_edit.setFocus()
else: else:
self.endSeparatorLineEdit.setText(get_reference_separator(u'sep_e_default')) self.end_separator_line_edit.setText(get_reference_separator(u'sep_e_default'))
self.endSeparatorLineEdit.setPalette(self.getGreyTextPalette(not checked)) self.end_separator_line_edit.setPalette(self.getGreyTextPalette(not checked))
def onEndSeparatorLineEditEdited(self, text): def on_end_separator_line_edit_edited(self, text):
self.endSeparatorCheckBox.setChecked(True) self.end_separator_check_box.setChecked(True)
self.endSeparatorLineEdit.setPalette(self.getGreyTextPalette(False)) self.end_separator_line_edit.setPalette(self.getGreyTextPalette(False))
def onEndSeparatorLineEditFinished(self): def on_end_separator_line_edit_finished(self):
if self.endSeparatorLineEdit.isModified(): if self.end_separator_line_edit.isModified():
text = self.endSeparatorLineEdit.text() text = self.end_separator_line_edit.text()
if text == get_reference_separator(u'sep_e_default') or not text.replace(u'|', u''): if text == get_reference_separator(u'sep_e_default') or not text.replace(u'|', u''):
self.endSeparatorCheckBox.setChecked(False) self.end_separator_check_box.setChecked(False)
self.endSeparatorLineEdit.setText(get_reference_separator(u'sep_e_default')) self.end_separator_line_edit.setText(get_reference_separator(u'sep_e_default'))
self.endSeparatorLineEdit.setPalette(self.getGreyTextPalette(True)) self.end_separator_line_edit.setPalette(self.getGreyTextPalette(True))
def load(self): def load(self):
settings = Settings() settings = Settings()
settings.beginGroup(self.settingsSection) settings.beginGroup(self.settings_section)
self.show_new_chapters = settings.value(u'display new chapter') self.show_new_chapters = settings.value(u'display new chapter')
self.display_style = settings.value(u'display brackets') self.display_style = settings.value(u'display brackets')
self.layout_style = settings.value(u'verse layout style') self.layout_style = settings.value(u'verse layout style')
self.bible_theme = settings.value(u'bible theme') self.bible_theme = settings.value(u'bible theme')
self.second_bibles = settings.value(u'second bibles') self.second_bibles = settings.value(u'second bibles')
self.newChaptersCheckBox.setChecked(self.show_new_chapters) self.new_chapters_check_box.setChecked(self.show_new_chapters)
self.displayStyleComboBox.setCurrentIndex(self.display_style) self.display_style_combo_box.setCurrentIndex(self.display_style)
self.layoutStyleComboBox.setCurrentIndex(self.layout_style) self.layout_style_combo_box.setCurrentIndex(self.layout_style)
self.bibleSecondCheckBox.setChecked(self.second_bibles) self.bible_second_check_box.setChecked(self.second_bibles)
verse_separator = settings.value(u'verse separator') verse_separator = settings.value(u'verse separator')
if (verse_separator.strip(u'|') == u'') or (verse_separator == get_reference_separator(u'sep_v_default')): if (verse_separator.strip(u'|') == u'') or (verse_separator == get_reference_separator(u'sep_v_default')):
self.verseSeparatorLineEdit.setText(get_reference_separator(u'sep_v_default')) self.verse_separator_line_edit.setText(get_reference_separator(u'sep_v_default'))
self.verseSeparatorLineEdit.setPalette(self.getGreyTextPalette(True)) self.verse_separator_line_edit.setPalette(self.getGreyTextPalette(True))
self.verseSeparatorCheckBox.setChecked(False) self.verse_separator_check_box.setChecked(False)
else: else:
self.verseSeparatorLineEdit.setText(verse_separator) self.verse_separator_line_edit.setText(verse_separator)
self.verseSeparatorLineEdit.setPalette(self.getGreyTextPalette(False)) self.verse_separator_line_edit.setPalette(self.getGreyTextPalette(False))
self.verseSeparatorCheckBox.setChecked(True) self.verse_separator_check_box.setChecked(True)
range_separator = settings.value(u'range separator') range_separator = settings.value(u'range separator')
if (range_separator.strip(u'|') == u'') or (range_separator == get_reference_separator(u'sep_r_default')): if (range_separator.strip(u'|') == u'') or (range_separator == get_reference_separator(u'sep_r_default')):
self.rangeSeparatorLineEdit.setText(get_reference_separator(u'sep_r_default')) self.range_separator_line_edit.setText(get_reference_separator(u'sep_r_default'))
self.rangeSeparatorLineEdit.setPalette(self.getGreyTextPalette(True)) self.range_separator_line_edit.setPalette(self.getGreyTextPalette(True))
self.rangeSeparatorCheckBox.setChecked(False) self.range_separator_check_box.setChecked(False)
else: else:
self.rangeSeparatorLineEdit.setText(range_separator) self.range_separator_line_edit.setText(range_separator)
self.rangeSeparatorLineEdit.setPalette(self.getGreyTextPalette(False)) self.range_separator_line_edit.setPalette(self.getGreyTextPalette(False))
self.rangeSeparatorCheckBox.setChecked(True) self.range_separator_check_box.setChecked(True)
list_separator = settings.value(u'list separator') list_separator = settings.value(u'list separator')
if (list_separator.strip(u'|') == u'') or (list_separator == get_reference_separator(u'sep_l_default')): if (list_separator.strip(u'|') == u'') or (list_separator == get_reference_separator(u'sep_l_default')):
self.listSeparatorLineEdit.setText(get_reference_separator(u'sep_l_default')) self.list_separator_line_edit.setText(get_reference_separator(u'sep_l_default'))
self.listSeparatorLineEdit.setPalette(self.getGreyTextPalette(True)) self.list_separator_line_edit.setPalette(self.getGreyTextPalette(True))
self.listSeparatorCheckBox.setChecked(False) self.list_separator_check_box.setChecked(False)
else: else:
self.listSeparatorLineEdit.setText(list_separator) self.list_separator_line_edit.setText(list_separator)
self.listSeparatorLineEdit.setPalette(self.getGreyTextPalette(False)) self.list_separator_line_edit.setPalette(self.getGreyTextPalette(False))
self.listSeparatorCheckBox.setChecked(True) self.list_separator_check_box.setChecked(True)
end_separator = settings.value(u'end separator') end_separator = settings.value(u'end separator')
if (end_separator.strip(u'|') == u'') or (end_separator == get_reference_separator(u'sep_e_default')): if (end_separator.strip(u'|') == u'') or (end_separator == get_reference_separator(u'sep_e_default')):
self.endSeparatorLineEdit.setText(get_reference_separator(u'sep_e_default')) self.end_separator_line_edit.setText(get_reference_separator(u'sep_e_default'))
self.endSeparatorLineEdit.setPalette(self.getGreyTextPalette(True)) self.end_separator_line_edit.setPalette(self.getGreyTextPalette(True))
self.endSeparatorCheckBox.setChecked(False) self.end_separator_check_box.setChecked(False)
else: else:
self.endSeparatorLineEdit.setText(end_separator) self.end_separator_line_edit.setText(end_separator)
self.endSeparatorLineEdit.setPalette(self.getGreyTextPalette(False)) self.end_separator_line_edit.setPalette(self.getGreyTextPalette(False))
self.endSeparatorCheckBox.setChecked(True) self.end_separator_check_box.setChecked(True)
self.language_selection = settings.value(u'book name language') self.language_selection = settings.value(u'book name language')
self.languageSelectionComboBox.setCurrentIndex(self.language_selection) self.language_selection_combo_box.setCurrentIndex(self.language_selection)
settings.endGroup() settings.endGroup()
def save(self): def save(self):
settings = Settings() settings = Settings()
settings.beginGroup(self.settingsSection) settings.beginGroup(self.settings_section)
settings.setValue(u'display new chapter', self.show_new_chapters) settings.setValue(u'display new chapter', self.show_new_chapters)
settings.setValue(u'display brackets', self.display_style) settings.setValue(u'display brackets', self.display_style)
settings.setValue(u'verse layout style', self.layout_style) settings.setValue(u'verse layout style', self.layout_style)
settings.setValue(u'second bibles', self.second_bibles) settings.setValue(u'second bibles', self.second_bibles)
settings.setValue(u'bible theme', self.bible_theme) settings.setValue(u'bible theme', self.bible_theme)
if self.verseSeparatorCheckBox.isChecked(): if self.verse_separator_check_box.isChecked():
settings.setValue(u'verse separator', self.verseSeparatorLineEdit.text()) settings.setValue(u'verse separator', self.verse_separator_line_edit.text())
else: else:
settings.remove(u'verse separator') settings.remove(u'verse separator')
if self.rangeSeparatorCheckBox.isChecked(): if self.range_separator_check_box.isChecked():
settings.setValue(u'range separator', self.rangeSeparatorLineEdit.text()) settings.setValue(u'range separator', self.range_separator_line_edit.text())
else: else:
settings.remove(u'range separator') settings.remove(u'range separator')
if self.listSeparatorCheckBox.isChecked(): if self.list_separator_check_box.isChecked():
settings.setValue(u'list separator', self.listSeparatorLineEdit.text()) settings.setValue(u'list separator', self.list_separator_line_edit.text())
else: else:
settings.remove(u'list separator') settings.remove(u'list separator')
if self.endSeparatorCheckBox.isChecked(): if self.end_separator_check_box.isChecked():
settings.setValue(u'end separator', self.endSeparatorLineEdit.text()) settings.setValue(u'end separator', self.end_separator_line_edit.text())
else: else:
settings.remove(u'end separator') settings.remove(u'end separator')
update_reference_separators() update_reference_separators()
if self.language_selection != settings.value(u'book name language'): if self.language_selection != settings.value(u'book name language'):
settings.setValue(u'book name language', self.language_selection) settings.setValue(u'book name language', self.language_selection)
self.settings_form.register_post_process(u'bibles_load_list', self.settings_form.register_post_process(u'bibles_load_list')
translate('OpenLP.BibleTab', 'Bibles Lists updating.'))
settings.endGroup() settings.endGroup()
if self.tab_visited:
self.settings_form.register_post_process(u'bibles_config_updated')
self.tab_visited = False
def update_theme_list(self, theme_list): def update_theme_list(self, theme_list):
""" """
@ -388,10 +390,10 @@ class BiblesTab(SettingsTab):
[u'Bible Theme', u'Song Theme'] [u'Bible Theme', u'Song Theme']
""" """
self.bibleThemeComboBox.clear() self.bible_theme_combo_box.clear()
self.bibleThemeComboBox.addItem(u'') self.bible_theme_combo_box.addItem(u'')
self.bibleThemeComboBox.addItems(theme_list) self.bible_theme_combo_box.addItems(theme_list)
find_and_set_in_combo_box(self.bibleThemeComboBox, self.bible_theme) find_and_set_in_combo_box(self.bible_theme_combo_box, self.bible_theme)
def getGreyTextPalette(self, greyed): def getGreyTextPalette(self, greyed):
""" """
@ -403,4 +405,3 @@ class BiblesTab(SettingsTab):
color.setAlpha(128) color.setAlpha(128)
palette.setColor(QtGui.QPalette.Active, QtGui.QPalette.Text, color) palette.setColor(QtGui.QPalette.Active, QtGui.QPalette.Text, color)
return palette return palette

View File

@ -353,8 +353,7 @@ class BibleDB(QtCore.QObject, Manager):
book, book_id, language_id) book, book_id, language_id)
return book_id return book_id
def get_book_ref_id_by_localised_name(self, book, def get_book_ref_id_by_localised_name(self, book, language_selection):
language_selection):
""" """
Return the id of a named book. Return the id of a named book.
@ -362,8 +361,7 @@ class BibleDB(QtCore.QObject, Manager):
The name of the book, according to the selected language. The name of the book, according to the selected language.
``language_selection`` ``language_selection``
The language selection the user has chosen in the settings The language selection the user has chosen in the settings section of the Bible.
section of the Bible.
""" """
log.debug(u'get_book_ref_id_by_localised_name("%s", "%s")', book, language_selection) log.debug(u'get_book_ref_id_by_localised_name("%s", "%s")', book, language_selection)
from openlp.plugins.bibles.lib import LanguageSelection, BibleStrings from openlp.plugins.bibles.lib import LanguageSelection, BibleStrings
@ -423,12 +421,12 @@ class BibleDB(QtCore.QObject, Manager):
log.debug(u'Book name corrected to "%s"', db_book.name) log.debug(u'Book name corrected to "%s"', db_book.name)
if end_verse == -1: if end_verse == -1:
end_verse = self.get_verse_count(book_id, chapter) end_verse = self.get_verse_count(book_id, chapter)
verses = self.session.query(Verse)\ verses = self.session.query(Verse) \
.filter_by(book_id=db_book.id)\ .filter_by(book_id=db_book.id) \
.filter_by(chapter=chapter)\ .filter_by(chapter=chapter) \
.filter(Verse.verse >= start_verse)\ .filter(Verse.verse >= start_verse) \
.filter(Verse.verse <= end_verse)\ .filter(Verse.verse <= end_verse) \
.order_by(Verse.verse)\ .order_by(Verse.verse) \
.all() .all()
verse_list.extend(verses) verse_list.extend(verses)
else: else:
@ -491,9 +489,9 @@ class BibleDB(QtCore.QObject, Manager):
The chapter to get the verse count for. The chapter to get the verse count for.
""" """
log.debug(u'BibleDB.get_verse_count("%s", "%s")', book_ref_id, chapter) log.debug(u'BibleDB.get_verse_count("%s", "%s")', book_ref_id, chapter)
count = self.session.query(func.max(Verse.verse)).join(Book)\ count = self.session.query(func.max(Verse.verse)).join(Book) \
.filter(Book.book_reference_id==book_ref_id)\ .filter(Book.book_reference_id == book_ref_id) \
.filter(Verse.chapter==chapter)\ .filter(Verse.chapter == chapter) \
.scalar() .scalar()
if not count: if not count:
return 0 return 0

View File

@ -44,6 +44,7 @@ from openlp.plugins.bibles.lib.db import BiblesResourcesDB
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
class BibleSearch(object): class BibleSearch(object):
""" """
Enumeration class for the different search methods for the "quick search". Enumeration class for the different search methods for the "quick search".
@ -71,7 +72,6 @@ class BibleMediaItem(MediaManagerItem):
self.second_search_results = {} self.second_search_results = {}
self.checkSearchResult() self.checkSearchResult()
Registry().register_function(u'bibles_load_list', self.reload_bibles) Registry().register_function(u'bibles_load_list', self.reload_bibles)
Registry().register_function(u'config_updated', self.config_update)
def __checkSecondBible(self, bible, second_bible): def __checkSecondBible(self, bible, second_bible):
""" """

View File

@ -37,6 +37,7 @@ from sqlalchemy import Table, func, select, insert
__version__ = 1 __version__ = 1
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
def upgrade_setup(metadata): def upgrade_setup(metadata):
""" """
Set up the latest revision all tables, with reflection, needed for the Set up the latest revision all tables, with reflection, needed for the
@ -56,7 +57,7 @@ def upgrade_1(session, metadata, tables):
""" """
Version 1 upgrade. Version 1 upgrade.
This upgrade renames a number of keys to a single naming convention.. This upgrade renames a number of keys to a single naming convention.
""" """
metadata_table = metadata.tables[u'metadata'] metadata_table = metadata.tables[u'metadata']
# Copy "Version" to "name" ("version" used by upgrade system) # Copy "Version" to "name" ("version" used by upgrade system)

View File

@ -46,7 +46,7 @@ __default_settings__ = {
u'custom/last search type': CustomSearch.Titles, u'custom/last search type': CustomSearch.Titles,
u'custom/display footer': True, u'custom/display footer': True,
u'custom/add custom from service': True u'custom/add custom from service': True
} }
class CustomPlugin(Plugin): class CustomPlugin(Plugin):

View File

@ -35,6 +35,7 @@ from PyQt4 import QtCore, QtGui
from openlp.core.lib import SettingsTab, Settings, translate from openlp.core.lib import SettingsTab, Settings, translate
class CustomTab(SettingsTab): class CustomTab(SettingsTab):
""" """
CustomTab is the Custom settings tab in the settings dialog. CustomTab is the Custom settings tab in the settings dialog.
@ -45,7 +46,7 @@ class CustomTab(SettingsTab):
def setupUi(self): def setupUi(self):
self.setObjectName(u'CustomTab') self.setObjectName(u'CustomTab')
SettingsTab.setupUi(self) SettingsTab.setupUi(self)
self.custom_mode_group_box = QtGui.QGroupBox(self.leftColumn) self.custom_mode_group_box = QtGui.QGroupBox(self.left_column)
self.custom_mode_group_box.setObjectName(u'custom_mode_group_box') self.custom_mode_group_box.setObjectName(u'custom_mode_group_box')
self.custom_mode_layout = QtGui.QFormLayout(self.custom_mode_group_box) self.custom_mode_layout = QtGui.QFormLayout(self.custom_mode_group_box)
self.custom_mode_layout.setObjectName(u'custom_mode_layout') self.custom_mode_layout.setObjectName(u'custom_mode_layout')
@ -55,9 +56,9 @@ class CustomTab(SettingsTab):
self.add_from_service_checkbox = QtGui.QCheckBox(self.custom_mode_group_box) self.add_from_service_checkbox = QtGui.QCheckBox(self.custom_mode_group_box)
self.add_from_service_checkbox.setObjectName(u'add_from_service_checkbox') self.add_from_service_checkbox.setObjectName(u'add_from_service_checkbox')
self.custom_mode_layout.addRow(self.add_from_service_checkbox) self.custom_mode_layout.addRow(self.add_from_service_checkbox)
self.leftLayout.addWidget(self.custom_mode_group_box) self.left_layout.addWidget(self.custom_mode_group_box)
self.leftLayout.addStretch() self.left_layout.addStretch()
self.rightLayout.addStretch() self.right_layout.addStretch()
self.display_footer_check_box.stateChanged.connect(self.on_display_footer_check_box_changed) self.display_footer_check_box.stateChanged.connect(self.on_display_footer_check_box_changed)
self.add_from_service_checkbox.stateChanged.connect(self.on_add_from_service_check_box_changed) self.add_from_service_checkbox.stateChanged.connect(self.on_add_from_service_check_box_changed)
@ -81,7 +82,7 @@ class CustomTab(SettingsTab):
def load(self): def load(self):
settings = Settings() settings = Settings()
settings.beginGroup(self.settingsSection) settings.beginGroup(self.settings_section)
self.display_footer = settings.value(u'display footer') self.display_footer = settings.value(u'display footer')
self.update_load = settings.value(u'add custom from service') self.update_load = settings.value(u'add custom from service')
self.display_footer_check_box.setChecked(self.display_footer) self.display_footer_check_box.setChecked(self.display_footer)
@ -90,7 +91,10 @@ class CustomTab(SettingsTab):
def save(self): def save(self):
settings = Settings() settings = Settings()
settings.beginGroup(self.settingsSection) settings.beginGroup(self.settings_section)
settings.setValue(u'display footer', self.display_footer) settings.setValue(u'display footer', self.display_footer)
settings.setValue(u'add custom from service', self.update_load) settings.setValue(u'add custom from service', self.update_load)
settings.endGroup() settings.endGroup()
if self.tab_visited:
self.settings_form.register_post_process(u'custom_config_updated')
self.tab_visited = False

View File

@ -75,10 +75,13 @@ class CustomMediaItem(MediaManagerItem):
self.onSearchTextButtonClicked) self.onSearchTextButtonClicked)
Registry().register_function(u'custom_load_list', self.loadList) Registry().register_function(u'custom_load_list', self.loadList)
Registry().register_function(u'custom_preview', self.onPreviewClick) Registry().register_function(u'custom_preview', self.onPreviewClick)
Registry().register_function(u'config_updated', self.config_updated)
Registry().register_function(u'custom_create_from_service', self.create_from_service_item) Registry().register_function(u'custom_create_from_service', self.create_from_service_item)
def config_updated(self): def config_update(self):
"""
Config has been updated so reload values
"""
log.debug(u'Config loaded')
self.add_custom_from_service = Settings().value(self.settingsSection + u'/add custom from service') self.add_custom_from_service = Settings().value(self.settingsSection + u'/add custom from service')
def retranslateUi(self): def retranslateUi(self):
@ -92,9 +95,9 @@ class CustomMediaItem(MediaManagerItem):
translate('SongsPlugin.MediaItem', 'Search Titles...')), translate('SongsPlugin.MediaItem', 'Search Titles...')),
(CustomSearch.Themes, u':/slides/slide_theme.png', UiStrings().Themes, UiStrings().SearchThemes) (CustomSearch.Themes, u':/slides/slide_theme.png', UiStrings().Themes, UiStrings().SearchThemes)
]) ])
self.searchTextEdit.set_current_search_type(Settings().value(u'%s/last search type' % self.settingsSection))
self.loadList(self.manager.get_all_objects(CustomSlide, order_by_ref=CustomSlide.title)) self.loadList(self.manager.get_all_objects(CustomSlide, order_by_ref=CustomSlide.title))
self.searchTextEdit.set_current_search_type(Settings().value( u'%s/last search type' % self.settingsSection)) self.config_update()
self.config_updated()
def loadList(self, custom_slides, target_group=None): def loadList(self, custom_slides, target_group=None):
# Sort out what custom we want to select after loading the list. # Sort out what custom we want to select after loading the list.

View File

@ -53,7 +53,6 @@ class ImagePlugin(Plugin):
self.weight = -7 self.weight = -7
self.iconPath = u':/plugins/plugin_images.png' self.iconPath = u':/plugins/plugin_images.png'
self.icon = build_icon(self.iconPath) self.icon = build_icon(self.iconPath)
Registry().execute(u'image_updated', self.image_updated)
def about(self): def about(self):
about_text = translate('ImagePlugin', '<strong>Image Plugin</strong>' about_text = translate('ImagePlugin', '<strong>Image Plugin</strong>'
@ -116,12 +115,12 @@ class ImagePlugin(Plugin):
} }
self.setPluginUiTextStrings(tooltips) self.setPluginUiTextStrings(tooltips)
def image_updated(self): def config_update(self):
""" """
Triggered by saving and changing the image border. Sets the images in Triggered by saving and changing the image border. Sets the images in image manager to require updates.
image manager to require updates. Actual update is triggered by the Actual update is triggered by the last part of saving the config.
last part of saving the config.
""" """
log.info(u'Images config_update')
background = QtGui.QColor(Settings().value(self.settingsSection + u'/background color')) background = QtGui.QColor(Settings().value(self.settingsSection + u'/background color'))
self.image_manager.update_images_border(ImageSource.ImagePlugin, background) self.image_manager.update_images_border(ImageSource.ImagePlugin, background)

View File

@ -27,9 +27,10 @@
# Temple Place, Suite 330, Boston, MA 02111-1307 USA # # Temple Place, Suite 330, Boston, MA 02111-1307 USA #
############################################################################### ###############################################################################
from PyQt4 import QtCore, QtGui from PyQt4 import QtGui
from openlp.core.lib import Registry, SettingsTab, Settings, UiStrings, translate
from openlp.core.lib import SettingsTab, Registry, Settings, UiStrings, translate
class ImageTab(SettingsTab): class ImageTab(SettingsTab):
@ -42,53 +43,53 @@ class ImageTab(SettingsTab):
def setupUi(self): def setupUi(self):
self.setObjectName(u'ImagesTab') self.setObjectName(u'ImagesTab')
SettingsTab.setupUi(self) SettingsTab.setupUi(self)
self.bgColorGroupBox = QtGui.QGroupBox(self.leftColumn) self.background_color_group_box = QtGui.QGroupBox(self.left_column)
self.bgColorGroupBox.setObjectName(u'FontGroupBox') self.background_color_group_box.setObjectName(u'background_color_group_box')
self.formLayout = QtGui.QFormLayout(self.bgColorGroupBox) self.form_layout = QtGui.QFormLayout(self.background_color_group_box)
self.formLayout.setObjectName(u'FormLayout') self.form_layout.setObjectName(u'form_layout')
self.colorLayout = QtGui.QHBoxLayout() self.color_layout = QtGui.QHBoxLayout()
self.backgroundColorLabel = QtGui.QLabel(self.bgColorGroupBox) self.background_color_label = QtGui.QLabel(self.background_color_group_box)
self.backgroundColorLabel.setObjectName(u'BackgroundColorLabel') self.background_color_label.setObjectName(u'background_color_label')
self.colorLayout.addWidget(self.backgroundColorLabel) self.color_layout.addWidget(self.background_color_label)
self.backgroundColorButton = QtGui.QPushButton(self.bgColorGroupBox) self.background_color_button = QtGui.QPushButton(self.background_color_group_box)
self.backgroundColorButton.setObjectName(u'BackgroundColorButton') self.background_color_button.setObjectName(u'background_color_button')
self.colorLayout.addWidget(self.backgroundColorButton) self.color_layout.addWidget(self.background_color_button)
self.formLayout.addRow(self.colorLayout) self.form_layout.addRow(self.color_layout)
self.information_label = QtGui.QLabel(self.bgColorGroupBox) self.information_label = QtGui.QLabel(self.background_color_group_box)
self.information_label.setObjectName(u'information_label') self.information_label.setObjectName(u'information_label')
self.information_label.setWordWrap(True) self.information_label.setWordWrap(True)
self.formLayout.addRow(self.information_label) self.form_layout.addRow(self.information_label)
self.leftLayout.addWidget(self.bgColorGroupBox) self.left_layout.addWidget(self.background_color_group_box)
self.leftLayout.addStretch() self.left_layout.addStretch()
self.rightColumn.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred) self.right_column.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred)
self.rightLayout.addStretch() self.right_layout.addStretch()
# Signals and slots # Signals and slots
self.backgroundColorButton.clicked.connect(self.onbackgroundColorButtonClicked) self.background_color_button.clicked.connect(self.on_background_color_button_clicked)
def retranslateUi(self): def retranslateUi(self):
self.bgColorGroupBox.setTitle(UiStrings().BackgroundColor) self.background_color_group_box.setTitle(UiStrings().BackgroundColor)
self.backgroundColorLabel.setText(UiStrings().DefaultColor) self.background_color_label.setText(UiStrings().DefaultColor)
self.information_label.setText( self.information_label.setText(
translate('ImagesPlugin.ImageTab', 'Visible background for images with aspect ratio different to screen.')) translate('ImagesPlugin.ImageTab', 'Visible background for images with aspect ratio different to screen.'))
def onbackgroundColorButtonClicked(self): def on_background_color_button_clicked(self):
new_color = QtGui.QColorDialog.getColor(QtGui.QColor(self.bg_color), self) new_color = QtGui.QColorDialog.getColor(QtGui.QColor(self.background_color), self)
if new_color.isValid(): if new_color.isValid():
self.bg_color = new_color.name() self.background_color = new_color.name()
self.backgroundColorButton.setStyleSheet(u'background-color: %s' % self.bg_color) self.background_color_button.setStyleSheet(u'background-color: %s' % self.background_color)
def load(self): def load(self):
settings = Settings() settings = Settings()
settings.beginGroup(self.settingsSection) settings.beginGroup(self.settings_section)
self.bg_color = settings.value(u'background color') self.background_color = settings.value(u'background color')
self.initial_color = self.bg_color self.initial_color = self.background_color
settings.endGroup() settings.endGroup()
self.backgroundColorButton.setStyleSheet(u'background-color: %s' % self.bg_color) self.background_color_button.setStyleSheet(u'background-color: %s' % self.background_color)
def save(self): def save(self):
settings = Settings() settings = Settings()
settings.beginGroup(self.settingsSection) settings.beginGroup(self.settings_section)
settings.setValue(u'background color', self.bg_color) settings.setValue(u'background color', self.background_color)
settings.endGroup() settings.endGroup()
if self.initial_color != self.bg_color: if self.initial_color != self.background_color:
self.settings_form.register_post_process(u'image_updated') self.settings_form.register_post_process(u'images_config_updated')

View File

@ -207,7 +207,7 @@ class ImageMediaItem(MediaManagerItem):
'You must select an image or group to delete.')): 'You must select an image or group to delete.')):
item_list = self.listView.selectedItems() item_list = self.listView.selectedItems()
self.application.set_busy_cursor() self.application.set_busy_cursor()
self.main_window.displayProgressBar(len(item_list)) self.main_window.display_progress_bar(len(item_list))
for row_item in item_list: for row_item in item_list:
if row_item: if row_item:
item_data = row_item.data(0, QtCore.Qt.UserRole) item_data = row_item.data(0, QtCore.Qt.UserRole)
@ -234,7 +234,7 @@ class ImageMediaItem(MediaManagerItem):
self.fill_groups_combobox(self.choose_group_form.group_combobox) self.fill_groups_combobox(self.choose_group_form.group_combobox)
self.fill_groups_combobox(self.add_group_form.parent_group_combobox) self.fill_groups_combobox(self.add_group_form.parent_group_combobox)
self.main_window.increment_progress_bar() self.main_window.increment_progress_bar()
self.main_window.finishedProgressBar() self.main_window.finished_progress_bar()
self.application.set_normal_cursor() self.application.set_normal_cursor()
self.listView.blockSignals(False) self.listView.blockSignals(False)
@ -323,7 +323,7 @@ class ImageMediaItem(MediaManagerItem):
""" """
if not initial_load: if not initial_load:
self.application.set_busy_cursor() self.application.set_busy_cursor()
self.main_window.displayProgressBar(len(images)) self.main_window.display_progress_bar(len(images))
self.listView.clear() self.listView.clear()
# Load the list of groups and add them to the treeView # Load the list of groups and add them to the treeView
group_items = {} group_items = {}
@ -356,7 +356,7 @@ class ImageMediaItem(MediaManagerItem):
if not initial_load: if not initial_load:
self.main_window.increment_progress_bar() self.main_window.increment_progress_bar()
if not initial_load: if not initial_load:
self.main_window.finishedProgressBar() self.main_window.finished_progress_bar()
self.application.set_normal_cursor() self.application.set_normal_cursor()
def validateAndLoad(self, files, target_group=None): def validateAndLoad(self, files, target_group=None):
@ -446,7 +446,7 @@ class ImageMediaItem(MediaManagerItem):
return return
# Initialize busy cursor and progress bar # Initialize busy cursor and progress bar
self.application.set_busy_cursor() self.application.set_busy_cursor()
self.main_window.displayProgressBar(len(images)) self.main_window.display_progress_bar(len(images))
# Save the new images in the database # Save the new images in the database
self.save_new_images_list(images, group_id=parent_group.id, reload_list=False) self.save_new_images_list(images, group_id=parent_group.id, reload_list=False)
self.loadFullList(self.manager.get_all_objects(ImageFilenames, order_by_ref=ImageFilenames.filename), self.loadFullList(self.manager.get_all_objects(ImageFilenames, order_by_ref=ImageFilenames.filename),

View File

@ -32,9 +32,9 @@ from PyQt4 import QtGui
from openlp.core.lib import Settings, SettingsTab, UiStrings, translate from openlp.core.lib import Settings, SettingsTab, UiStrings, translate
class MediaQCheckBox(QtGui.QCheckBox): class MediaQ_check_box(QtGui.QCheckBox):
""" """
MediaQCheckBox adds an extra property, playerName to the QCheckBox class. MediaQ_check_box adds an extra property, playerName to the Q_check_box class.
""" """
def setPlayerName(self, name): def setPlayerName(self, name):
self.playerName = name self.playerName = name
@ -51,36 +51,36 @@ class MediaTab(SettingsTab):
def setupUi(self): def setupUi(self):
self.setObjectName(u'MediaTab') self.setObjectName(u'MediaTab')
SettingsTab.setupUi(self) SettingsTab.setupUi(self)
self.advancedGroupBox = QtGui.QGroupBox(self.leftColumn) self.advanced_group_box = QtGui.QGroupBox(self.left_column)
self.advancedGroupBox.setObjectName(u'advancedGroupBox') self.advanced_group_box.setObjectName(u'advanced_group_box')
self.advancedLayout = QtGui.QVBoxLayout(self.advancedGroupBox) self.advanced_layout = QtGui.QVBoxLayout(self.advanced_group_box)
self.advancedLayout.setObjectName(u'advancedLayout') self.advanced_layout.setObjectName(u'advanced_layout')
self.overridePlayerCheckBox = QtGui.QCheckBox(self.advancedGroupBox) self.override_player_check_box = QtGui.QCheckBox(self.advanced_group_box)
self.overridePlayerCheckBox.setObjectName(u'overridePlayerCheckBox') self.override_player_check_box.setObjectName(u'override_player_check_box')
self.advancedLayout.addWidget(self.overridePlayerCheckBox) self.advanced_layout.addWidget(self.override_player_check_box)
self.autoStartCheckBox = QtGui.QCheckBox(self.advancedGroupBox) self.auto_start_check_box = QtGui.QCheckBox(self.advanced_group_box)
self.autoStartCheckBox.setObjectName(u'autoStartCheckBox') self.auto_start_check_box.setObjectName(u'auto_start_check_box')
self.advancedLayout.addWidget(self.autoStartCheckBox) self.advanced_layout.addWidget(self.auto_start_check_box)
self.leftLayout.addWidget(self.advancedGroupBox) self.left_layout.addWidget(self.advanced_group_box)
self.leftLayout.addStretch() self.left_layout.addStretch()
self.rightLayout.addStretch() self.right_layout.addStretch()
def retranslateUi(self): def retranslateUi(self):
self.advancedGroupBox.setTitle(UiStrings().Advanced) self.advanced_group_box.setTitle(UiStrings().Advanced)
self.overridePlayerCheckBox.setText(translate('MediaPlugin.MediaTab', 'Allow media player to be overridden')) self.override_player_check_box.setText(translate('MediaPlugin.MediaTab', 'Allow media player to be overridden'))
self.autoStartCheckBox.setText(translate('MediaPlugin.MediaTab', 'Start Live items automatically')) self.auto_start_check_box.setText(translate('MediaPlugin.MediaTab', 'Start Live items automatically'))
def load(self): def load(self):
self.overridePlayerCheckBox.setChecked(Settings().value(self.settingsSection + u'/override player')) self.override_player_check_box.setChecked(Settings().value(self.settings_section + u'/override player'))
self.autoStartCheckBox.setChecked(Settings().value(self.settingsSection + u'/media auto start')) self.auto_start_check_box.setChecked(Settings().value(self.settings_section + u'/media auto start'))
def save(self): def save(self):
setting_key = self.settingsSection + u'/override player' setting_key = self.settings_section + u'/override player'
if Settings().value(setting_key) != self.overridePlayerCheckBox.checkState(): if Settings().value(setting_key) != self.override_player_check_box.checkState():
Settings().setValue(setting_key, self.overridePlayerCheckBox.checkState()) Settings().setValue(setting_key, self.override_player_check_box.checkState())
self.settings_form.register_post_process(u'mediaitem_suffix_reset') self.settings_form.register_post_process(u'mediaitem_suffix_reset')
self.settings_form.register_post_process(u'mediaitem_media_rebuild') self.settings_form.register_post_process(u'mediaitem_media_rebuild')
self.settings_form.register_post_process(u'mediaitem_suffixes') self.settings_form.register_post_process(u'mediaitem_suffixes')
setting_key = self.settingsSection + u'/media auto start' setting_key = self.settings_section + u'/media auto start'
if Settings().value(setting_key) != self.autoStartCheckBox.checkState(): if Settings().value(setting_key) != self.auto_start_check_box.checkState():
Settings().setValue(setting_key, self.autoStartCheckBox.checkState()) Settings().setValue(setting_key, self.auto_start_check_box.checkState())

View File

@ -151,7 +151,7 @@ class PresentationMediaItem(MediaManagerItem):
titles = [os.path.split(file)[1] for file in currlist] titles = [os.path.split(file)[1] for file in currlist]
self.application.set_busy_cursor() self.application.set_busy_cursor()
if not initialLoad: if not initialLoad:
self.main_window.displayProgressBar(len(files)) self.main_window.display_progress_bar(len(files))
# Sort the presentations by its filename considering language specific characters. # Sort the presentations by its filename considering language specific characters.
files.sort(cmp=locale_compare, files.sort(cmp=locale_compare,
key=lambda filename: os.path.split(unicode(filename))[1]) key=lambda filename: os.path.split(unicode(filename))[1])
@ -205,7 +205,7 @@ class PresentationMediaItem(MediaManagerItem):
item_name.setToolTip(file) item_name.setToolTip(file)
self.listView.addItem(item_name) self.listView.addItem(item_name)
if not initialLoad: if not initialLoad:
self.main_window.finishedProgressBar() self.main_window.finished_progress_bar()
self.application.set_normal_cursor() self.application.set_normal_cursor()
def onDeleteClick(self): def onDeleteClick(self):
@ -217,7 +217,7 @@ class PresentationMediaItem(MediaManagerItem):
row_list = [item.row() for item in items] row_list = [item.row() for item in items]
row_list.sort(reverse=True) row_list.sort(reverse=True)
self.application.set_busy_cursor() self.application.set_busy_cursor()
self.main_window.displayProgressBar(len(row_list)) self.main_window.display_progress_bar(len(row_list))
for item in items: for item in items:
filepath = unicode(item.data(QtCore.Qt.UserRole)) filepath = unicode(item.data(QtCore.Qt.UserRole))
for cidx in self.controllers: for cidx in self.controllers:
@ -225,7 +225,7 @@ class PresentationMediaItem(MediaManagerItem):
doc.presentation_deleted() doc.presentation_deleted()
doc.close_presentation() doc.close_presentation()
self.main_window.increment_progress_bar() self.main_window.increment_progress_bar()
self.main_window.finishedProgressBar() self.main_window.finished_progress_bar()
self.application.set_busy_cursor() self.application.set_busy_cursor()
for row in row_list: for row in row_list:
self.listView.takeItem(row) self.listView.takeItem(row)

View File

@ -31,6 +31,7 @@ from PyQt4 import QtGui
from openlp.core.lib import Settings, SettingsTab, UiStrings, translate from openlp.core.lib import Settings, SettingsTab, UiStrings, translate
class PresentationTab(SettingsTab): class PresentationTab(SettingsTab):
""" """
PresentationsTab is the Presentations settings tab in the settings dialog. PresentationsTab is the Presentations settings tab in the settings dialog.
@ -50,43 +51,43 @@ class PresentationTab(SettingsTab):
""" """
self.setObjectName(u'PresentationTab') self.setObjectName(u'PresentationTab')
SettingsTab.setupUi(self) SettingsTab.setupUi(self)
self.ControllersGroupBox = QtGui.QGroupBox(self.leftColumn) self.controllers_group_box = QtGui.QGroupBox(self.left_column)
self.ControllersGroupBox.setObjectName(u'ControllersGroupBox') self.controllers_group_box.setObjectName(u'controllers_group_box')
self.ControllersLayout = QtGui.QVBoxLayout(self.ControllersGroupBox) self.controllers_layout = QtGui.QVBoxLayout(self.controllers_group_box)
self.ControllersLayout.setObjectName(u'ControllersLayout') self.controllers_layout.setObjectName(u'ccontrollers_layout')
self.PresenterCheckboxes = {} self.presenter_check_boxes = {}
for key in self.controllers: for key in self.controllers:
controller = self.controllers[key] controller = self.controllers[key]
checkbox = QtGui.QCheckBox(self.ControllersGroupBox) checkbox = QtGui.QCheckBox(self.controllers_group_box)
checkbox.setObjectName(controller.name + u'CheckBox') checkbox.setObjectName(controller.name + u'CheckBox')
self.PresenterCheckboxes[controller.name] = checkbox self.presenter_check_boxes[controller.name] = checkbox
self.ControllersLayout.addWidget(checkbox) self.controllers_layout.addWidget(checkbox)
self.leftLayout.addWidget(self.ControllersGroupBox) self.left_layout.addWidget(self.controllers_group_box)
self.AdvancedGroupBox = QtGui.QGroupBox(self.leftColumn) self.advanced_group_box = QtGui.QGroupBox(self.left_column)
self.AdvancedGroupBox.setObjectName(u'AdvancedGroupBox') self.advanced_group_box.setObjectName(u'advanced_group_box')
self.AdvancedLayout = QtGui.QVBoxLayout(self.AdvancedGroupBox) self.advanced_layout = QtGui.QVBoxLayout(self.advanced_group_box)
self.AdvancedLayout.setObjectName(u'AdvancedLayout') self.advanced_layout.setObjectName(u'advanced_layout')
self.OverrideAppCheckBox = QtGui.QCheckBox(self.AdvancedGroupBox) self.override_app_check_box = QtGui.QCheckBox(self.advanced_group_box)
self.OverrideAppCheckBox.setObjectName(u'OverrideAppCheckBox') self.override_app_check_box.setObjectName(u'override_app_check_box')
self.AdvancedLayout.addWidget(self.OverrideAppCheckBox) self.advanced_layout.addWidget(self.override_app_check_box)
self.leftLayout.addWidget(self.AdvancedGroupBox) self.left_layout.addWidget(self.advanced_group_box)
self.leftLayout.addStretch() self.left_layout.addStretch()
self.rightLayout.addStretch() self.right_layout.addStretch()
def retranslateUi(self): def retranslateUi(self):
""" """
Make any translation changes Make any translation changes
""" """
self.ControllersGroupBox.setTitle(translate('PresentationPlugin.PresentationTab', 'Available Controllers')) self.controllers_group_box.setTitle(translate('PresentationPlugin.PresentationTab', 'Available Controllers'))
for key in self.controllers: for key in self.controllers:
controller = self.controllers[key] controller = self.controllers[key]
checkbox = self.PresenterCheckboxes[controller.name] checkbox = self.presenter_check_boxes[controller.name]
self.setControllerText(checkbox, controller) self.set_controller_text(checkbox, controller)
self.AdvancedGroupBox.setTitle(UiStrings().Advanced) self.advanced_group_box.setTitle(UiStrings().Advanced)
self.OverrideAppCheckBox.setText( self.override_app_check_box.setText(
translate('PresentationPlugin.PresentationTab', 'Allow presentation application to be overridden')) translate('PresentationPlugin.PresentationTab', 'Allow presentation application to be overridden'))
def setControllerText(self, checkbox, controller): def set_controller_text(self, checkbox, controller):
if checkbox.isEnabled(): if checkbox.isEnabled():
checkbox.setText(controller.name) checkbox.setText(controller.name)
else: else:
@ -99,15 +100,14 @@ class PresentationTab(SettingsTab):
""" """
for key in self.controllers: for key in self.controllers:
controller = self.controllers[key] controller = self.controllers[key]
checkbox = self.PresenterCheckboxes[controller.name] checkbox = self.presenter_check_boxes[controller.name]
checkbox.setChecked(Settings().value(self.settingsSection + u'/' + controller.name)) checkbox.setChecked(Settings().value(self.settings_section + u'/' + controller.name))
self.OverrideAppCheckBox.setChecked(Settings().value(self.settingsSection + u'/override app')) self.override_app_check_box.setChecked(Settings().value(self.settings_section + u'/override app'))
def save(self): def save(self):
""" """
Save the settings. If the tab hasn't been made visible to the user Save the settings. If the tab hasn't been made visible to the user then there is nothing to do,
then there is nothing to do, so exit. This removes the need to so exit. This removes the need to start presentation applications unnecessarily.
start presentation applications unnecessarily.
""" """
if not self.activated: if not self.activated:
return return
@ -115,8 +115,8 @@ class PresentationTab(SettingsTab):
for key in self.controllers: for key in self.controllers:
controller = self.controllers[key] controller = self.controllers[key]
if controller.is_available(): if controller.is_available():
checkbox = self.PresenterCheckboxes[controller.name] checkbox = self.presenter_check_boxes[controller.name]
setting_key = self.settingsSection + u'/' + controller.name setting_key = self.settings_section + u'/' + controller.name
if Settings().value(setting_key) != checkbox.checkState(): if Settings().value(setting_key) != checkbox.checkState():
changed = True changed = True
Settings().setValue(setting_key, checkbox.checkState()) Settings().setValue(setting_key, checkbox.checkState())
@ -124,22 +124,22 @@ class PresentationTab(SettingsTab):
controller.start_process() controller.start_process()
else: else:
controller.kill() controller.kill()
setting_key = self.settingsSection + u'/override app' setting_key = self.settings_section + u'/override app'
if Settings().value(setting_key) != self.OverrideAppCheckBox.checkState(): if Settings().value(setting_key) != self.override_app_check_box.checkState():
Settings().setValue(setting_key, self.OverrideAppCheckBox.checkState()) Settings().setValue(setting_key, self.override_app_check_box.checkState())
changed = True changed = True
if changed: if changed:
self.settings_form.register_post_process(u'mediaitem_suffix_reset') self.settings_form.register_post_process(u'mediaitem_suffix_reset')
self.settings_form.register_post_process(u'mediaitem_presentation_rebuild') self.settings_form.register_post_process(u'mediaitem_presentation_rebuild')
self.settings_form.register_post_process(u'mediaitem_suffixes') self.settings_form.register_post_process(u'mediaitem_suffixes')
def tabVisible(self): def tab_visible(self):
""" """
Tab has just been made visible to the user Tab has just been made visible to the user
""" """
self.activated = True self.activated = True
for key in self.controllers: for key in self.controllers:
controller = self.controllers[key] controller = self.controllers[key]
checkbox = self.PresenterCheckboxes[controller.name] checkbox = self.presenter_check_boxes[controller.name]
checkbox.setEnabled(controller.is_available()) checkbox.setEnabled(controller.is_available())
self.setControllerText(checkbox, controller) self.set_controller_text(checkbox, controller)

View File

@ -110,7 +110,7 @@ class PresentationPlugin(Plugin):
Create the Media Manager List Create the Media Manager List
""" """
self.mediaItem = PresentationMediaItem( self.mediaItem = PresentationMediaItem(
self.main_window.mediaDockManager.media_dock, self, self.icon, self.controllers) self.main_window.media_dock_manager.media_dock, self, self.icon, self.controllers)
def registerControllers(self, controller): def registerControllers(self, controller):
""" """
@ -132,13 +132,12 @@ class PresentationPlugin(Plugin):
if filename.endswith(u'controller.py') and not filename == 'presentationcontroller.py': if filename.endswith(u'controller.py') and not filename == 'presentationcontroller.py':
path = os.path.join(controller_dir, filename) path = os.path.join(controller_dir, filename)
if os.path.isfile(path): if os.path.isfile(path):
modulename = u'openlp.plugins.presentations.lib.' + os.path.splitext(filename)[0] module_name = u'openlp.plugins.presentations.lib.' + os.path.splitext(filename)[0]
log.debug(u'Importing controller %s', modulename) log.debug(u'Importing controller %s', module_name)
try: try:
__import__(modulename, globals(), locals(), []) __import__(module_name, globals(), locals(), [])
except ImportError: except ImportError:
log.warn(u'Failed to import %s on path %s', log.warn(u'Failed to import %s on path %s', module_name, path)
modulename, path)
controller_classes = PresentationController.__subclasses__() controller_classes = PresentationController.__subclasses__()
for controller_class in controller_classes: for controller_class in controller_classes:
controller = controller_class(self) controller = controller_class(self)

View File

@ -45,7 +45,7 @@ class RemoteTab(SettingsTab):
def setupUi(self): def setupUi(self):
self.setObjectName(u'RemoteTab') self.setObjectName(u'RemoteTab')
SettingsTab.setupUi(self) SettingsTab.setupUi(self)
self.server_settings_group_box = QtGui.QGroupBox(self.leftColumn) self.server_settings_group_box = QtGui.QGroupBox(self.left_column)
self.server_settings_group_box.setObjectName(u'server_settings_group_box') self.server_settings_group_box.setObjectName(u'server_settings_group_box')
self.server_settings_layout = QtGui.QFormLayout(self.server_settings_group_box) self.server_settings_layout = QtGui.QFormLayout(self.server_settings_group_box)
self.server_settings_layout.setObjectName(u'server_settings_layout') self.server_settings_layout.setObjectName(u'server_settings_layout')
@ -78,10 +78,10 @@ class RemoteTab(SettingsTab):
self.stage_url.setObjectName(u'stage_url') self.stage_url.setObjectName(u'stage_url')
self.stage_url.setOpenExternalLinks(True) self.stage_url.setOpenExternalLinks(True)
self.server_settings_layout.addRow(self.stage_url_label, self.stage_url) self.server_settings_layout.addRow(self.stage_url_label, self.stage_url)
self.leftLayout.addWidget(self.server_settings_group_box) self.left_layout.addWidget(self.server_settings_group_box)
self.android_app_group_box = QtGui.QGroupBox(self.rightColumn) self.android_app_group_box = QtGui.QGroupBox(self.right_column)
self.android_app_group_box.setObjectName(u'android_app_group_box') self.android_app_group_box.setObjectName(u'android_app_group_box')
self.rightLayout.addWidget(self.android_app_group_box) self.right_layout.addWidget(self.android_app_group_box)
self.qr_layout = QtGui.QVBoxLayout(self.android_app_group_box) self.qr_layout = QtGui.QVBoxLayout(self.android_app_group_box)
self.qr_layout.setObjectName(u'qr_layout') self.qr_layout.setObjectName(u'qr_layout')
self.qr_code_label = QtGui.QLabel(self.android_app_group_box) self.qr_code_label = QtGui.QLabel(self.android_app_group_box)
@ -94,8 +94,8 @@ class RemoteTab(SettingsTab):
self.qr_description_label.setOpenExternalLinks(True) self.qr_description_label.setOpenExternalLinks(True)
self.qr_description_label.setWordWrap(True) self.qr_description_label.setWordWrap(True)
self.qr_layout.addWidget(self.qr_description_label) self.qr_layout.addWidget(self.qr_description_label)
self.leftLayout.addStretch() self.left_layout.addStretch()
self.rightLayout.addStretch() self.right_layout.addStretch()
self.twelve_hour_check_box.stateChanged.connect(self.onTwelveHourCheckBoxChanged) self.twelve_hour_check_box.stateChanged.connect(self.onTwelveHourCheckBoxChanged)
self.address_edit.textChanged.connect(self.set_urls) self.address_edit.textChanged.connect(self.set_urls)
self.port_spin_box.valueChanged.connect(self.set_urls) self.port_spin_box.valueChanged.connect(self.set_urls)
@ -135,20 +135,20 @@ class RemoteTab(SettingsTab):
self.stage_url.setText(u'<a href="%s">%s</a>' % (url, url)) self.stage_url.setText(u'<a href="%s">%s</a>' % (url, url))
def load(self): def load(self):
self.port_spin_box.setValue(Settings().value(self.settingsSection + u'/port')) self.port_spin_box.setValue(Settings().value(self.settings_section + u'/port'))
self.address_edit.setText(Settings().value(self.settingsSection + u'/ip address')) self.address_edit.setText(Settings().value(self.settings_section + u'/ip address'))
self.twelve_hour = Settings().value(self.settingsSection + u'/twelve hour') self.twelve_hour = Settings().value(self.settings_section + u'/twelve hour')
self.twelve_hour_check_box.setChecked(self.twelve_hour) self.twelve_hour_check_box.setChecked(self.twelve_hour)
self.set_urls() self.set_urls()
def save(self): def save(self):
changed = False changed = False
if Settings().value(self.settingsSection + u'/ip address') != self.address_edit.text() or \ if Settings().value(self.settings_section + u'/ip address') != self.address_edit.text() or \
Settings().value(self.settingsSection + u'/port') != self.port_spin_box.value(): Settings().value(self.settings_section + u'/port') != self.port_spin_box.value():
changed = True changed = True
Settings().setValue(self.settingsSection + u'/port', self.port_spin_box.value()) Settings().setValue(self.settings_section + u'/port', self.port_spin_box.value())
Settings().setValue(self.settingsSection + u'/ip address', self.address_edit.text()) Settings().setValue(self.settings_section + u'/ip address', self.address_edit.text())
Settings().setValue(self.settingsSection + u'/twelve hour', self.twelve_hour) Settings().setValue(self.settings_section + u'/twelve hour', self.twelve_hour)
if changed: if changed:
Registry().register_function(u'remotes_config_updated') Registry().register_function(u'remotes_config_updated')

View File

@ -97,8 +97,7 @@ class RemotesPlugin(Plugin):
def config_update(self): def config_update(self):
""" """
Called when Config is changed to restart the server on new address or Called when Config is changed to restart the server on new address or port
port
""" """
self.finalise() self.finalise()
self.initialise() self.initialise()

View File

@ -84,7 +84,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
self.verse_delete_button.clicked.connect(self.on_verse_delete_button_clicked) self.verse_delete_button.clicked.connect(self.on_verse_delete_button_clicked)
self.verse_list_widget.itemClicked.connect(self.on_verse_list_view_clicked) self.verse_list_widget.itemClicked.connect(self.on_verse_list_view_clicked)
self.verse_order_edit.textChanged.connect(self.on_verse_order_text_changed) self.verse_order_edit.textChanged.connect(self.on_verse_order_text_changed)
self.theme_add_button.clicked.connect(self.theme_manager.onAddTheme) self.theme_add_button.clicked.connect(self.theme_manager.on_add_theme)
self.maintenance_button.clicked.connect(self.on_maintenance_button_clicked) self.maintenance_button.clicked.connect(self.on_maintenance_button_clicked)
self.from_file_button.clicked.connect(self.on_audio_add_from_file_button_clicked) self.from_file_button.clicked.connect(self.on_audio_add_from_file_button_clicked)
self.from_media_button.clicked.connect(self.on_audio_add_from_media_button_clicked) self.from_media_button.clicked.connect(self.on_audio_add_from_media_button_clicked)

View File

@ -104,7 +104,6 @@ class SongMediaItem(MediaManagerItem):
self.addSearchToToolBar() self.addSearchToToolBar()
# Signals and slots # Signals and slots
Registry().register_function(u'songs_load_list', self.on_song_list_load) Registry().register_function(u'songs_load_list', self.on_song_list_load)
Registry().register_function(u'config_updated', self.config_update)
Registry().register_function(u'songs_preview', self.onPreviewClick) Registry().register_function(u'songs_preview', self.onPreviewClick)
QtCore.QObject.connect(self.searchTextEdit, QtCore.SIGNAL(u'cleared()'), self.onClearTextButtonClick) QtCore.QObject.connect(self.searchTextEdit, QtCore.SIGNAL(u'cleared()'), self.onClearTextButtonClick)
QtCore.QObject.connect(self.searchTextEdit, QtCore.SIGNAL(u'searchTypeChanged(int)'), QtCore.QObject.connect(self.searchTextEdit, QtCore.SIGNAL(u'searchTypeChanged(int)'),
@ -120,6 +119,10 @@ class SongMediaItem(MediaManagerItem):
self.searchTextEdit.setFocus() self.searchTextEdit.setFocus()
def config_update(self): def config_update(self):
"""
IS triggered when the songs config is updated
"""
log.debug(u'config_updated')
self.searchAsYouType = Settings().value(self.settingsSection + u'/search as type') self.searchAsYouType = Settings().value(self.settingsSection + u'/search as type')
self.updateServiceOnEdit = Settings().value(self.settingsSection + u'/update service on edit') self.updateServiceOnEdit = Settings().value(self.settingsSection + u'/update service on edit')
self.addSongFromService = Settings().value(self.settingsSection + u'/add song from service',) self.addSongFromService = Settings().value(self.settingsSection + u'/add song from service',)
@ -366,7 +369,7 @@ class SongMediaItem(MediaManagerItem):
QtGui.QMessageBox.Yes) == QtGui.QMessageBox.No: QtGui.QMessageBox.Yes) == QtGui.QMessageBox.No:
return return
self.application.set_busy_cursor() self.application.set_busy_cursor()
self.main_window.displayProgressBar(len(items)) self.main_window.display_progress_bar(len(items))
for item in items: for item in items:
item_id = item.data(QtCore.Qt.UserRole) item_id = item.data(QtCore.Qt.UserRole)
media_files = self.plugin.manager.get_all_objects(MediaFile, MediaFile.song_id == item_id) media_files = self.plugin.manager.get_all_objects(MediaFile, MediaFile.song_id == item_id)
@ -383,7 +386,7 @@ class SongMediaItem(MediaManagerItem):
log.exception(u'Could not remove directory: %s', save_path) log.exception(u'Could not remove directory: %s', save_path)
self.plugin.manager.delete_object(Song, item_id) self.plugin.manager.delete_object(Song, item_id)
self.main_window.increment_progress_bar() self.main_window.increment_progress_bar()
self.main_window.finishedProgressBar() self.main_window.finished_progress_bar()
self.application.set_normal_cursor() self.application.set_normal_cursor()
self.onSearchTextButtonClicked() self.onSearchTextButtonClicked()

View File

@ -42,69 +42,72 @@ class SongsTab(SettingsTab):
""" """
self.setObjectName(u'SongsTab') self.setObjectName(u'SongsTab')
SettingsTab.setupUi(self) SettingsTab.setupUi(self)
self.modeGroupBox = QtGui.QGroupBox(self.leftColumn) self.mode_group_box = QtGui.QGroupBox(self.left_column)
self.modeGroupBox.setObjectName(u'modeGroupBox') self.mode_group_box.setObjectName(u'mode_group_box')
self.modeLayout = QtGui.QVBoxLayout(self.modeGroupBox) self.mode_layout = QtGui.QVBoxLayout(self.mode_group_box)
self.modeLayout.setObjectName(u'modeLayout') self.mode_layout.setObjectName(u'mode_layout')
self.searchAsTypeCheckBox = QtGui.QCheckBox(self.modeGroupBox) self.search_as_type_check_box = QtGui.QCheckBox(self.mode_group_box)
self.searchAsTypeCheckBox.setObjectName(u'SearchAsTypeCheckBox') self.search_as_type_check_box.setObjectName(u'SearchAsType_check_box')
self.modeLayout.addWidget(self.searchAsTypeCheckBox) self.mode_layout.addWidget(self.search_as_type_check_box)
self.toolBarActiveCheckBox = QtGui.QCheckBox(self.modeGroupBox) self.tool_bar_active_check_box = QtGui.QCheckBox(self.mode_group_box)
self.toolBarActiveCheckBox.setObjectName(u'toolBarActiveCheckBox') self.tool_bar_active_check_box.setObjectName(u'tool_bar_active_check_box')
self.modeLayout.addWidget(self.toolBarActiveCheckBox) self.mode_layout.addWidget(self.tool_bar_active_check_box)
self.updateOnEditCheckBox = QtGui.QCheckBox(self.modeGroupBox) self.update_on_edit_check_box = QtGui.QCheckBox(self.mode_group_box)
self.updateOnEditCheckBox.setObjectName(u'updateOnEditCheckBox') self.update_on_edit_check_box.setObjectName(u'update_on_edit_check_box')
self.modeLayout.addWidget(self.updateOnEditCheckBox) self.mode_layout.addWidget(self.update_on_edit_check_box)
self.addFromServiceCheckBox = QtGui.QCheckBox(self.modeGroupBox) self.add_from_service_check_box = QtGui.QCheckBox(self.mode_group_box)
self.addFromServiceCheckBox.setObjectName(u'addFromServiceCheckBox') self.add_from_service_check_box.setObjectName(u'add_from_service_check_box')
self.modeLayout.addWidget(self.addFromServiceCheckBox) self.mode_layout.addWidget(self.add_from_service_check_box)
self.leftLayout.addWidget(self.modeGroupBox) self.left_layout.addWidget(self.mode_group_box)
self.leftLayout.addStretch() self.left_layout.addStretch()
self.rightLayout.addStretch() self.right_layout.addStretch()
self.searchAsTypeCheckBox.stateChanged.connect(self.onSearchAsTypeCheckBoxChanged) self.search_as_type_check_box.stateChanged.connect(self.on_search_as_type_check_box_changed)
self.toolBarActiveCheckBox.stateChanged.connect(self.onToolBarActiveCheckBoxChanged) self.tool_bar_active_check_box.stateChanged.connect(self.on_tool_bar_active_check_box_changed)
self.updateOnEditCheckBox.stateChanged.connect(self.onUpdateOnEditCheckBoxChanged) self.update_on_edit_check_box.stateChanged.connect(self.on_update_on_edit_check_box_changed)
self.addFromServiceCheckBox.stateChanged.connect(self.onAddFromServiceCheckBoxChanged) self.add_from_service_check_box.stateChanged.connect(self.on_add_from_service_check_box_changed)
def retranslateUi(self): def retranslateUi(self):
self.modeGroupBox.setTitle(translate('SongsPlugin.SongsTab', 'Songs Mode')) self.mode_group_box.setTitle(translate('SongsPlugin.SongsTab', 'Songs Mode'))
self.searchAsTypeCheckBox.setText(translate('SongsPlugin.SongsTab', 'Enable search as you type')) self.search_as_type_check_box.setText(translate('SongsPlugin.SongsTab', 'Enable search as you type'))
self.toolBarActiveCheckBox.setText(translate('SongsPlugin.SongsTab', self.tool_bar_active_check_box.setText(translate('SongsPlugin.SongsTab',
'Display verses on live tool bar')) 'Display verses on live tool bar'))
self.updateOnEditCheckBox.setText(translate('SongsPlugin.SongsTab', 'Update service from song edit')) self.update_on_edit_check_box.setText(translate('SongsPlugin.SongsTab', 'Update service from song edit'))
self.addFromServiceCheckBox.setText(translate('SongsPlugin.SongsTab', self.add_from_service_check_box.setText(translate('SongsPlugin.SongsTab',
'Import missing songs from service files')) 'Import missing songs from service files'))
def onSearchAsTypeCheckBoxChanged(self, check_state): def on_search_as_type_check_box_changed(self, check_state):
self.song_search = (check_state == QtCore.Qt.Checked) self.song_search = (check_state == QtCore.Qt.Checked)
def onToolBarActiveCheckBoxChanged(self, check_state): def on_tool_bar_active_check_box_changed(self, check_state):
self.tool_bar = (check_state == QtCore.Qt.Checked) self.tool_bar = (check_state == QtCore.Qt.Checked)
def onUpdateOnEditCheckBoxChanged(self, check_state): def on_update_on_edit_check_box_changed(self, check_state):
self.update_edit = (check_state == QtCore.Qt.Checked) self.update_edit = (check_state == QtCore.Qt.Checked)
def onAddFromServiceCheckBoxChanged(self, check_state): def on_add_from_service_check_box_changed(self, check_state):
self.update_load = (check_state == QtCore.Qt.Checked) self.update_load = (check_state == QtCore.Qt.Checked)
def load(self): def load(self):
settings = Settings() settings = Settings()
settings.beginGroup(self.settingsSection) settings.beginGroup(self.settings_section)
self.song_search = settings.value(u'search as type') self.song_search = settings.value(u'search as type')
self.tool_bar = settings.value(u'display songbar') self.tool_bar = settings.value(u'display songbar')
self.update_edit = settings.value(u'update service on edit') self.update_edit = settings.value(u'update service on edit')
self.update_load = settings.value(u'add song from service') self.update_load = settings.value(u'add song from service')
self.searchAsTypeCheckBox.setChecked(self.song_search) self.search_as_type_check_box.setChecked(self.song_search)
self.toolBarActiveCheckBox.setChecked(self.tool_bar) self.tool_bar_active_check_box.setChecked(self.tool_bar)
self.updateOnEditCheckBox.setChecked(self.update_edit) self.update_on_edit_check_box.setChecked(self.update_edit)
self.addFromServiceCheckBox.setChecked(self.update_load) self.add_from_service_check_box.setChecked(self.update_load)
settings.endGroup() settings.endGroup()
def save(self): def save(self):
settings = Settings() settings = Settings()
settings.beginGroup(self.settingsSection) settings.beginGroup(self.settings_section)
settings.setValue(u'search as type', self.song_search) settings.setValue(u'search as type', self.song_search)
settings.setValue(u'display songbar', self.tool_bar) settings.setValue(u'display songbar', self.tool_bar)
settings.setValue(u'update service on edit', self.update_edit) settings.setValue(u'update service on edit', self.update_edit)
settings.setValue(u'add song from service', self.update_load) settings.setValue(u'add song from service', self.update_load)
settings.endGroup() settings.endGroup()
if self.tab_visited:
self.settings_form.register_post_process(u'songs_config_updated')
self.tab_visited = False

View File

@ -106,12 +106,12 @@ class SongUsagePlugin(Plugin):
self.song_usage_menu.addSeparator() self.song_usage_menu.addSeparator()
self.song_usage_menu.addAction(self.song_usage_report) self.song_usage_menu.addAction(self.song_usage_report)
self.song_usage_menu.addAction(self.song_usage_delete) self.song_usage_menu.addAction(self.song_usage_delete)
self.song_usage_active_button = QtGui.QToolButton(self.main_window.statusBar) self.song_usage_active_button = QtGui.QToolButton(self.main_window.status_bar)
self.song_usage_active_button.setCheckable(True) self.song_usage_active_button.setCheckable(True)
self.song_usage_active_button.setAutoRaise(True) self.song_usage_active_button.setAutoRaise(True)
self.song_usage_active_button.setStatusTip(translate('SongUsagePlugin', 'Toggle the tracking of song usage.')) self.song_usage_active_button.setStatusTip(translate('SongUsagePlugin', 'Toggle the tracking of song usage.'))
self.song_usage_active_button.setObjectName(u'song_usage_active_button') self.song_usage_active_button.setObjectName(u'song_usage_active_button')
self.main_window.statusBar.insertPermanentWidget(1, self.song_usage_active_button) self.main_window.status_bar.insertPermanentWidget(1, self.song_usage_active_button)
self.song_usage_active_button.hide() self.song_usage_active_button.hide()
# Signals and slots # Signals and slots
QtCore.QObject.connect(self.song_usage_status, QtCore.SIGNAL(u'visibilityChanged(bool)'), QtCore.QObject.connect(self.song_usage_status, QtCore.SIGNAL(u'visibilityChanged(bool)'),

View File

@ -40,7 +40,7 @@ import os
import sys import sys
from distutils.version import LooseVersion from distutils.version import LooseVersion
# If we try to import uno before nose this will greate a warning. Just try to import nose first to supress the warning. # If we try to import uno before nose this will create a warning. Just try to import nose first to suppress the warning.
try: try:
import nose import nose
except ImportError: except ImportError:

View File

@ -27,6 +27,9 @@ class TestSettingsForm(TestCase):
""" """
Some pre-test setup required. Some pre-test setup required.
""" """
self.dummy1 = MagicMock()
self.dummy2 = MagicMock()
self.dummy3 = MagicMock()
self.desktop = MagicMock() self.desktop = MagicMock()
self.desktop.primaryScreen.return_value = SCREEN[u'primary'] self.desktop.primaryScreen.return_value = SCREEN[u'primary']
self.desktop.screenCount.return_value = SCREEN[u'number'] self.desktop.screenCount.return_value = SCREEN[u'number']
@ -108,3 +111,59 @@ class TestSettingsForm(TestCase):
# WHEN testing the processing stack # WHEN testing the processing stack
# THEN the processing stack should still have two items # THEN the processing stack should still have two items
assert len(self.form.processes) == 2, u'No new processes should have been added to the stack' assert len(self.form.processes) == 2, u'No new processes should have been added to the stack'
def register_image_manager_trigger_test_one(self):
"""
Test the triggering of the image manager rebuild event from image background change
"""
# GIVEN: Three functions registered to be call
Registry().register_function(u'images_config_updated', self.dummy1)
Registry().register_function(u'config_screen_changed', self.dummy2)
Registry().register_function(u'images_regenerate', self.dummy3)
# WHEN: The Images have been changed and the form submitted
self.form.register_post_process(u'images_config_updated')
self.form.accept()
# THEN: images_regenerate should have been added.
assert self.dummy1.call_count == 1, u'dummy1 should have been called once'
assert self.dummy2.call_count == 0, u'dummy2 should not have been called at all'
assert self.dummy3.call_count == 1, u'dummy3 should have been called once'
def register_image_manager_trigger_test_two(self):
"""
Test the triggering of the image manager rebuild event from screen dimension change
"""
# GIVEN: Three functions registered to be call
Registry().register_function(u'images_config_updated', self.dummy1)
Registry().register_function(u'config_screen_changed', self.dummy2)
Registry().register_function(u'images_regenerate', self.dummy3)
# WHEN: The Images have been changed and the form submitted
self.form.register_post_process(u'config_screen_changed')
self.form.accept()
# THEN: images_regenerate should have been added.
assert self.dummy1.call_count == 0, u'dummy1 should not have been called at all'
assert self.dummy2.call_count == 1, u'dummy2 should have been called once'
assert self.dummy3.call_count == 1, u'dummy3 should have been called once'
def register_image_manager_trigger_test_three(self):
"""
Test the triggering of the image manager rebuild event from image background change and a change to the
screen dimension.
"""
# GIVEN: Three functions registered to be call
Registry().register_function(u'images_config_updated', self.dummy1)
Registry().register_function(u'config_screen_changed', self.dummy2)
Registry().register_function(u'images_regenerate', self.dummy3)
# WHEN: The Images have been changed and the form submitted
self.form.register_post_process(u'config_screen_changed')
self.form.register_post_process(u'images_config_updated')
self.form.accept()
# THEN: Images_regenerate should have been added.
assert self.dummy1.call_count == 1, u'dummy1 should have been called once'
assert self.dummy2.call_count == 1, u'dummy2 should have been called once'
assert self.dummy3.call_count == 1, u'dummy3 should have been called once'