Head and conflicts

This commit is contained in:
Tim Bentley 2013-03-17 21:29:00 +00:00
commit 8e03c2e4b7
43 changed files with 1671 additions and 1591 deletions

View File

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

View File

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

View File

@ -36,7 +36,7 @@ import re
from PyQt4 import QtCore, QtGui
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.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.
"""
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 addImportMenuItem(self, importMenu):
"""
@ -284,14 +284,14 @@ class Plugin(QtCore.QObject):
"""
if self.mediaItem:
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):
"""
Called by the plugin Manager to cleanup things.
"""
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):
"""
@ -403,9 +403,11 @@ class Plugin(QtCore.QObject):
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):
"""

View File

@ -114,7 +114,7 @@ class Registry(object):
Register an event and associated function to be called
``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
recipients.

View File

@ -39,8 +39,7 @@ from openlp.core.lib import Registry
class SettingsTab(QtGui.QWidget):
"""
SettingsTab is a helper widget for plugins to define Tabs for the settings
dialog.
SettingsTab is a helper widget for plugins to define Tabs for the settings dialog.
"""
def __init__(self, parent, title, visible_title=None, icon_path=None):
"""
@ -53,11 +52,12 @@ class SettingsTab(QtGui.QWidget):
The title of the tab, which is usually displayed on the tab.
"""
QtGui.QWidget.__init__(self, parent)
self.tabTitle = title
self.tabTitleVisible = visible_title
self.settingsSection = self.tabTitle.lower()
self.tab_title = title
self.tab_title_visible = visible_title
self.settings_section = self.tab_title.lower()
self.tab_visited = False
if icon_path:
self.iconPath = icon_path
self.icon_path = icon_path
self.setupUi()
self.retranslateUi()
self.initialise()
@ -67,20 +67,20 @@ class SettingsTab(QtGui.QWidget):
"""
Setup the tab's interface.
"""
self.tabLayout = QtGui.QHBoxLayout(self)
self.tabLayout.setObjectName(u'tabLayout')
self.leftColumn = QtGui.QWidget(self)
self.leftColumn.setObjectName(u'leftColumn')
self.leftLayout = QtGui.QVBoxLayout(self.leftColumn)
self.leftLayout.setMargin(0)
self.leftLayout.setObjectName(u'leftLayout')
self.tabLayout.addWidget(self.leftColumn)
self.rightColumn = QtGui.QWidget(self)
self.rightColumn.setObjectName(u'rightColumn')
self.rightLayout = QtGui.QVBoxLayout(self.rightColumn)
self.rightLayout.setMargin(0)
self.rightLayout.setObjectName(u'rightLayout')
self.tabLayout.addWidget(self.rightColumn)
self.tab_layout = QtGui.QHBoxLayout(self)
self.tab_layout.setObjectName(u'tab_layout')
self.left_column = QtGui.QWidget(self)
self.left_column.setObjectName(u'left_column')
self.left_layout = QtGui.QVBoxLayout(self.left_column)
self.left_layout.setMargin(0)
self.left_layout.setObjectName(u'left_layout')
self.tab_layout.addWidget(self.left_column)
self.right_column = QtGui.QWidget(self)
self.right_column.setObjectName(u'right_column')
self.right_layout = QtGui.QVBoxLayout(self.right_column)
self.right_layout.setMargin(0)
self.right_layout.setObjectName(u'right_layout')
self.tab_layout.addWidget(self.right_column)
def resizeEvent(self, event=None):
"""
@ -88,11 +88,11 @@ class SettingsTab(QtGui.QWidget):
"""
if event:
QtGui.QWidget.resizeEvent(self, event)
width = self.width() - self.tabLayout.spacing() - \
self.tabLayout.contentsMargins().left() - self.tabLayout.contentsMargins().right()
left_width = min(width - self.rightColumn.minimumSizeHint().width(), width / 2)
left_width = max(left_width, self.leftColumn.minimumSizeHint().width())
self.leftColumn.setFixedWidth(left_width)
width = self.width() - self.tab_layout.spacing() - \
self.tab_layout.contentsMargins().left() - self.tab_layout.contentsMargins().right()
left_width = min(width - self.right_column.minimumSizeHint().width(), width / 2)
left_width = max(left_width, self.left_column.minimumSizeHint().width())
self.left_column.setFixedWidth(left_width)
def retranslateUi(self):
"""
@ -134,11 +134,11 @@ class SettingsTab(QtGui.QWidget):
"""
pass
def tabVisible(self):
def tab_visible(self):
"""
Tab has just been made visible to the user
"""
pass
self.tab_visited = True
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_color = u'#ffffff'
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')
SettingsTab.__init__(self, parent, u'Advanced', advanced_translated)
@ -65,7 +65,7 @@ class AdvancedTab(SettingsTab):
"""
self.setObjectName(u'AdvancedTab')
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_layout = QtGui.QFormLayout(self.ui_group_box)
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.setObjectName(u'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
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_layout = QtGui.QFormLayout(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.setObjectName(u'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
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_layout = QtGui.QFormLayout(self.data_directory_group_box)
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_copy_check_layout)
self.data_directory_layout.addRow(self.new_data_directory_has_files_label)
self.leftLayout.addWidget(self.data_directory_group_box)
self.leftLayout.addStretch()
self.left_layout.addWidget(self.data_directory_group_box)
self.left_layout.addStretch()
# 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_layout = QtGui.QFormLayout(self.default_image_group_box)
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_revert_button)
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
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_layout = QtGui.QVBoxLayout(self.hide_mouse_group_box)
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.setObjectName(u'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
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_layout = QtGui.QVBoxLayout(self.slide_group_box)
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.setObjectName(u'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
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_layout = QtGui.QVBoxLayout(self.display_workaround_group_box)
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.setObjectName(u'alternate_rows_check_box')
self.display_workaround_layout.addWidget(self.alternate_rows_check_box)
self.rightLayout.addWidget(self.display_workaround_group_box)
self.rightLayout.addStretch()
self.right_layout.addWidget(self.display_workaround_group_box)
self.right_layout.addStretch()
self.should_update_service_name_example = False
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)
@ -259,7 +259,6 @@ class AdvancedTab(SettingsTab):
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)
def retranslateUi(self):
"""
Setup the interface translation strings.
@ -334,7 +333,7 @@ class AdvancedTab(SettingsTab):
Load settings from disk.
"""
settings = Settings()
settings.beginGroup(self.settingsSection)
settings.beginGroup(self.settings_section)
# The max recent files value does not have an interface and so never
# gets actually stored in the settings therefore the default value of
# 20 will always be used.
@ -406,7 +405,7 @@ class AdvancedTab(SettingsTab):
Save settings to disk.
"""
settings = Settings()
settings.beginGroup(self.settingsSection)
settings.beginGroup(self.settings_section)
settings.setValue(u'default service enabled', self.service_name_check_box.isChecked())
service_name = self.service_name_edit.text()
preset_is_valid = self.generate_service_name_example()[0]

View File

@ -91,6 +91,11 @@ try:
WEBKIT_VERSION = QtWebKit.qWebKitVersion()
except AttributeError:
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
@ -144,12 +149,15 @@ class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog):
u'PySQLite: %s\n' % SQLITE_VERSION + \
u'Mako: %s\n' % MAKO_VERSION + \
u'CherryPy: %s\n' % CHERRYPY_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 os.environ.get(u'KDE_FULL_SESSION') == u'true':
system += u'Desktop: KDE SC\n'
elif os.environ.get(u'GNOME_DESKTOP_SESSION_ID'):
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)
def on_save_report_button_clicked(self):
@ -188,8 +196,7 @@ class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog):
def on_send_report_button_clicked(self):
"""
Opening systems default email client and inserting exception log and
system informations.
Opening systems default email client and inserting exception log and system information.
"""
body = translate('OpenLP.ExceptionForm',
'*OpenLP Bug Report*\n'

View File

@ -47,9 +47,9 @@ class GeneralTab(SettingsTab):
Initialise the general settings tab
"""
self.screens = ScreenList()
self.iconPath = u':/icon/openlp-logo-16x16.png'
generalTranslated = translate('OpenLP.GeneralTab', 'General')
SettingsTab.__init__(self, parent, u'General', generalTranslated)
self.icon_path = u':/icon/openlp-logo-16x16.png'
general_translated = translate('OpenLP.GeneralTab', 'General')
SettingsTab.__init__(self, parent, u'General', general_translated)
def setupUi(self):
"""
@ -57,274 +57,272 @@ class GeneralTab(SettingsTab):
"""
self.setObjectName(u'GeneralTab')
SettingsTab.setupUi(self)
self.tabLayout.setStretch(1, 1)
self.tab_layout.setStretch(1, 1)
# Monitors
self.monitorGroupBox = QtGui.QGroupBox(self.leftColumn)
self.monitorGroupBox.setObjectName(u'monitorGroupBox')
self.monitorLayout = QtGui.QGridLayout(self.monitorGroupBox)
self.monitorLayout.setObjectName(u'monitorLayout')
self.monitorRadioButton = QtGui.QRadioButton(self.monitorGroupBox)
self.monitorRadioButton.setObjectName(u'monitorRadioButton')
self.monitorLayout.addWidget(self.monitorRadioButton, 0, 0, 1, 5)
self.monitorComboBox = QtGui.QComboBox(self.monitorGroupBox)
self.monitorComboBox.setObjectName(u'monitorComboBox')
self.monitorLayout.addWidget(self.monitorComboBox, 1, 1, 1, 4)
self.monitor_group_box = QtGui.QGroupBox(self.left_column)
self.monitor_group_box.setObjectName(u'monitor_group_box')
self.monitor_layout = QtGui.QGridLayout(self.monitor_group_box)
self.monitor_layout.setObjectName(u'monitor_layout')
self.monitor_radio_button = QtGui.QRadioButton(self.monitor_group_box)
self.monitor_radio_button.setObjectName(u'monitor_radio_button')
self.monitor_layout.addWidget(self.monitor_radio_button, 0, 0, 1, 5)
self.monitor_combo_box = QtGui.QComboBox(self.monitor_group_box)
self.monitor_combo_box.setObjectName(u'monitor_combo_box')
self.monitor_layout.addWidget(self.monitor_combo_box, 1, 1, 1, 4)
# Display Position
self.overrideRadioButton = QtGui.QRadioButton(self.monitorGroupBox)
self.overrideRadioButton.setObjectName(u'overrideRadioButton')
self.monitorLayout.addWidget(self.overrideRadioButton, 2, 0, 1, 5)
self.override_radio_button = QtGui.QRadioButton(self.monitor_group_box)
self.override_radio_button.setObjectName(u'override_radio_button')
self.monitor_layout.addWidget(self.override_radio_button, 2, 0, 1, 5)
# Custom position
self.customXLabel = QtGui.QLabel(self.monitorGroupBox)
self.customXLabel.setObjectName(u'customXLabel')
self.monitorLayout.addWidget(self.customXLabel, 3, 1)
self.customXValueEdit = QtGui.QSpinBox(self.monitorGroupBox)
self.customXValueEdit.setObjectName(u'customXValueEdit')
self.customXValueEdit.setRange(-9999, 9999)
self.monitorLayout.addWidget(self.customXValueEdit, 4, 1)
self.customYLabel = QtGui.QLabel(self.monitorGroupBox)
self.customYLabel.setObjectName(u'customYLabel')
self.monitorLayout.addWidget(self.customYLabel, 3, 2)
self.customYValueEdit = QtGui.QSpinBox(self.monitorGroupBox)
self.customYValueEdit.setObjectName(u'customYValueEdit')
self.customYValueEdit.setRange(-9999, 9999)
self.monitorLayout.addWidget(self.customYValueEdit, 4, 2)
self.customWidthLabel = QtGui.QLabel(self.monitorGroupBox)
self.customWidthLabel.setObjectName(u'customWidthLabel')
self.monitorLayout.addWidget(self.customWidthLabel, 3, 3)
self.customWidthValueEdit = QtGui.QSpinBox(self.monitorGroupBox)
self.customWidthValueEdit.setObjectName(u'customWidthValueEdit')
self.customWidthValueEdit.setMaximum(9999)
self.monitorLayout.addWidget(self.customWidthValueEdit, 4, 3)
self.customHeightLabel = QtGui.QLabel(self.monitorGroupBox)
self.customHeightLabel.setObjectName(u'customHeightLabel')
self.monitorLayout.addWidget(self.customHeightLabel, 3, 4)
self.customHeightValueEdit = QtGui.QSpinBox(self.monitorGroupBox)
self.customHeightValueEdit.setObjectName(u'customHeightValueEdit')
self.customHeightValueEdit.setMaximum(9999)
self.monitorLayout.addWidget(self.customHeightValueEdit, 4, 4)
self.displayOnMonitorCheck = QtGui.QCheckBox(self.monitorGroupBox)
self.displayOnMonitorCheck.setObjectName(u'monitorComboBox')
self.monitorLayout.addWidget(self.displayOnMonitorCheck, 5, 0, 1, 5)
self.custom_x_label = QtGui.QLabel(self.monitor_group_box)
self.custom_x_label.setObjectName(u'custom_x_label')
self.monitor_layout.addWidget(self.custom_x_label, 3, 1)
self.custom_X_value_edit = QtGui.QSpinBox(self.monitor_group_box)
self.custom_X_value_edit.setObjectName(u'custom_X_value_edit')
self.custom_X_value_edit.setRange(-9999, 9999)
self.monitor_layout.addWidget(self.custom_X_value_edit, 4, 1)
self.custom_y_label = QtGui.QLabel(self.monitor_group_box)
self.custom_y_label.setObjectName(u'custom_y_label')
self.monitor_layout.addWidget(self.custom_y_label, 3, 2)
self.custom_Y_value_edit = QtGui.QSpinBox(self.monitor_group_box)
self.custom_Y_value_edit.setObjectName(u'custom_Y_value_edit')
self.custom_Y_value_edit.setRange(-9999, 9999)
self.monitor_layout.addWidget(self.custom_Y_value_edit, 4, 2)
self.custom_width_label = QtGui.QLabel(self.monitor_group_box)
self.custom_width_label.setObjectName(u'custom_width_label')
self.monitor_layout.addWidget(self.custom_width_label, 3, 3)
self.custom_width_value_edit = QtGui.QSpinBox(self.monitor_group_box)
self.custom_width_value_edit.setObjectName(u'custom_width_value_edit')
self.custom_width_value_edit.setMaximum(9999)
self.monitor_layout.addWidget(self.custom_width_value_edit, 4, 3)
self.custom_height_label = QtGui.QLabel(self.monitor_group_box)
self.custom_height_label.setObjectName(u'custom_height_label')
self.monitor_layout.addWidget(self.custom_height_label, 3, 4)
self.custom_height_value_edit = QtGui.QSpinBox(self.monitor_group_box)
self.custom_height_value_edit.setObjectName(u'custom_height_value_edit')
self.custom_height_value_edit.setMaximum(9999)
self.monitor_layout.addWidget(self.custom_height_value_edit, 4, 4)
self.display_on_monitor_check = QtGui.QCheckBox(self.monitor_group_box)
self.display_on_monitor_check.setObjectName(u'monitor_combo_box')
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
# less stretchy (and therefore smaller) than the others
self.monitorLayout.setColumnStretch(0, 1)
self.monitorLayout.setColumnStretch(1, 3)
self.monitorLayout.setColumnStretch(2, 3)
self.monitorLayout.setColumnStretch(3, 3)
self.monitorLayout.setColumnStretch(4, 3)
self.leftLayout.addWidget(self.monitorGroupBox)
self.monitor_layout.setColumnStretch(0, 1)
self.monitor_layout.setColumnStretch(1, 3)
self.monitor_layout.setColumnStretch(2, 3)
self.monitor_layout.setColumnStretch(3, 3)
self.monitor_layout.setColumnStretch(4, 3)
self.left_layout.addWidget(self.monitor_group_box)
# CCLI Details
self.ccliGroupBox = QtGui.QGroupBox(self.leftColumn)
self.ccliGroupBox.setObjectName(u'ccliGroupBox')
self.ccliLayout = QtGui.QFormLayout(self.ccliGroupBox)
self.ccliLayout.setObjectName(u'ccliLayout')
self.numberLabel = QtGui.QLabel(self.ccliGroupBox)
self.numberLabel.setObjectName(u'numberLabel')
self.numberEdit = QtGui.QLineEdit(self.ccliGroupBox)
self.numberEdit.setValidator(QtGui.QIntValidator())
self.numberEdit.setObjectName(u'numberEdit')
self.ccliLayout.addRow(self.numberLabel, self.numberEdit)
self.usernameLabel = QtGui.QLabel(self.ccliGroupBox)
self.usernameLabel.setObjectName(u'usernameLabel')
self.usernameEdit = QtGui.QLineEdit(self.ccliGroupBox)
self.usernameEdit.setObjectName(u'usernameEdit')
self.ccliLayout.addRow(self.usernameLabel, self.usernameEdit)
self.passwordLabel = QtGui.QLabel(self.ccliGroupBox)
self.passwordLabel.setObjectName(u'passwordLabel')
self.passwordEdit = QtGui.QLineEdit(self.ccliGroupBox)
self.passwordEdit.setEchoMode(QtGui.QLineEdit.Password)
self.passwordEdit.setObjectName(u'passwordEdit')
self.ccliLayout.addRow(self.passwordLabel, self.passwordEdit)
self.leftLayout.addWidget(self.ccliGroupBox)
self.ccli_group_box = QtGui.QGroupBox(self.left_column)
self.ccli_group_box.setObjectName(u'ccli_group_box')
self.ccli_layout = QtGui.QFormLayout(self.ccli_group_box)
self.ccli_layout.setObjectName(u'ccli_layout')
self.number_label = QtGui.QLabel(self.ccli_group_box)
self.number_label.setObjectName(u'number_label')
self.number_edit = QtGui.QLineEdit(self.ccli_group_box)
self.number_edit.setValidator(QtGui.QIntValidator())
self.number_edit.setObjectName(u'number_edit')
self.ccli_layout.addRow(self.number_label, self.number_edit)
self.username_label = QtGui.QLabel(self.ccli_group_box)
self.username_label.setObjectName(u'username_label')
self.username_edit = QtGui.QLineEdit(self.ccli_group_box)
self.username_edit.setObjectName(u'username_edit')
self.ccli_layout.addRow(self.username_label, self.username_edit)
self.password_label = QtGui.QLabel(self.ccli_group_box)
self.password_label.setObjectName(u'password_label')
self.password_edit = QtGui.QLineEdit(self.ccli_group_box)
self.password_edit.setEchoMode(QtGui.QLineEdit.Password)
self.password_edit.setObjectName(u'password_edit')
self.ccli_layout.addRow(self.password_label, self.password_edit)
self.left_layout.addWidget(self.ccli_group_box)
# Background audio
self.audioGroupBox = QtGui.QGroupBox(self.leftColumn)
self.audioGroupBox.setObjectName(u'audioGroupBox')
self.audioLayout = QtGui.QVBoxLayout(self.audioGroupBox)
self.audioLayout.setObjectName(u'audioLayout')
self.startPausedCheckBox = QtGui.QCheckBox(self.audioGroupBox)
self.startPausedCheckBox.setObjectName(u'startPausedCheckBox')
self.audioLayout.addWidget(self.startPausedCheckBox)
self.repeatListCheckBox = QtGui.QCheckBox(self.audioGroupBox)
self.repeatListCheckBox.setObjectName(u'repeatListCheckBox')
self.audioLayout.addWidget(self.repeatListCheckBox)
self.leftLayout.addWidget(self.audioGroupBox)
self.leftLayout.addStretch()
self.audio_group_box = QtGui.QGroupBox(self.left_column)
self.audio_group_box.setObjectName(u'audio_group_box')
self.audio_layout = QtGui.QVBoxLayout(self.audio_group_box)
self.audio_layout.setObjectName(u'audio_layout')
self.start_paused_check_box = QtGui.QCheckBox(self.audio_group_box)
self.start_paused_check_box.setObjectName(u'start_paused_check_box')
self.audio_layout.addWidget(self.start_paused_check_box)
self.repeat_list_check_box = QtGui.QCheckBox(self.audio_group_box)
self.repeat_list_check_box.setObjectName(u'repeat_list_check_box')
self.audio_layout.addWidget(self.repeat_list_check_box)
self.left_layout.addWidget(self.audio_group_box)
self.left_layout.addStretch()
# Application Startup
self.startupGroupBox = QtGui.QGroupBox(self.rightColumn)
self.startupGroupBox.setObjectName(u'startupGroupBox')
self.startupLayout = QtGui.QVBoxLayout(self.startupGroupBox)
self.startupLayout.setObjectName(u'startupLayout')
self.warningCheckBox = QtGui.QCheckBox(self.startupGroupBox)
self.warningCheckBox.setObjectName(u'warningCheckBox')
self.startupLayout.addWidget(self.warningCheckBox)
self.autoOpenCheckBox = QtGui.QCheckBox(self.startupGroupBox)
self.autoOpenCheckBox.setObjectName(u'autoOpenCheckBox')
self.startupLayout.addWidget(self.autoOpenCheckBox)
self.showSplashCheckBox = QtGui.QCheckBox(self.startupGroupBox)
self.showSplashCheckBox.setObjectName(u'showSplashCheckBox')
self.startupLayout.addWidget(self.showSplashCheckBox)
self.checkForUpdatesCheckBox = QtGui.QCheckBox(self.startupGroupBox)
self.checkForUpdatesCheckBox.setObjectName(u'checkForUpdatesCheckBox')
self.startupLayout.addWidget(self.checkForUpdatesCheckBox)
self.rightLayout.addWidget(self.startupGroupBox)
self.startup_group_box = QtGui.QGroupBox(self.right_column)
self.startup_group_box.setObjectName(u'startup_group_box')
self.startup_layout = QtGui.QVBoxLayout(self.startup_group_box)
self.startup_layout.setObjectName(u'startup_layout')
self.warning_check_box = QtGui.QCheckBox(self.startup_group_box)
self.warning_check_box.setObjectName(u'warning_check_box')
self.startup_layout.addWidget(self.warning_check_box)
self.auto_open_check_box = QtGui.QCheckBox(self.startup_group_box)
self.auto_open_check_box.setObjectName(u'auto_open_check_box')
self.startup_layout.addWidget(self.auto_open_check_box)
self.show_splash_check_box = QtGui.QCheckBox(self.startup_group_box)
self.show_splash_check_box.setObjectName(u'show_splash_check_box')
self.startup_layout.addWidget(self.show_splash_check_box)
self.check_for_updates_check_box = QtGui.QCheckBox(self.startup_group_box)
self.check_for_updates_check_box.setObjectName(u'check_for_updates_check_box')
self.startup_layout.addWidget(self.check_for_updates_check_box)
self.right_layout.addWidget(self.startup_group_box)
# Application Settings
self.settingsGroupBox = QtGui.QGroupBox(self.rightColumn)
self.settingsGroupBox.setObjectName(u'settingsGroupBox')
self.settingsLayout = QtGui.QFormLayout(self.settingsGroupBox)
self.settingsLayout.setObjectName(u'settingsLayout')
self.saveCheckServiceCheckBox = QtGui.QCheckBox(self.settingsGroupBox)
self.saveCheckServiceCheckBox.setObjectName(u'saveCheckServiceCheckBox')
self.settingsLayout.addRow(self.saveCheckServiceCheckBox)
self.autoUnblankCheckBox = QtGui.QCheckBox(self.settingsGroupBox)
self.autoUnblankCheckBox.setObjectName(u'autoUnblankCheckBox')
self.settingsLayout.addRow(self.autoUnblankCheckBox)
self.autoPreviewCheckBox = QtGui.QCheckBox(self.settingsGroupBox)
self.autoPreviewCheckBox.setObjectName(u'autoPreviewCheckBox')
self.settingsLayout.addRow(self.autoPreviewCheckBox)
self.settings_group_box = QtGui.QGroupBox(self.right_column)
self.settings_group_box.setObjectName(u'settings_group_box')
self.settings_layout = QtGui.QFormLayout(self.settings_group_box)
self.settings_layout.setObjectName(u'settings_layout')
self.save_check_service_check_box = QtGui.QCheckBox(self.settings_group_box)
self.save_check_service_check_box.setObjectName(u'save_check_service_check_box')
self.settings_layout.addRow(self.save_check_service_check_box)
self.auto_unblank_check_box = QtGui.QCheckBox(self.settings_group_box)
self.auto_unblank_check_box.setObjectName(u'auto_unblank_check_box')
self.settings_layout.addRow(self.auto_unblank_check_box)
self.auto_preview_check_box = QtGui.QCheckBox(self.settings_group_box)
self.auto_preview_check_box.setObjectName(u'auto_preview_check_box')
self.settings_layout.addRow(self.auto_preview_check_box)
# Moved here from image tab
self.timeoutLabel = QtGui.QLabel(self.settingsGroupBox)
self.timeoutLabel.setObjectName(u'timeoutLabel')
self.timeoutSpinBox = QtGui.QSpinBox(self.settingsGroupBox)
self.timeoutSpinBox.setObjectName(u'timeoutSpinBox')
self.timeoutSpinBox.setRange(1, 180)
self.settingsLayout.addRow(self.timeoutLabel, self.timeoutSpinBox)
self.rightLayout.addWidget(self.settingsGroupBox)
self.rightLayout.addStretch()
self.timeout_label = QtGui.QLabel(self.settings_group_box)
self.timeout_label.setObjectName(u'timeout_label')
self.timeout_spin_box = QtGui.QSpinBox(self.settings_group_box)
self.timeout_spin_box.setObjectName(u'timeout_spin_box')
self.timeout_spin_box.setRange(1, 180)
self.settings_layout.addRow(self.timeout_label, self.timeout_spin_box)
self.right_layout.addWidget(self.settings_group_box)
self.right_layout.addStretch()
# Signals and slots
self.overrideRadioButton.toggled.connect(self.onOverrideRadioButtonPressed)
self.customHeightValueEdit.valueChanged.connect(self.onDisplayChanged)
self.customWidthValueEdit.valueChanged.connect(self.onDisplayChanged)
self.customYValueEdit.valueChanged.connect(self.onDisplayChanged)
self.customXValueEdit.valueChanged.connect(self.onDisplayChanged)
self.monitorComboBox.currentIndexChanged.connect(self.onDisplayChanged)
self.override_radio_button.toggled.connect(self.on_override_radio_button_pressed)
self.custom_height_value_edit.valueChanged.connect(self.on_display_changed)
self.custom_width_value_edit.valueChanged.connect(self.on_display_changed)
self.custom_Y_value_edit.valueChanged.connect(self.on_display_changed)
self.custom_X_value_edit.valueChanged.connect(self.on_display_changed)
self.monitor_combo_box.currentIndexChanged.connect(self.on_display_changed)
# Reload the tab, as the screen resolution/count may have changed.
Registry().register_function(u'config_screen_changed', self.load)
# Remove for now
self.usernameLabel.setVisible(False)
self.usernameEdit.setVisible(False)
self.passwordLabel.setVisible(False)
self.passwordEdit.setVisible(False)
self.username_label.setVisible(False)
self.username_edit.setVisible(False)
self.password_label.setVisible(False)
self.password_edit.setVisible(False)
def retranslateUi(self):
"""
Translate the general settings tab to the currently selected language
"""
self.tabTitleVisible = translate('OpenLP.GeneralTab', 'General')
self.monitorGroupBox.setTitle(translate('OpenLP.GeneralTab', 'Monitors'))
self.monitorRadioButton.setText(translate('OpenLP.GeneralTab', 'Select monitor for output display:'))
self.displayOnMonitorCheck.setText(translate('OpenLP.GeneralTab', 'Display if a single screen'))
self.startupGroupBox.setTitle(translate('OpenLP.GeneralTab', 'Application Startup'))
self.warningCheckBox.setText(translate('OpenLP.GeneralTab', 'Show blank screen warning'))
self.autoOpenCheckBox.setText(translate('OpenLP.GeneralTab', 'Automatically open the last service'))
self.showSplashCheckBox.setText(translate('OpenLP.GeneralTab', 'Show the splash screen'))
self.checkForUpdatesCheckBox.setText(translate('OpenLP.GeneralTab', 'Check for updates to OpenLP'))
self.settingsGroupBox.setTitle(translate('OpenLP.GeneralTab', 'Application Settings'))
self.saveCheckServiceCheckBox.setText(translate('OpenLP.GeneralTab',
self.tab_title_visible = translate('OpenLP.GeneralTab', 'General')
self.monitor_group_box.setTitle(translate('OpenLP.GeneralTab', 'Monitors'))
self.monitor_radio_button.setText(translate('OpenLP.GeneralTab', 'Select monitor for output display:'))
self.display_on_monitor_check.setText(translate('OpenLP.GeneralTab', 'Display if a single screen'))
self.startup_group_box.setTitle(translate('OpenLP.GeneralTab', 'Application Startup'))
self.warning_check_box.setText(translate('OpenLP.GeneralTab', 'Show blank screen warning'))
self.auto_open_check_box.setText(translate('OpenLP.GeneralTab', 'Automatically open the last service'))
self.show_splash_check_box.setText(translate('OpenLP.GeneralTab', 'Show the splash screen'))
self.check_for_updates_check_box.setText(translate('OpenLP.GeneralTab', 'Check for updates to OpenLP'))
self.settings_group_box.setTitle(translate('OpenLP.GeneralTab', 'Application Settings'))
self.save_check_service_check_box.setText(translate('OpenLP.GeneralTab',
'Prompt to save before starting a new service'))
self.autoUnblankCheckBox.setText(translate('OpenLP.GeneralTab', 'Unblank display when adding new live item'))
self.autoPreviewCheckBox.setText(translate('OpenLP.GeneralTab', 'Automatically preview next item in service'))
self.timeoutLabel.setText(translate('OpenLP.GeneralTab', 'Timed slide interval:'))
self.timeoutSpinBox.setSuffix(translate('OpenLP.GeneralTab', ' sec'))
self.ccliGroupBox.setTitle(translate('OpenLP.GeneralTab', 'CCLI Details'))
self.numberLabel.setText(UiStrings().CCLINumberLabel)
self.usernameLabel.setText(translate('OpenLP.GeneralTab', 'SongSelect username:'))
self.passwordLabel.setText(translate('OpenLP.GeneralTab', 'SongSelect password:'))
self.auto_unblank_check_box.setText(translate('OpenLP.GeneralTab', 'Unblank display when adding new live item'))
self.auto_preview_check_box.setText(translate('OpenLP.GeneralTab', 'Automatically preview next item in service'))
self.timeout_label.setText(translate('OpenLP.GeneralTab', 'Timed slide interval:'))
self.timeout_spin_box.setSuffix(translate('OpenLP.GeneralTab', ' sec'))
self.ccli_group_box.setTitle(translate('OpenLP.GeneralTab', 'CCLI Details'))
self.number_label.setText(UiStrings().CCLINumberLabel)
self.username_label.setText(translate('OpenLP.GeneralTab', 'SongSelect username:'))
self.password_label.setText(translate('OpenLP.GeneralTab', 'SongSelect password:'))
# Moved from display tab
self.overrideRadioButton.setText(translate('OpenLP.GeneralTab', 'Override display position:'))
self.customXLabel.setText(translate('OpenLP.GeneralTab', 'X'))
self.customYLabel.setText(translate('OpenLP.GeneralTab', 'Y'))
self.customHeightLabel.setText(translate('OpenLP.GeneralTab', 'Height'))
self.customWidthLabel.setText(translate('OpenLP.GeneralTab', 'Width'))
self.audioGroupBox.setTitle(translate('OpenLP.GeneralTab', 'Background Audio'))
self.startPausedCheckBox.setText(translate('OpenLP.GeneralTab', 'Start background audio paused'))
self.repeatListCheckBox.setText(translate('OpenLP.GeneralTab', 'Repeat track list'))
self.override_radio_button.setText(translate('OpenLP.GeneralTab', 'Override display position:'))
self.custom_x_label.setText(translate('OpenLP.GeneralTab', 'X'))
self.custom_y_label.setText(translate('OpenLP.GeneralTab', 'Y'))
self.custom_height_label.setText(translate('OpenLP.GeneralTab', 'Height'))
self.custom_width_label.setText(translate('OpenLP.GeneralTab', 'Width'))
self.audio_group_box.setTitle(translate('OpenLP.GeneralTab', 'Background Audio'))
self.start_paused_check_box.setText(translate('OpenLP.GeneralTab', 'Start background audio paused'))
self.repeat_list_check_box.setText(translate('OpenLP.GeneralTab', 'Repeat track list'))
def load(self):
"""
Load the settings to populate the form
"""
settings = Settings()
settings.beginGroup(self.settingsSection)
self.monitorComboBox.clear()
self.monitorComboBox.addItems(self.screens.get_screen_list())
settings.beginGroup(self.settings_section)
self.monitor_combo_box.clear()
self.monitor_combo_box.addItems(self.screens.get_screen_list())
monitorNumber = settings.value(u'monitor')
self.monitorComboBox.setCurrentIndex(monitorNumber)
self.numberEdit.setText(settings.value(u'ccli number'))
self.usernameEdit.setText(settings.value(u'songselect username'))
self.passwordEdit.setText(settings.value(u'songselect password'))
self.saveCheckServiceCheckBox.setChecked(settings.value(u'save prompt'))
self.autoUnblankCheckBox.setChecked(settings.value(u'auto unblank'))
self.displayOnMonitorCheck.setChecked(self.screens.display)
self.warningCheckBox.setChecked(settings.value(u'blank warning'))
self.autoOpenCheckBox.setChecked(settings.value(u'auto open'))
self.showSplashCheckBox.setChecked(settings.value(u'show splash'))
self.checkForUpdatesCheckBox.setChecked(settings.value(u'update check'))
self.autoPreviewCheckBox.setChecked(settings.value(u'auto preview'))
self.timeoutSpinBox.setValue(settings.value(u'loop delay'))
self.monitorRadioButton.setChecked(not settings.value(u'override position',))
self.overrideRadioButton.setChecked(settings.value(u'override position'))
self.customXValueEdit.setValue(settings.value(u'x position'))
self.customYValueEdit.setValue(settings.value(u'y position'))
self.customHeightValueEdit.setValue(settings.value(u'height'))
self.customWidthValueEdit.setValue(settings.value(u'width'))
self.startPausedCheckBox.setChecked(settings.value(u'audio start paused'))
self.repeatListCheckBox.setChecked(settings.value(u'audio repeat list'))
self.monitor_combo_box.setCurrentIndex(monitorNumber)
self.number_edit.setText(settings.value(u'ccli number'))
self.username_edit.setText(settings.value(u'songselect username'))
self.password_edit.setText(settings.value(u'songselect password'))
self.save_check_service_check_box.setChecked(settings.value(u'save prompt'))
self.auto_unblank_check_box.setChecked(settings.value(u'auto unblank'))
self.display_on_monitor_check.setChecked(self.screens.display)
self.warning_check_box.setChecked(settings.value(u'blank warning'))
self.auto_open_check_box.setChecked(settings.value(u'auto open'))
self.show_splash_check_box.setChecked(settings.value(u'show splash'))
self.check_for_updates_check_box.setChecked(settings.value(u'update check'))
self.auto_preview_check_box.setChecked(settings.value(u'auto preview'))
self.timeout_spin_box.setValue(settings.value(u'loop delay'))
self.monitor_radio_button.setChecked(not settings.value(u'override position',))
self.override_radio_button.setChecked(settings.value(u'override position'))
self.custom_X_value_edit.setValue(settings.value(u'x position'))
self.custom_Y_value_edit.setValue(settings.value(u'y position'))
self.custom_height_value_edit.setValue(settings.value(u'height'))
self.custom_width_value_edit.setValue(settings.value(u'width'))
self.start_paused_check_box.setChecked(settings.value(u'audio start paused'))
self.repeat_list_check_box.setChecked(settings.value(u'audio repeat list'))
settings.endGroup()
self.monitorComboBox.setDisabled(self.overrideRadioButton.isChecked())
self.customXValueEdit.setEnabled(self.overrideRadioButton.isChecked())
self.customYValueEdit.setEnabled(self.overrideRadioButton.isChecked())
self.customHeightValueEdit.setEnabled(self.overrideRadioButton.isChecked())
self.customWidthValueEdit.setEnabled(self.overrideRadioButton.isChecked())
self.monitor_combo_box.setDisabled(self.override_radio_button.isChecked())
self.custom_X_value_edit.setEnabled(self.override_radio_button.isChecked())
self.custom_Y_value_edit.setEnabled(self.override_radio_button.isChecked())
self.custom_height_value_edit.setEnabled(self.override_radio_button.isChecked())
self.custom_width_value_edit.setEnabled(self.override_radio_button.isChecked())
self.display_changed = False
settings.beginGroup(self.settingsSection)
def save(self):
"""
Save the settings from the form
"""
settings = Settings()
settings.beginGroup(self.settingsSection)
settings.setValue(u'monitor', self.monitorComboBox.currentIndex())
settings.setValue(u'display on monitor', self.displayOnMonitorCheck.isChecked())
settings.setValue(u'blank warning', self.warningCheckBox.isChecked())
settings.setValue(u'auto open', self.autoOpenCheckBox.isChecked())
settings.setValue(u'show splash', self.showSplashCheckBox.isChecked())
settings.setValue(u'update check', self.checkForUpdatesCheckBox.isChecked())
settings.setValue(u'save prompt', self.saveCheckServiceCheckBox.isChecked())
settings.setValue(u'auto unblank', self.autoUnblankCheckBox.isChecked())
settings.setValue(u'auto preview', self.autoPreviewCheckBox.isChecked())
settings.setValue(u'loop delay', self.timeoutSpinBox.value())
settings.setValue(u'ccli number', self.numberEdit.displayText())
settings.setValue(u'songselect username', self.usernameEdit.displayText())
settings.setValue(u'songselect password', self.passwordEdit.displayText())
settings.setValue(u'x position', self.customXValueEdit.value())
settings.setValue(u'y position', self.customYValueEdit.value())
settings.setValue(u'height', self.customHeightValueEdit.value())
settings.setValue(u'width', self.customWidthValueEdit.value())
settings.setValue(u'override position', self.overrideRadioButton.isChecked())
settings.setValue(u'audio start paused', self.startPausedCheckBox.isChecked())
settings.setValue(u'audio repeat list', self.repeatListCheckBox.isChecked())
settings.beginGroup(self.settings_section)
settings.setValue(u'monitor', self.monitor_combo_box.currentIndex())
settings.setValue(u'display on monitor', self.display_on_monitor_check.isChecked())
settings.setValue(u'blank warning', self.warning_check_box.isChecked())
settings.setValue(u'auto open', self.auto_open_check_box.isChecked())
settings.setValue(u'show splash', self.show_splash_check_box.isChecked())
settings.setValue(u'update check', self.check_for_updates_check_box.isChecked())
settings.setValue(u'save prompt', self.save_check_service_check_box.isChecked())
settings.setValue(u'auto unblank', self.auto_unblank_check_box.isChecked())
settings.setValue(u'auto preview', self.auto_preview_check_box.isChecked())
settings.setValue(u'loop delay', self.timeout_spin_box.value())
settings.setValue(u'ccli number', self.number_edit.displayText())
settings.setValue(u'songselect username', self.username_edit.displayText())
settings.setValue(u'songselect password', self.password_edit.displayText())
settings.setValue(u'x position', self.custom_X_value_edit.value())
settings.setValue(u'y position', self.custom_Y_value_edit.value())
settings.setValue(u'height', self.custom_height_value_edit.value())
settings.setValue(u'width', self.custom_width_value_edit.value())
settings.setValue(u'override position', self.override_radio_button.isChecked())
settings.setValue(u'audio start paused', self.start_paused_check_box.isChecked())
settings.setValue(u'audio repeat list', self.repeat_list_check_box.isChecked())
settings.endGroup()
# On save update the screens as well
self.post_set_up(True)
def post_set_up(self, postUpdate=False):
"""
Apply settings after settings tab has loaded and most of the
system so must be delayed
Apply settings after settings tab has loaded and most of the system so must be delayed
"""
self.settings_form.register_post_process(u'slidecontroller_live_spin_delay')
# Do not continue on start up.
if not postUpdate:
return
self.screens.set_current_display(self.monitorComboBox.currentIndex())
self.screens.display = self.displayOnMonitorCheck.isChecked()
self.screens.set_current_display(self.monitor_combo_box.currentIndex())
self.screens.display = self.display_on_monitor_check.isChecked()
self.screens.override[u'size'] = QtCore.QRect(
self.customXValueEdit.value(),
self.customYValueEdit.value(),
self.customWidthValueEdit.value(),
self.customHeightValueEdit.value())
if self.overrideRadioButton.isChecked():
self.custom_X_value_edit.value(),
self.custom_Y_value_edit.value(),
self.custom_width_value_edit.value(),
self.custom_height_value_edit.value())
if self.override_radio_button.isChecked():
self.screens.set_override_display()
else:
self.screens.reset_current_display()
@ -332,21 +330,21 @@ class GeneralTab(SettingsTab):
self.settings_form.register_post_process(u'config_screen_changed')
self.display_changed = False
def onOverrideRadioButtonPressed(self, checked):
def on_override_radio_button_pressed(self, checked):
"""
Toggle screen state depending on check box state.
``checked``
The state of the check box (boolean).
"""
self.monitorComboBox.setDisabled(checked)
self.customXValueEdit.setEnabled(checked)
self.customYValueEdit.setEnabled(checked)
self.customHeightValueEdit.setEnabled(checked)
self.customWidthValueEdit.setEnabled(checked)
self.monitor_combo_box.setDisabled(checked)
self.custom_X_value_edit.setEnabled(checked)
self.custom_Y_value_edit.setEnabled(checked)
self.custom_height_value_edit.setEnabled(checked)
self.custom_width_value_edit.setEnabled(checked)
self.display_changed = True
def onDisplayChanged(self):
def on_display_changed(self):
"""
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.
"""
def setPlayerName(self, name):
def set_player_name(self, name):
"""
Set the player name
"""
@ -56,8 +56,8 @@ class PlayerTab(SettingsTab):
Constructor
"""
self.media_players = self.media_controller.media_players
self.savedUsedPlayers = None
self.iconPath = u':/media/multimedia-player.png'
self.saved_used_players = None
self.icon_path = u':/media/multimedia-player.png'
player_translated = translate('OpenLP.PlayerTab', 'Players')
SettingsTab.__init__(self, parent, u'Players', player_translated)
@ -67,163 +67,164 @@ class PlayerTab(SettingsTab):
"""
self.setObjectName(u'MediaTab')
SettingsTab.setupUi(self)
self.bgColorGroupBox = QtGui.QGroupBox(self.leftColumn)
self.bgColorGroupBox.setObjectName(u'FontGroupBox')
self.formLayout = QtGui.QFormLayout(self.bgColorGroupBox)
self.formLayout.setObjectName(u'FormLayout')
self.colorLayout = QtGui.QHBoxLayout()
self.backgroundColorLabel = QtGui.QLabel(self.bgColorGroupBox)
self.backgroundColorLabel.setObjectName(u'BackgroundColorLabel')
self.colorLayout.addWidget(self.backgroundColorLabel)
self.backgroundColorButton = QtGui.QPushButton(self.bgColorGroupBox)
self.backgroundColorButton.setObjectName(u'BackgroundColorButton')
self.colorLayout.addWidget(self.backgroundColorButton)
self.formLayout.addRow(self.colorLayout)
self.information_label = QtGui.QLabel(self.bgColorGroupBox)
self.background_color_group_box = QtGui.QGroupBox(self.left_column)
self.background_color_group_box.setObjectName(u'background_color_group_box')
self.form_layout = QtGui.QFormLayout(self.background_color_group_box)
self.form_layout.setObjectName(u'form_layout')
self.color_layout = QtGui.QHBoxLayout()
self.background_color_label = QtGui.QLabel(self.background_color_group_box)
self.background_color_label.setObjectName(u'background_color_label')
self.color_layout.addWidget(self.background_color_label)
self.background_color_button = QtGui.QPushButton(self.background_color_group_box)
self.background_color_button.setObjectName(u'background_color_button')
self.color_layout.addWidget(self.background_color_button)
self.form_layout.addRow(self.color_layout)
self.information_label = QtGui.QLabel(self.background_color_group_box)
self.information_label.setObjectName(u'information_label')
self.information_label.setWordWrap(True)
self.formLayout.addRow(self.information_label)
self.leftLayout.addWidget(self.bgColorGroupBox)
self.leftLayout.addStretch()
self.rightColumn.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred)
self.rightLayout.addStretch()
self.mediaPlayerGroupBox = QtGui.QGroupBox(self.leftColumn)
self.mediaPlayerGroupBox.setObjectName(u'mediaPlayerGroupBox')
self.mediaPlayerLayout = QtGui.QVBoxLayout(self.mediaPlayerGroupBox)
self.mediaPlayerLayout.setObjectName(u'mediaPlayerLayout')
self.playerCheckBoxes = {}
self.leftLayout.addWidget(self.mediaPlayerGroupBox)
self.playerOrderGroupBox = QtGui.QGroupBox(self.leftColumn)
self.playerOrderGroupBox.setObjectName(u'playerOrderGroupBox')
self.playerOrderLayout = QtGui.QHBoxLayout(self.playerOrderGroupBox)
self.playerOrderLayout.setObjectName(u'playerOrderLayout')
self.playerOrderlistWidget = QtGui.QListWidget(self.playerOrderGroupBox)
self.form_layout.addRow(self.information_label)
self.left_layout.addWidget(self.background_color_group_box)
self.left_layout.addStretch()
self.right_column.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred)
self.right_layout.addStretch()
self.media_player_group_box = QtGui.QGroupBox(self.left_column)
self.media_player_group_box.setObjectName(u'media_player_group_box')
self.media_player_layout = QtGui.QVBoxLayout(self.media_player_group_box)
self.media_player_layout.setObjectName(u'media_player_layout')
self.player_check_boxes = {}
self.left_layout.addWidget(self.media_player_group_box)
self.player_order_group_box = QtGui.QGroupBox(self.left_column)
self.player_order_group_box.setObjectName(u'player_order_group_box')
self.player_order_layout = QtGui.QHBoxLayout(self.player_order_group_box)
self.player_order_layout.setObjectName(u'player_order_layout')
self.player_order_list_widget = QtGui.QListWidget(self.player_order_group_box)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.playerOrderlistWidget.sizePolicy().hasHeightForWidth())
self.playerOrderlistWidget.setSizePolicy(sizePolicy)
self.playerOrderlistWidget.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded)
self.playerOrderlistWidget.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
self.playerOrderlistWidget.setEditTriggers(QtGui.QAbstractItemView.NoEditTriggers)
self.playerOrderlistWidget.setObjectName(u'playerOrderlistWidget')
self.playerOrderLayout.addWidget(self.playerOrderlistWidget)
self.orderingButtonLayout = QtGui.QVBoxLayout()
self.orderingButtonLayout.setObjectName(u'orderingButtonLayout')
self.orderingButtonLayout.addStretch(1)
self.orderingUpButton = create_button(self, u'orderingUpButton', role=u'up', click=self.onUpButtonClicked)
self.orderingDownButton = create_button(self, u'orderingDownButton', role=u'down',
click=self.onDownButtonClicked)
self.orderingButtonLayout.addWidget(self.orderingUpButton)
self.orderingButtonLayout.addWidget(self.orderingDownButton)
self.orderingButtonLayout.addStretch(1)
self.playerOrderLayout.addLayout(self.orderingButtonLayout)
self.leftLayout.addWidget(self.playerOrderGroupBox)
self.leftLayout.addStretch()
self.rightLayout.addStretch()
sizePolicy.setHeightForWidth(self.player_order_list_widget.sizePolicy().hasHeightForWidth())
self.player_order_list_widget.setSizePolicy(sizePolicy)
self.player_order_list_widget.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded)
self.player_order_list_widget.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
self.player_order_list_widget.setEditTriggers(QtGui.QAbstractItemView.NoEditTriggers)
self.player_order_list_widget.setObjectName(u'player_order_list_widget')
self.player_order_layout.addWidget(self.player_order_list_widget)
self.ordering_button_layout = QtGui.QVBoxLayout()
self.ordering_button_layout.setObjectName(u'ordering_button_layout')
self.ordering_button_layout.addStretch(1)
self.ordering_up_button = create_button(self, u'ordering_up_button', role=u'up',
click=self.on_up_button_clicked)
self.ordering_down_button = create_button(self, u'ordering_down_button', role=u'down',
click=self.on_down_button_clicked)
self.ordering_button_layout.addWidget(self.ordering_up_button)
self.ordering_button_layout.addWidget(self.ordering_down_button)
self.ordering_button_layout.addStretch(1)
self.player_order_layout.addLayout(self.ordering_button_layout)
self.left_layout.addWidget(self.player_order_group_box)
self.left_layout.addStretch()
self.right_layout.addStretch()
# Signals and slots
self.backgroundColorButton.clicked.connect(self.onbackgroundColorButtonClicked)
self.background_color_button.clicked.connect(self.on_background_color_button_clicked)
def retranslateUi(self):
"""
Translate the UI on the fly
"""
self.mediaPlayerGroupBox.setTitle(translate('OpenLP.PlayerTab', 'Available Media Players'))
self.playerOrderGroupBox.setTitle(translate('OpenLP.PlayerTab', 'Player Search Order'))
self.bgColorGroupBox.setTitle(UiStrings().BackgroundColor)
self.backgroundColorLabel.setText(UiStrings().DefaultColor)
self.media_player_group_box.setTitle(translate('OpenLP.PlayerTab', 'Available Media Players'))
self.player_order_group_box.setTitle(translate('OpenLP.PlayerTab', 'Player Search Order'))
self.background_color_group_box.setTitle(UiStrings().BackgroundColor)
self.background_color_label.setText(UiStrings().DefaultColor)
self.information_label.setText(translate('OpenLP.PlayerTab',
'Visible background for videos with aspect ratio different to screen.'))
self.retranslatePlayers()
def onbackgroundColorButtonClicked(self):
def on_background_color_button_clicked(self):
"""
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():
self.bg_color = new_color.name()
self.backgroundColorButton.setStyleSheet(u'background-color: %s' % self.bg_color)
self.background_color = new_color.name()
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
"""
player = self.sender().playerName
if check_state == QtCore.Qt.Checked:
if player not in self.usedPlayers:
self.usedPlayers.append(player)
if player not in self.used_players:
self.used_players.append(player)
else:
if player in self.usedPlayers:
self.usedPlayers.remove(player)
self.updatePlayerList()
if player in self.used_players:
self.used_players.remove(player)
self.update_player_list()
def updatePlayerList(self):
def update_player_list(self):
"""
Update the list of media players
"""
self.playerOrderlistWidget.clear()
for player in self.usedPlayers:
if player in self.playerCheckBoxes.keys():
if len(self.usedPlayers) == 1:
self.player_order_list_widget.clear()
for player in self.used_players:
if player in self.player_check_boxes.keys():
if len(self.used_players) == 1:
# 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:
self.playerCheckBoxes[u'%s' % player].setEnabled(True)
self.playerOrderlistWidget.addItem(self.media_players[unicode(player)].original_name)
self.player_check_boxes[u'%s' % player].setEnabled(True)
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
"""
row = self.playerOrderlistWidget.currentRow()
row = self.player_order_list_widget.currentRow()
if row <= 0:
return
item = self.playerOrderlistWidget.takeItem(row)
self.playerOrderlistWidget.insertItem(row - 1, item)
self.playerOrderlistWidget.setCurrentRow(row - 1)
self.usedPlayers.insert(row - 1, self.usedPlayers.pop(row))
item = self.player_order_list_widget.takeItem(row)
self.player_order_list_widget.insertItem(row - 1, item)
self.player_order_list_widget.setCurrentRow(row - 1)
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
"""
row = self.playerOrderlistWidget.currentRow()
if row == -1 or row > self.playerOrderlistWidget.count() - 1:
row = self.player_order_list_widget.currentRow()
if row == -1 or row > self.player_order_list_widget.count() - 1:
return
item = self.playerOrderlistWidget.takeItem(row)
self.playerOrderlistWidget.insertItem(row + 1, item)
self.playerOrderlistWidget.setCurrentRow(row + 1)
self.usedPlayers.insert(row + 1, self.usedPlayers.pop(row))
item = self.player_order_list_widget.takeItem(row)
self.player_order_list_widget.insertItem(row + 1, item)
self.player_order_list_widget.setCurrentRow(row + 1)
self.used_players.insert(row + 1, self.used_players.pop(row))
def load(self):
"""
Load the settings
"""
if self.savedUsedPlayers:
self.usedPlayers = self.savedUsedPlayers
self.usedPlayers = get_media_players()[0]
self.savedUsedPlayers = self.usedPlayers
if self.saved_used_players:
self.used_players = self.saved_used_players
self.used_players = get_media_players()[0]
self.saved_used_players = self.used_players
settings = Settings()
settings.beginGroup(self.settingsSection)
self.updatePlayerList()
self.bg_color = settings.value(u'background color')
self.initial_color = self.bg_color
settings.beginGroup(self.settings_section)
self.update_player_list()
self.background_color = settings.value(u'background color')
self.initial_color = self.background_color
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):
"""
Save the settings
"""
settings = Settings()
settings.beginGroup(self.settingsSection)
settings.setValue(u'background color', self.bg_color)
settings.beginGroup(self.settings_section)
settings.setValue(u'background color', self.background_color)
settings.endGroup()
old_players, override_player = get_media_players()
if self.usedPlayers != old_players:
if self.used_players != old_players:
# 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_media_rebuild')
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():
player = self.media_players[key]
checkbox = MediaQCheckBox(self.mediaPlayerGroupBox)
checkbox = MediaQCheckBox(self.media_player_group_box)
checkbox.setEnabled(player.available)
checkbox.setObjectName(player.name + u'CheckBox')
checkbox.setObjectName(player.name + u'_check_box')
checkbox.setToolTip(player.get_info())
checkbox.setPlayerName(player.name)
self.playerCheckBoxes[player.name] = checkbox
checkbox.stateChanged.connect(self.onPlayerCheckBoxChanged)
self.mediaPlayerLayout.addWidget(checkbox)
if player.available and player.name in self.usedPlayers:
checkbox.set_player_name(player.name)
self.player_check_boxes[player.name] = checkbox
checkbox.stateChanged.connect(self.on_player_check_box_changed)
self.media_player_layout.addWidget(checkbox)
if player.available and player.name in self.used_players:
checkbox.setChecked(True)
else:
checkbox.setChecked(False)
self.updatePlayerList()
self.update_player_list()
self.retranslatePlayers()
def retranslatePlayers(self):
"""
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]
checkbox = self.playerCheckBoxes[player.name]
checkbox.setPlayerName(player.name)
checkbox = self.player_check_boxes[player.name]
checkbox.set_player_name(player.name)
if player.available:
checkbox.setText(player.display_name)
else:

View File

@ -58,12 +58,12 @@ except OSError, e:
if VLC_AVAILABLE:
try:
version = vlc.libvlc_get_version()
VERSION = vlc.libvlc_get_version()
except:
version = u'0.0.0'
if LooseVersion(version) < LooseVersion('1.1.0'):
VERSION = u'0.0.0'
if LooseVersion(VERSION) < LooseVersion('1.1.0'):
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']

View File

@ -208,7 +208,7 @@ class ServiceManagerDialog(object):
self.service_manager_list.itemCollapsed.connect(self.collapsed)
self.service_manager_list.itemExpanded.connect(self.expanded)
# 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')
# build the drag and drop context menu
self.dndMenu = QtGui.QMenu()
@ -325,7 +325,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
self.service_id += 1
self._modified = modified
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):
"""
@ -338,7 +338,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
Setter for service file.
"""
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)
self._save_lite = self._file_name.endswith(u'.oszl')
@ -403,14 +403,14 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
file_name = QtGui.QFileDialog.getOpenFileName(
self.main_window,
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)')
)
if not file_name:
return False
else:
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])
self.load_file(file_name)
@ -463,7 +463,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
base_name = os.path.splitext(file_name)[0]
service_file_name = '%s.osd' % base_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 = []
write_list = []
missing_list = []
@ -471,7 +471,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
total_size = 0
self.application.set_busy_cursor()
# 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
for item in self.service_items:
if not item[u'service_item'].uses_file():
@ -493,7 +493,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
answer = QtGui.QMessageBox.critical(self, title, message,
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok | QtGui.QMessageBox.Cancel))
if answer == QtGui.QMessageBox.Cancel:
self.main_window.finishedProgressBar()
self.main_window.finished_progress_bar()
return False
# Check if item contains a missing file.
for item in list(self.service_items):
@ -553,14 +553,14 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
finally:
if zip_file:
zip_file.close()
self.main_window.finishedProgressBar()
self.main_window.finished_progress_bar()
self.application.set_normal_cursor()
if success:
try:
shutil.copy(temp_file_name, path_file_name)
except shutil.Error:
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)
delete_file(temp_file_name)
return success
@ -581,11 +581,11 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
base_name = os.path.splitext(file_name)[0]
service_file_name = '%s.osd' % base_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 = []
self.application.set_busy_cursor()
# 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:
self.main_window.increment_progress_bar()
service_item = item[u'service_item'].get_service_repr(self._save_lite)
@ -610,14 +610,14 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
finally:
if zip_file:
zip_file.close()
self.main_window.finishedProgressBar()
self.main_window.finished_progress_bar()
self.application.set_normal_cursor()
if success:
try:
shutil.copy(temp_file_name, path_file_name)
except shutil.Error:
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)
delete_file(temp_file_name)
return success
@ -645,7 +645,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
default_file_name = format_time(default_pattern, local_time)
else:
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)
# 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.
@ -714,7 +714,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
file_to.close()
self.new_file()
self.set_file_name(file_name)
self.main_window.displayProgressBar(len(items))
self.main_window.display_progress_bar(len(items))
for item in items:
self.main_window.increment_progress_bar()
service_item = ServiceItem()
@ -732,7 +732,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
service_item.temporary_edit = self.load_item_temporary
self.add_service_item(service_item, repaint=False)
delete_file(p_file)
self.main_window.addRecentFile(file_name)
self.main_window.add_recent_file(file_name)
self.set_modified(False)
Settings().setValue('servicemanager/last file', file_name)
else:
@ -760,7 +760,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
file_to.close()
if zip_file:
zip_file.close()
self.main_window.finishedProgressBar()
self.main_window.finished_progress_bar()
self.application.set_normal_cursor()
self.repaint_service_list(-1, -1)
@ -873,7 +873,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
self.auto_play_slides_loop.setChecked(False)
if service_item.auto_play_slides_once and service_item.timed_slide_interval == 0:
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()
def toggle_auto_play_slides_loop(self):
@ -888,7 +888,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
self.auto_play_slides_once.setChecked(False)
if service_item.auto_play_slides_loop and service_item.timed_slide_interval == 0:
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()
def on_timed_slide_interval(self):
@ -1231,7 +1231,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
log.debug(u'on_theme_combo_box_selected')
self.service_theme = self.theme_combo_box.currentText()
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)
def theme_change(self):
@ -1400,7 +1400,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
self.application.set_busy_cursor()
if self.service_items[item][u'service_item'].is_valid:
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
if self.service_items and item < len(self.service_items) and \
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.
"""
def setupUi(self, settingsDialog):
def setupUi(self, settings_dialog):
"""
Set up the UI
"""
settingsDialog.setObjectName(u'settingsDialog')
settingsDialog.resize(800, 500)
settingsDialog.setWindowIcon(build_icon(u':/system/system_settings.png'))
self.dialogLayout = QtGui.QGridLayout(settingsDialog)
self.dialogLayout.setObjectName(u'dialog_layout')
self.dialogLayout.setMargin(8)
self.settingListWidget = QtGui.QListWidget(settingsDialog)
self.settingListWidget.setUniformItemSizes(True)
self.settingListWidget.setMinimumSize(QtCore.QSize(150, 0))
self.settingListWidget.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
self.settingListWidget.setObjectName(u'settingListWidget')
self.dialogLayout.addWidget(self.settingListWidget, 0, 0, 1, 1)
self.stackedLayout = QtGui.QStackedLayout()
self.stackedLayout.setObjectName(u'stackedLayout')
self.dialogLayout.addLayout(self.stackedLayout, 0, 1, 1, 1)
self.button_box = create_button_box(settingsDialog, u'button_box', [u'cancel', u'ok'])
self.dialogLayout.addWidget(self.button_box, 1, 1, 1, 1)
self.retranslateUi(settingsDialog)
self.settingListWidget.currentRowChanged.connect(self.tabChanged)
settings_dialog.setObjectName(u'settings_dialog')
settings_dialog.resize(800, 500)
settings_dialog.setWindowIcon(build_icon(u':/system/system_settings.png'))
self.dialog_layout = QtGui.QGridLayout(settings_dialog)
self.dialog_layout.setObjectName(u'dialog_layout')
self.dialog_layout.setMargin(8)
self.setting_list_widget = QtGui.QListWidget(settings_dialog)
self.setting_list_widget.setUniformItemSizes(True)
self.setting_list_widget.setMinimumSize(QtCore.QSize(150, 0))
self.setting_list_widget.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
self.setting_list_widget.setObjectName(u'setting_list_widget')
self.dialog_layout.addWidget(self.setting_list_widget, 0, 0, 1, 1)
self.stacked_layout = QtGui.QStackedLayout()
self.stacked_layout.setObjectName(u'stacked_layout')
self.dialog_layout.addLayout(self.stacked_layout, 0, 1, 1, 1)
self.button_box = create_button_box(settings_dialog, u'button_box', [u'cancel', u'ok'])
self.dialog_layout.addWidget(self.button_box, 1, 1, 1, 1)
self.retranslateUi(settings_dialog)
self.setting_list_widget.currentRowChanged.connect(self.tab_changed)
def retranslateUi(self, settingsDialog):
def retranslateUi(self, settings_dialog):
"""
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
"""
# load all the settings
self.settingListWidget.clear()
while self.stackedLayout.count():
self.setting_list_widget.clear()
while self.stacked_layout.count():
# take at 0 and the rest shuffle up.
self.stackedLayout.takeAt(0)
self.insertTab(self.generalTab, 0, PluginStatus.Active)
self.insertTab(self.themesTab, 1, PluginStatus.Active)
self.insertTab(self.advancedTab, 2, PluginStatus.Active)
self.insertTab(self.playerTab, 3, PluginStatus.Active)
self.stacked_layout.takeAt(0)
self.insert_tab(self.general_tab, 0, PluginStatus.Active)
self.insert_tab(self.themes_tab, 1, PluginStatus.Active)
self.insert_tab(self.advanced_tab, 2, PluginStatus.Active)
self.insert_tab(self.player_tab, 3, PluginStatus.Active)
count = 4
for plugin in self.plugin_manager.plugins:
if plugin.settingsTab:
self.insertTab(plugin.settingsTab, count, plugin.status)
self.insert_tab(plugin.settingsTab, count, plugin.status)
count += 1
self.settingListWidget.setCurrentRow(0)
self.setting_list_widget.setCurrentRow(0)
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
"""
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
pos = self.stackedLayout.addWidget(tab)
pos = self.stacked_layout.addWidget(tab)
if is_active:
item_name = QtGui.QListWidgetItem(tab.tabTitleVisible)
icon = build_icon(tab.iconPath)
item_name = QtGui.QListWidgetItem(tab.tab_title_visible)
icon = build_icon(tab.icon_path)
item_name.setIcon(icon)
self.settingListWidget.insertItem(location, item_name)
self.setting_list_widget.insertItem(location, item_name)
else:
# then remove tab to stop the UI displaying it even if
# it is not required.
self.stackedLayout.takeAt(pos)
# then remove tab to stop the UI displaying it even if it is not required.
self.stacked_layout.takeAt(pos)
def accept(self):
"""
Process the form saving the settings
"""
self.resetSuffixes = True
for tabIndex in range(self.stackedLayout.count()):
self.stackedLayout.widget(tabIndex).save()
# Must go after all settings are save
for tabIndex in range(self.stacked_layout.count()):
self.stacked_layout.widget(tabIndex).save()
# if the display of image background are changing we need to regenerate the image cache
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:
Registry().execute(self.processes.pop(0))
Registry().execute(u'config_updated')
return QtGui.QDialog.accept(self)
def reject(self):
@ -111,8 +111,8 @@ class SettingsForm(QtGui.QDialog, Ui_SettingsDialog):
Process the form saving the settings
"""
self.processes = []
for tabIndex in range(self.stackedLayout.count()):
self.stackedLayout.widget(tabIndex).cancel()
for tabIndex in range(self.stacked_layout.count()):
self.stacked_layout.widget(tabIndex).cancel()
return QtGui.QDialog.reject(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
"""
# General tab
self.generalTab = GeneralTab(self)
self.general_tab = GeneralTab(self)
# Themes tab
self.themesTab = ThemesTab(self)
self.themes_tab = ThemesTab(self)
# Advanced tab
self.advancedTab = AdvancedTab(self)
self.advanced_tab = AdvancedTab(self)
# Advanced tab
self.playerTab = PlayerTab(self)
self.generalTab.post_set_up()
self.themesTab.post_set_up()
self.advancedTab.post_set_up()
self.playerTab.post_set_up()
self.player_tab = PlayerTab(self)
self.general_tab.post_set_up()
self.themes_tab.post_set_up()
self.advanced_tab.post_set_up()
self.player_tab.post_set_up()
for plugin in self.plugin_manager.plugins:
if plugin.settingsTab:
plugin.settingsTab.post_set_up()
def tabChanged(self, tabIndex):
def tab_changed(self, tabIndex):
"""
A different settings tab is selected
"""
self.stackedLayout.setCurrentIndex(tabIndex)
self.stackedLayout.currentWidget().tabVisible()
self.stacked_layout.setCurrentIndex(tabIndex)
self.stacked_layout.currentWidget().tab_visible()
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,
icon=u':/media/media_time.png', checked=False, can_shortcuts=True,
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)
else:
self.play_slides_menu.setDefaultAction(self.play_slides_once)
@ -616,7 +616,7 @@ class SlideController(DisplayController):
"""
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):
"""
@ -645,7 +645,7 @@ class SlideController(DisplayController):
self.play_slides_loop.setChecked(False)
self.play_slides_loop.setIcon(build_icon(u':/media/media_time.png'))
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)
if item.is_capable(ItemCapabilities.CanLoop) and len(item.get_frames()) > 1:
self.toolbar.set_widget_visible(self.loop_list)
@ -766,8 +766,8 @@ class SlideController(DisplayController):
action.setData(counter)
action.triggered.connect(self.onTrackTriggered)
self.display.audio_player.repeat = Settings().value(
self.main_window.generalSettingsSection + u'/audio repeat list')
if Settings().value(self.main_window.generalSettingsSection + u'/audio start paused'):
self.main_window.general_settings_section + u'/audio repeat list')
if Settings().value(self.main_window.general_settings_section + u'/audio start paused'):
self.audio_pause_item.setChecked(True)
self.display.audio_player.pause()
else:
@ -875,7 +875,7 @@ class SlideController(DisplayController):
Allow the main display to blank the main display at startup time
"""
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):
# Order done to handle initial conversion
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_post_set_up', self._push_themes)
self.settingsSection = u'themes'
self.themeForm = ThemeForm(self)
self.fileRenameForm = FileRenameForm()
self.theme_form = ThemeForm(self)
self.file_rename_form = FileRenameForm()
# start with the layout
self.layout = QtGui.QVBoxLayout(self)
self.layout.setSpacing(0)
@ -74,13 +74,13 @@ class ThemeManager(QtGui.QWidget):
self.toolbar.add_toolbar_action(u'newTheme',
text=UiStrings().NewTheme, icon=u':/themes/theme_new.png',
tooltip=translate('OpenLP.ThemeManager', 'Create a new theme.'),
triggers=self.onAddTheme)
triggers=self.on_add_theme)
self.toolbar.add_toolbar_action(u'editTheme',
text=translate('OpenLP.ThemeManager', 'Edit Theme'),
icon=u':/themes/theme_edit.png',
tooltip=translate('OpenLP.ThemeManager', 'Edit a 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'),
icon=u':/general/general_delete.png',
tooltip=translate('OpenLP.ThemeManager', 'Delete a theme.'),
@ -137,11 +137,11 @@ class ThemeManager(QtGui.QWidget):
self.theme_list = []
self.path = AppLocation.get_section_data_path(self.settingsSection)
check_directory_exists(self.path)
self.thumbPath = os.path.join(self.path, u'thumbnails')
check_directory_exists(self.thumbPath)
self.themeForm.path = self.path
self.oldBackgroundImage = None
self.badV1NameChars = re.compile(r'[%+\[\]]')
self.thumb_path = os.path.join(self.path, u'thumbnails')
check_directory_exists(self.thumb_path)
self.theme_form.path = self.path
self.old_background_image = None
self.bad_v1_name_chars = re.compile(r'[%+\[\]]')
# Last little bits of setting up
self.global_theme = Settings().value(self.settingsSection + u'/global theme')
@ -155,9 +155,9 @@ class ThemeManager(QtGui.QWidget):
theme_name = item.text()
# If default theme restrict actions
if real_theme_name == theme_name:
self.deleteToolbarAction.setVisible(True)
self.delete_toolbar_action.setVisible(True)
else:
self.deleteToolbarAction.setVisible(False)
self.delete_toolbar_action.setVisible(False)
def context_menu(self, point):
"""
@ -192,7 +192,7 @@ class ThemeManager(QtGui.QWidget):
if self.global_theme == new_name:
name = translate('OpenLP.ThemeManager', '%s (default)') % new_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):
"""
@ -216,15 +216,15 @@ class ThemeManager(QtGui.QWidget):
Registry().execute(u'theme_update_global')
self._push_themes()
def onAddTheme(self):
def on_add_theme(self):
"""
Loads a new theme with the default settings and then launches the theme
editing form for the user to make their customisations.
"""
theme = ThemeXML()
theme.set_default_header_footer()
self.themeForm.theme = theme
self.themeForm.exec_()
self.theme_form.theme = theme
self.theme_form.exec_()
self.load_themes()
def on_rename_theme(self):
@ -236,14 +236,14 @@ class ThemeManager(QtGui.QWidget):
translate('OpenLP.ThemeManager', 'Rename %s theme?'), False, False):
item = self.theme_list_widget.currentItem()
old_theme_name = item.data(QtCore.Qt.UserRole)
self.fileRenameForm.file_name_edit.setText(old_theme_name)
if self.fileRenameForm.exec_():
new_theme_name = self.fileRenameForm.file_name_edit.text()
self.file_rename_form.file_name_edit.setText(old_theme_name)
if self.file_rename_form.exec_():
new_theme_name = self.file_rename_form.file_name_edit.text()
if old_theme_name == new_theme_name:
return
if self.check_if_theme_exists(new_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)
for plugin in self.plugin_manager.plugins:
if plugin.uses_theme(old_theme_name):
@ -257,19 +257,19 @@ class ThemeManager(QtGui.QWidget):
"""
item = self.theme_list_widget.currentItem()
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)
if self.fileRenameForm.exec_(True):
new_theme_name = self.fileRenameForm.file_name_edit.text()
if self.file_rename_form.exec_(True):
new_theme_name = self.file_rename_form.file_name_edit.text()
if self.check_if_theme_exists(new_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.
"""
log.debug(u'cloneThemeData')
log.debug(u'clone_theme_data')
save_to = None
save_from = None
if theme_data.background_type == u'image':
@ -290,10 +290,10 @@ class ThemeManager(QtGui.QWidget):
item = self.theme_list_widget.currentItem()
theme = self.get_theme_data(item.data(QtCore.Qt.UserRole))
if theme.background_type == u'image':
self.oldBackgroundImage = theme.background_filename
self.themeForm.theme = theme
self.themeForm.exec_(True)
self.oldBackgroundImage = None
self.old_background_image = theme.background_filename
self.theme_form.theme = theme
self.theme_form.exec_(True)
self.old_background_image = None
self.renderer.update_theme(theme.theme_name)
self.load_themes()
@ -324,7 +324,7 @@ class ThemeManager(QtGui.QWidget):
self.theme_list.remove(theme)
thumb = u'%s.png' % theme
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:
encoding = get_filesystem_encoding()
shutil.rmtree(os.path.join(self.path, theme).encode(encoding))
@ -370,9 +370,8 @@ class ThemeManager(QtGui.QWidget):
def on_import_theme(self):
"""
Opens a file dialog to select the theme file(s) to import before
attempting to extract OpenLP themes from those files. This process
will load both OpenLP version 1 and version 2 themes.
Opens a file dialog to select the theme file(s) to import before attempting to extract OpenLP themes from
those files. This process will load both OpenLP version 1 and version 2 themes.
"""
files = QtGui.QFileDialog.getOpenFileNames(self,
translate('OpenLP.ThemeManager', 'Select Theme Import File'),
@ -405,7 +404,6 @@ class ThemeManager(QtGui.QWidget):
theme.theme_name = UiStrings().Default
self._write_theme(theme, None, None)
Settings().setValue(self.settingsSection + u'/global theme', theme.theme_name)
self.config_updated()
self.application.set_normal_cursor()
self.load_themes()
@ -431,7 +429,7 @@ class ThemeManager(QtGui.QWidget):
name = translate('OpenLP.ThemeManager', '%s (default)') % text_name
else:
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)
if validate_thumb(theme, 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()
v1_background = xml_tree.find(u'BackgroundType')
if v1_background is not None:
theme_name, file_xml, out_file, abort_import = self.unzip_version_122(
directory, theme_zip, xml_file[0], xml_tree, v1_background, out_file)
theme_name, file_xml, out_file, abort_import = \
self.unzip_version_122(directory, theme_zip, xml_file[0], xml_tree, v1_background, out_file)
else:
theme_name = xml_tree.find(u'name').text.strip()
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.
"""
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_exists = os.path.exists(theme_folder)
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)
check_directory_exists(theme_dir)
theme_file = os.path.join(theme_dir, name + u'.xml')
if self.oldBackgroundImage and image_to != self.oldBackgroundImage:
delete_file(self.oldBackgroundImage)
if self.old_background_image and image_to != self.old_background_image:
delete_file(self.old_background_image)
out_file = None
try:
out_file = open(theme_file, u'w')
@ -663,7 +661,7 @@ class ThemeManager(QtGui.QWidget):
if os.path.exists(sample_path_name):
os.unlink(sample_path_name)
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)
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.
"""
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:
self.main_window.increment_progress_bar()
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()
def generate_image(self, theme_data, forcePage=False):
@ -759,7 +757,7 @@ class ThemeManager(QtGui.QWidget):
"""
theme = Theme(xml_data)
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:
new_theme.background_type = BackgroundType.to_string(BackgroundType.Solid)
new_theme.background_color = unicode(theme.BackgroundParameter1.name())

View File

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

View File

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

View File

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

View File

@ -353,8 +353,7 @@ class BibleDB(QtCore.QObject, Manager):
book, book_id, language_id)
return book_id
def get_book_ref_id_by_localised_name(self, book,
language_selection):
def get_book_ref_id_by_localised_name(self, book, language_selection):
"""
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.
``language_selection``
The language selection the user has chosen in the settings
section of the Bible.
The language selection the user has chosen in the settings section of the Bible.
"""
log.debug(u'get_book_ref_id_by_localised_name("%s", "%s")', book, language_selection)
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)
if end_verse == -1:
end_verse = self.get_verse_count(book_id, chapter)
verses = self.session.query(Verse)\
.filter_by(book_id=db_book.id)\
.filter_by(chapter=chapter)\
.filter(Verse.verse >= start_verse)\
.filter(Verse.verse <= end_verse)\
.order_by(Verse.verse)\
verses = self.session.query(Verse) \
.filter_by(book_id=db_book.id) \
.filter_by(chapter=chapter) \
.filter(Verse.verse >= start_verse) \
.filter(Verse.verse <= end_verse) \
.order_by(Verse.verse) \
.all()
verse_list.extend(verses)
else:
@ -491,9 +489,9 @@ class BibleDB(QtCore.QObject, Manager):
The chapter to get the verse count for.
"""
log.debug(u'BibleDB.get_verse_count("%s", "%s")', book_ref_id, chapter)
count = self.session.query(func.max(Verse.verse)).join(Book)\
.filter(Book.book_reference_id==book_ref_id)\
.filter(Verse.chapter==chapter)\
count = self.session.query(func.max(Verse.verse)).join(Book) \
.filter(Book.book_reference_id == book_ref_id) \
.filter(Verse.chapter == chapter) \
.scalar()
if not count:
return 0

View File

@ -44,6 +44,7 @@ from openlp.plugins.bibles.lib.db import BiblesResourcesDB
log = logging.getLogger(__name__)
class BibleSearch(object):
"""
Enumeration class for the different search methods for the "quick search".
@ -71,7 +72,6 @@ class BibleMediaItem(MediaManagerItem):
self.second_search_results = {}
self.checkSearchResult()
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):
"""

View File

@ -37,6 +37,7 @@ from sqlalchemy import Table, func, select, insert
__version__ = 1
log = logging.getLogger(__name__)
def upgrade_setup(metadata):
"""
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.
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']
# 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/display footer': True,
u'custom/add custom from service': True
}
}
class CustomPlugin(Plugin):

View File

@ -35,6 +35,7 @@ from PyQt4 import QtCore, QtGui
from openlp.core.lib import SettingsTab, Settings, translate
class CustomTab(SettingsTab):
"""
CustomTab is the Custom settings tab in the settings dialog.
@ -45,7 +46,7 @@ class CustomTab(SettingsTab):
def setupUi(self):
self.setObjectName(u'CustomTab')
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_layout = QtGui.QFormLayout(self.custom_mode_group_box)
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.setObjectName(u'add_from_service_checkbox')
self.custom_mode_layout.addRow(self.add_from_service_checkbox)
self.leftLayout.addWidget(self.custom_mode_group_box)
self.leftLayout.addStretch()
self.rightLayout.addStretch()
self.left_layout.addWidget(self.custom_mode_group_box)
self.left_layout.addStretch()
self.right_layout.addStretch()
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)
@ -81,7 +82,7 @@ class CustomTab(SettingsTab):
def load(self):
settings = Settings()
settings.beginGroup(self.settingsSection)
settings.beginGroup(self.settings_section)
self.display_footer = settings.value(u'display footer')
self.update_load = settings.value(u'add custom from service')
self.display_footer_check_box.setChecked(self.display_footer)
@ -90,7 +91,10 @@ class CustomTab(SettingsTab):
def save(self):
settings = Settings()
settings.beginGroup(self.settingsSection)
settings.beginGroup(self.settings_section)
settings.setValue(u'display footer', self.display_footer)
settings.setValue(u'add custom from service', self.update_load)
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)
Registry().register_function(u'custom_load_list', self.loadList)
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)
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')
def retranslateUi(self):
@ -92,9 +95,9 @@ class CustomMediaItem(MediaManagerItem):
translate('SongsPlugin.MediaItem', 'Search Titles...')),
(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.searchTextEdit.set_current_search_type(Settings().value( u'%s/last search type' % self.settingsSection))
self.config_updated()
self.config_update()
def loadList(self, custom_slides):
# Sort out what custom we want to select after loading the list.

View File

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

View File

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

View File

@ -99,7 +99,7 @@ class ImageMediaItem(MediaManagerItem):
row_list = [item.row() for item in self.listView.selectedIndexes()]
row_list.sort(reverse=True)
self.application.set_busy_cursor()
self.main_window.displayProgressBar(len(row_list))
self.main_window.display_progress_bar(len(row_list))
for row in row_list:
text = self.listView.item(row)
if text:
@ -107,14 +107,14 @@ class ImageMediaItem(MediaManagerItem):
self.listView.takeItem(row)
self.main_window.increment_progress_bar()
Settings.setValue(self.settingsSection + u'/images files', self.getFileList())
self.main_window.finishedProgressBar()
self.main_window.finished_progress_bar()
self.application.set_normal_cursor()
self.listView.blockSignals(False)
def loadList(self, images, initialLoad=False):
self.application.set_busy_cursor()
if not initialLoad:
self.main_window.displayProgressBar(len(images))
self.main_window.display_progress_bar(len(images))
# Sort the images by its filename considering language specific
# characters.
images.sort(cmp=locale_compare, key=lambda filename: os.path.split(unicode(filename))[1])
@ -136,7 +136,7 @@ class ImageMediaItem(MediaManagerItem):
if not initialLoad:
self.main_window.increment_progress_bar()
if not initialLoad:
self.main_window.finishedProgressBar()
self.main_window.finished_progress_bar()
self.application.set_normal_cursor()
def generateSlideData(self, service_item, item=None, xmlVersion=False,

View File

@ -32,9 +32,9 @@ from PyQt4 import QtGui
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):
self.playerName = name
@ -51,36 +51,36 @@ class MediaTab(SettingsTab):
def setupUi(self):
self.setObjectName(u'MediaTab')
SettingsTab.setupUi(self)
self.advancedGroupBox = QtGui.QGroupBox(self.leftColumn)
self.advancedGroupBox.setObjectName(u'advancedGroupBox')
self.advancedLayout = QtGui.QVBoxLayout(self.advancedGroupBox)
self.advancedLayout.setObjectName(u'advancedLayout')
self.overridePlayerCheckBox = QtGui.QCheckBox(self.advancedGroupBox)
self.overridePlayerCheckBox.setObjectName(u'overridePlayerCheckBox')
self.advancedLayout.addWidget(self.overridePlayerCheckBox)
self.autoStartCheckBox = QtGui.QCheckBox(self.advancedGroupBox)
self.autoStartCheckBox.setObjectName(u'autoStartCheckBox')
self.advancedLayout.addWidget(self.autoStartCheckBox)
self.leftLayout.addWidget(self.advancedGroupBox)
self.leftLayout.addStretch()
self.rightLayout.addStretch()
self.advanced_group_box = QtGui.QGroupBox(self.left_column)
self.advanced_group_box.setObjectName(u'advanced_group_box')
self.advanced_layout = QtGui.QVBoxLayout(self.advanced_group_box)
self.advanced_layout.setObjectName(u'advanced_layout')
self.override_player_check_box = QtGui.QCheckBox(self.advanced_group_box)
self.override_player_check_box.setObjectName(u'override_player_check_box')
self.advanced_layout.addWidget(self.override_player_check_box)
self.auto_start_check_box = QtGui.QCheckBox(self.advanced_group_box)
self.auto_start_check_box.setObjectName(u'auto_start_check_box')
self.advanced_layout.addWidget(self.auto_start_check_box)
self.left_layout.addWidget(self.advanced_group_box)
self.left_layout.addStretch()
self.right_layout.addStretch()
def retranslateUi(self):
self.advancedGroupBox.setTitle(UiStrings().Advanced)
self.overridePlayerCheckBox.setText(translate('MediaPlugin.MediaTab', 'Allow media player to be overridden'))
self.autoStartCheckBox.setText(translate('MediaPlugin.MediaTab', 'Start Live items automatically'))
self.advanced_group_box.setTitle(UiStrings().Advanced)
self.override_player_check_box.setText(translate('MediaPlugin.MediaTab', 'Allow media player to be overridden'))
self.auto_start_check_box.setText(translate('MediaPlugin.MediaTab', 'Start Live items automatically'))
def load(self):
self.overridePlayerCheckBox.setChecked(Settings().value(self.settingsSection + u'/override player'))
self.autoStartCheckBox.setChecked(Settings().value(self.settingsSection + u'/media auto start'))
self.override_player_check_box.setChecked(Settings().value(self.settings_section + u'/override player'))
self.auto_start_check_box.setChecked(Settings().value(self.settings_section + u'/media auto start'))
def save(self):
setting_key = self.settingsSection + u'/override player'
if Settings().value(setting_key) != self.overridePlayerCheckBox.checkState():
Settings().setValue(setting_key, self.overridePlayerCheckBox.checkState())
setting_key = self.settings_section + u'/override player'
if Settings().value(setting_key) != self.override_player_check_box.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_media_rebuild')
self.settings_form.register_post_process(u'mediaitem_suffixes')
setting_key = self.settingsSection + u'/media auto start'
if Settings().value(setting_key) != self.autoStartCheckBox.checkState():
Settings().setValue(setting_key, self.autoStartCheckBox.checkState())
setting_key = self.settings_section + u'/media auto start'
if Settings().value(setting_key) != self.auto_start_check_box.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]
self.application.set_busy_cursor()
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.
files.sort(cmp=locale_compare,
key=lambda filename: os.path.split(unicode(filename))[1])
@ -205,7 +205,7 @@ class PresentationMediaItem(MediaManagerItem):
item_name.setToolTip(file)
self.listView.addItem(item_name)
if not initialLoad:
self.main_window.finishedProgressBar()
self.main_window.finished_progress_bar()
self.application.set_normal_cursor()
def onDeleteClick(self):
@ -217,7 +217,7 @@ class PresentationMediaItem(MediaManagerItem):
row_list = [item.row() for item in items]
row_list.sort(reverse=True)
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:
filepath = unicode(item.data(QtCore.Qt.UserRole))
for cidx in self.controllers:
@ -225,7 +225,7 @@ class PresentationMediaItem(MediaManagerItem):
doc.presentation_deleted()
doc.close_presentation()
self.main_window.increment_progress_bar()
self.main_window.finishedProgressBar()
self.main_window.finished_progress_bar()
self.application.set_busy_cursor()
for row in row_list:
self.listView.takeItem(row)

View File

@ -31,6 +31,7 @@ from PyQt4 import QtGui
from openlp.core.lib import Settings, SettingsTab, UiStrings, translate
class PresentationTab(SettingsTab):
"""
PresentationsTab is the Presentations settings tab in the settings dialog.
@ -50,43 +51,43 @@ class PresentationTab(SettingsTab):
"""
self.setObjectName(u'PresentationTab')
SettingsTab.setupUi(self)
self.ControllersGroupBox = QtGui.QGroupBox(self.leftColumn)
self.ControllersGroupBox.setObjectName(u'ControllersGroupBox')
self.ControllersLayout = QtGui.QVBoxLayout(self.ControllersGroupBox)
self.ControllersLayout.setObjectName(u'ControllersLayout')
self.PresenterCheckboxes = {}
self.controllers_group_box = QtGui.QGroupBox(self.left_column)
self.controllers_group_box.setObjectName(u'controllers_group_box')
self.controllers_layout = QtGui.QVBoxLayout(self.controllers_group_box)
self.controllers_layout.setObjectName(u'ccontrollers_layout')
self.presenter_check_boxes = {}
for key in self.controllers:
controller = self.controllers[key]
checkbox = QtGui.QCheckBox(self.ControllersGroupBox)
checkbox = QtGui.QCheckBox(self.controllers_group_box)
checkbox.setObjectName(controller.name + u'CheckBox')
self.PresenterCheckboxes[controller.name] = checkbox
self.ControllersLayout.addWidget(checkbox)
self.leftLayout.addWidget(self.ControllersGroupBox)
self.AdvancedGroupBox = QtGui.QGroupBox(self.leftColumn)
self.AdvancedGroupBox.setObjectName(u'AdvancedGroupBox')
self.AdvancedLayout = QtGui.QVBoxLayout(self.AdvancedGroupBox)
self.AdvancedLayout.setObjectName(u'AdvancedLayout')
self.OverrideAppCheckBox = QtGui.QCheckBox(self.AdvancedGroupBox)
self.OverrideAppCheckBox.setObjectName(u'OverrideAppCheckBox')
self.AdvancedLayout.addWidget(self.OverrideAppCheckBox)
self.leftLayout.addWidget(self.AdvancedGroupBox)
self.leftLayout.addStretch()
self.rightLayout.addStretch()
self.presenter_check_boxes[controller.name] = checkbox
self.controllers_layout.addWidget(checkbox)
self.left_layout.addWidget(self.controllers_group_box)
self.advanced_group_box = QtGui.QGroupBox(self.left_column)
self.advanced_group_box.setObjectName(u'advanced_group_box')
self.advanced_layout = QtGui.QVBoxLayout(self.advanced_group_box)
self.advanced_layout.setObjectName(u'advanced_layout')
self.override_app_check_box = QtGui.QCheckBox(self.advanced_group_box)
self.override_app_check_box.setObjectName(u'override_app_check_box')
self.advanced_layout.addWidget(self.override_app_check_box)
self.left_layout.addWidget(self.advanced_group_box)
self.left_layout.addStretch()
self.right_layout.addStretch()
def retranslateUi(self):
"""
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:
controller = self.controllers[key]
checkbox = self.PresenterCheckboxes[controller.name]
self.setControllerText(checkbox, controller)
self.AdvancedGroupBox.setTitle(UiStrings().Advanced)
self.OverrideAppCheckBox.setText(
checkbox = self.presenter_check_boxes[controller.name]
self.set_controller_text(checkbox, controller)
self.advanced_group_box.setTitle(UiStrings().Advanced)
self.override_app_check_box.setText(
translate('PresentationPlugin.PresentationTab', 'Allow presentation application to be overridden'))
def setControllerText(self, checkbox, controller):
def set_controller_text(self, checkbox, controller):
if checkbox.isEnabled():
checkbox.setText(controller.name)
else:
@ -99,15 +100,14 @@ class PresentationTab(SettingsTab):
"""
for key in self.controllers:
controller = self.controllers[key]
checkbox = self.PresenterCheckboxes[controller.name]
checkbox.setChecked(Settings().value(self.settingsSection + u'/' + controller.name))
self.OverrideAppCheckBox.setChecked(Settings().value(self.settingsSection + u'/override app'))
checkbox = self.presenter_check_boxes[controller.name]
checkbox.setChecked(Settings().value(self.settings_section + u'/' + controller.name))
self.override_app_check_box.setChecked(Settings().value(self.settings_section + u'/override app'))
def save(self):
"""
Save the settings. If the tab hasn't been made visible to the user
then there is nothing to do, so exit. This removes the need to
start presentation applications unnecessarily.
Save the settings. If the tab hasn't been made visible to the user then there is nothing to do,
so exit. This removes the need to start presentation applications unnecessarily.
"""
if not self.activated:
return
@ -115,8 +115,8 @@ class PresentationTab(SettingsTab):
for key in self.controllers:
controller = self.controllers[key]
if controller.is_available():
checkbox = self.PresenterCheckboxes[controller.name]
setting_key = self.settingsSection + u'/' + controller.name
checkbox = self.presenter_check_boxes[controller.name]
setting_key = self.settings_section + u'/' + controller.name
if Settings().value(setting_key) != checkbox.checkState():
changed = True
Settings().setValue(setting_key, checkbox.checkState())
@ -124,22 +124,22 @@ class PresentationTab(SettingsTab):
controller.start_process()
else:
controller.kill()
setting_key = self.settingsSection + u'/override app'
if Settings().value(setting_key) != self.OverrideAppCheckBox.checkState():
Settings().setValue(setting_key, self.OverrideAppCheckBox.checkState())
setting_key = self.settings_section + u'/override app'
if Settings().value(setting_key) != self.override_app_check_box.checkState():
Settings().setValue(setting_key, self.override_app_check_box.checkState())
changed = True
if changed:
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_suffixes')
def tabVisible(self):
def tab_visible(self):
"""
Tab has just been made visible to the user
"""
self.activated = True
for key in self.controllers:
controller = self.controllers[key]
checkbox = self.PresenterCheckboxes[controller.name]
checkbox = self.presenter_check_boxes[controller.name]
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
"""
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):
"""
@ -132,13 +132,12 @@ class PresentationPlugin(Plugin):
if filename.endswith(u'controller.py') and not filename == 'presentationcontroller.py':
path = os.path.join(controller_dir, filename)
if os.path.isfile(path):
modulename = u'openlp.plugins.presentations.lib.' + os.path.splitext(filename)[0]
log.debug(u'Importing controller %s', modulename)
module_name = u'openlp.plugins.presentations.lib.' + os.path.splitext(filename)[0]
log.debug(u'Importing controller %s', module_name)
try:
__import__(modulename, globals(), locals(), [])
__import__(module_name, globals(), locals(), [])
except ImportError:
log.warn(u'Failed to import %s on path %s',
modulename, path)
log.warn(u'Failed to import %s on path %s', module_name, path)
controller_classes = PresentationController.__subclasses__()
for controller_class in controller_classes:
controller = controller_class(self)

View File

@ -48,7 +48,7 @@ class RemoteTab(SettingsTab):
def setupUi(self):
self.setObjectName(u'RemoteTab')
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_layout = QtGui.QFormLayout(self.server_settings_group_box)
self.server_settings_layout.setObjectName(u'server_settings_layout')
@ -63,8 +63,8 @@ class RemoteTab(SettingsTab):
self.twelve_hour_check_box = QtGui.QCheckBox(self.server_settings_group_box)
self.twelve_hour_check_box.setObjectName(u'twelve_hour_check_box')
self.server_settings_layout.addRow(self.twelve_hour_check_box)
self.leftLayout.addWidget(self.server_settings_group_box)
self.http_settings_group_box = QtGui.QGroupBox(self.leftColumn)
self.left_layout.addWidget(self.server_settings_group_box)
self.http_settings_group_box = QtGui.QGroupBox(self.left_column)
self.http_settings_group_box.setObjectName(u'http_settings_group_box')
self.http_setting_layout = QtGui.QFormLayout(self.http_settings_group_box)
self.http_setting_layout.setObjectName(u'http_setting_layout')
@ -86,8 +86,8 @@ class RemoteTab(SettingsTab):
self.stage_url.setObjectName(u'stage_url')
self.stage_url.setOpenExternalLinks(True)
self.http_setting_layout.addRow(self.stage_url_label, self.stage_url)
self.leftLayout.addWidget(self.http_settings_group_box)
self.https_settings_group_box = QtGui.QGroupBox(self.leftColumn)
self.left_layout.addWidget(self.http_settings_group_box)
self.https_settings_group_box = QtGui.QGroupBox(self.left_column)
self.https_settings_group_box.setCheckable(True)
self.https_settings_group_box.setChecked(False)
self.https_settings_group_box.setObjectName(u'https_settings_group_box')
@ -116,8 +116,8 @@ class RemoteTab(SettingsTab):
self.stage_https_url.setObjectName(u'stage_https_url')
self.stage_https_url.setOpenExternalLinks(True)
self.https_settings_layout.addRow(self.stage_https_url_label, self.stage_https_url)
self.leftLayout.addWidget(self.https_settings_group_box)
self.user_login_group_box = QtGui.QGroupBox(self.leftColumn)
self.left_layout.addWidget(self.https_settings_group_box)
self.user_login_group_box = QtGui.QGroupBox(self.left_column)
self.user_login_group_box.setCheckable(True)
self.user_login_group_box.setChecked(False)
self.user_login_group_box.setObjectName(u'user_login_group_box')
@ -133,10 +133,10 @@ class RemoteTab(SettingsTab):
self.password = QtGui.QLineEdit(self.user_login_group_box)
self.password.setObjectName(u'password')
self.user_login_layout.addRow(self.password_label, self.password)
self.leftLayout.addWidget(self.user_login_group_box)
self.android_app_group_box = QtGui.QGroupBox(self.rightColumn)
self.left_layout.addWidget(self.user_login_group_box)
self.android_app_group_box = QtGui.QGroupBox(self.right_column)
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.setObjectName(u'qr_layout')
self.qr_code_label = QtGui.QLabel(self.android_app_group_box)
@ -149,8 +149,8 @@ class RemoteTab(SettingsTab):
self.qr_description_label.setOpenExternalLinks(True)
self.qr_description_label.setWordWrap(True)
self.qr_layout.addWidget(self.qr_description_label)
self.leftLayout.addStretch()
self.rightLayout.addStretch()
self.left_layout.addStretch()
self.right_layout.addStretch()
self.twelve_hour_check_box.stateChanged.connect(self.on_twelve_hour_check_box_changed)
self.address_edit.textChanged.connect(self.set_urls)
self.port_spin_box.valueChanged.connect(self.set_urls)
@ -205,10 +205,10 @@ class RemoteTab(SettingsTab):
self.stage_https_url.setText(u'<a href="%s">%s</a>' % (https_url, https_url))
def load(self):
self.port_spin_box.setValue(Settings().value(self.settingsSection + u'/port'))
self.https_port_spin_box.setValue(Settings().value(self.settingsSection + u'/https port'))
self.address_edit.setText(Settings().value(self.settingsSection + u'/ip address'))
self.twelve_hour = Settings().value(self.settingsSection + u'/twelve hour')
self.port_spin_box.setValue(Settings().value(self.settings_section + u'/port'))
self.https_port_spin_box.setValue(Settings().value(self.settings_section + u'/https port'))
self.address_edit.setText(Settings().value(self.settings_section + u'/ip address'))
self.twelve_hour = Settings().value(self.settings_section + u'/twelve hour')
self.twelve_hour_check_box.setChecked(self.twelve_hour)
shared_data = AppLocation.get_directory(AppLocation.SharedData)
if not os.path.exists(os.path.join(shared_data, u'openlp.crt')) or \
@ -217,29 +217,30 @@ class RemoteTab(SettingsTab):
self.https_settings_group_box.setEnabled(False)
self.https_error_label.setVisible(True)
else:
self.https_settings_group_box.setChecked(Settings().value(self.settingsSection + u'/https enabled'))
self.https_settings_group_box.setChecked(Settings().value(self.settings_section + u'/https enabled'))
self.https_settings_group_box.setEnabled(True)
self.https_error_label.setVisible(False)
self.user_login_group_box.setChecked(Settings().value(self.settingsSection + u'/authentication enabled'))
self.user_id.setText(Settings().value(self.settingsSection + u'/user id'))
self.password.setText(Settings().value(self.settingsSection + u'/password'))
self.user_login_group_box.setChecked(Settings().value(self.settings_section + u'/authentication enabled'))
self.user_id.setText(Settings().value(self.settings_section + u'/user id'))
self.password.setText(Settings().value(self.settings_section + u'/password'))
self.set_urls()
def save(self):
changed = False
if Settings().value(self.settingsSection + u'/ip address') != self.address_edit.text() or \
Settings().value(self.settingsSection + u'/port') != self.port_spin_box.value() or \
Settings().value(self.settingsSection + u'/https port') != self.https_port_spin_box.value() or \
Settings().value(self.settingsSection + u'/https enabled') != self.https_settings_group_box.isChecked():
if Settings().value(self.settings_section + u'/ip address') != self.address_edit.text() or \
Settings().value(self.settings_section + u'/port') != self.port_spin_box.value() or \
Settings().value(self.settings_section + u'/https port') != self.https_port_spin_box.value() or \
Settings().value(self.settings_section + u'/https enabled') != \
self.https_settings_group_box.isChecked():
changed = True
Settings().setValue(self.settingsSection + u'/port', self.port_spin_box.value())
Settings().setValue(self.settingsSection + u'/https port', self.https_port_spin_box.value())
Settings().setValue(self.settingsSection + u'/https enabled', self.https_settings_group_box.isChecked())
Settings().setValue(self.settingsSection + u'/ip address', self.address_edit.text())
Settings().setValue(self.settingsSection + u'/twelve hour', self.twelve_hour)
Settings().setValue(self.settingsSection + u'/authentication enabled', self.user_login_group_box.isChecked())
Settings().setValue(self.settingsSection + u'/user id', self.user_id.text())
Settings().setValue(self.settingsSection + u'/password', self.password.text())
Settings().setValue(self.settings_section + u'/port', self.port_spin_box.value())
Settings().setValue(self.settings_section + u'/https port', self.https_port_spin_box.value())
Settings().setValue(self.settings_section + u'/https enabled', self.https_settings_group_box.isChecked())
Settings().setValue(self.settings_section + u'/ip address', self.address_edit.text())
Settings().setValue(self.settings_section + u'/twelve hour', self.twelve_hour)
Settings().setValue(self.settings_section + u'/authentication enabled', self.user_login_group_box.isChecked())
Settings().setValue(self.settings_section + u'/user id', self.user_id.text())
Settings().setValue(self.settings_section + u'/password', self.password.text())
if changed:
Registry().execute(u'remotes_config_updated')

View File

@ -102,8 +102,7 @@ class RemotesPlugin(Plugin):
def config_update(self):
"""
Called when Config is changed to restart the server on new address or
port
Called when Config is changed to restart the server on new address or port
"""
self.finalise()
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_list_widget.itemClicked.connect(self.on_verse_list_view_clicked)
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.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)

View File

@ -104,7 +104,6 @@ class SongMediaItem(MediaManagerItem):
self.addSearchToToolBar()
# Signals and slots
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)
QtCore.QObject.connect(self.searchTextEdit, QtCore.SIGNAL(u'cleared()'), self.onClearTextButtonClick)
QtCore.QObject.connect(self.searchTextEdit, QtCore.SIGNAL(u'searchTypeChanged(int)'),
@ -120,6 +119,10 @@ class SongMediaItem(MediaManagerItem):
self.searchTextEdit.setFocus()
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.updateServiceOnEdit = Settings().value(self.settingsSection + u'/update service on edit')
self.addSongFromService = Settings().value(self.settingsSection + u'/add song from service',)
@ -366,7 +369,7 @@ class SongMediaItem(MediaManagerItem):
QtGui.QMessageBox.Yes) == QtGui.QMessageBox.No:
return
self.application.set_busy_cursor()
self.main_window.displayProgressBar(len(items))
self.main_window.display_progress_bar(len(items))
for item in items:
item_id = item.data(QtCore.Qt.UserRole)
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)
self.plugin.manager.delete_object(Song, item_id)
self.main_window.increment_progress_bar()
self.main_window.finishedProgressBar()
self.main_window.finished_progress_bar()
self.application.set_normal_cursor()
self.onSearchTextButtonClicked()

View File

@ -42,69 +42,72 @@ class SongsTab(SettingsTab):
"""
self.setObjectName(u'SongsTab')
SettingsTab.setupUi(self)
self.modeGroupBox = QtGui.QGroupBox(self.leftColumn)
self.modeGroupBox.setObjectName(u'modeGroupBox')
self.modeLayout = QtGui.QVBoxLayout(self.modeGroupBox)
self.modeLayout.setObjectName(u'modeLayout')
self.searchAsTypeCheckBox = QtGui.QCheckBox(self.modeGroupBox)
self.searchAsTypeCheckBox.setObjectName(u'SearchAsTypeCheckBox')
self.modeLayout.addWidget(self.searchAsTypeCheckBox)
self.toolBarActiveCheckBox = QtGui.QCheckBox(self.modeGroupBox)
self.toolBarActiveCheckBox.setObjectName(u'toolBarActiveCheckBox')
self.modeLayout.addWidget(self.toolBarActiveCheckBox)
self.updateOnEditCheckBox = QtGui.QCheckBox(self.modeGroupBox)
self.updateOnEditCheckBox.setObjectName(u'updateOnEditCheckBox')
self.modeLayout.addWidget(self.updateOnEditCheckBox)
self.addFromServiceCheckBox = QtGui.QCheckBox(self.modeGroupBox)
self.addFromServiceCheckBox.setObjectName(u'addFromServiceCheckBox')
self.modeLayout.addWidget(self.addFromServiceCheckBox)
self.leftLayout.addWidget(self.modeGroupBox)
self.leftLayout.addStretch()
self.rightLayout.addStretch()
self.searchAsTypeCheckBox.stateChanged.connect(self.onSearchAsTypeCheckBoxChanged)
self.toolBarActiveCheckBox.stateChanged.connect(self.onToolBarActiveCheckBoxChanged)
self.updateOnEditCheckBox.stateChanged.connect(self.onUpdateOnEditCheckBoxChanged)
self.addFromServiceCheckBox.stateChanged.connect(self.onAddFromServiceCheckBoxChanged)
self.mode_group_box = QtGui.QGroupBox(self.left_column)
self.mode_group_box.setObjectName(u'mode_group_box')
self.mode_layout = QtGui.QVBoxLayout(self.mode_group_box)
self.mode_layout.setObjectName(u'mode_layout')
self.search_as_type_check_box = QtGui.QCheckBox(self.mode_group_box)
self.search_as_type_check_box.setObjectName(u'SearchAsType_check_box')
self.mode_layout.addWidget(self.search_as_type_check_box)
self.tool_bar_active_check_box = QtGui.QCheckBox(self.mode_group_box)
self.tool_bar_active_check_box.setObjectName(u'tool_bar_active_check_box')
self.mode_layout.addWidget(self.tool_bar_active_check_box)
self.update_on_edit_check_box = QtGui.QCheckBox(self.mode_group_box)
self.update_on_edit_check_box.setObjectName(u'update_on_edit_check_box')
self.mode_layout.addWidget(self.update_on_edit_check_box)
self.add_from_service_check_box = QtGui.QCheckBox(self.mode_group_box)
self.add_from_service_check_box.setObjectName(u'add_from_service_check_box')
self.mode_layout.addWidget(self.add_from_service_check_box)
self.left_layout.addWidget(self.mode_group_box)
self.left_layout.addStretch()
self.right_layout.addStretch()
self.search_as_type_check_box.stateChanged.connect(self.on_search_as_type_check_box_changed)
self.tool_bar_active_check_box.stateChanged.connect(self.on_tool_bar_active_check_box_changed)
self.update_on_edit_check_box.stateChanged.connect(self.on_update_on_edit_check_box_changed)
self.add_from_service_check_box.stateChanged.connect(self.on_add_from_service_check_box_changed)
def retranslateUi(self):
self.modeGroupBox.setTitle(translate('SongsPlugin.SongsTab', 'Songs Mode'))
self.searchAsTypeCheckBox.setText(translate('SongsPlugin.SongsTab', 'Enable search as you type'))
self.toolBarActiveCheckBox.setText(translate('SongsPlugin.SongsTab',
self.mode_group_box.setTitle(translate('SongsPlugin.SongsTab', 'Songs Mode'))
self.search_as_type_check_box.setText(translate('SongsPlugin.SongsTab', 'Enable search as you type'))
self.tool_bar_active_check_box.setText(translate('SongsPlugin.SongsTab',
'Display verses on live tool bar'))
self.updateOnEditCheckBox.setText(translate('SongsPlugin.SongsTab', 'Update service from song edit'))
self.addFromServiceCheckBox.setText(translate('SongsPlugin.SongsTab',
self.update_on_edit_check_box.setText(translate('SongsPlugin.SongsTab', 'Update service from song edit'))
self.add_from_service_check_box.setText(translate('SongsPlugin.SongsTab',
'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)
def onToolBarActiveCheckBoxChanged(self, check_state):
def on_tool_bar_active_check_box_changed(self, check_state):
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)
def onAddFromServiceCheckBoxChanged(self, check_state):
def on_add_from_service_check_box_changed(self, check_state):
self.update_load = (check_state == QtCore.Qt.Checked)
def load(self):
settings = Settings()
settings.beginGroup(self.settingsSection)
settings.beginGroup(self.settings_section)
self.song_search = settings.value(u'search as type')
self.tool_bar = settings.value(u'display songbar')
self.update_edit = settings.value(u'update service on edit')
self.update_load = settings.value(u'add song from service')
self.searchAsTypeCheckBox.setChecked(self.song_search)
self.toolBarActiveCheckBox.setChecked(self.tool_bar)
self.updateOnEditCheckBox.setChecked(self.update_edit)
self.addFromServiceCheckBox.setChecked(self.update_load)
self.search_as_type_check_box.setChecked(self.song_search)
self.tool_bar_active_check_box.setChecked(self.tool_bar)
self.update_on_edit_check_box.setChecked(self.update_edit)
self.add_from_service_check_box.setChecked(self.update_load)
settings.endGroup()
def save(self):
settings = Settings()
settings.beginGroup(self.settingsSection)
settings.beginGroup(self.settings_section)
settings.setValue(u'search as type', self.song_search)
settings.setValue(u'display songbar', self.tool_bar)
settings.setValue(u'update service on edit', self.update_edit)
settings.setValue(u'add song from service', self.update_load)
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.addAction(self.song_usage_report)
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.setAutoRaise(True)
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.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()
# Signals and slots
QtCore.QObject.connect(self.song_usage_status, QtCore.SIGNAL(u'visibilityChanged(bool)'),

View File

@ -40,7 +40,7 @@ import os
import sys
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:
import nose
except ImportError:

View File

@ -27,6 +27,9 @@ class TestSettingsForm(TestCase):
"""
Some pre-test setup required.
"""
self.dummy1 = MagicMock()
self.dummy2 = MagicMock()
self.dummy3 = MagicMock()
self.desktop = MagicMock()
self.desktop.primaryScreen.return_value = SCREEN[u'primary']
self.desktop.screenCount.return_value = SCREEN[u'number']
@ -108,3 +111,59 @@ class TestSettingsForm(TestCase):
# WHEN testing the processing stack
# 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'
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'