forked from openlp/openlp
commit
44ea74cf55
|
@ -688,3 +688,13 @@ class MediaManagerItem(QtGui.QWidget):
|
||||||
|
|
||||||
service_manager = property(_get_service_manager)
|
service_manager = property(_get_service_manager)
|
||||||
|
|
||||||
|
def _get_theme_manager(self):
|
||||||
|
"""
|
||||||
|
Adds the theme manager to the class dynamically
|
||||||
|
"""
|
||||||
|
if not hasattr(self, u'_theme_manager'):
|
||||||
|
self._theme_manager = Registry().get(u'theme_manager')
|
||||||
|
return self._theme_manager
|
||||||
|
|
||||||
|
theme_manager = property(_get_theme_manager)
|
||||||
|
|
||||||
|
|
|
@ -92,5 +92,5 @@ class Registry(object):
|
||||||
raise KeyError(u'Invalid Method call for key %s' % key)
|
raise KeyError(u'Invalid Method call for key %s' % key)
|
||||||
return
|
return
|
||||||
if key in self.service_list:
|
if key in self.service_list:
|
||||||
del self.service_list[key]
|
del self.service_list[key]
|
||||||
|
|
||||||
|
|
|
@ -128,7 +128,7 @@ class Renderer(object):
|
||||||
The theme name.
|
The theme name.
|
||||||
"""
|
"""
|
||||||
if theme_name not in self._theme_dimensions:
|
if theme_name not in self._theme_dimensions:
|
||||||
theme_data = self.theme_manager.getThemeData(theme_name)
|
theme_data = self.theme_manager.get_theme_data(theme_name)
|
||||||
main_rect = self.get_main_rectangle(theme_data)
|
main_rect = self.get_main_rectangle(theme_data)
|
||||||
footer_rect = self.get_footer_rectangle(theme_data)
|
footer_rect = self.get_footer_rectangle(theme_data)
|
||||||
self._theme_dimensions[theme_name] = [theme_data, main_rect, footer_rect]
|
self._theme_dimensions[theme_name] = [theme_data, main_rect, footer_rect]
|
||||||
|
@ -315,7 +315,7 @@ class Renderer(object):
|
||||||
if text_contains_split:
|
if text_contains_split:
|
||||||
text = slides[-1] + u'\n[---]\n' + text
|
text = slides[-1] + u'\n[---]\n' + text
|
||||||
else:
|
else:
|
||||||
text = slides[-1] + u'\n'+ text
|
text = slides[-1] + u'\n' + text
|
||||||
text = text.replace(u'<br>', u'\n')
|
text = text.replace(u'<br>', u'\n')
|
||||||
else:
|
else:
|
||||||
pages.extend(slides)
|
pages.extend(slides)
|
||||||
|
@ -543,7 +543,7 @@ class Renderer(object):
|
||||||
end_tags.reverse()
|
end_tags.reverse()
|
||||||
# Remove the indexes.
|
# Remove the indexes.
|
||||||
html_tags = [tag[1] for tag in html_tags]
|
html_tags = [tag[1] for tag in html_tags]
|
||||||
return raw_text + u''.join(end_tags), u''.join(start_tags), u''.join(html_tags)
|
return raw_text + u''.join(end_tags), u''.join(start_tags), u''.join(html_tags)
|
||||||
|
|
||||||
def _binary_chop(self, formatted, previous_html, previous_raw, html_list, raw_list, separator, line_end):
|
def _binary_chop(self, formatted, previous_html, previous_raw, html_list, raw_list, separator, line_end):
|
||||||
"""
|
"""
|
||||||
|
@ -661,4 +661,5 @@ class Renderer(object):
|
||||||
self._theme_manager = Registry().get(u'theme_manager')
|
self._theme_manager = Registry().get(u'theme_manager')
|
||||||
return self._theme_manager
|
return self._theme_manager
|
||||||
|
|
||||||
theme_manager = property(_get_theme_manager)
|
theme_manager = property(_get_theme_manager)
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,8 @@
|
||||||
|
|
||||||
from PyQt4 import QtGui
|
from PyQt4 import QtGui
|
||||||
|
|
||||||
|
from openlp.core.lib import Registry
|
||||||
|
|
||||||
class SettingsTab(QtGui.QWidget):
|
class SettingsTab(QtGui.QWidget):
|
||||||
"""
|
"""
|
||||||
SettingsTab is a helper widget for plugins to define Tabs for the settings
|
SettingsTab is a helper widget for plugins to define Tabs for the settings
|
||||||
|
@ -131,3 +133,54 @@ class SettingsTab(QtGui.QWidget):
|
||||||
Tab has just been made visible to the user
|
Tab has just been made visible to the user
|
||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def _get_service_manager(self):
|
||||||
|
"""
|
||||||
|
Adds the service manager to the class dynamically
|
||||||
|
"""
|
||||||
|
if not hasattr(self, u'_service_manager'):
|
||||||
|
self._service_manager = Registry().get(u'service_manager')
|
||||||
|
return self._service_manager
|
||||||
|
|
||||||
|
service_manager = property(_get_service_manager)
|
||||||
|
|
||||||
|
def _get_main_window(self):
|
||||||
|
"""
|
||||||
|
Adds the main window to the class dynamically
|
||||||
|
"""
|
||||||
|
if not hasattr(self, u'_main_window'):
|
||||||
|
self._main_window = Registry().get(u'main_window')
|
||||||
|
return self._main_window
|
||||||
|
|
||||||
|
main_window = property(_get_main_window)
|
||||||
|
|
||||||
|
def _get_renderer(self):
|
||||||
|
"""
|
||||||
|
Adds the Renderer to the class dynamically
|
||||||
|
"""
|
||||||
|
if not hasattr(self, u'_renderer'):
|
||||||
|
self._renderer = Registry().get(u'renderer')
|
||||||
|
return self._renderer
|
||||||
|
|
||||||
|
renderer = property(_get_renderer)
|
||||||
|
|
||||||
|
def _get_theme_manager(self):
|
||||||
|
"""
|
||||||
|
Adds the theme manager to the class dynamically
|
||||||
|
"""
|
||||||
|
if not hasattr(self, u'_theme_manager'):
|
||||||
|
self._theme_manager = Registry().get(u'theme_manager')
|
||||||
|
return self._theme_manager
|
||||||
|
|
||||||
|
theme_manager = property(_get_theme_manager)
|
||||||
|
|
||||||
|
def _get_media_controller(self):
|
||||||
|
"""
|
||||||
|
Adds the media controller to the class dynamically
|
||||||
|
"""
|
||||||
|
if not hasattr(self, u'_media_controller'):
|
||||||
|
self._media_controller = Registry().get(u'media_controller')
|
||||||
|
return self._media_controller
|
||||||
|
|
||||||
|
media_controller = property(_get_media_controller)
|
||||||
|
|
||||||
|
|
|
@ -213,6 +213,7 @@ class ThemeXML(object):
|
||||||
"""
|
"""
|
||||||
FIRST_CAMEL_REGEX = re.compile(u'(.)([A-Z][a-z]+)')
|
FIRST_CAMEL_REGEX = re.compile(u'(.)([A-Z][a-z]+)')
|
||||||
SECOND_CAMEL_REGEX = re.compile(u'([a-z0-9])([A-Z])')
|
SECOND_CAMEL_REGEX = re.compile(u'([a-z0-9])([A-Z])')
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
"""
|
"""
|
||||||
Initialise the theme object.
|
Initialise the theme object.
|
||||||
|
|
|
@ -164,6 +164,7 @@ class Theme(object):
|
||||||
* ``0`` - normal
|
* ``0`` - normal
|
||||||
* ``1`` - lyrics
|
* ``1`` - lyrics
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, xml):
|
def __init__(self, xml):
|
||||||
"""
|
"""
|
||||||
Initialise a theme with data from xml
|
Initialise a theme with data from xml
|
||||||
|
|
|
@ -103,4 +103,4 @@ from thememanager import ThemeManager
|
||||||
|
|
||||||
__all__ = ['SplashScreen', 'AboutForm', 'SettingsForm', 'MainDisplay',
|
__all__ = ['SplashScreen', 'AboutForm', 'SettingsForm', 'MainDisplay',
|
||||||
'SlideController', 'ServiceManager', 'ThemeManager', 'MediaDockManager',
|
'SlideController', 'ServiceManager', 'ThemeManager', 'MediaDockManager',
|
||||||
'ServiceItemEditForm', 'FirstTimeForm']
|
'ServiceItemEditForm', 'FirstTimeForm' ]
|
||||||
|
|
|
@ -52,10 +52,10 @@ class AdvancedTab(SettingsTab):
|
||||||
"""
|
"""
|
||||||
Initialise the settings tab
|
Initialise the settings tab
|
||||||
"""
|
"""
|
||||||
self.displayChanged = False
|
self.display_changed = False
|
||||||
self.defaultImage = u':/graphics/openlp-splash-screen.png'
|
self.default_image = u':/graphics/openlp-splash-screen.png'
|
||||||
self.defaultColor = u'#ffffff'
|
self.default_color = u'#ffffff'
|
||||||
self.dataExists = False
|
self.data_exists = False
|
||||||
self.iconPath = u':/system/system_settings.png'
|
self.iconPath = u':/system/system_settings.png'
|
||||||
advanced_translated = translate('OpenLP.AdvancedTab', 'Advanced')
|
advanced_translated = translate('OpenLP.AdvancedTab', 'Advanced')
|
||||||
SettingsTab.__init__(self, parent, u'Advanced', advanced_translated)
|
SettingsTab.__init__(self, parent, u'Advanced', advanced_translated)
|
||||||
|
@ -66,278 +66,288 @@ class AdvancedTab(SettingsTab):
|
||||||
"""
|
"""
|
||||||
self.setObjectName(u'AdvancedTab')
|
self.setObjectName(u'AdvancedTab')
|
||||||
SettingsTab.setupUi(self)
|
SettingsTab.setupUi(self)
|
||||||
self.uiGroupBox = QtGui.QGroupBox(self.leftColumn)
|
self.ui_group_box = QtGui.QGroupBox(self.leftColumn)
|
||||||
self.uiGroupBox.setObjectName(u'uiGroupBox')
|
self.ui_group_box.setObjectName(u'ui_group_box')
|
||||||
self.uiLayout = QtGui.QFormLayout(self.uiGroupBox)
|
self.ui_layout = QtGui.QFormLayout(self.ui_group_box)
|
||||||
self.uiLayout.setObjectName(u'uiLayout')
|
self.ui_layout.setObjectName(u'ui_layout')
|
||||||
self.recentLabel = QtGui.QLabel(self.uiGroupBox)
|
self.recent_label = QtGui.QLabel(self.ui_group_box)
|
||||||
self.recentLabel.setObjectName(u'recentLabel')
|
self.recent_label.setObjectName(u'recent_label')
|
||||||
self.recentSpinBox = QtGui.QSpinBox(self.uiGroupBox)
|
self.recent_spin_box = QtGui.QSpinBox(self.ui_group_box)
|
||||||
self.recentSpinBox.setObjectName(u'recentSpinBox')
|
self.recent_spin_box.setObjectName(u'recent_spin_box')
|
||||||
self.recentSpinBox.setMinimum(0)
|
self.recent_spin_box.setMinimum(0)
|
||||||
self.uiLayout.addRow(self.recentLabel, self.recentSpinBox)
|
self.ui_layout.addRow(self.recent_label, self.recent_spin_box)
|
||||||
self.mediaPluginCheckBox = QtGui.QCheckBox(self.uiGroupBox)
|
self.media_plugin_check_box = QtGui.QCheckBox(self.ui_group_box)
|
||||||
self.mediaPluginCheckBox.setObjectName(u'mediaPluginCheckBox')
|
self.media_plugin_check_box.setObjectName(u'media_plugin_check_box')
|
||||||
self.uiLayout.addRow(self.mediaPluginCheckBox)
|
self.ui_layout.addRow(self.media_plugin_check_box)
|
||||||
self.doubleClickLiveCheckBox = QtGui.QCheckBox(self.uiGroupBox)
|
self.double_click_live_check_box = QtGui.QCheckBox(self.ui_group_box)
|
||||||
self.doubleClickLiveCheckBox.setObjectName(u'doubleClickLiveCheckBox')
|
self.double_click_live_check_box.setObjectName(u'double_click_live_check_box')
|
||||||
self.uiLayout.addRow(self.doubleClickLiveCheckBox)
|
self.ui_layout.addRow(self.double_click_live_check_box)
|
||||||
self.singleClickPreviewCheckBox = QtGui.QCheckBox(self.uiGroupBox)
|
self.single_click_preview_check_box = QtGui.QCheckBox(self.ui_group_box)
|
||||||
self.singleClickPreviewCheckBox.setObjectName(u'singleClickPreviewCheckBox')
|
self.single_click_preview_check_box.setObjectName(u'single_click_preview_check_box')
|
||||||
self.uiLayout.addRow(self.singleClickPreviewCheckBox)
|
self.ui_layout.addRow(self.single_click_preview_check_box)
|
||||||
self.expandServiceItemCheckBox = QtGui.QCheckBox(self.uiGroupBox)
|
self.expand_service_item_check_box = QtGui.QCheckBox(self.ui_group_box)
|
||||||
self.expandServiceItemCheckBox.setObjectName(u'expandServiceItemCheckBox')
|
self.expand_service_item_check_box.setObjectName(u'expand_service_item_check_box')
|
||||||
self.uiLayout.addRow(self.expandServiceItemCheckBox)
|
self.ui_layout.addRow(self.expand_service_item_check_box)
|
||||||
self.enableAutoCloseCheckBox = QtGui.QCheckBox(self.uiGroupBox)
|
self.enable_auto_close_check_box = QtGui.QCheckBox(self.ui_group_box)
|
||||||
self.enableAutoCloseCheckBox.setObjectName(u'enableAutoCloseCheckBox')
|
self.enable_auto_close_check_box.setObjectName(u'enable_auto_close_check_box')
|
||||||
self.uiLayout.addRow(self.enableAutoCloseCheckBox)
|
self.ui_layout.addRow(self.enable_auto_close_check_box)
|
||||||
self.leftLayout.addWidget(self.uiGroupBox)
|
self.leftLayout.addWidget(self.ui_group_box)
|
||||||
# Default service name
|
# Default service name
|
||||||
self.serviceNameGroupBox = QtGui.QGroupBox(self.leftColumn)
|
self.service_name_group_box = QtGui.QGroupBox(self.leftColumn)
|
||||||
self.serviceNameGroupBox.setObjectName(u'serviceNameGroupBox')
|
self.service_name_group_box.setObjectName(u'service_name_group_box')
|
||||||
self.serviceNameLayout = QtGui.QFormLayout(self.serviceNameGroupBox)
|
self.service_name_layout = QtGui.QFormLayout(self.service_name_group_box)
|
||||||
self.serviceNameCheckBox = QtGui.QCheckBox(self.serviceNameGroupBox)
|
self.service_name_check_box = QtGui.QCheckBox(self.service_name_group_box)
|
||||||
self.serviceNameCheckBox.setObjectName(u'serviceNameCheckBox')
|
self.service_name_check_box.setObjectName(u'service_name_check_box')
|
||||||
self.serviceNameLayout.setObjectName(u'serviceNameLayout')
|
self.service_name_layout.setObjectName(u'service_name_layout')
|
||||||
self.serviceNameLayout.addRow(self.serviceNameCheckBox)
|
self.service_name_layout.addRow(self.service_name_check_box)
|
||||||
self.serviceNameTimeLabel = QtGui.QLabel(self.serviceNameGroupBox)
|
self.service_name_time_label = QtGui.QLabel(self.service_name_group_box)
|
||||||
self.serviceNameTimeLabel.setObjectName(u'serviceNameTimeLabel')
|
self.service_name_time_label.setObjectName(u'service_name_time_label')
|
||||||
self.serviceNameDay = QtGui.QComboBox(self.serviceNameGroupBox)
|
self.service_name_day = QtGui.QComboBox(self.service_name_group_box)
|
||||||
self.serviceNameDay.addItems([u'', u'', u'', u'', u'', u'', u'', u''])
|
self.service_name_day.addItems([u'', u'', u'', u'', u'', u'', u'', u''])
|
||||||
self.serviceNameDay.setObjectName(u'serviceNameDay')
|
self.service_name_day.setObjectName(u'service_name_day')
|
||||||
self.serviceNameTime = QtGui.QTimeEdit(self.serviceNameGroupBox)
|
self.service_name_time = QtGui.QTimeEdit(self.service_name_group_box)
|
||||||
self.serviceNameTime.setObjectName(u'serviceNameTime')
|
self.service_name_time.setObjectName(u'service_name_time')
|
||||||
self.serviceNameTimeHBox = QtGui.QHBoxLayout()
|
self.service_name_time_layout = QtGui.QHBoxLayout()
|
||||||
self.serviceNameTimeHBox.setObjectName(u'serviceNameTimeHBox')
|
self.service_name_time_layout.setObjectName(u'service_name_time_layout')
|
||||||
self.serviceNameTimeHBox.addWidget(self.serviceNameDay)
|
self.service_name_time_layout.addWidget(self.service_name_day)
|
||||||
self.serviceNameTimeHBox.addWidget(self.serviceNameTime)
|
self.service_name_time_layout.addWidget(self.service_name_time)
|
||||||
self.serviceNameLayout.addRow(self.serviceNameTimeLabel, self.serviceNameTimeHBox)
|
self.service_name_layout.addRow(self.service_name_time_label, self.service_name_time_layout)
|
||||||
self.serviceNameLabel = QtGui.QLabel(self.serviceNameGroupBox)
|
self.service_name_label = QtGui.QLabel(self.service_name_group_box)
|
||||||
self.serviceNameLabel.setObjectName(u'serviceNameLabel')
|
self.service_name_label.setObjectName(u'service_name_label')
|
||||||
self.serviceNameEdit = QtGui.QLineEdit(self.serviceNameGroupBox)
|
self.service_name_edit = QtGui.QLineEdit(self.service_name_group_box)
|
||||||
self.serviceNameEdit.setObjectName(u'serviceNameEdit')
|
self.service_name_edit.setObjectName(u'service_name_edit')
|
||||||
self.serviceNameEdit.setValidator(QtGui.QRegExpValidator(QtCore.QRegExp(r'[^/\\?*|<>\[\]":+]+'), self))
|
self.service_name_edit.setValidator(QtGui.QRegExpValidator(QtCore.QRegExp(r'[^/\\?*|<>\[\]":+]+'), self))
|
||||||
self.serviceNameRevertButton = QtGui.QToolButton(self.serviceNameGroupBox)
|
self.service_name_revert_button = QtGui.QToolButton(self.service_name_group_box)
|
||||||
self.serviceNameRevertButton.setObjectName(u'serviceNameRevertButton')
|
self.service_name_revert_button.setObjectName(u'service_name_revert_button')
|
||||||
self.serviceNameRevertButton.setIcon(build_icon(u':/general/general_revert.png'))
|
self.service_name_revert_button.setIcon(build_icon(u':/general/general_revert.png'))
|
||||||
self.serviceNameHBox = QtGui.QHBoxLayout()
|
self.service_name_button_layout = QtGui.QHBoxLayout()
|
||||||
self.serviceNameHBox.setObjectName(u'serviceNameHBox')
|
self.service_name_button_layout.setObjectName(u'service_name_button_layout')
|
||||||
self.serviceNameHBox.addWidget(self.serviceNameEdit)
|
self.service_name_button_layout.addWidget(self.service_name_edit)
|
||||||
self.serviceNameHBox.addWidget(self.serviceNameRevertButton)
|
self.service_name_button_layout.addWidget(self.service_name_revert_button)
|
||||||
self.serviceNameLayout.addRow(self.serviceNameLabel, self.serviceNameHBox)
|
self.service_name_layout.addRow(self.service_name_label, self.service_name_button_layout)
|
||||||
self.serviceNameExampleLabel = QtGui.QLabel(self.serviceNameGroupBox)
|
self.service_name_example_label = QtGui.QLabel(self.service_name_group_box)
|
||||||
self.serviceNameExampleLabel.setObjectName(u'serviceNameExampleLabel')
|
self.service_name_example_label.setObjectName(u'service_name_example_label')
|
||||||
self.serviceNameExample = QtGui.QLabel(self.serviceNameGroupBox)
|
self.service_name_example = QtGui.QLabel(self.service_name_group_box)
|
||||||
self.serviceNameExample.setObjectName(u'serviceNameExample')
|
self.service_name_example.setObjectName(u'service_name_example')
|
||||||
self.serviceNameLayout.addRow(self.serviceNameExampleLabel, self.serviceNameExample)
|
self.service_name_layout.addRow(self.service_name_example_label, self.service_name_example)
|
||||||
self.leftLayout.addWidget(self.serviceNameGroupBox)
|
self.leftLayout.addWidget(self.service_name_group_box)
|
||||||
# Data Directory
|
# Data Directory
|
||||||
self.dataDirectoryGroupBox = QtGui.QGroupBox(self.leftColumn)
|
self.data_directory_group_box = QtGui.QGroupBox(self.leftColumn)
|
||||||
self.dataDirectoryGroupBox.setObjectName(u'dataDirectoryGroupBox')
|
self.data_directory_group_box.setObjectName(u'data_directory_group_box')
|
||||||
self.dataDirectoryLayout = QtGui.QFormLayout(self.dataDirectoryGroupBox)
|
self.data_directory_layout = QtGui.QFormLayout(self.data_directory_group_box)
|
||||||
self.dataDirectoryLayout.setObjectName(u'dataDirectoryLayout')
|
self.data_directory_layout.setObjectName(u'data_directory_layout')
|
||||||
self.dataDirectoryCurrentLabel = QtGui.QLabel(self.dataDirectoryGroupBox)
|
self.data_directory_current_label = QtGui.QLabel(self.data_directory_group_box)
|
||||||
self.dataDirectoryCurrentLabel.setObjectName( u'dataDirectoryCurrentLabel')
|
self.data_directory_current_label.setObjectName( u'data_directory_current_label')
|
||||||
self.dataDirectoryLabel = QtGui.QLabel(self.dataDirectoryGroupBox)
|
self.data_directory_label = QtGui.QLabel(self.data_directory_group_box)
|
||||||
self.dataDirectoryLabel.setObjectName(u'dataDirectoryLabel')
|
self.data_directory_label.setObjectName(u'data_directory_label')
|
||||||
self.dataDirectoryNewLabel = QtGui.QLabel(self.dataDirectoryGroupBox)
|
self.data_directory_new_label = QtGui.QLabel(self.data_directory_group_box)
|
||||||
self.dataDirectoryNewLabel.setObjectName(u'dataDirectoryCurrentLabel')
|
self.data_directory_new_label.setObjectName(u'data_directory_current_label')
|
||||||
self.newDataDirectoryEdit = QtGui.QLineEdit(self.dataDirectoryGroupBox)
|
self.new_data_directory_edit = QtGui.QLineEdit(self.data_directory_group_box)
|
||||||
self.newDataDirectoryEdit.setObjectName(u'newDataDirectoryEdit')
|
self.new_data_directory_edit.setObjectName(u'new_data_directory_edit')
|
||||||
self.newDataDirectoryEdit.setReadOnly(True)
|
self.new_data_directory_edit.setReadOnly(True)
|
||||||
self.newDataDirectoryHasFilesLabel = QtGui.QLabel(self.dataDirectoryGroupBox)
|
self.new_data_directory_has_files_label = QtGui.QLabel(self.data_directory_group_box)
|
||||||
self.newDataDirectoryHasFilesLabel.setObjectName(u'newDataDirectoryHasFilesLabel')
|
self.new_data_directory_has_files_label.setObjectName(u'new_data_directory_has_files_label')
|
||||||
self.newDataDirectoryHasFilesLabel.setWordWrap(True)
|
self.new_data_directory_has_files_label.setWordWrap(True)
|
||||||
self.dataDirectoryBrowseButton = QtGui.QToolButton(self.dataDirectoryGroupBox)
|
self.data_directory_browse_button = QtGui.QToolButton(self.data_directory_group_box)
|
||||||
self.dataDirectoryBrowseButton.setObjectName(u'dataDirectoryBrowseButton')
|
self.data_directory_browse_button.setObjectName(u'data_directory_browse_button')
|
||||||
self.dataDirectoryBrowseButton.setIcon(build_icon(u':/general/general_open.png'))
|
self.data_directory_browse_button.setIcon(build_icon(u':/general/general_open.png'))
|
||||||
self.dataDirectoryDefaultButton = QtGui.QToolButton(self.dataDirectoryGroupBox)
|
self.data_directory_default_button = QtGui.QToolButton(self.data_directory_group_box)
|
||||||
self.dataDirectoryDefaultButton.setObjectName(u'dataDirectoryDefaultButton')
|
self.data_directory_default_button.setObjectName(u'data_directory_default_button')
|
||||||
self.dataDirectoryDefaultButton.setIcon(build_icon(u':/general/general_revert.png'))
|
self.data_directory_default_button.setIcon(build_icon(u':/general/general_revert.png'))
|
||||||
self.dataDirectoryCancelButton = QtGui.QToolButton(self.dataDirectoryGroupBox)
|
self.data_directory_cancel_button = QtGui.QToolButton(self.data_directory_group_box)
|
||||||
self.dataDirectoryCancelButton.setObjectName(u'dataDirectoryCancelButton')
|
self.data_directory_cancel_button.setObjectName(u'data_directory_cancel_button')
|
||||||
self.dataDirectoryCancelButton.setIcon(build_icon(u':/general/general_delete.png'))
|
self.data_directory_cancel_button.setIcon(build_icon(u':/general/general_delete.png'))
|
||||||
self.newDataDirectoryLabelHBox = QtGui.QHBoxLayout()
|
self.new_data_directory_label_layout = QtGui.QHBoxLayout()
|
||||||
self.newDataDirectoryLabelHBox.setObjectName(u'newDataDirectoryLabelHBox')
|
self.new_data_directory_label_layout.setObjectName(u'new_data_directory_label_layout')
|
||||||
self.newDataDirectoryLabelHBox.addWidget(self.newDataDirectoryEdit)
|
self.new_data_directory_label_layout.addWidget(self.new_data_directory_edit)
|
||||||
self.newDataDirectoryLabelHBox.addWidget(self.dataDirectoryBrowseButton)
|
self.new_data_directory_label_layout.addWidget(self.data_directory_browse_button)
|
||||||
self.newDataDirectoryLabelHBox.addWidget(self.dataDirectoryDefaultButton)
|
self.new_data_directory_label_layout.addWidget(self.data_directory_default_button)
|
||||||
self.dataDirectoryCopyCheckHBox = QtGui.QHBoxLayout()
|
self.data_directory_copy_check_layout = QtGui.QHBoxLayout()
|
||||||
self.dataDirectoryCopyCheckHBox.setObjectName(u'dataDirectoryCopyCheckHBox')
|
self.data_directory_copy_check_layout.setObjectName(u'data_directory_copy_check_layout')
|
||||||
self.dataDirectoryCopyCheckBox = QtGui.QCheckBox(self.dataDirectoryGroupBox)
|
self.data_directory_copy_check_box = QtGui.QCheckBox(self.data_directory_group_box)
|
||||||
self.dataDirectoryCopyCheckBox.setObjectName(u'dataDirectoryCopyCheckBox')
|
self.data_directory_copy_check_box.setObjectName(u'data_directory_copy_check_box')
|
||||||
self.dataDirectoryCopyCheckHBox.addWidget(self.dataDirectoryCopyCheckBox)
|
self.data_directory_copy_check_layout.addWidget(self.data_directory_copy_check_box)
|
||||||
self.dataDirectoryCopyCheckHBox.addStretch()
|
self.data_directory_copy_check_layout.addStretch()
|
||||||
self.dataDirectoryCopyCheckHBox.addWidget(self.dataDirectoryCancelButton)
|
self.data_directory_copy_check_layout.addWidget(self.data_directory_cancel_button)
|
||||||
self.dataDirectoryLayout.addRow(self.dataDirectoryCurrentLabel, self.dataDirectoryLabel)
|
self.data_directory_layout.addRow(self.data_directory_current_label, self.data_directory_label)
|
||||||
self.dataDirectoryLayout.addRow(self.dataDirectoryNewLabel, self.newDataDirectoryLabelHBox)
|
self.data_directory_layout.addRow(self.data_directory_new_label, self.new_data_directory_label_layout)
|
||||||
self.dataDirectoryLayout.addRow(self.dataDirectoryCopyCheckHBox)
|
self.data_directory_layout.addRow(self.data_directory_copy_check_layout)
|
||||||
self.dataDirectoryLayout.addRow(self.newDataDirectoryHasFilesLabel)
|
self.data_directory_layout.addRow(self.new_data_directory_has_files_label)
|
||||||
self.leftLayout.addWidget(self.dataDirectoryGroupBox)
|
self.leftLayout.addWidget(self.data_directory_group_box)
|
||||||
self.leftLayout.addStretch()
|
self.leftLayout.addStretch()
|
||||||
# Default Image
|
# Default Image
|
||||||
self.defaultImageGroupBox = QtGui.QGroupBox(self.rightColumn)
|
self.default_image_group_box = QtGui.QGroupBox(self.rightColumn)
|
||||||
self.defaultImageGroupBox.setObjectName(u'defaultImageGroupBox')
|
self.default_image_group_box.setObjectName(u'default_image_group_box')
|
||||||
self.defaultImageLayout = QtGui.QFormLayout(self.defaultImageGroupBox)
|
self.default_image_layout = QtGui.QFormLayout(self.default_image_group_box)
|
||||||
self.defaultImageLayout.setObjectName(u'defaultImageLayout')
|
self.default_image_layout.setObjectName(u'default_image_layout')
|
||||||
self.defaultColorLabel = QtGui.QLabel(self.defaultImageGroupBox)
|
self.default_color_label = QtGui.QLabel(self.default_image_group_box)
|
||||||
self.defaultColorLabel.setObjectName(u'defaultColorLabel')
|
self.default_color_label.setObjectName(u'default_color_label')
|
||||||
self.defaultColorButton = QtGui.QPushButton(self.defaultImageGroupBox)
|
self.default_color_button = QtGui.QPushButton(self.default_image_group_box)
|
||||||
self.defaultColorButton.setObjectName(u'defaultColorButton')
|
self.default_color_button.setObjectName(u'default_color_button')
|
||||||
self.defaultImageLayout.addRow(self.defaultColorLabel, self.defaultColorButton)
|
self.default_image_layout.addRow(self.default_color_label, self.default_color_button)
|
||||||
self.defaultFileLabel = QtGui.QLabel(self.defaultImageGroupBox)
|
self.default_file_label = QtGui.QLabel(self.default_image_group_box)
|
||||||
self.defaultFileLabel.setObjectName(u'defaultFileLabel')
|
self.default_file_label.setObjectName(u'default_file_label')
|
||||||
self.defaultFileEdit = QtGui.QLineEdit(self.defaultImageGroupBox)
|
self.default_file_edit = QtGui.QLineEdit(self.default_image_group_box)
|
||||||
self.defaultFileEdit.setObjectName(u'defaultFileEdit')
|
self.default_file_edit.setObjectName(u'default_file_edit')
|
||||||
self.defaultBrowseButton = QtGui.QToolButton(self.defaultImageGroupBox)
|
self.default_browse_button = QtGui.QToolButton(self.default_image_group_box)
|
||||||
self.defaultBrowseButton.setObjectName(u'defaultBrowseButton')
|
self.default_browse_button.setObjectName(u'default_browse_button')
|
||||||
self.defaultBrowseButton.setIcon(build_icon(u':/general/general_open.png'))
|
self.default_browse_button.setIcon(build_icon(u':/general/general_open.png'))
|
||||||
self.defaultRevertButton = QtGui.QToolButton(self.defaultImageGroupBox)
|
self.default_revert_button = QtGui.QToolButton(self.default_image_group_box)
|
||||||
self.defaultRevertButton.setObjectName(u'defaultRevertButton')
|
self.default_revert_button.setObjectName(u'default_revert_button')
|
||||||
self.defaultRevertButton.setIcon(build_icon(u':/general/general_revert.png'))
|
self.default_revert_button.setIcon(build_icon(u':/general/general_revert.png'))
|
||||||
self.defaultFileLayout = QtGui.QHBoxLayout()
|
self.default_file_layout = QtGui.QHBoxLayout()
|
||||||
self.defaultFileLayout.setObjectName(u'defaultFileLayout')
|
self.default_file_layout.setObjectName(u'default_file_layout')
|
||||||
self.defaultFileLayout.addWidget(self.defaultFileEdit)
|
self.default_file_layout.addWidget(self.default_file_edit)
|
||||||
self.defaultFileLayout.addWidget(self.defaultBrowseButton)
|
self.default_file_layout.addWidget(self.default_browse_button)
|
||||||
self.defaultFileLayout.addWidget(self.defaultRevertButton)
|
self.default_file_layout.addWidget(self.default_revert_button)
|
||||||
self.defaultImageLayout.addRow(self.defaultFileLabel, self.defaultFileLayout)
|
self.default_image_layout.addRow(self.default_file_label, self.default_file_layout)
|
||||||
self.rightLayout.addWidget(self.defaultImageGroupBox)
|
self.rightLayout.addWidget(self.default_image_group_box)
|
||||||
# Hide mouse
|
# Hide mouse
|
||||||
self.hideMouseGroupBox = QtGui.QGroupBox(self.rightColumn)
|
self.hide_mouse_group_box = QtGui.QGroupBox(self.rightColumn)
|
||||||
self.hideMouseGroupBox.setObjectName(u'hideMouseGroupBox')
|
self.hide_mouse_group_box.setObjectName(u'hide_mouse_group_box')
|
||||||
self.hideMouseLayout = QtGui.QVBoxLayout(self.hideMouseGroupBox)
|
self.hide_mouse_layout = QtGui.QVBoxLayout(self.hide_mouse_group_box)
|
||||||
self.hideMouseLayout.setObjectName(u'hideMouseLayout')
|
self.hide_mouse_layout.setObjectName(u'hide_mouse_layout')
|
||||||
self.hideMouseCheckBox = QtGui.QCheckBox(self.hideMouseGroupBox)
|
self.hide_mouse_check_box = QtGui.QCheckBox(self.hide_mouse_group_box)
|
||||||
self.hideMouseCheckBox.setObjectName(u'hideMouseCheckBox')
|
self.hide_mouse_check_box.setObjectName(u'hide_mouse_check_box')
|
||||||
self.hideMouseLayout.addWidget(self.hideMouseCheckBox)
|
self.hide_mouse_layout.addWidget(self.hide_mouse_check_box)
|
||||||
self.rightLayout.addWidget(self.hideMouseGroupBox)
|
self.rightLayout.addWidget(self.hide_mouse_group_box)
|
||||||
# Service Item Slide Limits
|
# Service Item Slide Limits
|
||||||
self.slideGroupBox = QtGui.QGroupBox(self.rightColumn)
|
self.slide_group_box = QtGui.QGroupBox(self.rightColumn)
|
||||||
self.slideGroupBox.setObjectName(u'slideGroupBox')
|
self.slide_group_box.setObjectName(u'slide_group_box')
|
||||||
self.slideLayout = QtGui.QVBoxLayout(self.slideGroupBox)
|
self.slide_layout = QtGui.QVBoxLayout(self.slide_group_box)
|
||||||
self.slideLayout.setObjectName(u'slideLayout')
|
self.slide_layout.setObjectName(u'slide_layout')
|
||||||
self.slideLabel = QtGui.QLabel(self.slideGroupBox)
|
self.slide_label = QtGui.QLabel(self.slide_group_box)
|
||||||
self.slideLabel.setWordWrap(True)
|
self.slide_label.setWordWrap(True)
|
||||||
self.slideLayout.addWidget(self.slideLabel)
|
self.slide_layout.addWidget(self.slide_label)
|
||||||
self.endSlideRadioButton = QtGui.QRadioButton(self.slideGroupBox)
|
self.end_slide_radio_button = QtGui.QRadioButton(self.slide_group_box)
|
||||||
self.endSlideRadioButton.setObjectName(u'endSlideRadioButton')
|
self.end_slide_radio_button.setObjectName(u'end_slide_radio_button')
|
||||||
self.slideLayout.addWidget(self.endSlideRadioButton)
|
self.slide_layout.addWidget(self.end_slide_radio_button)
|
||||||
self.wrapSlideRadioButton = QtGui.QRadioButton(self.slideGroupBox)
|
self.wrap_slide_radio_button = QtGui.QRadioButton(self.slide_group_box)
|
||||||
self.wrapSlideRadioButton.setObjectName(u'wrapSlideRadioButton')
|
self.wrap_slide_radio_button.setObjectName(u'wrap_slide_radio_button')
|
||||||
self.slideLayout.addWidget(self.wrapSlideRadioButton)
|
self.slide_layout.addWidget(self.wrap_slide_radio_button)
|
||||||
self.nextItemRadioButton = QtGui.QRadioButton(self.slideGroupBox)
|
self.next_item_radio_button = QtGui.QRadioButton(self.slide_group_box)
|
||||||
self.nextItemRadioButton.setObjectName(u'nextItemRadioButton')
|
self.next_item_radio_button.setObjectName(u'next_item_radio_button')
|
||||||
self.slideLayout.addWidget(self.nextItemRadioButton)
|
self.slide_layout.addWidget(self.next_item_radio_button)
|
||||||
self.rightLayout.addWidget(self.slideGroupBox)
|
self.rightLayout.addWidget(self.slide_group_box)
|
||||||
# Display Workarounds
|
# Display Workarounds
|
||||||
self.displayWorkaroundGroupBox = QtGui.QGroupBox(self.leftColumn)
|
self.display_workaround_group_box = QtGui.QGroupBox(self.leftColumn)
|
||||||
self.displayWorkaroundGroupBox.setObjectName(u'displayWorkaroundGroupBox')
|
self.display_workaround_group_box.setObjectName(u'display_workaround_group_box')
|
||||||
self.displayWorkaroundLayout = QtGui.QVBoxLayout(self.displayWorkaroundGroupBox)
|
self.display_workaround_layout = QtGui.QVBoxLayout(self.display_workaround_group_box)
|
||||||
self.displayWorkaroundLayout.setObjectName(u'displayWorkaroundLayout')
|
self.display_workaround_layout.setObjectName(u'display_workaround_layout')
|
||||||
self.x11BypassCheckBox = QtGui.QCheckBox(self.displayWorkaroundGroupBox)
|
self.x11_bypass_check_box = QtGui.QCheckBox(self.display_workaround_group_box)
|
||||||
self.x11BypassCheckBox.setObjectName(u'x11BypassCheckBox')
|
self.x11_bypass_check_box.setObjectName(u'x11_bypass_check_box')
|
||||||
self.displayWorkaroundLayout.addWidget(self.x11BypassCheckBox)
|
self.display_workaround_layout.addWidget(self.x11_bypass_check_box)
|
||||||
self.alternateRowsCheckBox = QtGui.QCheckBox(self.displayWorkaroundGroupBox)
|
self.alternate_rows_check_box = QtGui.QCheckBox(self.display_workaround_group_box)
|
||||||
self.alternateRowsCheckBox.setObjectName(u'alternateRowsCheckBox')
|
self.alternate_rows_check_box.setObjectName(u'alternate_rows_check_box')
|
||||||
self.displayWorkaroundLayout.addWidget(self.alternateRowsCheckBox)
|
self.display_workaround_layout.addWidget(self.alternate_rows_check_box)
|
||||||
self.rightLayout.addWidget(self.displayWorkaroundGroupBox)
|
self.rightLayout.addWidget(self.display_workaround_group_box)
|
||||||
self.rightLayout.addStretch()
|
self.rightLayout.addStretch()
|
||||||
self.shouldUpdateServiceNameExample = False
|
self.should_update_service_name_example = False
|
||||||
QtCore.QObject.connect(self.serviceNameCheckBox, QtCore.SIGNAL(u'toggled(bool)'),
|
QtCore.QObject.connect(self.service_name_check_box, QtCore.SIGNAL(u'toggled(bool)'),
|
||||||
self.serviceNameCheckBoxToggled)
|
self.service_name_check_box_toggled)
|
||||||
QtCore.QObject.connect(self.serviceNameDay, QtCore.SIGNAL(u'currentIndexChanged(int)'),
|
QtCore.QObject.connect(self.service_name_day, QtCore.SIGNAL(u'currentIndexChanged(int)'),
|
||||||
self.onServiceNameDayChanged)
|
self.on_service_name_day_changed)
|
||||||
QtCore.QObject.connect(self.serviceNameTime, QtCore.SIGNAL(u'timeChanged(QTime)'),
|
QtCore.QObject.connect(self.service_name_time, QtCore.SIGNAL(u'timeChanged(QTime)'),
|
||||||
self.updateServiceNameExample)
|
self.update_service_name_example)
|
||||||
QtCore.QObject.connect(self.serviceNameEdit, QtCore.SIGNAL(u'textChanged(QString)'),
|
QtCore.QObject.connect(self.service_name_edit, QtCore.SIGNAL(u'textChanged(QString)'),
|
||||||
self.updateServiceNameExample)
|
self.update_service_name_example)
|
||||||
QtCore.QObject.connect(self.serviceNameRevertButton, QtCore.SIGNAL(u'clicked()'),
|
QtCore.QObject.connect(self.service_name_revert_button, QtCore.SIGNAL(u'clicked()'),
|
||||||
self.onServiceNameRevertButtonClicked)
|
self.on_service_name_revert_button_clicked)
|
||||||
QtCore.QObject.connect(self.defaultColorButton, QtCore.SIGNAL(u'clicked()'), self.onDefaultColorButtonClicked)
|
QtCore.QObject.connect(self.default_color_button, QtCore.SIGNAL(u'clicked()'),
|
||||||
QtCore.QObject.connect(self.defaultBrowseButton, QtCore.SIGNAL(u'clicked()'), self.onDefaultBrowseButtonClicked)
|
self.on_default_color_button_clicked)
|
||||||
QtCore.QObject.connect(self.defaultRevertButton, QtCore.SIGNAL(u'clicked()'), self.onDefaultRevertButtonClicked)
|
QtCore.QObject.connect(self.default_browse_button, QtCore.SIGNAL(u'clicked()'),
|
||||||
QtCore.QObject.connect(self.x11BypassCheckBox, QtCore.SIGNAL(u'toggled(bool)'), self.onX11BypassCheckBoxToggled)
|
self.on_default_browse_button_clicked)
|
||||||
QtCore.QObject.connect(self.alternateRowsCheckBox,
|
QtCore.QObject.connect(self.default_revert_button, QtCore.SIGNAL(u'clicked()'),
|
||||||
QtCore.SIGNAL(u'toggled(bool)'), self.onAlternateRowsCheckBoxToggled)
|
self.on_default_revert_button_clicked)
|
||||||
QtCore.QObject.connect(self.dataDirectoryBrowseButton, QtCore.SIGNAL(u'clicked()'),
|
QtCore.QObject.connect(self.x11_bypass_check_box, QtCore.SIGNAL(u'toggled(bool)'),
|
||||||
self.onDataDirectoryBrowseButtonClicked)
|
self.on_X11_bypass_check_box_toggled)
|
||||||
QtCore.QObject.connect(self.dataDirectoryDefaultButton, QtCore.SIGNAL(u'clicked()'),
|
QtCore.QObject.connect(self.alternate_rows_check_box,QtCore.SIGNAL(u'toggled(bool)'),
|
||||||
self.onDataDirectoryDefaultButtonClicked)
|
self.on_alternate_rows_check_box_toggled)
|
||||||
QtCore.QObject.connect(self.dataDirectoryCancelButton, QtCore.SIGNAL(u'clicked()'),
|
QtCore.QObject.connect(self.data_directory_browse_button, QtCore.SIGNAL(u'clicked()'),
|
||||||
self.onDataDirectoryCancelButtonClicked)
|
self.on_data_directory_browse_button_clicked)
|
||||||
QtCore.QObject.connect(self.dataDirectoryCopyCheckBox, QtCore.SIGNAL(u'toggled(bool)'),
|
QtCore.QObject.connect(self.data_directory_default_button, QtCore.SIGNAL(u'clicked()'),
|
||||||
self.onDataDirectoryCopyCheckBoxToggled)
|
self.on_data_directory_default_button_clicked)
|
||||||
QtCore.QObject.connect(self.endSlideRadioButton, QtCore.SIGNAL(u'clicked()'), self.onEndSlideButtonClicked)
|
QtCore.QObject.connect(self.data_directory_cancel_button, QtCore.SIGNAL(u'clicked()'),
|
||||||
QtCore.QObject.connect(self.wrapSlideRadioButton, QtCore.SIGNAL(u'clicked()'), self.onWrapSlideButtonClicked)
|
self.on_data_directory_cancel_button_clicked)
|
||||||
QtCore.QObject.connect(self.nextItemRadioButton, QtCore.SIGNAL(u'clicked()'), self.onnextItemButtonClicked)
|
QtCore.QObject.connect(self.data_directory_copy_check_box, QtCore.SIGNAL(u'toggled(bool)'),
|
||||||
|
self.on_data_directory_copy_check_box_toggled)
|
||||||
|
QtCore.QObject.connect(self.end_slide_radio_button, QtCore.SIGNAL(u'clicked()'),
|
||||||
|
self.on_end_slide_button_clicked)
|
||||||
|
QtCore.QObject.connect(self.wrap_slide_radio_button, QtCore.SIGNAL(u'clicked()'),
|
||||||
|
self.on_wrap_slide_button_clicked)
|
||||||
|
QtCore.QObject.connect(self.next_item_radio_button, QtCore.SIGNAL(u'clicked()'),
|
||||||
|
self.on_next_item_button_clicked)
|
||||||
|
|
||||||
|
|
||||||
def retranslateUi(self):
|
def retranslateUi(self):
|
||||||
"""
|
"""
|
||||||
Setup the interface translation strings.
|
Setup the interface translation strings.
|
||||||
"""
|
"""
|
||||||
self.tabTitleVisible = UiStrings().Advanced
|
self.tabTitleVisible = UiStrings().Advanced
|
||||||
self.uiGroupBox.setTitle(translate('OpenLP.AdvancedTab', 'UI Settings'))
|
self.ui_group_box.setTitle(translate('OpenLP.AdvancedTab', 'UI Settings'))
|
||||||
self.dataDirectoryGroupBox.setTitle(translate('OpenLP.AdvancedTab', 'Data Location'))
|
self.data_directory_group_box.setTitle(translate('OpenLP.AdvancedTab', 'Data Location'))
|
||||||
self.recentLabel.setText(translate('OpenLP.AdvancedTab', 'Number of recent files to display:'))
|
self.recent_label.setText(translate('OpenLP.AdvancedTab', 'Number of recent files to display:'))
|
||||||
self.mediaPluginCheckBox.setText(translate('OpenLP.AdvancedTab',
|
self.media_plugin_check_box.setText(translate('OpenLP.AdvancedTab',
|
||||||
'Remember active media manager tab on startup'))
|
'Remember active media manager tab on startup'))
|
||||||
self.doubleClickLiveCheckBox.setText(translate('OpenLP.AdvancedTab',
|
self.double_click_live_check_box.setText(translate('OpenLP.AdvancedTab',
|
||||||
'Double-click to send items straight to live'))
|
'Double-click to send items straight to live'))
|
||||||
self.singleClickPreviewCheckBox.setText(translate('OpenLP.AdvancedTab',
|
self.single_click_preview_check_box.setText(translate('OpenLP.AdvancedTab',
|
||||||
'Preview items when clicked in Media Manager'))
|
'Preview items when clicked in Media Manager'))
|
||||||
self.expandServiceItemCheckBox.setText(translate('OpenLP.AdvancedTab',
|
self.expand_service_item_check_box.setText(translate('OpenLP.AdvancedTab',
|
||||||
'Expand new service items on creation'))
|
'Expand new service items on creation'))
|
||||||
self.enableAutoCloseCheckBox.setText(translate('OpenLP.AdvancedTab',
|
self.enable_auto_close_check_box.setText(translate('OpenLP.AdvancedTab',
|
||||||
'Enable application exit confirmation'))
|
'Enable application exit confirmation'))
|
||||||
self.serviceNameGroupBox.setTitle(translate('OpenLP.AdvancedTab', 'Default Service Name'))
|
self.service_name_group_box.setTitle(translate('OpenLP.AdvancedTab', 'Default Service Name'))
|
||||||
self.serviceNameCheckBox.setText(translate('OpenLP.AdvancedTab', 'Enable default service name'))
|
self.service_name_check_box.setText(translate('OpenLP.AdvancedTab', 'Enable default service name'))
|
||||||
self.serviceNameTimeLabel.setText(translate('OpenLP.AdvancedTab', 'Date and Time:'))
|
self.service_name_time_label.setText(translate('OpenLP.AdvancedTab', 'Date and Time:'))
|
||||||
self.serviceNameDay.setItemText(0, translate('OpenLP.AdvancedTab', 'Monday'))
|
self.service_name_day.setItemText(0, translate('OpenLP.AdvancedTab', 'Monday'))
|
||||||
self.serviceNameDay.setItemText(1, translate('OpenLP.AdvancedTab', 'Tuesday'))
|
self.service_name_day.setItemText(1, translate('OpenLP.AdvancedTab', 'Tuesday'))
|
||||||
self.serviceNameDay.setItemText(2, translate('OpenLP.AdvancedTab', 'Wednesday'))
|
self.service_name_day.setItemText(2, translate('OpenLP.AdvancedTab', 'Wednesday'))
|
||||||
self.serviceNameDay.setItemText(3, translate('OpenLP.AdvancedTab', 'Thurdsday'))
|
self.service_name_day.setItemText(3, translate('OpenLP.AdvancedTab', 'Thurdsday'))
|
||||||
self.serviceNameDay.setItemText(4, translate('OpenLP.AdvancedTab', 'Friday'))
|
self.service_name_day.setItemText(4, translate('OpenLP.AdvancedTab', 'Friday'))
|
||||||
self.serviceNameDay.setItemText(5, translate('OpenLP.AdvancedTab', 'Saturday'))
|
self.service_name_day.setItemText(5, translate('OpenLP.AdvancedTab', 'Saturday'))
|
||||||
self.serviceNameDay.setItemText(6, translate('OpenLP.AdvancedTab', 'Sunday'))
|
self.service_name_day.setItemText(6, translate('OpenLP.AdvancedTab', 'Sunday'))
|
||||||
self.serviceNameDay.setItemText(7, translate('OpenLP.AdvancedTab', 'Now'))
|
self.service_name_day.setItemText(7, translate('OpenLP.AdvancedTab', 'Now'))
|
||||||
self.serviceNameTime.setToolTip(translate('OpenLP.AdvancedTab',
|
self.service_name_time.setToolTip(translate('OpenLP.AdvancedTab',
|
||||||
'Time when usual service starts.'))
|
'Time when usual service starts.'))
|
||||||
self.serviceNameLabel.setText(translate('OpenLP.AdvancedTab', 'Name:'))
|
self.service_name_label.setText(translate('OpenLP.AdvancedTab', 'Name:'))
|
||||||
self.serviceNameEdit.setToolTip(translate('OpenLP.AdvancedTab', 'Consult the OpenLP manual for usage.'))
|
self.service_name_edit.setToolTip(translate('OpenLP.AdvancedTab', 'Consult the OpenLP manual for usage.'))
|
||||||
self.serviceNameRevertButton.setToolTip(
|
self.service_name_revert_button.setToolTip(
|
||||||
translate('OpenLP.AdvancedTab', 'Revert to the default service name "%s".') % UiStrings().DefaultServiceName)
|
translate('OpenLP.AdvancedTab', 'Revert to the default service name "%s".') %
|
||||||
self.serviceNameExampleLabel.setText(translate('OpenLP.AdvancedTab', 'Example:'))
|
UiStrings().DefaultServiceName)
|
||||||
self.hideMouseGroupBox.setTitle(translate('OpenLP.AdvancedTab', 'Mouse Cursor'))
|
self.service_name_example_label.setText(translate('OpenLP.AdvancedTab', 'Example:'))
|
||||||
self.hideMouseCheckBox.setText(translate('OpenLP.AdvancedTab', 'Hide mouse cursor when over display window'))
|
self.hide_mouse_group_box.setTitle(translate('OpenLP.AdvancedTab', 'Mouse Cursor'))
|
||||||
self.defaultImageGroupBox.setTitle(translate('OpenLP.AdvancedTab', 'Default Image'))
|
self.hide_mouse_check_box.setText(translate('OpenLP.AdvancedTab', 'Hide mouse cursor when over display window'))
|
||||||
self.defaultColorLabel.setText(translate('OpenLP.AdvancedTab', 'Background color:'))
|
self.default_image_group_box.setTitle(translate('OpenLP.AdvancedTab', 'Default Image'))
|
||||||
self.defaultColorButton.setToolTip(translate('OpenLP.AdvancedTab', 'Click to select a color.'))
|
self.default_color_label.setText(translate('OpenLP.AdvancedTab', 'Background color:'))
|
||||||
self.defaultFileLabel.setText(translate('OpenLP.AdvancedTab', 'Image file:'))
|
self.default_color_button.setToolTip(translate('OpenLP.AdvancedTab', 'Click to select a color.'))
|
||||||
self.defaultBrowseButton.setToolTip(translate('OpenLP.AdvancedTab', 'Browse for an image file to display.'))
|
self.default_file_label.setText(translate('OpenLP.AdvancedTab', 'Image file:'))
|
||||||
self.defaultRevertButton.setToolTip(translate('OpenLP.AdvancedTab', 'Revert to the default OpenLP logo.'))
|
self.default_browse_button.setToolTip(translate('OpenLP.AdvancedTab', 'Browse for an image file to display.'))
|
||||||
self.dataDirectoryCurrentLabel.setText(translate('OpenLP.AdvancedTab', 'Current path:'))
|
self.default_revert_button.setToolTip(translate('OpenLP.AdvancedTab', 'Revert to the default OpenLP logo.'))
|
||||||
self.dataDirectoryNewLabel.setText(translate('OpenLP.AdvancedTab', 'Custom path:'))
|
self.data_directory_current_label.setText(translate('OpenLP.AdvancedTab', 'Current path:'))
|
||||||
self.dataDirectoryBrowseButton.setToolTip(translate('OpenLP.AdvancedTab', 'Browse for new data file location.'))
|
self.data_directory_new_label.setText(translate('OpenLP.AdvancedTab', 'Custom path:'))
|
||||||
self.dataDirectoryDefaultButton.setToolTip(
|
self.data_directory_browse_button.setToolTip(translate('OpenLP.AdvancedTab',
|
||||||
|
'Browse for new data file location.'))
|
||||||
|
self.data_directory_default_button.setToolTip(
|
||||||
translate('OpenLP.AdvancedTab', 'Set the data location to the default.'))
|
translate('OpenLP.AdvancedTab', 'Set the data location to the default.'))
|
||||||
self.dataDirectoryCancelButton.setText(translate('OpenLP.AdvancedTab', 'Cancel'))
|
self.data_directory_cancel_button.setText(translate('OpenLP.AdvancedTab', 'Cancel'))
|
||||||
self.dataDirectoryCancelButton.setToolTip(
|
self.data_directory_cancel_button.setToolTip(
|
||||||
translate('OpenLP.AdvancedTab', 'Cancel OpenLP data directory location change.'))
|
translate('OpenLP.AdvancedTab', 'Cancel OpenLP data directory location change.'))
|
||||||
self.dataDirectoryCopyCheckBox.setText(translate('OpenLP.AdvancedTab', 'Copy data to new location.'))
|
self.data_directory_copy_check_box.setText(translate('OpenLP.AdvancedTab', 'Copy data to new location.'))
|
||||||
self.dataDirectoryCopyCheckBox.setToolTip(translate(
|
self.data_directory_copy_check_box.setToolTip(translate(
|
||||||
'OpenLP.AdvancedTab', 'Copy the OpenLP data files to the new location.'))
|
'OpenLP.AdvancedTab', 'Copy the OpenLP data files to the new location.'))
|
||||||
self.newDataDirectoryHasFilesLabel.setText(
|
self.new_data_directory_has_files_label.setText(
|
||||||
translate('OpenLP.AdvancedTab', '<strong>WARNING:</strong> New data directory location contains '
|
translate('OpenLP.AdvancedTab', '<strong>WARNING:</strong> New data directory location contains '
|
||||||
'OpenLP data files. These files WILL be replaced during a copy.'))
|
'OpenLP data files. These files WILL be replaced during a copy.'))
|
||||||
self.displayWorkaroundGroupBox.setTitle(translate('OpenLP.AdvancedTab', 'Display Workarounds'))
|
self.display_workaround_group_box.setTitle(translate('OpenLP.AdvancedTab', 'Display Workarounds'))
|
||||||
self.x11BypassCheckBox.setText(translate('OpenLP.AdvancedTab','Bypass X11 Window Manager'))
|
self.x11_bypass_check_box.setText(translate('OpenLP.AdvancedTab','Bypass X11 Window Manager'))
|
||||||
self.alternateRowsCheckBox.setText(translate('OpenLP.AdvancedTab', 'Use alternating row colours in lists'))
|
self.alternate_rows_check_box.setText(translate('OpenLP.AdvancedTab', 'Use alternating row colours in lists'))
|
||||||
# Slide Limits
|
# Slide Limits
|
||||||
self.slideGroupBox.setTitle(translate('OpenLP.GeneralTab', 'Service Item Slide Limits'))
|
self.slide_group_box.setTitle(translate('OpenLP.GeneralTab', 'Service Item Slide Limits'))
|
||||||
self.slideLabel.setText(translate('OpenLP.GeneralTab', 'Behavior of next/previous on the last/first slide:'))
|
self.slide_label.setText(translate('OpenLP.GeneralTab', 'Behavior of next/previous on the last/first slide:'))
|
||||||
self.endSlideRadioButton.setText(translate('OpenLP.GeneralTab', '&Remain on Slide'))
|
self.end_slide_radio_button.setText(translate('OpenLP.GeneralTab', '&Remain on Slide'))
|
||||||
self.wrapSlideRadioButton.setText(translate('OpenLP.GeneralTab', '&Wrap around'))
|
self.wrap_slide_radio_button.setText(translate('OpenLP.GeneralTab', '&Wrap around'))
|
||||||
self.nextItemRadioButton.setText(translate('OpenLP.GeneralTab', '&Move to next/previous service item'))
|
self.next_item_radio_button.setText(translate('OpenLP.GeneralTab', '&Move to next/previous service item'))
|
||||||
|
|
||||||
def load(self):
|
def load(self):
|
||||||
"""
|
"""
|
||||||
|
@ -348,44 +358,44 @@ class AdvancedTab(SettingsTab):
|
||||||
# The max recent files value does not have an interface and so never
|
# The max recent files value does not have an interface and so never
|
||||||
# gets actually stored in the settings therefore the default value of
|
# gets actually stored in the settings therefore the default value of
|
||||||
# 20 will always be used.
|
# 20 will always be used.
|
||||||
self.recentSpinBox.setMaximum(settings.value(u'max recent files'))
|
self.recent_spin_box.setMaximum(settings.value(u'max recent files'))
|
||||||
self.recentSpinBox.setValue(settings.value(u'recent file count'))
|
self.recent_spin_box.setValue(settings.value(u'recent file count'))
|
||||||
self.mediaPluginCheckBox.setChecked(settings.value(u'save current plugin'))
|
self.media_plugin_check_box.setChecked(settings.value(u'save current plugin'))
|
||||||
self.doubleClickLiveCheckBox.setChecked(settings.value(u'double click live'))
|
self.double_click_live_check_box.setChecked(settings.value(u'double click live'))
|
||||||
self.singleClickPreviewCheckBox.setChecked(settings.value(u'single click preview'))
|
self.single_click_preview_check_box.setChecked(settings.value(u'single click preview'))
|
||||||
self.expandServiceItemCheckBox.setChecked(settings.value(u'expand service item'))
|
self.expand_service_item_check_box.setChecked(settings.value(u'expand service item'))
|
||||||
self.enableAutoCloseCheckBox.setChecked(settings.value(u'enable exit confirmation'))
|
self.enable_auto_close_check_box.setChecked(settings.value(u'enable exit confirmation'))
|
||||||
self.hideMouseCheckBox.setChecked(settings.value(u'hide mouse'))
|
self.hide_mouse_check_box.setChecked(settings.value(u'hide mouse'))
|
||||||
self.serviceNameDay.setCurrentIndex(settings.value(u'default service day'))
|
self.service_name_day.setCurrentIndex(settings.value(u'default service day'))
|
||||||
self.serviceNameTime.setTime(QtCore.QTime(settings.value(u'default service hour'),
|
self.service_name_time.setTime(QtCore.QTime(settings.value(u'default service hour'),
|
||||||
settings.value(u'default service minute')))
|
settings.value(u'default service minute')))
|
||||||
self.shouldUpdateServiceNameExample = True
|
self.should_update_service_name_example = True
|
||||||
self.serviceNameEdit.setText(settings.value(u'default service name'))
|
self.service_name_edit.setText(settings.value(u'default service name'))
|
||||||
default_service_enabled = settings.value(u'default service enabled')
|
default_service_enabled = settings.value(u'default service enabled')
|
||||||
self.serviceNameCheckBox.setChecked(default_service_enabled)
|
self.service_name_check_box.setChecked(default_service_enabled)
|
||||||
self.serviceNameCheckBoxToggled(default_service_enabled)
|
self.service_name_check_box_toggled(default_service_enabled)
|
||||||
self.x11BypassCheckBox.setChecked(settings.value(u'x11 bypass wm'))
|
self.x11_bypass_check_box.setChecked(settings.value(u'x11 bypass wm'))
|
||||||
self.defaultColor = settings.value(u'default color')
|
self.default_color = settings.value(u'default color')
|
||||||
self.defaultFileEdit.setText(settings.value(u'default image'))
|
self.default_file_edit.setText(settings.value(u'default image'))
|
||||||
self.slide_limits = settings.value(u'slide limits')
|
self.slide_limits = settings.value(u'slide limits')
|
||||||
# Prevent the dialog displayed by the alternateRowsCheckBox to display.
|
# Prevent the dialog displayed by the alternate_rows_check_box to display.
|
||||||
self.alternateRowsCheckBox.blockSignals(True)
|
self.alternate_rows_check_box.blockSignals(True)
|
||||||
self.alternateRowsCheckBox.setChecked(settings.value(u'alternate rows'))
|
self.alternate_rows_check_box.setChecked(settings.value(u'alternate rows'))
|
||||||
self.alternateRowsCheckBox.blockSignals(False)
|
self.alternate_rows_check_box.blockSignals(False)
|
||||||
if self.slide_limits == SlideLimits.End:
|
if self.slide_limits == SlideLimits.End:
|
||||||
self.endSlideRadioButton.setChecked(True)
|
self.end_slide_radio_button.setChecked(True)
|
||||||
elif self.slide_limits == SlideLimits.Wrap:
|
elif self.slide_limits == SlideLimits.Wrap:
|
||||||
self.wrapSlideRadioButton.setChecked(True)
|
self.wrap_slide_radio_button.setChecked(True)
|
||||||
else:
|
else:
|
||||||
self.nextItemRadioButton.setChecked(True)
|
self.next_item_radio_button.setChecked(True)
|
||||||
settings.endGroup()
|
settings.endGroup()
|
||||||
self.dataDirectoryCopyCheckBox.hide()
|
self.data_directory_copy_check_box.hide()
|
||||||
self.newDataDirectoryHasFilesLabel.hide()
|
self.new_data_directory_has_files_label.hide()
|
||||||
self.dataDirectoryCancelButton.hide()
|
self.data_directory_cancel_button.hide()
|
||||||
# Since data location can be changed, make sure the path is present.
|
# Since data location can be changed, make sure the path is present.
|
||||||
self.currentDataPath = AppLocation.get_data_path()
|
self.current_data_path = AppLocation.get_data_path()
|
||||||
if not os.path.exists(self.currentDataPath):
|
if not os.path.exists(self.current_data_path):
|
||||||
log.error(u'Data path not found %s' % self.currentDataPath)
|
log.error(u'Data path not found %s' % self.current_data_path)
|
||||||
answer = QtGui.QMessageBox.critical(self,
|
answer = QtGui.QMessageBox.critical(self,
|
||||||
translate('OpenLP.AdvancedTab',
|
translate('OpenLP.AdvancedTab',
|
||||||
'Data Directory Error'),
|
'Data Directory Error'),
|
||||||
|
@ -397,10 +407,8 @@ class AdvancedTab(SettingsTab):
|
||||||
'Click "No" to stop loading OpenLP. allowing you to fix '
|
'Click "No" to stop loading OpenLP. allowing you to fix '
|
||||||
'the the problem.\n\n'
|
'the the problem.\n\n'
|
||||||
'Click "Yes" to reset the data directory to the default '
|
'Click "Yes" to reset the data directory to the default '
|
||||||
'location.').replace('%s', self.currentDataPath),
|
'location.').replace('%s', self.current_data_path),
|
||||||
QtGui.QMessageBox.StandardButtons(
|
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes | QtGui.QMessageBox.No),
|
||||||
QtGui.QMessageBox.Yes |
|
|
||||||
QtGui.QMessageBox.No),
|
|
||||||
QtGui.QMessageBox.No)
|
QtGui.QMessageBox.No)
|
||||||
if answer == QtGui.QMessageBox.No:
|
if answer == QtGui.QMessageBox.No:
|
||||||
log.info(u'User requested termination')
|
log.info(u'User requested termination')
|
||||||
|
@ -408,13 +416,13 @@ class AdvancedTab(SettingsTab):
|
||||||
sys.exit()
|
sys.exit()
|
||||||
# Set data location to default.
|
# Set data location to default.
|
||||||
settings.remove(u'advanced/data path')
|
settings.remove(u'advanced/data path')
|
||||||
self.currentDataPath = AppLocation.get_data_path()
|
self.current_data_path = AppLocation.get_data_path()
|
||||||
log.warning(u'User requested data path set to default %s' % self.currentDataPath)
|
log.warning(u'User requested data path set to default %s' % self.current_data_path)
|
||||||
self.dataDirectoryLabel.setText(os.path.abspath(self.currentDataPath))
|
self.data_directory_label.setText(os.path.abspath(self.current_data_path))
|
||||||
self.defaultColorButton.setStyleSheet(u'background-color: %s' % self.defaultColor)
|
self.default_color_button.setStyleSheet(u'background-color: %s' % self.default_color)
|
||||||
# Don't allow data directory move if running portable.
|
# Don't allow data directory move if running portable.
|
||||||
if settings.value(u'advanced/is portable'):
|
if settings.value(u'advanced/is portable'):
|
||||||
self.dataDirectoryGroupBox.hide()
|
self.data_directory_group_box.hide()
|
||||||
|
|
||||||
def save(self):
|
def save(self):
|
||||||
"""
|
"""
|
||||||
|
@ -422,101 +430,124 @@ class AdvancedTab(SettingsTab):
|
||||||
"""
|
"""
|
||||||
settings = Settings()
|
settings = Settings()
|
||||||
settings.beginGroup(self.settingsSection)
|
settings.beginGroup(self.settingsSection)
|
||||||
settings.setValue(u'default service enabled', self.serviceNameCheckBox.isChecked())
|
settings.setValue(u'default service enabled', self.service_name_check_box.isChecked())
|
||||||
service_name = self.serviceNameEdit.text()
|
service_name = self.service_name_edit.text()
|
||||||
preset_is_valid = self.generateServiceNameExample()[0]
|
preset_is_valid = self.generate_service_name_example()[0]
|
||||||
if service_name == UiStrings().DefaultServiceName or not preset_is_valid:
|
if service_name == UiStrings().DefaultServiceName or not preset_is_valid:
|
||||||
settings.remove(u'default service name')
|
settings.remove(u'default service name')
|
||||||
self.serviceNameEdit.setText(service_name)
|
self.service_name_edit.setText(service_name)
|
||||||
else:
|
else:
|
||||||
settings.setValue(u'default service name', service_name)
|
settings.setValue(u'default service name', service_name)
|
||||||
settings.setValue(u'default service day', self.serviceNameDay.currentIndex())
|
settings.setValue(u'default service day', self.service_name_day.currentIndex())
|
||||||
settings.setValue(u'default service hour', self.serviceNameTime.time().hour())
|
settings.setValue(u'default service hour', self.service_name_time.time().hour())
|
||||||
settings.setValue(u'default service minute', self.serviceNameTime.time().minute())
|
settings.setValue(u'default service minute', self.service_name_time.time().minute())
|
||||||
settings.setValue(u'recent file count', self.recentSpinBox.value())
|
settings.setValue(u'recent file count', self.recent_spin_box.value())
|
||||||
settings.setValue(u'save current plugin', self.mediaPluginCheckBox.isChecked())
|
settings.setValue(u'save current plugin', self.media_plugin_check_box.isChecked())
|
||||||
settings.setValue(u'double click live', self.doubleClickLiveCheckBox.isChecked())
|
settings.setValue(u'double click live', self.double_click_live_check_box.isChecked())
|
||||||
settings.setValue(u'single click preview', self.singleClickPreviewCheckBox.isChecked())
|
settings.setValue(u'single click preview', self.single_click_preview_check_box.isChecked())
|
||||||
settings.setValue(u'expand service item', self.expandServiceItemCheckBox.isChecked())
|
settings.setValue(u'expand service item', self.expand_service_item_check_box.isChecked())
|
||||||
settings.setValue(u'enable exit confirmation', self.enableAutoCloseCheckBox.isChecked())
|
settings.setValue(u'enable exit confirmation', self.enable_auto_close_check_box.isChecked())
|
||||||
settings.setValue(u'hide mouse', self.hideMouseCheckBox.isChecked())
|
settings.setValue(u'hide mouse', self.hide_mouse_check_box.isChecked())
|
||||||
settings.setValue(u'x11 bypass wm', self.x11BypassCheckBox.isChecked())
|
settings.setValue(u'x11 bypass wm', self.x11_bypass_check_box.isChecked())
|
||||||
settings.setValue(u'alternate rows', self.alternateRowsCheckBox.isChecked())
|
settings.setValue(u'alternate rows', self.alternate_rows_check_box.isChecked())
|
||||||
settings.setValue(u'default color', self.defaultColor)
|
settings.setValue(u'default color', self.default_color)
|
||||||
settings.setValue(u'default image', self.defaultFileEdit.text())
|
settings.setValue(u'default image', self.default_file_edit.text())
|
||||||
settings.setValue(u'slide limits', self.slide_limits)
|
settings.setValue(u'slide limits', self.slide_limits)
|
||||||
settings.endGroup()
|
settings.endGroup()
|
||||||
if self.displayChanged:
|
if self.display_changed:
|
||||||
Receiver.send_message(u'config_screen_changed')
|
Receiver.send_message(u'config_screen_changed')
|
||||||
self.displayChanged = False
|
self.display_changed = False
|
||||||
Receiver.send_message(u'slidecontroller_update_slide_limits')
|
Receiver.send_message(u'slidecontroller_update_slide_limits')
|
||||||
|
|
||||||
def cancel(self):
|
def cancel(self):
|
||||||
|
"""
|
||||||
|
Cancel Pressed.
|
||||||
|
"""
|
||||||
# Dialogue was cancelled, remove any pending data path change.
|
# Dialogue was cancelled, remove any pending data path change.
|
||||||
self.onDataDirectoryCancelButtonClicked()
|
self.on_data_directory_cancel_button_clicked()
|
||||||
SettingsTab.cancel(self)
|
SettingsTab.cancel(self)
|
||||||
|
|
||||||
def serviceNameCheckBoxToggled(self, default_service_enabled):
|
def service_name_check_box_toggled(self, default_service_enabled):
|
||||||
self.serviceNameDay.setEnabled(default_service_enabled)
|
"""
|
||||||
time_enabled = default_service_enabled and self.serviceNameDay.currentIndex() is not 7
|
Service Name options changed
|
||||||
self.serviceNameTime.setEnabled(time_enabled)
|
"""
|
||||||
self.serviceNameEdit.setEnabled(default_service_enabled)
|
self.service_name_day.setEnabled(default_service_enabled)
|
||||||
self.serviceNameRevertButton.setEnabled(default_service_enabled)
|
time_enabled = default_service_enabled and self.service_name_day.currentIndex() is not 7
|
||||||
|
self.service_name_time.setEnabled(time_enabled)
|
||||||
|
self.service_name_edit.setEnabled(default_service_enabled)
|
||||||
|
self.service_name_revert_button.setEnabled(default_service_enabled)
|
||||||
|
|
||||||
def generateServiceNameExample(self):
|
def generate_service_name_example(self):
|
||||||
|
"""
|
||||||
|
Display an example of the template used
|
||||||
|
"""
|
||||||
preset_is_valid = True
|
preset_is_valid = True
|
||||||
if self.serviceNameDay.currentIndex() == 7:
|
if self.service_name_day.currentIndex() == 7:
|
||||||
local_time = datetime.now()
|
local_time = datetime.now()
|
||||||
else:
|
else:
|
||||||
now = datetime.now()
|
now = datetime.now()
|
||||||
day_delta = self.serviceNameDay.currentIndex() - now.weekday()
|
day_delta = self.service_name_day.currentIndex() - now.weekday()
|
||||||
if day_delta < 0:
|
if day_delta < 0:
|
||||||
day_delta += 7
|
day_delta += 7
|
||||||
time = now + timedelta(days=day_delta)
|
time = now + timedelta(days=day_delta)
|
||||||
local_time = time.replace(hour = self.serviceNameTime.time().hour(),
|
local_time = time.replace(hour = self.service_name_time.time().hour(),
|
||||||
minute = self.serviceNameTime.time().minute())
|
minute = self.service_name_time.time().minute())
|
||||||
try:
|
try:
|
||||||
service_name_example = format_time(unicode(self.serviceNameEdit.text()), local_time)
|
service_name_example = format_time(unicode(self.service_name_edit.text()), local_time)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
preset_is_valid = False
|
preset_is_valid = False
|
||||||
service_name_example = translate('OpenLP.AdvancedTab', 'Syntax error.')
|
service_name_example = translate('OpenLP.AdvancedTab', 'Syntax error.')
|
||||||
return preset_is_valid, service_name_example
|
return preset_is_valid, service_name_example
|
||||||
|
|
||||||
def updateServiceNameExample(self, returned_value):
|
def update_service_name_example(self, returned_value):
|
||||||
if not self.shouldUpdateServiceNameExample:
|
"""
|
||||||
|
Example Updated
|
||||||
|
"""
|
||||||
|
if not self.should_update_service_name_example:
|
||||||
return
|
return
|
||||||
name_example = self.generateServiceNameExample()[1]
|
name_example = self.generate_service_name_example()[1]
|
||||||
self.serviceNameExample.setText(name_example)
|
self.service_name_example.setText(name_example)
|
||||||
|
|
||||||
def onServiceNameDayChanged(self, service_day):
|
def on_service_name_day_changed(self, service_day):
|
||||||
self.serviceNameTime.setEnabled(service_day is not 7)
|
"""
|
||||||
self.updateServiceNameExample(None)
|
Service Name day changed
|
||||||
|
"""
|
||||||
|
self.service_name_time.setEnabled(service_day is not 7)
|
||||||
|
self.update_service_name_example(None)
|
||||||
|
|
||||||
def onServiceNameRevertButtonClicked(self):
|
def on_service_name_revert_button_clicked(self):
|
||||||
self.serviceNameEdit.setText(UiStrings().DefaultServiceName)
|
"""
|
||||||
self.serviceNameEdit.setFocus()
|
Service Name reverted
|
||||||
|
"""
|
||||||
|
self.service_name_edit.setText(UiStrings().DefaultServiceName)
|
||||||
|
self.service_name_edit.setFocus()
|
||||||
|
|
||||||
def onDefaultColorButtonClicked(self):
|
def on_default_color_button_clicked(self):
|
||||||
|
"""
|
||||||
|
Changed the default color
|
||||||
|
"""
|
||||||
new_color = QtGui.QColorDialog.getColor(
|
new_color = QtGui.QColorDialog.getColor(
|
||||||
QtGui.QColor(self.defaultColor), self)
|
QtGui.QColor(self.default_color), self)
|
||||||
if new_color.isValid():
|
if new_color.isValid():
|
||||||
self.defaultColor = new_color.name()
|
self.default_color = new_color.name()
|
||||||
self.defaultColorButton.setStyleSheet(u'background-color: %s' % self.defaultColor)
|
self.default_color_button.setStyleSheet(u'background-color: %s' % self.default_color)
|
||||||
|
|
||||||
def onDefaultBrowseButtonClicked(self):
|
def on_default_browse_button_clicked(self):
|
||||||
file_filters = u'%s;;%s (*.*) (*)' % (get_images_filter(),
|
"""
|
||||||
UiStrings().AllFiles)
|
Service Name options changed
|
||||||
|
"""
|
||||||
|
file_filters = u'%s;;%s (*.*) (*)' % (get_images_filter(), UiStrings().AllFiles)
|
||||||
filename = QtGui.QFileDialog.getOpenFileName(self,
|
filename = QtGui.QFileDialog.getOpenFileName(self,
|
||||||
translate('OpenLP.AdvancedTab', 'Open File'), '', file_filters)
|
translate('OpenLP.AdvancedTab', 'Open File'), '', file_filters)
|
||||||
if filename:
|
if filename:
|
||||||
self.defaultFileEdit.setText(filename)
|
self.default_file_edit.setText(filename)
|
||||||
self.defaultFileEdit.setFocus()
|
self.default_file_edit.setFocus()
|
||||||
|
|
||||||
def onDataDirectoryBrowseButtonClicked(self):
|
def on_data_directory_browse_button_clicked(self):
|
||||||
"""
|
"""
|
||||||
Browse for a new data directory location.
|
Browse for a new data directory location.
|
||||||
"""
|
"""
|
||||||
old_root_path = unicode(self.dataDirectoryLabel.text())
|
old_root_path = unicode(self.data_directory_label.text())
|
||||||
# Get the new directory location.
|
# Get the new directory location.
|
||||||
new_data_path = QtGui.QFileDialog.getExistingDirectory(self,
|
new_data_path = QtGui.QFileDialog.getExistingDirectory(self,
|
||||||
translate('OpenLP.AdvancedTab', 'Select Data Directory Location'), old_root_path,
|
translate('OpenLP.AdvancedTab', 'Select Data Directory Location'), old_root_path,
|
||||||
|
@ -524,8 +555,8 @@ class AdvancedTab(SettingsTab):
|
||||||
# Set the new data path.
|
# Set the new data path.
|
||||||
if new_data_path:
|
if new_data_path:
|
||||||
new_data_path = os.path.normpath(new_data_path)
|
new_data_path = os.path.normpath(new_data_path)
|
||||||
if self.currentDataPath.lower() == new_data_path.lower():
|
if self.current_data_path.lower() == new_data_path.lower():
|
||||||
self.onDataDirectoryCancelButtonClicked()
|
self.on_data_directory_cancel_button_clicked()
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
return
|
return
|
||||||
|
@ -539,18 +570,18 @@ class AdvancedTab(SettingsTab):
|
||||||
if answer != QtGui.QMessageBox.Yes:
|
if answer != QtGui.QMessageBox.Yes:
|
||||||
return
|
return
|
||||||
# Check if data already exists here.
|
# Check if data already exists here.
|
||||||
self.checkDataOverwrite(new_data_path)
|
self.check_data_overwrite(new_data_path)
|
||||||
# Save the new location.
|
# Save the new location.
|
||||||
Receiver.send_message(u'set_new_data_path', new_data_path)
|
Receiver.send_message(u'set_new_data_path', new_data_path)
|
||||||
self.newDataDirectoryEdit.setText(new_data_path)
|
self.new_data_directory_edit.setText(new_data_path)
|
||||||
self.dataDirectoryCancelButton.show()
|
self.data_directory_cancel_button.show()
|
||||||
|
|
||||||
def onDataDirectoryDefaultButtonClicked(self):
|
def on_data_directory_default_button_clicked(self):
|
||||||
"""
|
"""
|
||||||
Re-set the data directory location to the 'default' location.
|
Re-set the data directory location to the 'default' location.
|
||||||
"""
|
"""
|
||||||
new_data_path = AppLocation.get_directory(AppLocation.DataDir)
|
new_data_path = AppLocation.get_directory(AppLocation.DataDir)
|
||||||
if self.currentDataPath.lower() != new_data_path.lower():
|
if self.current_data_path.lower() != new_data_path.lower():
|
||||||
# Make sure they want to change the data location back to the
|
# Make sure they want to change the data location back to the
|
||||||
# default.
|
# default.
|
||||||
answer = QtGui.QMessageBox.question(self,
|
answer = QtGui.QMessageBox.question(self,
|
||||||
|
@ -560,29 +591,35 @@ class AdvancedTab(SettingsTab):
|
||||||
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes | QtGui.QMessageBox.No), QtGui.QMessageBox.No)
|
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes | QtGui.QMessageBox.No), QtGui.QMessageBox.No)
|
||||||
if answer != QtGui.QMessageBox.Yes:
|
if answer != QtGui.QMessageBox.Yes:
|
||||||
return
|
return
|
||||||
self.checkDataOverwrite(new_data_path)
|
self.check_data_overwrite(new_data_path)
|
||||||
# Save the new location.
|
# Save the new location.
|
||||||
Receiver.send_message(u'set_new_data_path', new_data_path)
|
Receiver.send_message(u'set_new_data_path', new_data_path)
|
||||||
self.newDataDirectoryEdit.setText(os.path.abspath(new_data_path))
|
self.new_data_directory_edit.setText(os.path.abspath(new_data_path))
|
||||||
self.dataDirectoryCancelButton.show()
|
self.data_directory_cancel_button.show()
|
||||||
else:
|
else:
|
||||||
# We cancel the change in case user changed their mind.
|
# We cancel the change in case user changed their mind.
|
||||||
self.onDataDirectoryCancelButtonClicked()
|
self.on_data_directory_cancel_button_clicked()
|
||||||
|
|
||||||
def onDataDirectoryCopyCheckBoxToggled(self):
|
def on_data_directory_copy_check_box_toggled(self):
|
||||||
|
"""
|
||||||
|
Service Name options changed
|
||||||
|
"""
|
||||||
Receiver.send_message(u'set_copy_data',
|
Receiver.send_message(u'set_copy_data',
|
||||||
self.dataDirectoryCopyCheckBox.isChecked())
|
self.data_directory_copy_check_box.isChecked())
|
||||||
if self.dataExists:
|
if self.data_exists:
|
||||||
if self.dataDirectoryCopyCheckBox.isChecked():
|
if self.data_directory_copy_check_box.isChecked():
|
||||||
self.newDataDirectoryHasFilesLabel.show()
|
self.new_data_directory_has_files_label.show()
|
||||||
else:
|
else:
|
||||||
self.newDataDirectoryHasFilesLabel.hide()
|
self.new_data_directory_has_files_label.hide()
|
||||||
|
|
||||||
def checkDataOverwrite(self, data_path ):
|
def check_data_overwrite(self, data_path ):
|
||||||
|
"""
|
||||||
|
Service Name options changed
|
||||||
|
"""
|
||||||
test_path = os.path.join(data_path, u'songs')
|
test_path = os.path.join(data_path, u'songs')
|
||||||
self.dataDirectoryCopyCheckBox.show()
|
self.data_directory_copy_check_box.show()
|
||||||
if os.path.exists(test_path):
|
if os.path.exists(test_path):
|
||||||
self.dataExists = True
|
self.data_exists = True
|
||||||
# Check is they want to replace existing data.
|
# Check is they want to replace existing data.
|
||||||
answer = QtGui.QMessageBox.warning(self,
|
answer = QtGui.QMessageBox.warning(self,
|
||||||
translate('OpenLP.AdvancedTab', 'Overwrite Existing Data'),
|
translate('OpenLP.AdvancedTab', 'Overwrite Existing Data'),
|
||||||
|
@ -591,42 +628,45 @@ class AdvancedTab(SettingsTab):
|
||||||
).replace('%s', os.path.abspath(data_path,)),
|
).replace('%s', os.path.abspath(data_path,)),
|
||||||
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes | QtGui.QMessageBox.No), QtGui.QMessageBox.No)
|
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes | QtGui.QMessageBox.No), QtGui.QMessageBox.No)
|
||||||
if answer == QtGui.QMessageBox.Yes:
|
if answer == QtGui.QMessageBox.Yes:
|
||||||
self.dataDirectoryCopyCheckBox.setChecked(True)
|
self.data_directory_copy_check_box.setChecked(True)
|
||||||
self.newDataDirectoryHasFilesLabel.show()
|
self.new_data_directory_has_files_label.show()
|
||||||
else:
|
else:
|
||||||
self.dataDirectoryCopyCheckBox.setChecked(False)
|
self.data_directory_copy_check_box.setChecked(False)
|
||||||
self.newDataDirectoryHasFilesLabel.hide()
|
self.new_data_directory_has_files_label.hide()
|
||||||
else:
|
else:
|
||||||
self.dataExists = False
|
self.data_exists = False
|
||||||
self.dataDirectoryCopyCheckBox.setChecked(True)
|
self.data_directory_copy_check_box.setChecked(True)
|
||||||
self.newDataDirectoryHasFilesLabel.hide()
|
self.new_data_directory_has_files_label.hide()
|
||||||
|
|
||||||
def onDataDirectoryCancelButtonClicked(self):
|
def on_data_directory_cancel_button_clicked(self):
|
||||||
"""
|
"""
|
||||||
Cancel the data directory location change
|
Cancel the data directory location change
|
||||||
"""
|
"""
|
||||||
self.newDataDirectoryEdit.clear()
|
self.new_data_directory_edit.clear()
|
||||||
self.dataDirectoryCopyCheckBox.setChecked(False)
|
self.data_directory_copy_check_box.setChecked(False)
|
||||||
Receiver.send_message(u'set_new_data_path', u'')
|
Receiver.send_message(u'set_new_data_path', u'')
|
||||||
Receiver.send_message(u'set_copy_data', False)
|
Receiver.send_message(u'set_copy_data', False)
|
||||||
self.dataDirectoryCopyCheckBox.hide()
|
self.data_directory_copy_check_box.hide()
|
||||||
self.dataDirectoryCancelButton.hide()
|
self.data_directory_cancel_button.hide()
|
||||||
self.newDataDirectoryHasFilesLabel.hide()
|
self.new_data_directory_has_files_label.hide()
|
||||||
|
|
||||||
def onDefaultRevertButtonClicked(self):
|
def on_default_revert_button_clicked(self):
|
||||||
self.defaultFileEdit.setText(u':/graphics/openlp-splash-screen.png')
|
"""
|
||||||
self.defaultFileEdit.setFocus()
|
Service Name options changed
|
||||||
|
"""
|
||||||
|
self.default_file_edit.setText(u':/graphics/openlp-splash-screen.png')
|
||||||
|
self.default_file_edit.setFocus()
|
||||||
|
|
||||||
def onX11BypassCheckBoxToggled(self, checked):
|
def on_X11_bypass_check_box_toggled(self, checked):
|
||||||
"""
|
"""
|
||||||
Toggle X11 bypass flag on maindisplay depending on check box state.
|
Toggle X11 bypass flag on maindisplay depending on check box state.
|
||||||
|
|
||||||
``checked``
|
``checked``
|
||||||
The state of the check box (boolean).
|
The state of the check box (boolean).
|
||||||
"""
|
"""
|
||||||
self.displayChanged = True
|
self.display_changed = True
|
||||||
|
|
||||||
def onAlternateRowsCheckBoxToggled(self, checked):
|
def on_alternate_rows_check_box_toggled(self, checked):
|
||||||
"""
|
"""
|
||||||
Notify user about required restart.
|
Notify user about required restart.
|
||||||
|
|
||||||
|
@ -637,11 +677,20 @@ class AdvancedTab(SettingsTab):
|
||||||
translate('OpenLP.AdvancedTab', 'Restart Required'),
|
translate('OpenLP.AdvancedTab', 'Restart Required'),
|
||||||
translate('OpenLP.AdvancedTab', 'This change will only take effect once OpenLP has been restarted.'))
|
translate('OpenLP.AdvancedTab', 'This change will only take effect once OpenLP has been restarted.'))
|
||||||
|
|
||||||
def onEndSlideButtonClicked(self):
|
def on_end_slide_button_clicked(self):
|
||||||
|
"""
|
||||||
|
Stop at the end either top ot bottom
|
||||||
|
"""
|
||||||
self.slide_limits = SlideLimits.End
|
self.slide_limits = SlideLimits.End
|
||||||
|
|
||||||
def onWrapSlideButtonClicked(self):
|
def on_wrap_slide_button_clicked(self):
|
||||||
|
"""
|
||||||
|
Wrap round the service item
|
||||||
|
"""
|
||||||
self.slide_limits = SlideLimits.Wrap
|
self.slide_limits = SlideLimits.Wrap
|
||||||
|
|
||||||
def onnextItemButtonClicked(self):
|
def on_next_item_button_clicked(self):
|
||||||
|
"""
|
||||||
|
Advance to the next service item
|
||||||
|
"""
|
||||||
self.slide_limits = SlideLimits.Next
|
self.slide_limits = SlideLimits.Next
|
||||||
|
|
|
@ -39,7 +39,7 @@ from ConfigParser import SafeConfigParser
|
||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib import translate, PluginStatus, Receiver, build_icon, check_directory_exists, Settings
|
from openlp.core.lib import translate, PluginStatus, Receiver, build_icon, check_directory_exists, Settings, Registry
|
||||||
from openlp.core.utils import get_web_page, AppLocation, get_filesystem_encoding
|
from openlp.core.utils import get_web_page, AppLocation, get_filesystem_encoding
|
||||||
from firsttimewizard import Ui_FirstTimeWizard, FirstTimePage
|
from firsttimewizard import Ui_FirstTimeWizard, FirstTimePage
|
||||||
|
|
||||||
|
@ -198,7 +198,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
|
||||||
self.themeComboBox.addItem(item.text())
|
self.themeComboBox.addItem(item.text())
|
||||||
if self.hasRunWizard:
|
if self.hasRunWizard:
|
||||||
# Add any existing themes to list.
|
# Add any existing themes to list.
|
||||||
for theme in self.parent().themeManagerContents.getThemes():
|
for theme in self.theme_manager.get_themes():
|
||||||
index = self.themeComboBox.findText(theme)
|
index = self.themeComboBox.findText(theme)
|
||||||
if index == -1:
|
if index == -1:
|
||||||
self.themeComboBox.addItem(theme)
|
self.themeComboBox.addItem(theme)
|
||||||
|
@ -461,3 +461,13 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
|
||||||
def _setPluginStatus(self, field, tag):
|
def _setPluginStatus(self, field, tag):
|
||||||
status = PluginStatus.Active if field.checkState() == QtCore.Qt.Checked else PluginStatus.Inactive
|
status = PluginStatus.Active if field.checkState() == QtCore.Qt.Checked else PluginStatus.Inactive
|
||||||
Settings().setValue(tag, status)
|
Settings().setValue(tag, status)
|
||||||
|
|
||||||
|
def _get_theme_manager(self):
|
||||||
|
"""
|
||||||
|
Adds the theme manager to the class dynamically
|
||||||
|
"""
|
||||||
|
if not hasattr(self, u'_theme_manager'):
|
||||||
|
self._theme_manager = Registry().get(u'theme_manager')
|
||||||
|
return self._theme_manager
|
||||||
|
|
||||||
|
theme_manager = property(_get_theme_manager)
|
||||||
|
|
|
@ -496,9 +496,9 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
||||||
self.copyData = False
|
self.copyData = False
|
||||||
# Set up signals and slots
|
# Set up signals and slots
|
||||||
QtCore.QObject.connect(self.importThemeItem, QtCore.SIGNAL(u'triggered()'),
|
QtCore.QObject.connect(self.importThemeItem, QtCore.SIGNAL(u'triggered()'),
|
||||||
self.themeManagerContents.onImportTheme)
|
self.themeManagerContents.on_import_theme)
|
||||||
QtCore.QObject.connect(self.exportThemeItem, QtCore.SIGNAL(u'triggered()'),
|
QtCore.QObject.connect(self.exportThemeItem, QtCore.SIGNAL(u'triggered()'),
|
||||||
self.themeManagerContents.onExportTheme)
|
self.themeManagerContents.on_export_theme)
|
||||||
QtCore.QObject.connect(self.mediaManagerDock, QtCore.SIGNAL(u'visibilityChanged(bool)'),
|
QtCore.QObject.connect(self.mediaManagerDock, QtCore.SIGNAL(u'visibilityChanged(bool)'),
|
||||||
self.viewMediaManagerItem.setChecked)
|
self.viewMediaManagerItem.setChecked)
|
||||||
QtCore.QObject.connect(self.serviceManagerDock, QtCore.SIGNAL(u'visibilityChanged(bool)'),
|
QtCore.QObject.connect(self.serviceManagerDock, QtCore.SIGNAL(u'visibilityChanged(bool)'),
|
||||||
|
@ -576,9 +576,9 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
||||||
self.settingsForm.postSetUp()
|
self.settingsForm.postSetUp()
|
||||||
# Once all components are initialised load the Themes
|
# Once all components are initialised load the Themes
|
||||||
log.info(u'Load Themes')
|
log.info(u'Load Themes')
|
||||||
self.themeManagerContents.loadThemes(True)
|
self.themeManagerContents.load_themes(True)
|
||||||
# Hide/show the theme combobox on the service manager
|
# Hide/show the theme combobox on the service manager
|
||||||
self.serviceManagerContents.themeChange()
|
self.serviceManagerContents.theme_change()
|
||||||
# Reset the cursor
|
# Reset the cursor
|
||||||
Receiver.send_message(u'cursor_normal')
|
Receiver.send_message(u'cursor_normal')
|
||||||
|
|
||||||
|
@ -687,7 +687,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
||||||
else:
|
else:
|
||||||
self.activePlugin.toggleStatus(PluginStatus.Inactive)
|
self.activePlugin.toggleStatus(PluginStatus.Inactive)
|
||||||
self.themeManagerContents.configUpdated()
|
self.themeManagerContents.configUpdated()
|
||||||
self.themeManagerContents.loadThemes(True)
|
self.themeManagerContents.load_themes(True)
|
||||||
Receiver.send_message(u'theme_update_global', self.themeManagerContents.global_theme)
|
Receiver.send_message(u'theme_update_global', self.themeManagerContents.global_theme)
|
||||||
# Check if any Bibles downloaded. If there are, they will be
|
# Check if any Bibles downloaded. If there are, they will be
|
||||||
# processed.
|
# processed.
|
||||||
|
@ -760,7 +760,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
||||||
"""
|
"""
|
||||||
Updates the new theme preview images.
|
Updates the new theme preview images.
|
||||||
"""
|
"""
|
||||||
self.themeManagerContents.updatePreviewImages()
|
self.themeManagerContents.update_preview_images()
|
||||||
|
|
||||||
def onFormattingTagItemClicked(self):
|
def onFormattingTagItemClicked(self):
|
||||||
"""
|
"""
|
||||||
|
@ -1040,7 +1040,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
||||||
while self.imageManager.imageThread.isRunning():
|
while self.imageManager.imageThread.isRunning():
|
||||||
time.sleep(0.1)
|
time.sleep(0.1)
|
||||||
# Clean temporary files used by services
|
# Clean temporary files used by services
|
||||||
self.serviceManagerContents.cleanUp()
|
self.serviceManagerContents.clean_up()
|
||||||
if save_settings:
|
if save_settings:
|
||||||
if Settings().value(u'advanced/save current plugin'):
|
if Settings().value(u'advanced/save current plugin'):
|
||||||
Settings().setValue(u'advanced/current media plugin', self.mediaToolBox.currentIndex())
|
Settings().setValue(u'advanced/current media plugin', self.mediaToolBox.currentIndex())
|
||||||
|
|
|
@ -45,10 +45,8 @@ class PlayerTab(SettingsTab):
|
||||||
"""
|
"""
|
||||||
MediaTab is the Media settings tab in the settings dialog.
|
MediaTab is the Media settings tab in the settings dialog.
|
||||||
"""
|
"""
|
||||||
def __init__(self, parent, mainWindow):
|
def __init__(self, parent):
|
||||||
self.parent = parent
|
self.mediaPlayers = self.media_controller.mediaPlayers
|
||||||
self.mainWindow = mainWindow
|
|
||||||
self.mediaPlayers = mainWindow.mediaController.mediaPlayers
|
|
||||||
self.savedUsedPlayers = None
|
self.savedUsedPlayers = None
|
||||||
self.iconPath = u':/media/multimedia-player.png'
|
self.iconPath = u':/media/multimedia-player.png'
|
||||||
player_translated = translate('OpenLP.PlayerTab', 'Players')
|
player_translated = translate('OpenLP.PlayerTab', 'Players')
|
||||||
|
@ -194,7 +192,7 @@ class PlayerTab(SettingsTab):
|
||||||
set_media_players(self.usedPlayers, override_player)
|
set_media_players(self.usedPlayers, override_player)
|
||||||
player_string_changed = True
|
player_string_changed = True
|
||||||
if player_string_changed:
|
if player_string_changed:
|
||||||
self.parent.reset_supported_suffixes()
|
self.service_manager.reset_supported_suffixes()
|
||||||
Receiver.send_message(u'mediaitem_media_rebuild')
|
Receiver.send_message(u'mediaitem_media_rebuild')
|
||||||
Receiver.send_message(u'config_screen_changed')
|
Receiver.send_message(u'config_screen_changed')
|
||||||
|
|
||||||
|
|
|
@ -95,14 +95,19 @@ class ServiceManagerList(QtGui.QTreeWidget):
|
||||||
|
|
||||||
class ServiceManagerDialog(object):
|
class ServiceManagerDialog(object):
|
||||||
"""
|
"""
|
||||||
|
UI part of the Service Manager
|
||||||
"""
|
"""
|
||||||
def setup_ui(self,widget):
|
def setup_ui(self, widget):
|
||||||
|
"""
|
||||||
|
Define the UI
|
||||||
|
"""
|
||||||
# Create the top toolbar
|
# Create the top toolbar
|
||||||
self.toolbar = OpenLPToolbar(self)
|
self.toolbar = OpenLPToolbar(self)
|
||||||
self.toolbar.addToolbarAction(u'newService', text=UiStrings().NewService, icon=u':/general/general_new.png',
|
self.toolbar.addToolbarAction(u'newService', text=UiStrings().NewService, icon=u':/general/general_new.png',
|
||||||
tooltip=UiStrings().CreateService, triggers=self.on_new_service_clicked)
|
tooltip=UiStrings().CreateService, triggers=self.on_new_service_clicked)
|
||||||
self.toolbar.addToolbarAction(u'openService', text=UiStrings().OpenService, icon=u':/general/general_open.png',
|
self.toolbar.addToolbarAction(u'openService', text=UiStrings().OpenService, icon=u':/general/general_open.png',
|
||||||
tooltip=translate('OpenLP.ServiceManager', 'Load an existing service.'), triggers=self.on_load_service_clicked)
|
tooltip=translate('OpenLP.ServiceManager', 'Load an existing service.'),
|
||||||
|
triggers=self.on_load_service_clicked)
|
||||||
self.toolbar.addToolbarAction(u'saveService', text=UiStrings().SaveService, icon=u':/general/general_save.png',
|
self.toolbar.addToolbarAction(u'saveService', text=UiStrings().SaveService, icon=u':/general/general_save.png',
|
||||||
tooltip=translate('OpenLP.ServiceManager', 'Save this service.'), triggers=self.decide_save_method)
|
tooltip=translate('OpenLP.ServiceManager', 'Save this service.'), triggers=self.decide_save_method)
|
||||||
self.toolbar.addSeparator()
|
self.toolbar.addSeparator()
|
||||||
|
@ -185,7 +190,8 @@ class ServiceManagerDialog(object):
|
||||||
self.service_manager_list.make_live = self.order_toolbar.addToolbarAction(u'make_live',
|
self.service_manager_list.make_live = self.order_toolbar.addToolbarAction(u'make_live',
|
||||||
text=translate('OpenLP.ServiceManager', 'Go Live'), icon=u':/general/general_live.png',
|
text=translate('OpenLP.ServiceManager', 'Go Live'), icon=u':/general/general_live.png',
|
||||||
tooltip=translate('OpenLP.ServiceManager', 'Send the selected item to Live.'),
|
tooltip=translate('OpenLP.ServiceManager', 'Send the selected item to Live.'),
|
||||||
shortcuts=[QtCore.Qt.Key_Enter, QtCore.Qt.Key_Return], category=UiStrings().Service, triggers=self.make_live)
|
shortcuts=[QtCore.Qt.Key_Enter, QtCore.Qt.Key_Return], category=UiStrings().Service,
|
||||||
|
triggers=self.make_live)
|
||||||
self.layout.addWidget(self.order_toolbar)
|
self.layout.addWidget(self.order_toolbar)
|
||||||
# Connect up our signals and slots
|
# Connect up our signals and slots
|
||||||
QtCore.QObject.connect(self.theme_combo_box, QtCore.SIGNAL(u'activated(int)'),
|
QtCore.QObject.connect(self.theme_combo_box, QtCore.SIGNAL(u'activated(int)'),
|
||||||
|
@ -206,8 +212,9 @@ class ServiceManagerDialog(object):
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'config_updated'), self.config_updated)
|
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'config_updated'), self.config_updated)
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'config_screen_changed'),
|
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'config_screen_changed'),
|
||||||
self.regenerate_service_Items)
|
self.regenerate_service_Items)
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'theme_update_global'), self.themeChange)
|
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'theme_update_global'), self.theme_change)
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'service_item_update'), self.serviceItemUpdate)
|
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'service_item_update'),
|
||||||
|
self.service_item_update)
|
||||||
# Last little bits of setting up
|
# Last little bits of setting up
|
||||||
self.service_theme = Settings().value(self.main_window.serviceManagerSettingsSection + u'/service theme')
|
self.service_theme = Settings().value(self.main_window.serviceManagerSettingsSection + u'/service theme')
|
||||||
self.servicePath = AppLocation.get_section_data_path(u'servicemanager')
|
self.servicePath = AppLocation.get_section_data_path(u'servicemanager')
|
||||||
|
@ -560,7 +567,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
|
||||||
if success:
|
if success:
|
||||||
try:
|
try:
|
||||||
shutil.copy(temp_file_name, path_file_name)
|
shutil.copy(temp_file_name, path_file_name)
|
||||||
except:
|
except shutil.Error:
|
||||||
return self.save_file_as()
|
return self.save_file_as()
|
||||||
self.main_window.addRecentFile(path_file_name)
|
self.main_window.addRecentFile(path_file_name)
|
||||||
self.set_modified(False)
|
self.set_modified(False)
|
||||||
|
@ -618,7 +625,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
|
||||||
if success:
|
if success:
|
||||||
try:
|
try:
|
||||||
shutil.copy(temp_file_name, path_file_name)
|
shutil.copy(temp_file_name, path_file_name)
|
||||||
except:
|
except shutil.Error:
|
||||||
return self.save_file_as()
|
return self.save_file_as()
|
||||||
self.main_window.addRecentFile(path_file_name)
|
self.main_window.addRecentFile(path_file_name)
|
||||||
self.set_modified(False)
|
self.set_modified(False)
|
||||||
|
@ -697,7 +704,8 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
|
||||||
try:
|
try:
|
||||||
ucsfile = zip_info.filename.decode(u'utf-8')
|
ucsfile = zip_info.filename.decode(u'utf-8')
|
||||||
except UnicodeDecodeError:
|
except UnicodeDecodeError:
|
||||||
log.exception(u'file_name "%s" is not valid UTF-8' % zip_info.file_name.decode(u'utf-8', u'replace'))
|
log.exception(u'file_name "%s" is not valid UTF-8' %
|
||||||
|
zip_info.file_name.decode(u'utf-8', u'replace'))
|
||||||
critical_error_message_box(message=translate('OpenLP.ServiceManager',
|
critical_error_message_box(message=translate('OpenLP.ServiceManager',
|
||||||
'File is not a valid service.\n The content encoding is not UTF-8.'))
|
'File is not a valid service.\n The content encoding is not UTF-8.'))
|
||||||
continue
|
continue
|
||||||
|
@ -809,7 +817,8 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
|
||||||
delay_suffix = u' %s s' % unicode(service_item[u'service_item'].timed_slide_interval)
|
delay_suffix = u' %s s' % unicode(service_item[u'service_item'].timed_slide_interval)
|
||||||
else:
|
else:
|
||||||
delay_suffix = u' ...'
|
delay_suffix = u' ...'
|
||||||
self.timed_slide_interval.setText(translate('OpenLP.ServiceManager', '&Delay between slides') + delay_suffix)
|
self.timed_slide_interval.setText(translate('OpenLP.ServiceManager', '&Delay between slides') +
|
||||||
|
delay_suffix)
|
||||||
# TODO for future: make group explains itself more visually
|
# TODO for future: make group explains itself more visually
|
||||||
else:
|
else:
|
||||||
self.auto_play_slides_group.menuAction().setVisible(False)
|
self.auto_play_slides_group.menuAction().setVisible(False)
|
||||||
|
@ -1201,13 +1210,13 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
|
||||||
self.service_manager_list.setCurrentItem(treewidgetitem)
|
self.service_manager_list.setCurrentItem(treewidgetitem)
|
||||||
treewidgetitem.setExpanded(item[u'expanded'])
|
treewidgetitem.setExpanded(item[u'expanded'])
|
||||||
|
|
||||||
def cleanUp(self):
|
def clean_up(self):
|
||||||
"""
|
"""
|
||||||
Empties the servicePath of temporary files on system exit.
|
Empties the servicePath of temporary files on system exit.
|
||||||
"""
|
"""
|
||||||
log.debug(u'Cleaning up servicePath')
|
log.debug(u'Cleaning up servicePath')
|
||||||
for file in os.listdir(self.servicePath):
|
for file_name in os.listdir(self.servicePath):
|
||||||
file_path = os.path.join(self.servicePath, file)
|
file_path = os.path.join(self.servicePath, file_name)
|
||||||
delete_file(file_path)
|
delete_file(file_path)
|
||||||
if os.path.exists(os.path.join(self.servicePath, u'audio')):
|
if os.path.exists(os.path.join(self.servicePath, u'audio')):
|
||||||
shutil.rmtree(os.path.join(self.servicePath, u'audio'), True)
|
shutil.rmtree(os.path.join(self.servicePath, u'audio'), True)
|
||||||
|
@ -1222,12 +1231,12 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
|
||||||
Settings().setValue(self.main_window.serviceManagerSettingsSection + u'/service theme', self.service_theme)
|
Settings().setValue(self.main_window.serviceManagerSettingsSection + u'/service theme', self.service_theme)
|
||||||
self.regenerate_service_Items(True)
|
self.regenerate_service_Items(True)
|
||||||
|
|
||||||
def themeChange(self):
|
def theme_change(self):
|
||||||
"""
|
"""
|
||||||
The theme may have changed in the settings dialog so make
|
The theme may have changed in the settings dialog so make
|
||||||
sure the theme combo box is in the correct state.
|
sure the theme combo box is in the correct state.
|
||||||
"""
|
"""
|
||||||
log.debug(u'themeChange')
|
log.debug(u'theme_change')
|
||||||
visible = self.renderer.theme_level == ThemeLevel.Global
|
visible = self.renderer.theme_level == ThemeLevel.Global
|
||||||
self.theme_label.setVisible(visible)
|
self.theme_label.setVisible(visible)
|
||||||
self.theme_combo_box.setVisible(visible)
|
self.theme_combo_box.setVisible(visible)
|
||||||
|
@ -1271,7 +1280,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
|
||||||
self.repaint_service_list(-1, -1)
|
self.repaint_service_list(-1, -1)
|
||||||
Receiver.send_message(u'cursor_normal')
|
Receiver.send_message(u'cursor_normal')
|
||||||
|
|
||||||
def serviceItemUpdate(self, message):
|
def service_item_update(self, message):
|
||||||
"""
|
"""
|
||||||
Triggered from plugins to update service items.
|
Triggered from plugins to update service items.
|
||||||
Save the values as they will be used as part of the service load
|
Save the values as they will be used as part of the service load
|
||||||
|
@ -1406,7 +1415,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
|
||||||
"""
|
"""
|
||||||
Triggers a remote edit to a plugin to allow item to be edited.
|
Triggers a remote edit to a plugin to allow item to be edited.
|
||||||
"""
|
"""
|
||||||
item, child = self.find_service_item()
|
item = self.find_service_item()[0]
|
||||||
if self.service_items[item][u'service_item'].is_capable(ItemCapabilities.CanEdit):
|
if self.service_items[item][u'service_item'].is_capable(ItemCapabilities.CanEdit):
|
||||||
new_item = Registry().get(self.service_items[item][u'service_item'].name). \
|
new_item = Registry().get(self.service_items[item][u'service_item'].name). \
|
||||||
onRemoteEdit(self.service_items[item][u'service_item'].edit_id)
|
onRemoteEdit(self.service_items[item][u'service_item'].edit_id)
|
||||||
|
|
|
@ -54,11 +54,11 @@ class SettingsForm(QtGui.QDialog, Ui_SettingsDialog):
|
||||||
# General tab
|
# General tab
|
||||||
self.generalTab = GeneralTab(self)
|
self.generalTab = GeneralTab(self)
|
||||||
# Themes tab
|
# Themes tab
|
||||||
self.themesTab = ThemesTab(self, self.main_window)
|
self.themesTab = ThemesTab(self)
|
||||||
# Advanced tab
|
# Advanced tab
|
||||||
self.advancedTab = AdvancedTab(self)
|
self.advancedTab = AdvancedTab(self)
|
||||||
# Advanced tab
|
# Advanced tab
|
||||||
self.playerTab = PlayerTab(self, self.main_window)
|
self.playerTab = PlayerTab(self)
|
||||||
|
|
||||||
def exec_(self):
|
def exec_(self):
|
||||||
# load all the settings
|
# load all the settings
|
||||||
|
|
|
@ -32,7 +32,7 @@ import os
|
||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib import Receiver, translate, UiStrings
|
from openlp.core.lib import Receiver, translate, UiStrings, Registry
|
||||||
from openlp.core.lib.theme import BackgroundType, BackgroundGradientType
|
from openlp.core.lib.theme import BackgroundType, BackgroundGradientType
|
||||||
from openlp.core.lib.ui import critical_error_message_box
|
from openlp.core.lib.ui import critical_error_message_box
|
||||||
from openlp.core.ui import ThemeLayoutForm
|
from openlp.core.ui import ThemeLayoutForm
|
||||||
|
@ -56,7 +56,6 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
|
||||||
The QWidget-derived parent of the wizard.
|
The QWidget-derived parent of the wizard.
|
||||||
"""
|
"""
|
||||||
QtGui.QWizard.__init__(self, parent)
|
QtGui.QWizard.__init__(self, parent)
|
||||||
self.thememanager = parent
|
|
||||||
self.setupUi(self)
|
self.setupUi(self)
|
||||||
self.registerFields()
|
self.registerFields()
|
||||||
self.updateThemeAllowed = True
|
self.updateThemeAllowed = True
|
||||||
|
@ -149,7 +148,7 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
|
||||||
# Do not trigger on start up
|
# Do not trigger on start up
|
||||||
if self.currentPage != self.welcomePage:
|
if self.currentPage != self.welcomePage:
|
||||||
self.updateTheme()
|
self.updateTheme()
|
||||||
self.thememanager.generateImage(self.theme, True)
|
self.theme_manager.generate_image(self.theme, True)
|
||||||
|
|
||||||
def updateLinesText(self, lines):
|
def updateLinesText(self, lines):
|
||||||
"""
|
"""
|
||||||
|
@ -196,7 +195,7 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
|
||||||
self.setOption(QtGui.QWizard.HaveCustomButton1, enabled)
|
self.setOption(QtGui.QWizard.HaveCustomButton1, enabled)
|
||||||
if self.page(pageId) == self.previewPage:
|
if self.page(pageId) == self.previewPage:
|
||||||
self.updateTheme()
|
self.updateTheme()
|
||||||
frame = self.thememanager.generateImage(self.theme)
|
frame = self.theme_manager.generate_image(self.theme)
|
||||||
self.previewBoxLabel.setPixmap(frame)
|
self.previewBoxLabel.setPixmap(frame)
|
||||||
self.displayAspectRatio = float(frame.width()) / frame.height()
|
self.displayAspectRatio = float(frame.width()) / frame.height()
|
||||||
self.resizeEvent()
|
self.resizeEvent()
|
||||||
|
@ -206,15 +205,15 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
|
||||||
Generate layout preview and display the form.
|
Generate layout preview and display the form.
|
||||||
"""
|
"""
|
||||||
self.updateTheme()
|
self.updateTheme()
|
||||||
width = self.thememanager.mainwindow.renderer.width
|
width = self.renderer.width
|
||||||
height = self.thememanager.mainwindow.renderer.height
|
height = self.renderer.height
|
||||||
pixmap = QtGui.QPixmap(width, height)
|
pixmap = QtGui.QPixmap(width, height)
|
||||||
pixmap.fill(QtCore.Qt.white)
|
pixmap.fill(QtCore.Qt.white)
|
||||||
paint = QtGui.QPainter(pixmap)
|
paint = QtGui.QPainter(pixmap)
|
||||||
paint.setPen(QtGui.QPen(QtCore.Qt.blue, 2))
|
paint.setPen(QtGui.QPen(QtCore.Qt.blue, 2))
|
||||||
paint.drawRect(self.thememanager.mainwindow.renderer.get_main_rectangle(self.theme))
|
paint.drawRect(self.renderer.get_main_rectangle(self.theme))
|
||||||
paint.setPen(QtGui.QPen(QtCore.Qt.red, 2))
|
paint.setPen(QtGui.QPen(QtCore.Qt.red, 2))
|
||||||
paint.drawRect(self.thememanager.mainwindow.renderer.get_footer_rectangle(self.theme))
|
paint.drawRect(self.renderer.get_footer_rectangle(self.theme))
|
||||||
paint.end()
|
paint.end()
|
||||||
self.themeLayoutForm.exec_(pixmap)
|
self.themeLayoutForm.exec_(pixmap)
|
||||||
|
|
||||||
|
@ -514,9 +513,9 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
|
||||||
filename = os.path.split(unicode(self.theme.background_filename))[1]
|
filename = os.path.split(unicode(self.theme.background_filename))[1]
|
||||||
saveTo = os.path.join(self.path, self.theme.theme_name, filename)
|
saveTo = os.path.join(self.path, self.theme.theme_name, filename)
|
||||||
saveFrom = self.theme.background_filename
|
saveFrom = self.theme.background_filename
|
||||||
if not self.edit_mode and not self.thememanager.checkIfThemeExists(self.theme.theme_name):
|
if not self.edit_mode and not self.theme_manager.check_if_theme_exists(self.theme.theme_name):
|
||||||
return
|
return
|
||||||
self.thememanager.saveTheme(self.theme, saveFrom, saveTo)
|
self.theme_manager.save_theme(self.theme, saveFrom, saveTo)
|
||||||
return QtGui.QDialog.accept(self)
|
return QtGui.QDialog.accept(self)
|
||||||
|
|
||||||
def _colorButton(self, field):
|
def _colorButton(self, field):
|
||||||
|
@ -527,3 +526,23 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
|
||||||
if new_color.isValid():
|
if new_color.isValid():
|
||||||
field = new_color.name()
|
field = new_color.name()
|
||||||
return field
|
return field
|
||||||
|
|
||||||
|
def _get_renderer(self):
|
||||||
|
"""
|
||||||
|
Adds the Renderer to the class dynamically
|
||||||
|
"""
|
||||||
|
if not hasattr(self, u'_renderer'):
|
||||||
|
self._renderer = Registry().get(u'renderer')
|
||||||
|
return self._renderer
|
||||||
|
|
||||||
|
renderer = property(_get_renderer)
|
||||||
|
|
||||||
|
def _get_theme_manager(self):
|
||||||
|
"""
|
||||||
|
Adds the theme manager to the class dynamically
|
||||||
|
"""
|
||||||
|
if not hasattr(self, u'_theme_manager'):
|
||||||
|
self._theme_manager = Registry().get(u'theme_manager')
|
||||||
|
return self._theme_manager
|
||||||
|
|
||||||
|
theme_manager = property(_get_theme_manager)
|
||||||
|
|
|
@ -72,67 +72,67 @@ class ThemeManager(QtGui.QWidget):
|
||||||
text=translate('OpenLP.ThemeManager', 'Edit Theme'),
|
text=translate('OpenLP.ThemeManager', 'Edit Theme'),
|
||||||
icon=u':/themes/theme_edit.png',
|
icon=u':/themes/theme_edit.png',
|
||||||
tooltip=translate('OpenLP.ThemeManager', 'Edit a theme.'),
|
tooltip=translate('OpenLP.ThemeManager', 'Edit a theme.'),
|
||||||
triggers=self.onEditTheme)
|
triggers=self.on_edit_theme)
|
||||||
self.deleteToolbarAction = self.toolbar.addToolbarAction(u'deleteTheme',
|
self.deleteToolbarAction = self.toolbar.addToolbarAction(u'delete_theme',
|
||||||
text=translate('OpenLP.ThemeManager', 'Delete Theme'),
|
text=translate('OpenLP.ThemeManager', 'Delete Theme'),
|
||||||
icon=u':/general/general_delete.png',
|
icon=u':/general/general_delete.png',
|
||||||
tooltip=translate('OpenLP.ThemeManager', 'Delete a theme.'),
|
tooltip=translate('OpenLP.ThemeManager', 'Delete a theme.'),
|
||||||
triggers=self.onDeleteTheme)
|
triggers=self.on_delete_theme)
|
||||||
self.toolbar.addSeparator()
|
self.toolbar.addSeparator()
|
||||||
self.toolbar.addToolbarAction(u'importTheme',
|
self.toolbar.addToolbarAction(u'importTheme',
|
||||||
text=translate('OpenLP.ThemeManager', 'Import Theme'),
|
text=translate('OpenLP.ThemeManager', 'Import Theme'),
|
||||||
icon=u':/general/general_import.png',
|
icon=u':/general/general_import.png',
|
||||||
tooltip=translate('OpenLP.ThemeManager', 'Import a theme.'),
|
tooltip=translate('OpenLP.ThemeManager', 'Import a theme.'),
|
||||||
triggers=self.onImportTheme)
|
triggers=self.on_import_theme)
|
||||||
self.toolbar.addToolbarAction(u'exportTheme',
|
self.toolbar.addToolbarAction(u'exportTheme',
|
||||||
text=translate('OpenLP.ThemeManager', 'Export Theme'),
|
text=translate('OpenLP.ThemeManager', 'Export Theme'),
|
||||||
icon=u':/general/general_export.png',
|
icon=u':/general/general_export.png',
|
||||||
tooltip=translate('OpenLP.ThemeManager', 'Export a theme.'),
|
tooltip=translate('OpenLP.ThemeManager', 'Export a theme.'),
|
||||||
triggers=self.onExportTheme)
|
triggers=self.on_export_theme)
|
||||||
self.layout.addWidget(self.toolbar)
|
self.layout.addWidget(self.toolbar)
|
||||||
self.themeWidget = QtGui.QWidgetAction(self.toolbar)
|
self.theme_widget = QtGui.QWidgetAction(self.toolbar)
|
||||||
self.themeWidget.setObjectName(u'themeWidget')
|
self.theme_widget.setObjectName(u'theme_widget')
|
||||||
# create theme manager list
|
# create theme manager list
|
||||||
self.themeListWidget = QtGui.QListWidget(self)
|
self.theme_list_widget = QtGui.QListWidget(self)
|
||||||
self.themeListWidget.setAlternatingRowColors(True)
|
self.theme_list_widget.setAlternatingRowColors(True)
|
||||||
self.themeListWidget.setIconSize(QtCore.QSize(88, 50))
|
self.theme_list_widget.setIconSize(QtCore.QSize(88, 50))
|
||||||
self.themeListWidget.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
|
self.theme_list_widget.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
|
||||||
self.themeListWidget.setObjectName(u'themeListWidget')
|
self.theme_list_widget.setObjectName(u'theme_list_widget')
|
||||||
self.layout.addWidget(self.themeListWidget)
|
self.layout.addWidget(self.theme_list_widget)
|
||||||
QtCore.QObject.connect(self.themeListWidget, QtCore.SIGNAL('customContextMenuRequested(QPoint)'),
|
QtCore.QObject.connect(self.theme_list_widget, QtCore.SIGNAL('customContextMenuRequested(QPoint)'),
|
||||||
self.contextMenu)
|
self.context_menu)
|
||||||
# build the context menu
|
# build the context menu
|
||||||
self.menu = QtGui.QMenu()
|
self.menu = QtGui.QMenu()
|
||||||
self.editAction = create_widget_action(self.menu,
|
self.edit_action = create_widget_action(self.menu,
|
||||||
text=translate('OpenLP.ThemeManager', '&Edit Theme'),
|
text=translate('OpenLP.ThemeManager', '&Edit Theme'),
|
||||||
icon=u':/themes/theme_edit.png', triggers=self.onEditTheme)
|
icon=u':/themes/theme_edit.png', triggers=self.on_edit_theme)
|
||||||
self.copyAction = create_widget_action(self.menu,
|
self.copy_action = create_widget_action(self.menu,
|
||||||
text=translate('OpenLP.ThemeManager', '&Copy Theme'),
|
text=translate('OpenLP.ThemeManager', '&Copy Theme'),
|
||||||
icon=u':/themes/theme_edit.png', triggers=self.onCopyTheme)
|
icon=u':/themes/theme_edit.png', triggers=self.on_copy_theme)
|
||||||
self.renameAction = create_widget_action(self.menu,
|
self.rename_action = create_widget_action(self.menu,
|
||||||
text=translate('OpenLP.ThemeManager', '&Rename Theme'),
|
text=translate('OpenLP.ThemeManager', '&Rename Theme'),
|
||||||
icon=u':/themes/theme_edit.png', triggers=self.onRenameTheme)
|
icon=u':/themes/theme_edit.png', triggers=self.on_rename_theme)
|
||||||
self.deleteAction = create_widget_action(self.menu,
|
self.delete_action = create_widget_action(self.menu,
|
||||||
text=translate('OpenLP.ThemeManager', '&Delete Theme'),
|
text=translate('OpenLP.ThemeManager', '&Delete Theme'),
|
||||||
icon=u':/general/general_delete.png', triggers=self.onDeleteTheme)
|
icon=u':/general/general_delete.png', triggers=self.on_delete_theme)
|
||||||
self.menu.addSeparator()
|
self.menu.addSeparator()
|
||||||
self.globalAction = create_widget_action(self.menu,
|
self.global_action = create_widget_action(self.menu,
|
||||||
text=translate('OpenLP.ThemeManager', 'Set As &Global Default'),
|
text=translate('OpenLP.ThemeManager', 'Set As &Global Default'),
|
||||||
icon=u':/general/general_export.png',
|
icon=u':/general/general_export.png',
|
||||||
triggers=self.changeGlobalFromScreen)
|
triggers=self.changeGlobalFromScreen)
|
||||||
self.exportAction = create_widget_action(self.menu,
|
self.exportAction = create_widget_action(self.menu,
|
||||||
text=translate('OpenLP.ThemeManager', '&Export Theme'),
|
text=translate('OpenLP.ThemeManager', '&Export Theme'),
|
||||||
icon=u':/general/general_export.png', triggers=self.onExportTheme)
|
icon=u':/general/general_export.png', triggers=self.on_export_theme)
|
||||||
# Signals
|
# Signals
|
||||||
QtCore.QObject.connect(self.themeListWidget,
|
QtCore.QObject.connect(self.theme_list_widget,
|
||||||
QtCore.SIGNAL(u'doubleClicked(QModelIndex)'), self.changeGlobalFromScreen)
|
QtCore.SIGNAL(u'doubleClicked(QModelIndex)'), self.changeGlobalFromScreen)
|
||||||
QtCore.QObject.connect(self.themeListWidget,
|
QtCore.QObject.connect(self.theme_list_widget,
|
||||||
QtCore.SIGNAL(u'currentItemChanged(QListWidgetItem *, QListWidgetItem *)'), self.checkListState)
|
QtCore.SIGNAL(u'currentItemChanged(QListWidgetItem *, QListWidgetItem *)'), self.check_list_state)
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||||
QtCore.SIGNAL(u'theme_update_global'), self.changeGlobalFromTab)
|
QtCore.SIGNAL(u'theme_update_global'), self.change_global_from_tab)
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'config_updated'), self.configUpdated)
|
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'config_updated'), self.config_updated)
|
||||||
# Variables
|
# Variables
|
||||||
self.themeList = []
|
self.theme_list = []
|
||||||
self.path = AppLocation.get_section_data_path(self.settingsSection)
|
self.path = AppLocation.get_section_data_path(self.settingsSection)
|
||||||
check_directory_exists(self.path)
|
check_directory_exists(self.path)
|
||||||
self.thumbPath = os.path.join(self.path, u'thumbnails')
|
self.thumbPath = os.path.join(self.path, u'thumbnails')
|
||||||
|
@ -141,27 +141,27 @@ class ThemeManager(QtGui.QWidget):
|
||||||
self.oldBackgroundImage = None
|
self.oldBackgroundImage = None
|
||||||
self.badV1NameChars = re.compile(r'[%+\[\]]')
|
self.badV1NameChars = re.compile(r'[%+\[\]]')
|
||||||
# Last little bits of setting up
|
# Last little bits of setting up
|
||||||
self.configUpdated()
|
self.config_updated()
|
||||||
|
|
||||||
def firstTime(self):
|
def first_time(self):
|
||||||
"""
|
"""
|
||||||
Import new themes downloaded by the first time wizard
|
Import new themes downloaded by the first time wizard
|
||||||
"""
|
"""
|
||||||
Receiver.send_message(u'cursor_busy')
|
Receiver.send_message(u'cursor_busy')
|
||||||
files = SettingsManager.get_files(self.settingsSection, u'.otz')
|
files = SettingsManager.get_files(self.settingsSection, u'.otz')
|
||||||
for file in files:
|
for file_name in files:
|
||||||
file = os.path.join(self.path, file)
|
file_name = os.path.join(self.path, file_name)
|
||||||
self.unzipTheme(file, self.path)
|
self.unzip_theme(file_name, self.path)
|
||||||
delete_file(file)
|
delete_file(file)
|
||||||
Receiver.send_message(u'cursor_normal')
|
Receiver.send_message(u'cursor_normal')
|
||||||
|
|
||||||
def configUpdated(self):
|
def config_updated(self):
|
||||||
"""
|
"""
|
||||||
Triggered when Config dialog is updated.
|
Triggered when Config dialog is updated.
|
||||||
"""
|
"""
|
||||||
self.global_theme = Settings().value(self.settingsSection + u'/global theme')
|
self.global_theme = Settings().value(self.settingsSection + u'/global theme')
|
||||||
|
|
||||||
def checkListState(self, item):
|
def check_list_state(self, item):
|
||||||
"""
|
"""
|
||||||
If Default theme selected remove delete button.
|
If Default theme selected remove delete button.
|
||||||
"""
|
"""
|
||||||
|
@ -175,41 +175,41 @@ class ThemeManager(QtGui.QWidget):
|
||||||
else:
|
else:
|
||||||
self.deleteToolbarAction.setVisible(False)
|
self.deleteToolbarAction.setVisible(False)
|
||||||
|
|
||||||
def contextMenu(self, point):
|
def context_menu(self, point):
|
||||||
"""
|
"""
|
||||||
Build the Right Click Context menu and set state depending on
|
Build the Right Click Context menu and set state depending on
|
||||||
the type of theme.
|
the type of theme.
|
||||||
"""
|
"""
|
||||||
item = self.themeListWidget.itemAt(point)
|
item = self.theme_list_widget.itemAt(point)
|
||||||
if item is None:
|
if item is None:
|
||||||
return
|
return
|
||||||
real_theme_name = item.data(QtCore.Qt.UserRole)
|
real_theme_name = item.data(QtCore.Qt.UserRole)
|
||||||
theme_name = unicode(item.text())
|
theme_name = unicode(item.text())
|
||||||
visible = real_theme_name == theme_name
|
visible = real_theme_name == theme_name
|
||||||
self.deleteAction.setVisible(visible)
|
self.delete_action.setVisible(visible)
|
||||||
self.renameAction.setVisible(visible)
|
self.rename_action.setVisible(visible)
|
||||||
self.globalAction.setVisible(visible)
|
self.global_action.setVisible(visible)
|
||||||
self.menu.exec_(self.themeListWidget.mapToGlobal(point))
|
self.menu.exec_(self.theme_list_widget.mapToGlobal(point))
|
||||||
|
|
||||||
def changeGlobalFromTab(self, theme_name):
|
def change_global_from_tab(self, theme_name):
|
||||||
"""
|
"""
|
||||||
Change the global theme when it is changed through the Themes settings
|
Change the global theme when it is changed through the Themes settings
|
||||||
tab
|
tab
|
||||||
"""
|
"""
|
||||||
log.debug(u'changeGlobalFromTab %s', theme_name)
|
log.debug(u'change_global_from_tab %s', theme_name)
|
||||||
for count in range (0, self.themeListWidget.count()):
|
for count in range (0, self.theme_list_widget.count()):
|
||||||
# reset the old name
|
# reset the old name
|
||||||
item = self.themeListWidget.item(count)
|
item = self.theme_list_widget.item(count)
|
||||||
old_name = item.text()
|
old_name = item.text()
|
||||||
new_name = item.data(QtCore.Qt.UserRole)
|
new_name = item.data(QtCore.Qt.UserRole)
|
||||||
if old_name != new_name:
|
if old_name != new_name:
|
||||||
self.themeListWidget.item(count).setText(new_name)
|
self.theme_list_widget.item(count).setText(new_name)
|
||||||
# Set the new name
|
# Set the new name
|
||||||
if theme_name == new_name:
|
if theme_name == new_name:
|
||||||
name = translate('OpenLP.ThemeManager', '%s (default)') % new_name
|
name = translate('OpenLP.ThemeManager', '%s (default)') % new_name
|
||||||
self.themeListWidget.item(count).setText(name)
|
self.theme_list_widget.item(count).setText(name)
|
||||||
self.deleteToolbarAction.setVisible(
|
self.deleteToolbarAction.setVisible(
|
||||||
item not in self.themeListWidget.selectedItems())
|
item not in self.theme_list_widget.selectedItems())
|
||||||
|
|
||||||
def changeGlobalFromScreen(self, index=-1):
|
def changeGlobalFromScreen(self, index=-1):
|
||||||
"""
|
"""
|
||||||
|
@ -217,21 +217,21 @@ class ThemeManager(QtGui.QWidget):
|
||||||
Theme Manager list
|
Theme Manager list
|
||||||
"""
|
"""
|
||||||
log.debug(u'changeGlobalFromScreen %s', index)
|
log.debug(u'changeGlobalFromScreen %s', index)
|
||||||
selected_row = self.themeListWidget.currentRow()
|
selected_row = self.theme_list_widget.currentRow()
|
||||||
for count in range (0, self.themeListWidget.count()):
|
for count in range (0, self.theme_list_widget.count()):
|
||||||
item = self.themeListWidget.item(count)
|
item = self.theme_list_widget.item(count)
|
||||||
old_name = item.text()
|
old_name = item.text()
|
||||||
# reset the old name
|
# reset the old name
|
||||||
if old_name != item.data(QtCore.Qt.UserRole):
|
if old_name != item.data(QtCore.Qt.UserRole):
|
||||||
self.themeListWidget.item(count).setText(item.data(QtCore.Qt.UserRole))
|
self.theme_list_widget.item(count).setText(item.data(QtCore.Qt.UserRole))
|
||||||
# Set the new name
|
# Set the new name
|
||||||
if count == selected_row:
|
if count == selected_row:
|
||||||
self.global_theme = self.themeListWidget.item(count).text()
|
self.global_theme = self.theme_list_widget.item(count).text()
|
||||||
name = translate('OpenLP.ThemeManager', '%s (default)') % self.global_theme
|
name = translate('OpenLP.ThemeManager', '%s (default)') % self.global_theme
|
||||||
self.themeListWidget.item(count).setText(name)
|
self.theme_list_widget.item(count).setText(name)
|
||||||
Settings().setValue(self.settingsSection + u'/global theme', self.global_theme)
|
Settings().setValue(self.settingsSection + u'/global theme', self.global_theme)
|
||||||
Receiver.send_message(u'theme_update_global', self.global_theme)
|
Receiver.send_message(u'theme_update_global', self.global_theme)
|
||||||
self._pushThemes()
|
self._push_themes()
|
||||||
|
|
||||||
def onAddTheme(self):
|
def onAddTheme(self):
|
||||||
"""
|
"""
|
||||||
|
@ -242,44 +242,44 @@ class ThemeManager(QtGui.QWidget):
|
||||||
theme.set_default_header_footer()
|
theme.set_default_header_footer()
|
||||||
self.themeForm.theme = theme
|
self.themeForm.theme = theme
|
||||||
self.themeForm.exec_()
|
self.themeForm.exec_()
|
||||||
self.loadThemes()
|
self.load_themes()
|
||||||
|
|
||||||
def onRenameTheme(self):
|
def on_rename_theme(self):
|
||||||
"""
|
"""
|
||||||
Renames an existing theme to a new name
|
Renames an existing theme to a new name
|
||||||
"""
|
"""
|
||||||
if self._validate_theme_action(translate('OpenLP.ThemeManager', 'You must select a theme to rename.'),
|
if self._validate_theme_action(translate('OpenLP.ThemeManager', 'You must select a theme to rename.'),
|
||||||
translate('OpenLP.ThemeManager', 'Rename Confirmation'),
|
translate('OpenLP.ThemeManager', 'Rename Confirmation'),
|
||||||
translate('OpenLP.ThemeManager', 'Rename %s theme?'), False, False):
|
translate('OpenLP.ThemeManager', 'Rename %s theme?'), False, False):
|
||||||
item = self.themeListWidget.currentItem()
|
item = self.theme_list_widget.currentItem()
|
||||||
old_theme_name = item.data(QtCore.Qt.UserRole)
|
old_theme_name = item.data(QtCore.Qt.UserRole)
|
||||||
self.fileRenameForm.fileNameEdit.setText(old_theme_name)
|
self.fileRenameForm.fileNameEdit.setText(old_theme_name)
|
||||||
if self.fileRenameForm.exec_():
|
if self.fileRenameForm.exec_():
|
||||||
new_theme_name = self.fileRenameForm.fileNameEdit.text()
|
new_theme_name = self.fileRenameForm.fileNameEdit.text()
|
||||||
if old_theme_name == new_theme_name:
|
if old_theme_name == new_theme_name:
|
||||||
return
|
return
|
||||||
if self.checkIfThemeExists(new_theme_name):
|
if self.check_if_theme_exists(new_theme_name):
|
||||||
old_theme_data = self.getThemeData(old_theme_name)
|
old_theme_data = self.get_theme_data(old_theme_name)
|
||||||
self.cloneThemeData(old_theme_data, new_theme_name)
|
self.cloneThemeData(old_theme_data, new_theme_name)
|
||||||
self.deleteTheme(old_theme_name)
|
self.delete_theme(old_theme_name)
|
||||||
for plugin in self.plugin_manager.plugins:
|
for plugin in self.plugin_manager.plugins:
|
||||||
if plugin.usesTheme(old_theme_name):
|
if plugin.usesTheme(old_theme_name):
|
||||||
plugin.renameTheme(old_theme_name, new_theme_name)
|
plugin.renameTheme(old_theme_name, new_theme_name)
|
||||||
self.renderer.update_theme(new_theme_name, old_theme_name)
|
self.renderer.update_theme(new_theme_name, old_theme_name)
|
||||||
self.loadThemes()
|
self.load_themes()
|
||||||
|
|
||||||
def onCopyTheme(self):
|
def on_copy_theme(self):
|
||||||
"""
|
"""
|
||||||
Copies an existing theme to a new name
|
Copies an existing theme to a new name
|
||||||
"""
|
"""
|
||||||
item = self.themeListWidget.currentItem()
|
item = self.theme_list_widget.currentItem()
|
||||||
old_theme_name = item.data(QtCore.Qt.UserRole)
|
old_theme_name = item.data(QtCore.Qt.UserRole)
|
||||||
self.fileRenameForm.fileNameEdit.setText(translate('OpenLP.ThemeManager',
|
self.fileRenameForm.fileNameEdit.setText(translate('OpenLP.ThemeManager',
|
||||||
'Copy of %s', 'Copy of <theme name>') % old_theme_name)
|
'Copy of %s', 'Copy of <theme name>') % old_theme_name)
|
||||||
if self.fileRenameForm.exec_(True):
|
if self.fileRenameForm.exec_(True):
|
||||||
new_theme_name = self.fileRenameForm.fileNameEdit.text()
|
new_theme_name = self.fileRenameForm.fileNameEdit.text()
|
||||||
if self.checkIfThemeExists(new_theme_name):
|
if self.check_if_theme_exists(new_theme_name):
|
||||||
theme_data = self.getThemeData(old_theme_name)
|
theme_data = self.get_theme_data(old_theme_name)
|
||||||
self.cloneThemeData(theme_data, new_theme_name)
|
self.cloneThemeData(theme_data, new_theme_name)
|
||||||
|
|
||||||
def cloneThemeData(self, theme_data, new_theme_name):
|
def cloneThemeData(self, theme_data, new_theme_name):
|
||||||
|
@ -295,65 +295,65 @@ class ThemeManager(QtGui.QWidget):
|
||||||
save_from = theme_data.background_filename
|
save_from = theme_data.background_filename
|
||||||
theme_data.theme_name = new_theme_name
|
theme_data.theme_name = new_theme_name
|
||||||
theme_data.extend_image_filename(self.path)
|
theme_data.extend_image_filename(self.path)
|
||||||
self.saveTheme(theme_data, save_from, save_to)
|
self.save_theme(theme_data, save_from, save_to)
|
||||||
self.loadThemes()
|
self.load_themes()
|
||||||
|
|
||||||
def onEditTheme(self):
|
def on_edit_theme(self):
|
||||||
"""
|
"""
|
||||||
Loads the settings for the theme that is to be edited and launches the
|
Loads the settings for the theme that is to be edited and launches the
|
||||||
theme editing form so the user can make their changes.
|
theme editing form so the user can make their changes.
|
||||||
"""
|
"""
|
||||||
if check_item_selected(self.themeListWidget,
|
if check_item_selected(self.theme_list_widget,
|
||||||
translate('OpenLP.ThemeManager', 'You must select a theme to edit.')):
|
translate('OpenLP.ThemeManager', 'You must select a theme to edit.')):
|
||||||
item = self.themeListWidget.currentItem()
|
item = self.theme_list_widget.currentItem()
|
||||||
theme = self.getThemeData(item.data(QtCore.Qt.UserRole))
|
theme = self.get_theme_data(item.data(QtCore.Qt.UserRole))
|
||||||
if theme.background_type == u'image':
|
if theme.background_type == u'image':
|
||||||
self.oldBackgroundImage = theme.background_filename
|
self.oldBackgroundImage = theme.background_filename
|
||||||
self.themeForm.theme = theme
|
self.themeForm.theme = theme
|
||||||
self.themeForm.exec_(True)
|
self.themeForm.exec_(True)
|
||||||
self.oldBackgroundImage = None
|
self.oldBackgroundImage = None
|
||||||
self.renderer.update_theme(theme.theme_name)
|
self.renderer.update_theme(theme.theme_name)
|
||||||
self.loadThemes()
|
self.load_themes()
|
||||||
|
|
||||||
def onDeleteTheme(self):
|
def on_delete_theme(self):
|
||||||
"""
|
"""
|
||||||
Delete a theme
|
Delete a theme
|
||||||
"""
|
"""
|
||||||
if self._validate_theme_action(translate('OpenLP.ThemeManager', 'You must select a theme to delete.'),
|
if self._validate_theme_action(translate('OpenLP.ThemeManager', 'You must select a theme to delete.'),
|
||||||
translate('OpenLP.ThemeManager', 'Delete Confirmation'),
|
translate('OpenLP.ThemeManager', 'Delete Confirmation'),
|
||||||
translate('OpenLP.ThemeManager', 'Delete %s theme?')):
|
translate('OpenLP.ThemeManager', 'Delete %s theme?')):
|
||||||
item = self.themeListWidget.currentItem()
|
item = self.theme_list_widget.currentItem()
|
||||||
theme = item.text()
|
theme = item.text()
|
||||||
row = self.themeListWidget.row(item)
|
row = self.theme_list_widget.row(item)
|
||||||
self.themeListWidget.takeItem(row)
|
self.theme_list_widget.takeItem(row)
|
||||||
self.deleteTheme(theme)
|
self.delete_theme(theme)
|
||||||
self.renderer.update_theme(theme, only_delete=True)
|
self.renderer.update_theme(theme, only_delete=True)
|
||||||
# As we do not reload the themes, push out the change. Reload the
|
# As we do not reload the themes, push out the change. Reload the
|
||||||
# list as the internal lists and events need to be triggered.
|
# list as the internal lists and events need to be triggered.
|
||||||
self._pushThemes()
|
self._push_themes()
|
||||||
|
|
||||||
def deleteTheme(self, theme):
|
def delete_theme(self, theme):
|
||||||
"""
|
"""
|
||||||
Delete a theme.
|
Delete a theme.
|
||||||
|
|
||||||
``theme``
|
``theme``
|
||||||
The theme to delete.
|
The theme to delete.
|
||||||
"""
|
"""
|
||||||
self.themeList.remove(theme)
|
self.theme_list.remove(theme)
|
||||||
thumb = u'%s.png' % theme
|
thumb = u'%s.png' % theme
|
||||||
delete_file(os.path.join(self.path, thumb))
|
delete_file(os.path.join(self.path, thumb))
|
||||||
delete_file(os.path.join(self.thumbPath, thumb))
|
delete_file(os.path.join(self.thumbPath, thumb))
|
||||||
try:
|
try:
|
||||||
encoding = get_filesystem_encoding()
|
encoding = get_filesystem_encoding()
|
||||||
shutil.rmtree(os.path.join(self.path, theme).encode(encoding))
|
shutil.rmtree(os.path.join(self.path, theme).encode(encoding))
|
||||||
except OSError:
|
except OSError, shutil.Error:
|
||||||
log.exception(u'Error deleting theme %s', theme)
|
log.exception(u'Error deleting theme %s', theme)
|
||||||
|
|
||||||
def onExportTheme(self):
|
def on_export_theme(self):
|
||||||
"""
|
"""
|
||||||
Export the theme in a zip file
|
Export the theme in a zip file
|
||||||
"""
|
"""
|
||||||
item = self.themeListWidget.currentItem()
|
item = self.theme_list_widget.currentItem()
|
||||||
if item is None:
|
if item is None:
|
||||||
critical_error_message_box(message=translate('OpenLP.ThemeManager', 'You have not selected a theme.'))
|
critical_error_message_box(message=translate('OpenLP.ThemeManager', 'You have not selected a theme.'))
|
||||||
return
|
return
|
||||||
|
@ -366,29 +366,26 @@ class ThemeManager(QtGui.QWidget):
|
||||||
Settings().setValue(self.settingsSection + u'/last directory export', path)
|
Settings().setValue(self.settingsSection + u'/last directory export', path)
|
||||||
theme_path = os.path.join(path, theme + u'.otz')
|
theme_path = os.path.join(path, theme + u'.otz')
|
||||||
# FIXME: Do not overwrite build-in.
|
# FIXME: Do not overwrite build-in.
|
||||||
zip = None
|
zip_file = None
|
||||||
try:
|
try:
|
||||||
zip = zipfile.ZipFile(theme_path, u'w')
|
zip_file = zipfile.ZipFile(theme_path, u'w')
|
||||||
source = os.path.join(self.path, theme)
|
source = os.path.join(self.path, theme)
|
||||||
for files in os.walk(source):
|
for files in os.walk(source):
|
||||||
for name in files[2]:
|
for name in files[2]:
|
||||||
zip.write(
|
zip_file.write(os.path.join(source, name).encode(u'utf-8'),
|
||||||
os.path.join(source, name).encode(u'utf-8'),
|
|
||||||
os.path.join(theme, name).encode(u'utf-8'))
|
os.path.join(theme, name).encode(u'utf-8'))
|
||||||
QtGui.QMessageBox.information(self,
|
QtGui.QMessageBox.information(self, translate('OpenLP.ThemeManager', 'Theme Exported'),
|
||||||
translate('OpenLP.ThemeManager', 'Theme Exported'),
|
|
||||||
translate('OpenLP.ThemeManager', 'Your theme has been successfully exported.'))
|
translate('OpenLP.ThemeManager', 'Your theme has been successfully exported.'))
|
||||||
except (IOError, OSError):
|
except (IOError, OSError):
|
||||||
log.exception(u'Export Theme Failed')
|
log.exception(u'Export Theme Failed')
|
||||||
critical_error_message_box(
|
critical_error_message_box(translate('OpenLP.ThemeManager', 'Theme Export Failed'),
|
||||||
translate('OpenLP.ThemeManager', 'Theme Export Failed'),
|
|
||||||
translate('OpenLP.ThemeManager', 'Your theme could not be exported due to an error.'))
|
translate('OpenLP.ThemeManager', 'Your theme could not be exported due to an error.'))
|
||||||
finally:
|
finally:
|
||||||
if zip:
|
if zip_file:
|
||||||
zip.close()
|
zip_file.close()
|
||||||
Receiver.send_message(u'cursor_normal')
|
Receiver.send_message(u'cursor_normal')
|
||||||
|
|
||||||
def onImportTheme(self):
|
def on_import_theme(self):
|
||||||
"""
|
"""
|
||||||
Opens a file dialog to select the theme file(s) to import before
|
Opens a file dialog to select the theme file(s) to import before
|
||||||
attempting to extract OpenLP themes from those files. This process
|
attempting to extract OpenLP themes from those files. This process
|
||||||
|
@ -402,36 +399,35 @@ class ThemeManager(QtGui.QWidget):
|
||||||
if not files:
|
if not files:
|
||||||
return
|
return
|
||||||
Receiver.send_message(u'cursor_busy')
|
Receiver.send_message(u'cursor_busy')
|
||||||
for file in files:
|
for file_name in files:
|
||||||
Settings().setValue(self.settingsSection + u'/last directory import', unicode(file))
|
Settings().setValue(self.settingsSection + u'/last directory import', unicode(file_name))
|
||||||
self.unzipTheme(file, self.path)
|
self.unzip_theme(file_name, self.path)
|
||||||
self.loadThemes()
|
self.load_themes()
|
||||||
Receiver.send_message(u'cursor_normal')
|
Receiver.send_message(u'cursor_normal')
|
||||||
|
|
||||||
def loadThemes(self, firstTime=False):
|
def load_themes(self, first_time=False):
|
||||||
"""
|
"""
|
||||||
Loads the theme lists and triggers updates accross the whole system
|
Loads the theme lists and triggers updates accross the whole system
|
||||||
using direct calls or core functions and events for the plugins.
|
using direct calls or core functions and events for the plugins.
|
||||||
The plugins will call back in to get the real list if they want it.
|
The plugins will call back in to get the real list if they want it.
|
||||||
"""
|
"""
|
||||||
log.debug(u'Load themes from dir')
|
log.debug(u'Load themes from dir')
|
||||||
self.themeList = []
|
self.theme_list = []
|
||||||
self.themeListWidget.clear()
|
self.theme_list_widget.clear()
|
||||||
files = SettingsManager.get_files(self.settingsSection, u'.png')
|
files = SettingsManager.get_files(self.settingsSection, u'.png')
|
||||||
if firstTime:
|
if first_time:
|
||||||
self.firstTime()
|
self.first_time()
|
||||||
files = SettingsManager.get_files(self.settingsSection, u'.png')
|
files = SettingsManager.get_files(self.settingsSection, u'.png')
|
||||||
# No themes have been found so create one
|
# No themes have been found so create one
|
||||||
if not files:
|
if not files:
|
||||||
theme = ThemeXML()
|
theme = ThemeXML()
|
||||||
theme.theme_name = UiStrings().Default
|
theme.theme_name = UiStrings().Default
|
||||||
self._writeTheme(theme, None, None)
|
self._write_theme(theme, None, None)
|
||||||
Settings().setValue(self.settingsSection + u'/global theme', theme.theme_name)
|
Settings().setValue(self.settingsSection + u'/global theme', theme.theme_name)
|
||||||
self.configUpdated()
|
self.config_updated()
|
||||||
files = SettingsManager.get_files(self.settingsSection, u'.png')
|
files = SettingsManager.get_files(self.settingsSection, u'.png')
|
||||||
# Sort the themes by its name considering language specific
|
# Sort the themes by its name considering language specific
|
||||||
files.sort(key=lambda file_name: unicode(file_name),
|
files.sort(key=lambda file_name: unicode(file_name), cmp=locale_compare)
|
||||||
cmp=locale_compare)
|
|
||||||
# now process the file list of png files
|
# now process the file list of png files
|
||||||
for name in files:
|
for name in files:
|
||||||
# check to see file is in theme root directory
|
# check to see file is in theme root directory
|
||||||
|
@ -450,23 +446,23 @@ class ThemeManager(QtGui.QWidget):
|
||||||
icon = create_thumb(theme, thumb)
|
icon = create_thumb(theme, thumb)
|
||||||
item_name.setIcon(icon)
|
item_name.setIcon(icon)
|
||||||
item_name.setData(QtCore.Qt.UserRole, text_name)
|
item_name.setData(QtCore.Qt.UserRole, text_name)
|
||||||
self.themeListWidget.addItem(item_name)
|
self.theme_list_widget.addItem(item_name)
|
||||||
self.themeList.append(text_name)
|
self.theme_list.append(text_name)
|
||||||
self._pushThemes()
|
self._push_themes()
|
||||||
|
|
||||||
def _pushThemes(self):
|
def _push_themes(self):
|
||||||
"""
|
"""
|
||||||
Notify listeners that the theme list has been updated
|
Notify listeners that the theme list has been updated
|
||||||
"""
|
"""
|
||||||
Receiver.send_message(u'theme_update_list', self.getThemes())
|
Receiver.send_message(u'theme_update_list', self.get_themes())
|
||||||
|
|
||||||
def getThemes(self):
|
def get_themes(self):
|
||||||
"""
|
"""
|
||||||
Return the list of loaded themes
|
Return the list of loaded themes
|
||||||
"""
|
"""
|
||||||
return self.themeList
|
return self.theme_list
|
||||||
|
|
||||||
def getThemeData(self, theme_name):
|
def get_theme_data(self, theme_name):
|
||||||
"""
|
"""
|
||||||
Returns a theme object from an XML file
|
Returns a theme object from an XML file
|
||||||
|
|
||||||
|
@ -480,18 +476,20 @@ class ThemeManager(QtGui.QWidget):
|
||||||
log.debug(u'No theme data - using default theme')
|
log.debug(u'No theme data - using default theme')
|
||||||
return ThemeXML()
|
return ThemeXML()
|
||||||
else:
|
else:
|
||||||
return self._createThemeFromXml(xml, self.path)
|
return self._create_theme_fom_Xml(xml, self.path)
|
||||||
|
|
||||||
def overWriteMessageBox(self, theme_name):
|
def over_write_message_box(self, theme_name):
|
||||||
ret = QtGui.QMessageBox.question(self,
|
"""
|
||||||
translate('OpenLP.ThemeManager', 'Theme Already Exists'),
|
Check before overwriting the theme
|
||||||
|
"""
|
||||||
|
ret = QtGui.QMessageBox.question(self, translate('OpenLP.ThemeManager', 'Theme Already Exists'),
|
||||||
translate('OpenLP.ThemeManager',
|
translate('OpenLP.ThemeManager',
|
||||||
'Theme %s already exists. Do you want to replace it?').replace('%s', theme_name),
|
'Theme %s already exists. Do you want to replace it?').replace('%s', theme_name),
|
||||||
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes | QtGui.QMessageBox.No),
|
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes | QtGui.QMessageBox.No),
|
||||||
QtGui.QMessageBox.No)
|
QtGui.QMessageBox.No)
|
||||||
return ret == QtGui.QMessageBox.Yes
|
return ret == QtGui.QMessageBox.Yes
|
||||||
|
|
||||||
def unzipTheme(self, file_name, dir):
|
def unzip_theme(self, file_name, dir):
|
||||||
"""
|
"""
|
||||||
Unzip the theme, remove the preview file if stored
|
Unzip the theme, remove the preview file if stored
|
||||||
Generate a new preview file. Check the XML theme version and upgrade if
|
Generate a new preview file. Check the XML theme version and upgrade if
|
||||||
|
@ -499,32 +497,32 @@ class ThemeManager(QtGui.QWidget):
|
||||||
"""
|
"""
|
||||||
log.debug(u'Unzipping theme %s', file_name)
|
log.debug(u'Unzipping theme %s', file_name)
|
||||||
file_name = unicode(file_name)
|
file_name = unicode(file_name)
|
||||||
zip = None
|
zip_file = None
|
||||||
out_file = None
|
out_file = None
|
||||||
file_xml = None
|
file_xml = None
|
||||||
abort_import = True
|
abort_import = True
|
||||||
try:
|
try:
|
||||||
zip = zipfile.ZipFile(file_name)
|
zip_file = zipfile.ZipFile(file_name)
|
||||||
xml_file = filter(lambda name:
|
xml_file = filter(lambda name:
|
||||||
os.path.splitext(name)[1].lower() == u'.xml', zip.namelist())
|
os.path.splitext(name)[1].lower() == u'.xml', zip_file.namelist())
|
||||||
if len(xml_file) != 1:
|
if len(xml_file) != 1:
|
||||||
log.exception(u'Theme contains "%s" XML files' % len(xml_file))
|
log.exception(u'Theme contains "%s" XML files' % len(xml_file))
|
||||||
raise Exception(u'validation')
|
raise Exception('validation')
|
||||||
xml_tree = ElementTree(element=XML(zip.read(xml_file[0]))).getroot()
|
xml_tree = ElementTree(element=XML(zip_file.read(xml_file[0]))).getroot()
|
||||||
v1_background = xml_tree.find(u'BackgroundType')
|
v1_background = xml_tree.find(u'BackgroundType')
|
||||||
if v1_background is not None:
|
if v1_background is not None:
|
||||||
theme_name, file_xml, out_file, abort_import = self.unzipVersion122(
|
theme_name, file_xml, out_file, abort_import = self.unzip_version_122(
|
||||||
dir, zip, xml_file[0], xml_tree, v1_background, out_file)
|
dir, zip_file, xml_file[0], xml_tree, v1_background, out_file)
|
||||||
else:
|
else:
|
||||||
theme_name = xml_tree.find(u'name').text.strip()
|
theme_name = xml_tree.find(u'name').text.strip()
|
||||||
theme_folder = os.path.join(dir, theme_name)
|
theme_folder = os.path.join(dir, theme_name)
|
||||||
theme_exists = os.path.exists(theme_folder)
|
theme_exists = os.path.exists(theme_folder)
|
||||||
if theme_exists and not self.overWriteMessageBox(theme_name):
|
if theme_exists and not self.over_write_message_box(theme_name):
|
||||||
abort_import = True
|
abort_import = True
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
abort_import = False
|
abort_import = False
|
||||||
for name in zip.namelist():
|
for name in zip_file.namelist():
|
||||||
try:
|
try:
|
||||||
uname = unicode(name, u'utf-8')
|
uname = unicode(name, u'utf-8')
|
||||||
except UnicodeDecodeError:
|
except UnicodeDecodeError:
|
||||||
|
@ -539,12 +537,12 @@ class ThemeManager(QtGui.QWidget):
|
||||||
full_name = os.path.join(dir, uname)
|
full_name = os.path.join(dir, uname)
|
||||||
check_directory_exists(os.path.dirname(full_name))
|
check_directory_exists(os.path.dirname(full_name))
|
||||||
if os.path.splitext(uname)[1].lower() == u'.xml':
|
if os.path.splitext(uname)[1].lower() == u'.xml':
|
||||||
file_xml = unicode(zip.read(name), u'utf-8')
|
file_xml = unicode(zip_file.read(name), u'utf-8')
|
||||||
out_file = open(full_name, u'w')
|
out_file = open(full_name, u'w')
|
||||||
out_file.write(file_xml.encode(u'utf-8'))
|
out_file.write(file_xml.encode(u'utf-8'))
|
||||||
else:
|
else:
|
||||||
out_file = open(full_name, u'wb')
|
out_file = open(full_name, u'wb')
|
||||||
out_file.write(zip.read(name))
|
out_file.write(zip_file.read(name))
|
||||||
out_file.close()
|
out_file.close()
|
||||||
except (IOError, zipfile.BadZipfile):
|
except (IOError, zipfile.BadZipfile):
|
||||||
log.exception(u'Importing theme from zip failed %s' % file_name)
|
log.exception(u'Importing theme from zip failed %s' % file_name)
|
||||||
|
@ -557,15 +555,15 @@ class ThemeManager(QtGui.QWidget):
|
||||||
raise
|
raise
|
||||||
finally:
|
finally:
|
||||||
# Close the files, to be able to continue creating the theme.
|
# Close the files, to be able to continue creating the theme.
|
||||||
if zip:
|
if zip_file:
|
||||||
zip.close()
|
zip_file.close()
|
||||||
if out_file:
|
if out_file:
|
||||||
out_file.close()
|
out_file.close()
|
||||||
if not abort_import:
|
if not abort_import:
|
||||||
# As all files are closed, we can create the Theme.
|
# As all files are closed, we can create the Theme.
|
||||||
if file_xml:
|
if file_xml:
|
||||||
theme = self._createThemeFromXml(file_xml, self.path)
|
theme = self._create_theme_fom_Xml(file_xml, self.path)
|
||||||
self.generateAndSaveImage(dir, theme_name, theme)
|
self.generate_and_save_image(dir, theme_name, theme)
|
||||||
# Only show the error message, when IOError was not raised (in
|
# Only show the error message, when IOError was not raised (in
|
||||||
# this case the error message has already been shown).
|
# this case the error message has already been shown).
|
||||||
elif zip is not None:
|
elif zip is not None:
|
||||||
|
@ -574,22 +572,21 @@ class ThemeManager(QtGui.QWidget):
|
||||||
translate('OpenLP.ThemeManager', 'File is not a valid theme.'))
|
translate('OpenLP.ThemeManager', 'File is not a valid theme.'))
|
||||||
log.exception(u'Theme file does not contain XML data %s' % file_name)
|
log.exception(u'Theme file does not contain XML data %s' % file_name)
|
||||||
|
|
||||||
def unzipVersion122(self, dir, zip, xml_file, xml_tree, background,
|
def unzip_version_122(self, dir_name, zip_file, xml_file, xml_tree, background, out_file):
|
||||||
out_file):
|
|
||||||
"""
|
"""
|
||||||
Unzip openlp.org 1.2x theme file and upgrade the theme xml. When calling
|
Unzip openlp.org 1.2x theme file and upgrade the theme xml. When calling
|
||||||
this method, please keep in mind, that some parameters are redundant.
|
this method, please keep in mind, that some parameters are redundant.
|
||||||
"""
|
"""
|
||||||
theme_name = xml_tree.find(u'Name').text.strip()
|
theme_name = xml_tree.find(u'Name').text.strip()
|
||||||
theme_name = self.badV1NameChars.sub(u'', theme_name)
|
theme_name = self.badV1NameChars.sub(u'', theme_name)
|
||||||
theme_folder = os.path.join(dir, theme_name)
|
theme_folder = os.path.join(dir_name, theme_name)
|
||||||
theme_exists = os.path.exists(theme_folder)
|
theme_exists = os.path.exists(theme_folder)
|
||||||
if theme_exists and not self.overWriteMessageBox(theme_name):
|
if theme_exists and not self.over_write_message_box(theme_name):
|
||||||
return '', '', '', True
|
return '', '', '', True
|
||||||
themedir = os.path.join(dir, theme_name)
|
themedir = os.path.join(dir_name, theme_name)
|
||||||
check_directory_exists(themedir)
|
check_directory_exists(themedir)
|
||||||
file_xml = unicode(zip.read(xml_file), u'utf-8')
|
file_xml = unicode(zip_file.read(xml_file), u'utf-8')
|
||||||
file_xml = self._migrateVersion122(file_xml)
|
file_xml = self._migrate_version_122(file_xml)
|
||||||
out_file = open(os.path.join(themedir, theme_name + u'.xml'), u'w')
|
out_file = open(os.path.join(themedir, theme_name + u'.xml'), u'w')
|
||||||
out_file.write(file_xml.encode(u'utf-8'))
|
out_file.write(file_xml.encode(u'utf-8'))
|
||||||
out_file.close()
|
out_file.close()
|
||||||
|
@ -597,18 +594,17 @@ class ThemeManager(QtGui.QWidget):
|
||||||
image_name = xml_tree.find(u'BackgroundParameter1').text.strip()
|
image_name = xml_tree.find(u'BackgroundParameter1').text.strip()
|
||||||
# image file has same extension and is in subfolder
|
# image file has same extension and is in subfolder
|
||||||
image_file = filter(lambda name: os.path.splitext(name)[1].lower()
|
image_file = filter(lambda name: os.path.splitext(name)[1].lower()
|
||||||
== os.path.splitext(image_name)[1].lower() and name.find(r'/'),
|
== os.path.splitext(image_name)[1].lower() and name.find(r'/'), zip_file.namelist())
|
||||||
zip.namelist())
|
|
||||||
if len(image_file) >= 1:
|
if len(image_file) >= 1:
|
||||||
out_file = open(os.path.join(themedir, image_name), u'wb')
|
out_file = open(os.path.join(themedir, image_name), u'wb')
|
||||||
out_file.write(zip.read(image_file[0]))
|
out_file.write(zip_file.read(image_file[0]))
|
||||||
out_file.close()
|
out_file.close()
|
||||||
else:
|
else:
|
||||||
log.exception(u'Theme file does not contain image file "%s"' % image_name.decode(u'utf-8', u'replace'))
|
log.exception(u'Theme file does not contain image file "%s"' % image_name.decode(u'utf-8', u'replace'))
|
||||||
raise Exception(u'validation')
|
raise Exception(u'validation')
|
||||||
return theme_name, file_xml, out_file, False
|
return theme_name, file_xml, out_file, False
|
||||||
|
|
||||||
def checkIfThemeExists(self, theme_name):
|
def check_if_theme_exists(self, theme_name):
|
||||||
"""
|
"""
|
||||||
Check if theme already exists and displays error message
|
Check if theme already exists and displays error message
|
||||||
|
|
||||||
|
@ -623,25 +619,25 @@ class ThemeManager(QtGui.QWidget):
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def saveTheme(self, theme, image_from, image_to):
|
def save_theme(self, theme, image_from, image_to):
|
||||||
"""
|
"""
|
||||||
Called by thememaintenance Dialog to save the theme
|
Called by thememaintenance Dialog to save the theme
|
||||||
and to trigger the reload of the theme list
|
and to trigger the reload of the theme list
|
||||||
"""
|
"""
|
||||||
self._writeTheme(theme, image_from, image_to)
|
self._write_theme(theme, image_from, image_to)
|
||||||
if theme.background_type == BackgroundType.to_string(BackgroundType.Image):
|
if theme.background_type == BackgroundType.to_string(BackgroundType.Image):
|
||||||
self.image_manager.updateImageBorder(theme.background_filename,
|
self.image_manager.updateImageBorder(theme.background_filename,
|
||||||
ImageSource.Theme, QtGui.QColor(theme.background_border_color))
|
ImageSource.Theme, QtGui.QColor(theme.background_border_color))
|
||||||
self.image_manager.processUpdates()
|
self.image_manager.processUpdates()
|
||||||
|
|
||||||
def _writeTheme(self, theme, image_from, image_to):
|
def _write_theme(self, theme, image_from, image_to):
|
||||||
"""
|
"""
|
||||||
Writes the theme to the disk and handles the background image if
|
Writes the theme to the disk and handles the background image if
|
||||||
necessary
|
necessary
|
||||||
"""
|
"""
|
||||||
name = theme.theme_name
|
name = theme.theme_name
|
||||||
theme_pretty_xml = theme.extract_formatted_xml()
|
theme_pretty_xml = theme.extract_formatted_xml()
|
||||||
log.debug(u'saveTheme %s %s', name, theme_pretty_xml.decode(u'utf-8'))
|
log.debug(u'save_theme %s %s', name, theme_pretty_xml.decode(u'utf-8'))
|
||||||
theme_dir = os.path.join(self.path, name)
|
theme_dir = os.path.join(self.path, name)
|
||||||
check_directory_exists(theme_dir)
|
check_directory_exists(theme_dir)
|
||||||
theme_file = os.path.join(theme_dir, name + u'.xml')
|
theme_file = os.path.join(theme_dir, name + u'.xml')
|
||||||
|
@ -660,13 +656,16 @@ class ThemeManager(QtGui.QWidget):
|
||||||
try:
|
try:
|
||||||
encoding = get_filesystem_encoding()
|
encoding = get_filesystem_encoding()
|
||||||
shutil.copyfile(unicode(image_from).encode(encoding), unicode(image_to).encode(encoding))
|
shutil.copyfile(unicode(image_from).encode(encoding), unicode(image_to).encode(encoding))
|
||||||
except IOError:
|
except IOError, shutil.Error:
|
||||||
log.exception(u'Failed to save theme image')
|
log.exception(u'Failed to save theme image')
|
||||||
self.generateAndSaveImage(self.path, name, theme)
|
self.generate_and_save_image(self.path, name, theme)
|
||||||
|
|
||||||
def generateAndSaveImage(self, dir, name, theme):
|
def generate_and_save_image(self, dir, name, theme):
|
||||||
log.debug(u'generateAndSaveImage %s %s', dir, name)
|
"""
|
||||||
frame = self.generateImage(theme)
|
Generate and Save the theme image.
|
||||||
|
"""
|
||||||
|
log.debug(u'generate_and_save_image %s %s', dir, name)
|
||||||
|
frame = self.generate_image(theme)
|
||||||
sample_path_name = os.path.join(self.path, name + u'.png')
|
sample_path_name = os.path.join(self.path, name + u'.png')
|
||||||
if os.path.exists(sample_path_name):
|
if os.path.exists(sample_path_name):
|
||||||
os.unlink(sample_path_name)
|
os.unlink(sample_path_name)
|
||||||
|
@ -675,18 +674,18 @@ class ThemeManager(QtGui.QWidget):
|
||||||
create_thumb(sample_path_name, thumb, False)
|
create_thumb(sample_path_name, thumb, False)
|
||||||
log.debug(u'Theme image written to %s', sample_path_name)
|
log.debug(u'Theme image written to %s', sample_path_name)
|
||||||
|
|
||||||
def updatePreviewImages(self):
|
def update_preview_images(self):
|
||||||
"""
|
"""
|
||||||
Called to update the themes' preview images.
|
Called to update the themes' preview images.
|
||||||
"""
|
"""
|
||||||
self.main_window.displayProgressBar(len(self.themeList))
|
self.main_window.displayProgressBar(len(self.theme_list))
|
||||||
for theme in self.themeList:
|
for theme in self.theme_list:
|
||||||
self.main_window.incrementProgressBar()
|
self.main_window.incrementProgressBar()
|
||||||
self.generateAndSaveImage(self.path, theme, self.getThemeData(theme))
|
self.generate_and_save_image(self.path, theme, self.get_theme_data(theme))
|
||||||
self.main_window.finishedProgressBar()
|
self.main_window.finishedProgressBar()
|
||||||
self.loadThemes()
|
self.load_themes()
|
||||||
|
|
||||||
def generateImage(self, theme_data, forcePage=False):
|
def generate_image(self, theme_data, forcePage=False):
|
||||||
"""
|
"""
|
||||||
Call the renderer to build a Sample Image
|
Call the renderer to build a Sample Image
|
||||||
|
|
||||||
|
@ -696,21 +695,21 @@ class ThemeManager(QtGui.QWidget):
|
||||||
``forcePage``
|
``forcePage``
|
||||||
Flag to tell message lines per page need to be generated.
|
Flag to tell message lines per page need to be generated.
|
||||||
"""
|
"""
|
||||||
log.debug(u'generateImage \n%s ', theme_data)
|
log.debug(u'generate_image \n%s ', theme_data)
|
||||||
return self.renderer.generate_preview(theme_data, forcePage)
|
return self.renderer.generate_preview(theme_data, forcePage)
|
||||||
|
|
||||||
def getPreviewImage(self, theme):
|
def get_preview_image(self, theme):
|
||||||
"""
|
"""
|
||||||
Return an image representing the look of the theme
|
Return an image representing the look of the theme
|
||||||
|
|
||||||
``theme``
|
``theme``
|
||||||
The theme to return the image for
|
The theme to return the image for
|
||||||
"""
|
"""
|
||||||
log.debug(u'getPreviewImage %s ', theme)
|
log.debug(u'get_preview_image %s ', theme)
|
||||||
image = os.path.join(self.path, theme + u'.png')
|
image = os.path.join(self.path, theme + u'.png')
|
||||||
return image
|
return image
|
||||||
|
|
||||||
def _createThemeFromXml(self, theme_xml, path):
|
def _create_theme_fom_Xml(self, theme_xml, path):
|
||||||
"""
|
"""
|
||||||
Return a theme object using information parsed from XML
|
Return a theme object using information parsed from XML
|
||||||
|
|
||||||
|
@ -722,15 +721,14 @@ class ThemeManager(QtGui.QWidget):
|
||||||
theme.extend_image_filename(path)
|
theme.extend_image_filename(path)
|
||||||
return theme
|
return theme
|
||||||
|
|
||||||
def _validate_theme_action(self, select_text, confirm_title, confirm_text,
|
def _validate_theme_action(self, select_text, confirm_title, confirm_text, testPlugin=True, confirm=True):
|
||||||
testPlugin=True, confirm=True):
|
|
||||||
"""
|
"""
|
||||||
Check to see if theme has been selected and the destructive action
|
Check to see if theme has been selected and the destructive action
|
||||||
is allowed.
|
is allowed.
|
||||||
"""
|
"""
|
||||||
self.global_theme = Settings().value(self.settingsSection + u'/global theme')
|
self.global_theme = Settings().value(self.settingsSection + u'/global theme')
|
||||||
if check_item_selected(self.themeListWidget, select_text):
|
if check_item_selected(self.theme_list_widget, select_text):
|
||||||
item = self.themeListWidget.currentItem()
|
item = self.theme_list_widget.currentItem()
|
||||||
theme = item.text()
|
theme = item.text()
|
||||||
# confirm deletion
|
# confirm deletion
|
||||||
if confirm:
|
if confirm:
|
||||||
|
@ -755,7 +753,7 @@ class ThemeManager(QtGui.QWidget):
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def _migrateVersion122(self, xml_data):
|
def _migrate_version_122(self, xml_data):
|
||||||
"""
|
"""
|
||||||
Convert the xml data from version 1 format to the current format.
|
Convert the xml data from version 1 format to the current format.
|
||||||
|
|
||||||
|
|
|
@ -38,8 +38,7 @@ class ThemesTab(SettingsTab):
|
||||||
"""
|
"""
|
||||||
ThemesTab is the theme settings tab in the settings dialog.
|
ThemesTab is the theme settings tab in the settings dialog.
|
||||||
"""
|
"""
|
||||||
def __init__(self, parent, mainwindow):
|
def __init__(self, parent):
|
||||||
self.mainwindow = mainwindow
|
|
||||||
generalTranslated = translate('OpenLP.ThemesTab', 'Themes')
|
generalTranslated = translate('OpenLP.ThemesTab', 'Themes')
|
||||||
SettingsTab.__init__(self, parent, u'Themes', generalTranslated)
|
SettingsTab.__init__(self, parent, u'Themes', generalTranslated)
|
||||||
self.iconPath = u':/themes/theme_new.png'
|
self.iconPath = u':/themes/theme_new.png'
|
||||||
|
@ -135,8 +134,8 @@ class ThemesTab(SettingsTab):
|
||||||
settings.setValue(u'theme level', self.theme_level)
|
settings.setValue(u'theme level', self.theme_level)
|
||||||
settings.setValue(u'global theme', self.global_theme)
|
settings.setValue(u'global theme', self.global_theme)
|
||||||
settings.endGroup()
|
settings.endGroup()
|
||||||
self.mainwindow.renderer.set_global_theme(self.global_theme)
|
self.renderer.set_global_theme(self.global_theme)
|
||||||
self.mainwindow.renderer.set_theme_level(self.theme_level)
|
self.renderer.set_theme_level(self.theme_level)
|
||||||
Receiver.send_message(u'theme_update_global', self.global_theme)
|
Receiver.send_message(u'theme_update_global', self.global_theme)
|
||||||
|
|
||||||
def postSetUp(self):
|
def postSetUp(self):
|
||||||
|
@ -153,7 +152,7 @@ class ThemesTab(SettingsTab):
|
||||||
|
|
||||||
def onDefaultComboBoxChanged(self, value):
|
def onDefaultComboBoxChanged(self, value):
|
||||||
self.global_theme = self.DefaultComboBox.currentText()
|
self.global_theme = self.DefaultComboBox.currentText()
|
||||||
self.mainwindow.renderer.set_global_theme(self.global_theme)
|
self.renderer.set_global_theme(self.global_theme)
|
||||||
self.__previewGlobalTheme()
|
self.__previewGlobalTheme()
|
||||||
|
|
||||||
def updateThemeList(self, theme_list):
|
def updateThemeList(self, theme_list):
|
||||||
|
@ -170,8 +169,8 @@ class ThemesTab(SettingsTab):
|
||||||
self.DefaultComboBox.clear()
|
self.DefaultComboBox.clear()
|
||||||
self.DefaultComboBox.addItems(theme_list)
|
self.DefaultComboBox.addItems(theme_list)
|
||||||
find_and_set_in_combo_box(self.DefaultComboBox, self.global_theme)
|
find_and_set_in_combo_box(self.DefaultComboBox, self.global_theme)
|
||||||
self.mainwindow.renderer.set_global_theme(self.global_theme)
|
self.renderer.set_global_theme(self.global_theme)
|
||||||
self.mainwindow.renderer.set_theme_level(self.theme_level)
|
self.renderer.set_theme_level(self.theme_level)
|
||||||
if self.global_theme is not u'':
|
if self.global_theme is not u'':
|
||||||
self.__previewGlobalTheme()
|
self.__previewGlobalTheme()
|
||||||
|
|
||||||
|
@ -179,7 +178,7 @@ class ThemesTab(SettingsTab):
|
||||||
"""
|
"""
|
||||||
Utility method to update the global theme preview image.
|
Utility method to update the global theme preview image.
|
||||||
"""
|
"""
|
||||||
image = self.mainwindow.themeManagerContents.getPreviewImage(self.global_theme)
|
image = self.theme_manager.get_preview_image(self.global_theme)
|
||||||
preview = QtGui.QPixmap(unicode(image))
|
preview = QtGui.QPixmap(unicode(image))
|
||||||
if not preview.isNull():
|
if not preview.isNull():
|
||||||
preview = preview.scaled(300, 255, QtCore.Qt.KeepAspectRatio, QtCore.Qt.SmoothTransformation)
|
preview = preview.scaled(300, 255, QtCore.Qt.KeepAspectRatio, QtCore.Qt.SmoothTransformation)
|
||||||
|
|
|
@ -61,8 +61,7 @@ class OpenLP1SongImport(SongImport):
|
||||||
The database providing the data to import.
|
The database providing the data to import.
|
||||||
"""
|
"""
|
||||||
SongImport.__init__(self, manager, **kwargs)
|
SongImport.__init__(self, manager, **kwargs)
|
||||||
self.availableThemes = \
|
self.availableThemes = kwargs[u'plugin'].theme_manager.get_themes()
|
||||||
kwargs[u'plugin'].formParent.themeManagerContents.getThemes()
|
|
||||||
|
|
||||||
def doImport(self):
|
def doImport(self):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in New Issue