Final set of PEP8 cleanups

This commit is contained in:
Tim Bentley 2014-03-20 19:10:31 +00:00
parent 30835067d3
commit 5d9533947d
41 changed files with 675 additions and 670 deletions

View File

@ -76,7 +76,7 @@ class AppLocation(object):
elif dir_type == AppLocation.PluginsDir: elif dir_type == AppLocation.PluginsDir:
app_path = os.path.abspath(os.path.split(sys.argv[0])[0]) app_path = os.path.abspath(os.path.split(sys.argv[0])[0])
return get_frozen_path(os.path.join(app_path, 'plugins'), return get_frozen_path(os.path.join(app_path, 'plugins'),
os.path.join(os.path.split(openlp.__file__)[0], 'plugins')) os.path.join(os.path.split(openlp.__file__)[0], 'plugins'))
elif dir_type == AppLocation.VersionDir: elif dir_type == AppLocation.VersionDir:
return get_frozen_path(os.path.abspath(os.path.split(sys.argv[0])[0]), os.path.split(openlp.__file__)[0]) return get_frozen_path(os.path.abspath(os.path.split(sys.argv[0])[0]), os.path.split(openlp.__file__)[0])
elif dir_type == AppLocation.LanguageDir: elif dir_type == AppLocation.LanguageDir:

View File

@ -91,4 +91,4 @@ class OpenLPMixin(object):
Common log exception handler which prints the calling path Common log exception handler which prints the calling path
""" """
trace_error_handler(self.logger) trace_error_handler(self.logger)
self.logger.exception(message) self.logger.exception(message)

View File

@ -149,4 +149,4 @@ class RegistryProperties(object):
""" """
if not hasattr(self, '_alerts_manager') or not self._alerts_manager: if not hasattr(self, '_alerts_manager') or not self._alerts_manager:
self._alerts_manager = Registry().get('alerts_manager') self._alerts_manager = Registry().get('alerts_manager')
return self._alerts_manager return self._alerts_manager

View File

@ -73,8 +73,9 @@ class UiStrings(object):
self.Default = translate('OpenLP.Ui', 'Default') self.Default = translate('OpenLP.Ui', 'Default')
self.DefaultColor = translate('OpenLP.Ui', 'Default Color:') self.DefaultColor = translate('OpenLP.Ui', 'Default Color:')
self.DefaultServiceName = translate('OpenLP.Ui', 'Service %Y-%m-%d %H-%M', self.DefaultServiceName = translate('OpenLP.Ui', 'Service %Y-%m-%d %H-%M',
'This may not contain any of the following characters: /\\?*|<>\[\]":+\n' 'This may not contain any of the following characters: /\\?*|<>\[\]":+\n'
'See http://docs.python.org/library/datetime.html#strftime-strptime-behavior for more information.') 'See http://docs.python.org/library/datetime'
'.html#strftime-strptime-behavior for more information.')
self.Delete = translate('OpenLP.Ui', '&Delete') self.Delete = translate('OpenLP.Ui', '&Delete')
self.DisplayStyle = translate('OpenLP.Ui', 'Display style:') self.DisplayStyle = translate('OpenLP.Ui', 'Display style:')
self.Duplicate = translate('OpenLP.Ui', 'Duplicate Error') self.Duplicate = translate('OpenLP.Ui', 'Duplicate Error')
@ -132,7 +133,7 @@ class UiStrings(object):
self.Service = translate('OpenLP.Ui', 'Service') self.Service = translate('OpenLP.Ui', 'Service')
self.Split = translate('OpenLP.Ui', 'Optional &Split') self.Split = translate('OpenLP.Ui', 'Optional &Split')
self.SplitToolTip = translate('OpenLP.Ui', self.SplitToolTip = translate('OpenLP.Ui',
'Split a slide into two only if it does not fit on the screen as one slide.') 'Split a slide into two only if it does not fit on the screen as one slide.')
self.StartTimeCode = translate('OpenLP.Ui', 'Start %s') self.StartTimeCode = translate('OpenLP.Ui', 'Start %s')
self.StopPlaySlidesInLoop = translate('OpenLP.Ui', 'Stop Play Slides in Loop') self.StopPlaySlidesInLoop = translate('OpenLP.Ui', 'Stop Play Slides in Loop')
self.StopPlaySlidesToEnd = translate('OpenLP.Ui', 'Stop Play Slides to End') self.StopPlaySlidesToEnd = translate('OpenLP.Ui', 'Stop Play Slides to End')

View File

@ -63,4 +63,4 @@ class FileDialog(QtGui.QFileDialog):
UiStrings().FileNotFoundMessage % file) UiStrings().FileNotFoundMessage % file)
continue continue
file_list.append(file) file_list.append(file)
return file_list return file_list

View File

@ -117,7 +117,9 @@ is the function which has to be called from outside. The generated and returned
display: table-cell; display: table-cell;
word-wrap: break-word; word-wrap: break-word;
-webkit-transition: opacity 0.4s ease; -webkit-transition: opacity 0.4s ease;
white-space:pre-wrap; word-wrap: break-word; text-align: left; vertical-align: top; font-family: Nimbus Sans L; font-size: 40pt; color: #FFFFFF; line-height: 100%; margin: 0;padding: 0; padding-bottom: 0; padding-left: 4px; width: 1580px; height: 810px; white-space:pre-wrap; word-wrap: break-word; text-align: left; vertical-align: top; font-family: Nimbus
Sans L; font-size: 40pt; color: #FFFFFF; line-height: 100%; margin: 0;padding: 0; padding-bottom: 0;
padding-left: 4px; width: 1580px; height: 810px;
} }
.lyricsmain { .lyricsmain {
-webkit-text-stroke: 0.125em #000000; -webkit-text-fill-color: #FFFFFF; text-shadow: #000000 5px 5px; -webkit-text-stroke: 0.125em #000000; -webkit-text-fill-color: #FFFFFF; text-shadow: #000000 5px 5px;
@ -720,12 +722,12 @@ def build_lyrics_format_css(theme_data, width, height):
else: else:
padding_bottom = '0' padding_bottom = '0'
lyrics = '%s word-wrap: break-word; ' \ lyrics = '%s word-wrap: break-word; ' \
'text-align: %s; vertical-align: %s; font-family: %s; ' \ 'text-align: %s; vertical-align: %s; font-family: %s; ' \
'font-size: %spt; color: %s; line-height: %d%%; margin: 0;' \ 'font-size: %spt; color: %s; line-height: %d%%; margin: 0;' \
'padding: 0; padding-bottom: %s; padding-left: %spx; width: %spx; height: %spx; ' % \ 'padding: 0; padding-bottom: %s; padding-left: %spx; width: %spx; height: %spx; ' % \
(justify, align, valign, theme_data.font_main_name, theme_data.font_main_size, (justify, align, valign, theme_data.font_main_name, theme_data.font_main_size,
theme_data.font_main_color, 100 + int(theme_data.font_main_line_adjustment), padding_bottom, theme_data.font_main_color, 100 + int(theme_data.font_main_line_adjustment), padding_bottom,
left_margin, width, height) left_margin, width, height)
if theme_data.font_main_italics: if theme_data.font_main_italics:
lyrics += 'font-style:italic; ' lyrics += 'font-style:italic; '
if theme_data.font_main_bold: if theme_data.font_main_bold:

View File

@ -113,8 +113,8 @@ class Image(object):
:param path: The image's file path. This should be an existing file path. :param path: The image's file path. This should be an existing file path.
:param source: The source describes the image's origin. Possible values are described in the :param source: The source describes the image's origin. Possible values are described in the
:class:`~openlp.core.lib.ImageSource` class. :class:`~openlp.core.lib.ImageSource` class.
:param background: A ``QtGui.QColor`` object specifying the colour to be used to fill the gabs if the image's ratio does not :param background: A ``QtGui.QColor`` object specifying the colour to be used to fill the gabs if the image's
match with the display ratio. ratio does not match with the display ratio.
""" """
self.path = path self.path = path

View File

@ -393,4 +393,4 @@ class Plugin(QtCore.QObject, RegistryProperties):
""" """
The plugin's needs to handle a new song creation The plugin's needs to handle a new song creation
""" """
pass pass

View File

@ -120,9 +120,8 @@ class SearchEdit(QtGui.QLineEdit):
A list of tuples to be used in the search type menu. The first item in the list will be preselected as the A list of tuples to be used in the search type menu. The first item in the list will be preselected as the
default. default.
:param items: The list of tuples to use. The tuples should contain an integer identifier, an icon (QIcon instance or :param items: The list of tuples to use. The tuples should contain an integer identifier, an icon (QIcon
instance or string) and a title for the item in the menu. In short, they should look like this::
string) and a title for the item in the menu. In short, they should look like this::
(<identifier>, <icon>, <title>, <place holder text>) (<identifier>, <icon>, <title>, <place holder text>)

File diff suppressed because it is too large Load Diff

View File

@ -263,7 +263,7 @@ class AdvancedTab(SettingsTab):
""" """
Setup the interface translation strings. Setup the interface translation strings.
""" """
self.tabTitleVisible = UiStrings().Advanced self.tab_title_visible = UiStrings().Advanced
self.ui_group_box.setTitle(translate('OpenLP.AdvancedTab', 'UI Settings')) self.ui_group_box.setTitle(translate('OpenLP.AdvancedTab', 'UI Settings'))
self.data_directory_group_box.setTitle(translate('OpenLP.AdvancedTab', 'Data Location')) self.data_directory_group_box.setTitle(translate('OpenLP.AdvancedTab', 'Data Location'))
self.recent_label.setText(translate('OpenLP.AdvancedTab', 'Number of recent files to display:')) self.recent_label.setText(translate('OpenLP.AdvancedTab', 'Number of recent files to display:'))
@ -319,7 +319,7 @@ class AdvancedTab(SettingsTab):
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.display_workaround_group_box.setTitle(translate('OpenLP.AdvancedTab', 'Display Workarounds')) self.display_workaround_group_box.setTitle(translate('OpenLP.AdvancedTab', 'Display Workarounds'))
self.x11_bypass_check_box.setText(translate('OpenLP.AdvancedTab','Bypass X11 Window Manager')) self.x11_bypass_check_box.setText(translate('OpenLP.AdvancedTab', 'Bypass X11 Window Manager'))
self.alternate_rows_check_box.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.slide_group_box.setTitle(translate('OpenLP.GeneralTab', 'Service Item Slide Limits')) self.slide_group_box.setTitle(translate('OpenLP.GeneralTab', 'Service Item Slide Limits'))
@ -375,7 +375,8 @@ class AdvancedTab(SettingsTab):
self.current_data_path = AppLocation.get_data_path() self.current_data_path = AppLocation.get_data_path()
if not os.path.exists(self.current_data_path): if not os.path.exists(self.current_data_path):
log.error('Data path not found %s' % self.current_data_path) log.error('Data path not found %s' % self.current_data_path)
answer = QtGui.QMessageBox.critical(self, translate('OpenLP.AdvancedTab', 'Data Directory Error'), answer = QtGui.QMessageBox.critical(
self, translate('OpenLP.AdvancedTab', 'Data Directory Error'),
translate('OpenLP.AdvancedTab', 'OpenLP data directory was not found\n\n%s\n\n' translate('OpenLP.AdvancedTab', 'OpenLP data directory was not found\n\n%s\n\n'
'This data directory was previously changed from the OpenLP ' 'This data directory was previously changed from the OpenLP '
'default location. If the new location was on removable ' 'default location. If the new location was on removable '
@ -537,8 +538,9 @@ class AdvancedTab(SettingsTab):
# Make sure they want to change the data. # Make sure they want to change the data.
answer = QtGui.QMessageBox.question(self, translate('OpenLP.AdvancedTab', 'Confirm Data Directory Change'), answer = QtGui.QMessageBox.question(self, translate('OpenLP.AdvancedTab', 'Confirm Data Directory Change'),
translate('OpenLP.AdvancedTab', 'Are you sure you want to change the ' translate('OpenLP.AdvancedTab', 'Are you sure you want to change the '
'location of the OpenLP data directory to:\n\n%s\n\nThe data directory ' 'location of the OpenLP data directory to:\n\n%s\n\nThe data '
'will be changed when OpenLP is closed.').replace('%s', new_data_path), 'directory will be changed when OpenLP is closed.').
replace('%s', new_data_path),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes | QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes |
QtGui.QMessageBox.No), QtGui.QMessageBox.No),
QtGui.QMessageBox.No) QtGui.QMessageBox.No)
@ -561,8 +563,9 @@ class AdvancedTab(SettingsTab):
# default. # default.
answer = QtGui.QMessageBox.question(self, translate('OpenLP.AdvancedTab', 'Reset Data Directory'), answer = QtGui.QMessageBox.question(self, translate('OpenLP.AdvancedTab', 'Reset Data Directory'),
translate('OpenLP.AdvancedTab', 'Are you sure you want to change the ' translate('OpenLP.AdvancedTab', 'Are you sure you want to change the '
'location of the OpenLP data directory to the default location?\n\nThis' 'location of the OpenLP data directory to the default '
' location will be used after OpenLP is closed.'), 'location?\n\nThis location will be used after OpenLP is '
'closed.'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes | QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes |
QtGui.QMessageBox.No), QtGui.QMessageBox.No),
QtGui.QMessageBox.No) QtGui.QMessageBox.No)
@ -588,7 +591,7 @@ class AdvancedTab(SettingsTab):
else: else:
self.new_data_directory_has_files_label.hide() self.new_data_directory_has_files_label.hide()
def check_data_overwrite(self, data_path ): def check_data_overwrite(self, data_path):
""" """
Check if there's already data in the target directory. Check if there's already data in the target directory.
""" """
@ -602,8 +605,8 @@ class AdvancedTab(SettingsTab):
translate('OpenLP.AdvancedTab', translate('OpenLP.AdvancedTab',
'WARNING: \n\nThe location you have selected \n\n%s\n\n' 'WARNING: \n\nThe location you have selected \n\n%s\n\n'
'appears to contain OpenLP data files. Do you wish to ' 'appears to contain OpenLP data files. Do you wish to '
'replace these files with the current data files?').replace 'replace these files with the current data files?').
('%s', os.path.abspath(data_path,)), replace('%s', os.path.abspath(data_path,)),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes | QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes |
QtGui.QMessageBox.No), QtGui.QMessageBox.No),
QtGui.QMessageBox.No) QtGui.QMessageBox.No)

View File

@ -83,9 +83,8 @@ class Ui_ExceptionDialog(object):
self.attach_tile_button = create_button(exception_dialog, 'attach_tile_button', self.attach_tile_button = create_button(exception_dialog, 'attach_tile_button',
icon=':/general/general_open.png', icon=':/general/general_open.png',
click=self.on_attach_file_button_clicked) click=self.on_attach_file_button_clicked)
self.button_box = create_button_box(exception_dialog, 'button_box', self.button_box = create_button_box(exception_dialog, 'button_box', ['close'],
['close'], [self.send_report_button, [self.send_report_button, self.save_report_button, self.attach_tile_button])
self.save_report_button, self.attach_tile_button])
self.exception_layout.addWidget(self.button_box) self.exception_layout.addWidget(self.button_box)
self.retranslateUi(exception_dialog) self.retranslateUi(exception_dialog)

View File

@ -157,7 +157,8 @@ class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog, RegistryProperties):
'--- Exception Traceback ---\n%s\n' '--- Exception Traceback ---\n%s\n'
'--- System information ---\n%s\n' '--- System information ---\n%s\n'
'--- Library Versions ---\n%s\n') '--- Library Versions ---\n%s\n')
filename = QtGui.QFileDialog.getSaveFileName(self, filename = QtGui.QFileDialog.getSaveFileName(
self,
translate('OpenLP.ExceptionForm', 'Save Crash Report'), translate('OpenLP.ExceptionForm', 'Save Crash Report'),
Settings().value(self.settings_section + '/last directory'), Settings().value(self.settings_section + '/last directory'),
translate('OpenLP.ExceptionForm', 'Text files (*.txt *.log *.text)')) translate('OpenLP.ExceptionForm', 'Text files (*.txt *.log *.text)'))
@ -185,14 +186,13 @@ class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog, RegistryProperties):
Opening systems default email client and inserting exception log and system information. Opening systems default email client and inserting exception log and system information.
""" """
body = translate('OpenLP.ExceptionForm', body = translate('OpenLP.ExceptionForm',
'*OpenLP Bug Report*\n' '*OpenLP Bug Report*\n'
'Version: %s\n\n' 'Version: %s\n\n'
'--- Details of the Exception. ---\n\n%s\n\n ' '--- Details of the Exception. ---\n\n%s\n\n '
'--- Exception Traceback ---\n%s\n' '--- Exception Traceback ---\n%s\n'
'--- System information ---\n%s\n' '--- System information ---\n%s\n'
'--- Library Versions ---\n%s\n', '--- Library Versions ---\n%s\n',
'Please add the information that bug reports are favoured written ' 'Please add the information that bug reports are favoured written in English.')
'in English.')
content = self._create_report() content = self._create_report()
source = '' source = ''
exception = '' exception = ''

View File

@ -57,4 +57,4 @@ class FileRenameForm(QtGui.QDialog, Ui_FileRenameDialog, RegistryProperties):
else: else:
self.setWindowTitle(translate('OpenLP.FileRenameForm', 'File Rename')) self.setWindowTitle(translate('OpenLP.FileRenameForm', 'File Rename'))
self.file_name_edit.setFocus() self.file_name_edit.setFocus()
return QtGui.QDialog.exec_(self) return QtGui.QDialog.exec_(self)

View File

@ -468,4 +468,4 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard, RegistryProperties):
Set the status of a plugin. Set the status of a plugin.
""" """
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)

View File

@ -174,4 +174,4 @@ class FormattingTagController(object):
if end and end != end_html: if end and end != end_html:
return translate('OpenLP.FormattingTagForm', return translate('OpenLP.FormattingTagForm',
'End tag %s does not match end tag for start tag %s' % (end, start_html)), None 'End tag %s does not match end tag for start tag %s' % (end, start_html)), None
return None, None return None, None

View File

@ -102,8 +102,7 @@ class Ui_FormattingTagDialog(object):
self.edit_button_layout.addWidget(self.delete_button) self.edit_button_layout.addWidget(self.delete_button)
self.edit_button_layout.addStretch() self.edit_button_layout.addStretch()
self.list_data_grid_layout.addLayout(self.edit_button_layout) self.list_data_grid_layout.addLayout(self.edit_button_layout)
self.button_box = create_button_box(formatting_tag_dialog, 'button_box', self.button_box = create_button_box(formatting_tag_dialog, 'button_box', ['cancel', 'save', 'defaults'])
['cancel', 'save', 'defaults'])
self.save_button = self.button_box.button(QtGui.QDialogButtonBox.Save) self.save_button = self.button_box.button(QtGui.QDialogButtonBox.Save)
self.save_button.setObjectName('save_button') self.save_button.setObjectName('save_button')
self.restore_button = self.button_box.button(QtGui.QDialogButtonBox.RestoreDefaults) self.restore_button = self.button_box.button(QtGui.QDialogButtonBox.RestoreDefaults)

View File

@ -204,4 +204,3 @@ class FormattingTagForm(QtGui.QDialog, Ui_FormattingTagDialog, FormattingTagCont
QtGui.QMessageBox.Ok) QtGui.QMessageBox.Ok)
#self.tag_table_widget.selectRow(pre_row - 1) #self.tag_table_widget.selectRow(pre_row - 1)
self.tag_table_widget.resizeRowsToContents() self.tag_table_widget.resizeRowsToContents()

View File

@ -223,7 +223,8 @@ class GeneralTab(SettingsTab):
self.save_check_service_check_box.setText(translate('OpenLP.GeneralTab', self.save_check_service_check_box.setText(translate('OpenLP.GeneralTab',
'Prompt to save before starting a new service')) 'Prompt to save before starting a new service'))
self.auto_unblank_check_box.setText(translate('OpenLP.GeneralTab', 'Unblank display when adding new live item')) self.auto_unblank_check_box.setText(translate('OpenLP.GeneralTab', 'Unblank display when adding new live item'))
self.auto_preview_check_box.setText(translate('OpenLP.GeneralTab', 'Automatically preview next item in service')) self.auto_preview_check_box.setText(translate('OpenLP.GeneralTab',
'Automatically preview next item in service'))
self.timeout_label.setText(translate('OpenLP.GeneralTab', 'Timed slide interval:')) self.timeout_label.setText(translate('OpenLP.GeneralTab', 'Timed slide interval:'))
self.timeout_spin_box.setSuffix(translate('OpenLP.GeneralTab', ' sec')) self.timeout_spin_box.setSuffix(translate('OpenLP.GeneralTab', ' sec'))
self.ccli_group_box.setTitle(translate('OpenLP.GeneralTab', 'CCLI Details')) self.ccli_group_box.setTitle(translate('OpenLP.GeneralTab', 'CCLI Details'))

View File

@ -160,4 +160,4 @@ class ListPreviewWidget(QtGui.QTableWidget, RegistryProperties):
""" """
Returns the number of slides this widget holds. Returns the number of slides this widget holds.
""" """
return super(ListPreviewWidget, self).rowCount() return super(ListPreviewWidget, self).rowCount()

View File

@ -601,4 +601,3 @@ class AudioPlayer(OpenLPMixin, QtCore.QObject):
:param signal: The signal to be fired :param signal: The signal to be fired
""" """
QtCore.QObject.connect(self.media_object, signal, slot) QtCore.QObject.connect(self.media_object, signal, slot)

View File

@ -887,7 +887,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow, RegistryProperties):
# application terminates normally. We need to exit without saving configuration. # application terminates normally. We need to exit without saving configuration.
QtGui.QMessageBox.information(self, translate('OpenLP.MainWindow', 'Import settings'), QtGui.QMessageBox.information(self, translate('OpenLP.MainWindow', 'Import settings'),
translate('OpenLP.MainWindow', 'OpenLP will now close. Imported settings will ' translate('OpenLP.MainWindow', 'OpenLP will now close. Imported settings will '
'be applied the next time you start OpenLP.'), 'be applied the next time you start OpenLP.'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok)) QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
self.settings_imported = True self.settings_imported = True
self.clean_up() self.clean_up()
@ -1042,8 +1042,8 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow, RegistryProperties):
ret = QtGui.QMessageBox.question(self, translate('OpenLP.MainWindow', 'Close OpenLP'), ret = QtGui.QMessageBox.question(self, translate('OpenLP.MainWindow', 'Close OpenLP'),
translate('OpenLP.MainWindow', 'Are you sure you want to close ' translate('OpenLP.MainWindow', 'Are you sure you want to close '
'OpenLP?'), 'OpenLP?'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes | QtGui QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes |
.QMessageBox.No), QtGui.QMessageBox.No),
QtGui.QMessageBox.Yes) QtGui.QMessageBox.Yes)
if ret == QtGui.QMessageBox.Yes: if ret == QtGui.QMessageBox.Yes:
self.clean_up() self.clean_up()
@ -1234,16 +1234,15 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow, RegistryProperties):
self.recent_files_menu.clear() self.recent_files_menu.clear()
for file_id, filename in enumerate(recent_files_to_display): for file_id, filename in enumerate(recent_files_to_display):
log.debug('Recent file name: %s', filename) log.debug('Recent file name: %s', filename)
action = create_action(self, '', action = create_action(self, '', text='&%d %s' % (file_id + 1,
text='&%d %s' % (file_id + 1,
os.path.splitext(os.path.basename(str(filename)))[0]), data=filename, os.path.splitext(os.path.basename(str(filename)))[0]), data=filename,
triggers=self.service_manager_contents.on_recent_service_clicked) triggers=self.service_manager_contents.on_recent_service_clicked)
self.recent_files_menu.addAction(action) self.recent_files_menu.addAction(action)
clear_recent_files_action = create_action(self, '', clear_recent_files_action = create_action(self, '',
text=translate('OpenLP.MainWindow', 'Clear List', 'Clear List of ' text=translate('OpenLP.MainWindow', 'Clear List', 'Clear List of '
'recent files'), 'recent files'),
statustip=translate('OpenLP.MainWindow', 'Clear the list of recent ' statustip=translate('OpenLP.MainWindow', 'Clear the list of recent '
'files.'), 'files.'),
enabled=bool(self.recent_files), enabled=bool(self.recent_files),
triggers=self.clear_recent_file_menu) triggers=self.clear_recent_file_menu)
add_actions(self.recent_files_menu, (None, clear_recent_files_action)) add_actions(self.recent_files_menu, (None, clear_recent_files_action))
@ -1352,8 +1351,8 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow, RegistryProperties):
self.application.set_normal_cursor() self.application.set_normal_cursor()
log.exception('Data copy failed %s' % str(why)) log.exception('Data copy failed %s' % str(why))
QtGui.QMessageBox.critical(self, translate('OpenLP.MainWindow', 'New Data Directory Error'), QtGui.QMessageBox.critical(self, translate('OpenLP.MainWindow', 'New Data Directory Error'),
translate('OpenLP.MainWindow', translate('OpenLP.MainWindow', 'OpenLP Data directory copy failed\n\n%s').
'OpenLP Data directory copy failed\n\n%s').replace('%s', str(why)), replace('%s', str(why)),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok)) QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
return False return False
else: else:
@ -1365,5 +1364,3 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow, RegistryProperties):
if self.new_data_path == AppLocation.get_directory(AppLocation.DataDir): if self.new_data_path == AppLocation.get_directory(AppLocation.DataDir):
settings.remove('advanced/data path') settings.remove('advanced/data path')
self.application.set_normal_cursor() self.application.set_normal_cursor()

View File

@ -383,7 +383,7 @@ class MediaController(RegistryMixin, OpenLPMixin, RegistryProperties):
if not is_valid: if not is_valid:
# Media could not be loaded correctly # Media could not be loaded correctly
critical_error_message_box(translate('MediaPlugin.MediaItem', 'Unsupported File'), critical_error_message_box(translate('MediaPlugin.MediaItem', 'Unsupported File'),
translate('MediaPlugin.MediaItem', 'Unsupported File')) translate('MediaPlugin.MediaItem', 'Unsupported File'))
return False return False
# dont care about actual theme, set a black background # dont care about actual theme, set a black background
if controller.is_live and not controller.media_info.is_background: if controller.is_live and not controller.media_info.is_background:
@ -402,7 +402,7 @@ class MediaController(RegistryMixin, OpenLPMixin, RegistryProperties):
if autoplay: if autoplay:
if not self.media_play(controller): if not self.media_play(controller):
critical_error_message_box(translate('MediaPlugin.MediaItem', 'Unsupported File'), critical_error_message_box(translate('MediaPlugin.MediaItem', 'Unsupported File'),
translate('MediaPlugin.MediaItem', 'Unsupported File')) translate('MediaPlugin.MediaItem', 'Unsupported File'))
return False return False
self.set_controls_visible(controller, True) self.set_controls_visible(controller, True)
log.debug('use %s controller' % self.current_media_players[controller.controller_type]) log.debug('use %s controller' % self.current_media_players[controller.controller_type])
@ -644,9 +644,9 @@ class MediaController(RegistryMixin, OpenLPMixin, RegistryProperties):
return return
display = self._define_display(self.live_controller) display = self._define_display(self.live_controller)
if self.live_controller.controller_type in self.current_media_players and \ if self.live_controller.controller_type in self.current_media_players and \
self.current_media_players[self.live_controller.controller_type].state == MediaState.Playing: self.current_media_players[self.live_controller.controller_type].state == MediaState.Playing:
self.current_media_players[self.live_controller.controller_type].pause(display) self.current_media_players[self.live_controller.controller_type].pause(display)
self.current_media_players[self.live_controller.controller_type].set_visible(display, False) self.current_media_players[self.live_controller.controller_type].set_visible(display, False)
def media_blank(self, msg): def media_blank(self, msg):
""" """
@ -701,4 +701,4 @@ class MediaController(RegistryMixin, OpenLPMixin, RegistryProperties):
""" """
if controller.is_live: if controller.is_live:
return controller.display return controller.display
return controller.preview_display return controller.preview_display

View File

@ -150,4 +150,4 @@ class MediaPlayer(RegistryProperties):
""" """
Returns Information about the player Returns Information about the player
""" """
return '' return ''

View File

@ -105,7 +105,7 @@ class PhononPlayer(MediaPlayer):
if ext not in mime_type_list: if ext not in mime_type_list:
mime_type_list.append(ext) mime_type_list.append(ext)
log.info('MediaPlugin: %s additional extensions: %s' % log.info('MediaPlugin: %s additional extensions: %s' %
(mimetype, ' '.join(self.additional_extensions[mimetype]))) (mimetype, ' '.join(self.additional_extensions[mimetype])))
def setup(self, display): def setup(self, display):
""" """

View File

@ -291,4 +291,4 @@ class VlcPlayer(MediaPlayer):
'<br/> <strong>' + translate('Media.player', 'Audio') + '<br/> <strong>' + translate('Media.player', 'Audio') +
'</strong><br/>' + str(AUDIO_EXT) + '<br/><strong>' + '</strong><br/>' + str(AUDIO_EXT) + '<br/><strong>' +
translate('Media.player', 'Video') + '</strong><br/>' + translate('Media.player', 'Video') + '</strong><br/>' +
str(VIDEO_EXT) + '<br/>') str(VIDEO_EXT) + '<br/>')

View File

@ -154,4 +154,4 @@ class PluginForm(QtGui.QDialog, Ui_PluginViewDialog, RegistryProperties):
elif self.active_plugin.status == PluginStatus.Disabled: elif self.active_plugin.status == PluginStatus.Disabled:
status_text = translate('OpenLP.PluginForm', '%s (Disabled)') status_text = translate('OpenLP.PluginForm', '%s (Disabled)')
self.plugin_list_widget.currentItem().setText( self.plugin_list_widget.currentItem().setText(
status_text % self.active_plugin.name_strings['singular']) status_text % self.active_plugin.name_strings['singular'])

View File

@ -394,4 +394,4 @@ class PrintServiceForm(QtGui.QDialog, Ui_PrintServiceDialog, RegistryProperties)
return return
for item in self.service_manager.service_items: for item in self.service_manager.service_items:
# Trigger Audit requests # Trigger Audit requests
Registry().register_function('print_service_started', [item['service_item']]) Registry().register_function('print_service_started', [item['service_item']])

View File

@ -689,8 +689,8 @@ class ServiceManager(OpenLPMixin, RegistryMixin, QtGui.QWidget, Ui_ServiceManage
if self._file_name.endswith('oszl') or self.service_has_all_original_files: if self._file_name.endswith('oszl') or self.service_has_all_original_files:
file_name = QtGui.QFileDialog.getSaveFileName(self.main_window, UiStrings().SaveService, path, file_name = QtGui.QFileDialog.getSaveFileName(self.main_window, UiStrings().SaveService, path,
translate('OpenLP.ServiceManager', translate('OpenLP.ServiceManager',
'OpenLP Service Files (*.osz);; OpenLP Service Files - lite ' 'OpenLP Service Files (*.osz);; OpenLP Service '
'(*.oszl)')) 'Files - lite (*.oszl)'))
else: else:
file_name = QtGui.QFileDialog.getSaveFileName(self.main_window, UiStrings().SaveService, path, file_name = QtGui.QFileDialog.getSaveFileName(self.main_window, UiStrings().SaveService, path,
translate('OpenLP.ServiceManager', translate('OpenLP.ServiceManager',
@ -783,7 +783,8 @@ class ServiceManager(OpenLPMixin, RegistryMixin, QtGui.QWidget, Ui_ServiceManage
self.log_exception('Service file is cannot be extracted as zip: %s' % file_name) self.log_exception('Service file is cannot be extracted as zip: %s' % file_name)
QtGui.QMessageBox.information(self, translate('OpenLP.ServiceManager', 'Corrupt File'), QtGui.QMessageBox.information(self, translate('OpenLP.ServiceManager', 'Corrupt File'),
translate('OpenLP.ServiceManager', translate('OpenLP.ServiceManager',
'This file is either corrupt or it is not an OpenLP 2 service file.')) 'This file is either corrupt or it is not an OpenLP 2 service '
'file.'))
self.application.set_normal_cursor() self.application.set_normal_cursor()
return return
finally: finally:
@ -1253,8 +1254,7 @@ class ServiceManager(OpenLPMixin, RegistryMixin, QtGui.QWidget, Ui_ServiceManage
tree_widget_item.setText(0, service_item_from_item.get_display_title()) tree_widget_item.setText(0, service_item_from_item.get_display_title())
tips = [] tips = []
if service_item_from_item.temporary_edit: if service_item_from_item.temporary_edit:
tips.append('<strong>%s:</strong> <em>%s</em>' % tips.append('<strong>%s:</strong> <em>%s</em>' % (translate('OpenLP.ServiceManager', 'Edit'),
(translate('OpenLP.ServiceManager', 'Edit'),
(translate('OpenLP.ServiceManager', 'Service copy only')))) (translate('OpenLP.ServiceManager', 'Service copy only'))))
if service_item_from_item.theme and service_item_from_item.theme != -1: if service_item_from_item.theme and service_item_from_item.theme != -1:
tips.append('<strong>%s:</strong> <em>%s</em>' % tips.append('<strong>%s:</strong> <em>%s</em>' %
@ -1492,9 +1492,9 @@ class ServiceManager(OpenLPMixin, RegistryMixin, QtGui.QWidget, Ui_ServiceManage
def find_service_item(self): def find_service_item(self):
""" """
Finds the first selected ServiceItem in the list and returns the position of the service_item_from_item and its selected Finds the first selected ServiceItem in the list and returns the position of the service_item_from_item and its
child item. For example, if the third child item (in the Slidecontroller known as slide) in the second service selected child item. For example, if the third child item (in the Slidecontroller known as slide) in the
item is selected this will return:: second service item is selected this will return::
(1, 2) (1, 2)
""" """
@ -1632,4 +1632,4 @@ class ServiceManager(OpenLPMixin, RegistryMixin, QtGui.QWidget, Ui_ServiceManage
Print a Service Order Sheet. Print a Service Order Sheet.
""" """
setting_dialog = PrintServiceForm() setting_dialog = PrintServiceForm()
setting_dialog.exec_() setting_dialog.exec_()

View File

@ -74,4 +74,4 @@ class ServiceNoteForm(QtGui.QDialog, RegistryProperties):
""" """
Translate the UI on the fly Translate the UI on the fly
""" """
self.setWindowTitle(translate('OpenLP.ServiceNoteForm', 'Service Item Notes')) self.setWindowTitle(translate('OpenLP.ServiceNoteForm', 'Service Item Notes'))

View File

@ -151,4 +151,4 @@ class SettingsForm(QtGui.QDialog, Ui_SettingsDialog, RegistryProperties):
:param function: The function to be called :param function: The function to be called
""" """
if not function in self.processes: if not function in self.processes:
self.processes.append(function) self.processes.append(function)

View File

@ -285,7 +285,7 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog, RegistryProperties)
if QtGui.QMessageBox.question(self, translate('OpenLP.ShortcutListDialog', 'Restore Default Shortcuts'), if QtGui.QMessageBox.question(self, translate('OpenLP.ShortcutListDialog', 'Restore Default Shortcuts'),
translate('OpenLP.ShortcutListDialog', 'Do you want to restore all ' translate('OpenLP.ShortcutListDialog', 'Do you want to restore all '
'shortcuts to their defaults?'), 'shortcuts to their defaults?'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes | QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes |
QtGui.QMessageBox.No)) == QtGui.QMessageBox.No: QtGui.QMessageBox.No)) == QtGui.QMessageBox.No:
return return
self._adjust_button(self.primary_push_button, False, text='') self._adjust_button(self.primary_push_button, False, text='')

View File

@ -170,14 +170,14 @@ class SlideController(DisplayController, RegistryProperties):
size_toolbar_policy.setHeightForWidth(self.toolbar.sizePolicy().hasHeightForWidth()) size_toolbar_policy.setHeightForWidth(self.toolbar.sizePolicy().hasHeightForWidth())
self.toolbar.setSizePolicy(size_toolbar_policy) self.toolbar.setSizePolicy(size_toolbar_policy)
self.previous_item = create_action(self, 'previousItem_' + self.type_prefix, self.previous_item = create_action(self, 'previousItem_' + self.type_prefix,
text=translate('OpenLP.SlideController', 'Previous Slide'), text=translate('OpenLP.SlideController', 'Previous Slide'),
icon=':/slides/slide_previous.png', icon=':/slides/slide_previous.png',
tooltip=translate('OpenLP.SlideController', 'Move to previous.'), tooltip=translate('OpenLP.SlideController', 'Move to previous.'),
can_shortcuts=True, context=QtCore.Qt.WidgetWithChildrenShortcut, can_shortcuts=True, context=QtCore.Qt.WidgetWithChildrenShortcut,
category=self.category, triggers=self.on_slide_selected_previous) category=self.category, triggers=self.on_slide_selected_previous)
self.toolbar.addAction(self.previous_item) self.toolbar.addAction(self.previous_item)
self.next_item = create_action(self, 'nextItem_' + self.type_prefix, self.next_item = create_action(self, 'nextItem_' + self.type_prefix,
text=translate('OpenLP.SlideController', 'Next Slide'), text=translate('OpenLP.SlideController', 'Next Slide'),
icon=':/slides/slide_next.png', icon=':/slides/slide_next.png',
tooltip=translate('OpenLP.SlideController', 'Move to next.'), tooltip=translate('OpenLP.SlideController', 'Move to next.'),
can_shortcuts=True, context=QtCore.Qt.WidgetWithChildrenShortcut, can_shortcuts=True, context=QtCore.Qt.WidgetWithChildrenShortcut,
@ -195,17 +195,17 @@ class SlideController(DisplayController, RegistryProperties):
self.hide_menu.setMenu(QtGui.QMenu(translate('OpenLP.SlideController', 'Hide'), self.toolbar)) self.hide_menu.setMenu(QtGui.QMenu(translate('OpenLP.SlideController', 'Hide'), self.toolbar))
self.toolbar.add_toolbar_widget(self.hide_menu) self.toolbar.add_toolbar_widget(self.hide_menu)
self.blank_screen = create_action(self, 'blankScreen', self.blank_screen = create_action(self, 'blankScreen',
text=translate('OpenLP.SlideController', 'Blank Screen'), text=translate('OpenLP.SlideController', 'Blank Screen'),
icon=':/slides/slide_blank.png', icon=':/slides/slide_blank.png',
checked=False, can_shortcuts=True, category=self.category, checked=False, can_shortcuts=True, category=self.category,
triggers=self.on_blank_display) triggers=self.on_blank_display)
self.theme_screen = create_action(self, 'themeScreen', self.theme_screen = create_action(self, 'themeScreen',
text=translate('OpenLP.SlideController', 'Blank to Theme'), text=translate('OpenLP.SlideController', 'Blank to Theme'),
icon=':/slides/slide_theme.png', icon=':/slides/slide_theme.png',
checked=False, can_shortcuts=True, category=self.category, checked=False, can_shortcuts=True, category=self.category,
triggers=self.on_theme_display) triggers=self.on_theme_display)
self.desktop_screen = create_action(self, 'desktopScreen', self.desktop_screen = create_action(self, 'desktopScreen',
text=translate('OpenLP.SlideController', 'Show Desktop'), text=translate('OpenLP.SlideController', 'Show Desktop'),
icon=':/slides/slide_desktop.png', icon=':/slides/slide_desktop.png',
checked=False, can_shortcuts=True, category=self.category, checked=False, can_shortcuts=True, category=self.category,
triggers=self.on_hide_display) triggers=self.on_hide_display)
@ -255,15 +255,16 @@ class SlideController(DisplayController, RegistryProperties):
self.toolbar.add_toolbar_widget(self.delay_spin_box) self.toolbar.add_toolbar_widget(self.delay_spin_box)
else: else:
self.toolbar.add_toolbar_action('goLive', icon=':/general/general_live.png', self.toolbar.add_toolbar_action('goLive', icon=':/general/general_live.png',
tooltip=translate('OpenLP.SlideController', 'Move to live.'), tooltip=translate('OpenLP.SlideController', 'Move to live.'),
triggers=self.on_go_live) triggers=self.on_go_live)
self.toolbar.add_toolbar_action('addToService', icon=':/general/general_add.png', self.toolbar.add_toolbar_action('addToService', icon=':/general/general_add.png',
tooltip=translate('OpenLP.SlideController', 'Add to Service.'), tooltip=translate('OpenLP.SlideController', 'Add to Service.'),
triggers=self.on_preview_add_to_service) triggers=self.on_preview_add_to_service)
self.toolbar.addSeparator() self.toolbar.addSeparator()
self.toolbar.add_toolbar_action('editSong', icon=':/general/general_edit.png', self.toolbar.add_toolbar_action('editSong', icon=':/general/general_edit.png',
tooltip=translate('OpenLP.SlideController', 'Edit and reload song preview.') tooltip=translate('OpenLP.SlideController',
, triggers=self.on_edit_song) 'Edit and reload song preview.'),
triggers=self.on_edit_song)
self.controller_layout.addWidget(self.toolbar) self.controller_layout.addWidget(self.toolbar)
# Build the Media Toolbar # Build the Media Toolbar
self.media_controller.register_controller(self) self.media_controller.register_controller(self)
@ -355,7 +356,7 @@ class SlideController(DisplayController, RegistryProperties):
{'key': 'O', 'configurable': True, 'text': translate('OpenLP.SlideController', 'Go to "Other"')} {'key': 'O', 'configurable': True, 'text': translate('OpenLP.SlideController', 'Go to "Other"')}
] ]
shortcuts.extend([{'key': str(number)} for number in range(10)]) shortcuts.extend([{'key': str(number)} for number in range(10)])
self.controller.addActions([create_action(self, 'shortcutAction_%s' % s['key'], self.controller.addActions([create_action(self, 'shortcutAction_%s' % s['key'],
text=s.get('text'), text=s.get('text'),
can_shortcuts=True, can_shortcuts=True,
context=QtCore.Qt.WidgetWithChildrenShortcut, context=QtCore.Qt.WidgetWithChildrenShortcut,
@ -394,9 +395,9 @@ class SlideController(DisplayController, RegistryProperties):
""" """
Called, when a shortcut has been activated to jump to a chorus, verse, etc. Called, when a shortcut has been activated to jump to a chorus, verse, etc.
**Note**: This implementation is based on shortcuts. But it rather works like "key sequenes". You have to **Note**: This implementation is based on shortcuts. But it rather works like "key sequenes". You have to
press one key after the other and **not** at the same time. press one key after the other and **not** at the same time.
For example to jump to "V3" you have to press "V" and afterwards but within a time frame of 350ms For example to jump to "V3" you have to press "V" and afterwards but within a time frame of 350ms
you have to press "3". you have to press "3".
""" """
try: try:
@ -456,17 +457,17 @@ class SlideController(DisplayController, RegistryProperties):
""" """
self.previous_service = create_action(parent, 'previousService', self.previous_service = create_action(parent, 'previousService',
text=translate('OpenLP.SlideController', 'Previous Service'), text=translate('OpenLP.SlideController', 'Previous Service'),
can_shortcuts=True, context=QtCore.Qt.WidgetWithChildrenShortcut, can_shortcuts=True, context=QtCore.Qt.WidgetWithChildrenShortcut,
category=self.category, category=self.category,
triggers=self.service_previous) triggers=self.service_previous)
self.next_service = create_action(parent, 'nextService', self.next_service = create_action(parent, 'nextService',
text=translate('OpenLP.SlideController', 'Next Service'), text=translate('OpenLP.SlideController', 'Next Service'),
can_shortcuts=True, context=QtCore.Qt.WidgetWithChildrenShortcut, can_shortcuts=True, context=QtCore.Qt.WidgetWithChildrenShortcut,
category=self.category, category=self.category,
triggers=self.service_next) triggers=self.service_next)
self.escape_item = create_action(parent, 'escapeItem', self.escape_item = create_action(parent, 'escapeItem',
text=translate('OpenLP.SlideController', 'Escape Item'), text=translate('OpenLP.SlideController', 'Escape Item'),
can_shortcuts=True, context=QtCore.Qt.WidgetWithChildrenShortcut, can_shortcuts=True, context=QtCore.Qt.WidgetWithChildrenShortcut,
category=self.category, category=self.category,
triggers=self.live_escape) triggers=self.live_escape)
@ -1325,7 +1326,7 @@ class SlideController(DisplayController, RegistryProperties):
""" """
Update how much time is remaining Update how much time is remaining
:param time: the time remainings :param time: the time remaining
""" """
seconds = self.display.audio_player.media_object.remainingTime() // 1000 seconds = self.display.audio_player.media_object.remainingTime() // 1000
minutes = seconds // 60 minutes = seconds // 60

View File

@ -74,12 +74,12 @@ class StartTimeForm(QtGui.QDialog, Ui_StartTimeDialog, RegistryProperties):
self.minute_finish_spin_box.value() * 60 + self.second_finish_spin_box.value() self.minute_finish_spin_box.value() * 60 + self.second_finish_spin_box.value()
if end > self.item['service_item'].media_length: if end > self.item['service_item'].media_length:
critical_error_message_box(title=translate('OpenLP.StartTime_form', 'Time Validation Error'), critical_error_message_box(title=translate('OpenLP.StartTime_form', 'Time Validation Error'),
message=translate('OpenLP.StartTime_form', message=translate('OpenLP.StartTime_form',
'Finish time is set after the end of the media item')) 'Finish time is set after the end of the media item'))
return return
elif start > end: elif start > end:
critical_error_message_box(title=translate('OpenLP.StartTime_form', 'Time Validation Error'), critical_error_message_box(title=translate('OpenLP.StartTime_form', 'Time Validation Error'),
message=translate('OpenLP.StartTime_form', message=translate('OpenLP.StartTime_form',
'Start time is after the finish time of the media item')) 'Start time is after the finish time of the media item'))
return return
self.item['service_item'].start_time = start self.item['service_item'].start_time = start
@ -94,4 +94,4 @@ class StartTimeForm(QtGui.QDialog, Ui_StartTimeDialog, RegistryProperties):
seconds -= 3600 * hours seconds -= 3600 * hours
minutes = seconds // 60 minutes = seconds // 60
seconds -= 60 * minutes seconds -= 60 * minutes
return hours, minutes, seconds return hours, minutes, seconds

View File

@ -180,7 +180,7 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard, RegistryProperties):
self.theme.background_type == background_image and is_not_image_file(self.theme.background_filename): self.theme.background_type == background_image and is_not_image_file(self.theme.background_filename):
QtGui.QMessageBox.critical(self, translate('OpenLP.ThemeWizard', 'Background Image Empty'), QtGui.QMessageBox.critical(self, translate('OpenLP.ThemeWizard', 'Background Image Empty'),
translate('OpenLP.ThemeWizard', '_you have not selected a ' translate('OpenLP.ThemeWizard', '_you have not selected a '
'background image. Please select one before continuing.')) 'background image. Please select one before continuing.'))
return False return False
else: else:
return True return True
@ -540,4 +540,4 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard, RegistryProperties):
new_color = QtGui.QColorDialog.getColor(QtGui.QColor(field), self) new_color = QtGui.QColorDialog.getColor(QtGui.QColor(field), self)
if new_color.isValid(): if new_color.isValid():
field = new_color.name() field = new_color.name()
return field return field

View File

@ -517,7 +517,7 @@ class ThemeManager(OpenLPMixin, RegistryMixin, QtGui.QWidget, Ui_ThemeManager, R
""" """
ret = QtGui.QMessageBox.question(self, translate('OpenLP.ThemeManager', 'Theme Already Exists'), 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?') 'Theme %s already exists. Do you want to replace it?')
.replace('%s', theme_name), .replace('%s', theme_name),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes | QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes |
QtGui.QMessageBox.No), QtGui.QMessageBox.No),
@ -753,4 +753,4 @@ class ThemeManager(OpenLPMixin, RegistryMixin, QtGui.QWidget, Ui_ThemeManager, R
% (theme, plugin.name)) % (theme, plugin.name))
return False return False
return True return True
return False return False

View File

@ -385,10 +385,10 @@ class Ui_ThemeWizard(object):
QtCore.SLOT('setDisabled(bool)')) QtCore.SLOT('setDisabled(bool)'))
QtCore.QObject.connect(self.footer_position_check_box, QtCore.SIGNAL('toggled(bool)'), self.footer_y_spin_box, QtCore.QObject.connect(self.footer_position_check_box, QtCore.SIGNAL('toggled(bool)'), self.footer_y_spin_box,
QtCore.SLOT('setDisabled(bool)')) QtCore.SLOT('setDisabled(bool)'))
QtCore.QObject.connect(self.footer_position_check_box, QtCore.SIGNAL('toggled(bool)'), self.footer_width_spin_box, QtCore.QObject.connect(self.footer_position_check_box, QtCore.SIGNAL('toggled(bool)'),
QtCore.SLOT('setDisabled(bool)')) self.footer_width_spin_box, QtCore.SLOT('setDisabled(bool)'))
QtCore.QObject.connect(self.footer_position_check_box, QtCore.SIGNAL('toggled(bool)'), self.footer_height_spin_box, QtCore.QObject.connect(self.footer_position_check_box, QtCore.SIGNAL('toggled(bool)'),
QtCore.SLOT('setDisabled(bool)')) self.footer_height_spin_box, QtCore.SLOT('setDisabled(bool)'))
def retranslateUi(self, themeWizard): def retranslateUi(self, themeWizard):
""" """
@ -409,15 +409,18 @@ class Ui_ThemeWizard(object):
self.background_combo_box.setItemText(BackgroundType.Gradient, self.background_combo_box.setItemText(BackgroundType.Gradient,
translate('OpenLP.ThemeWizard', 'Gradient')) translate('OpenLP.ThemeWizard', 'Gradient'))
self.background_combo_box.setItemText(BackgroundType.Image, UiStrings().Image) self.background_combo_box.setItemText(BackgroundType.Image, UiStrings().Image)
self.background_combo_box.setItemText(BackgroundType.Transparent, translate('OpenLP.ThemeWizard', 'Transparent')) self.background_combo_box.setItemText(BackgroundType.Transparent,
translate('OpenLP.ThemeWizard', 'Transparent'))
self.color_label.setText(translate('OpenLP.ThemeWizard', 'color:')) self.color_label.setText(translate('OpenLP.ThemeWizard', 'color:'))
self.gradient_start_label.setText(translate('OpenLP.ThemeWizard', 'Starting color:')) self.gradient_start_label.setText(translate('OpenLP.ThemeWizard', 'Starting color:'))
self.gradient_end_label.setText(translate('OpenLP.ThemeWizard', 'Ending color:')) self.gradient_end_label.setText(translate('OpenLP.ThemeWizard', 'Ending color:'))
self.gradient_type_label.setText(translate('OpenLP.ThemeWizard', 'Gradient:')) self.gradient_type_label.setText(translate('OpenLP.ThemeWizard', 'Gradient:'))
self.gradient_combo_box.setItemText(BackgroundGradientType.Horizontal, self.gradient_combo_box.setItemText(BackgroundGradientType.Horizontal,
translate('OpenLP.ThemeWizard', 'Horizontal')) translate('OpenLP.ThemeWizard', 'Horizontal'))
self.gradient_combo_box.setItemText(BackgroundGradientType.Vertical, translate('OpenLP.ThemeWizard', 'Vertical')) self.gradient_combo_box.setItemText(BackgroundGradientType.Vertical,
self.gradient_combo_box.setItemText(BackgroundGradientType.Circular, translate('OpenLP.ThemeWizard', 'Circular')) translate('OpenLP.ThemeWizard', 'Vertical'))
self.gradient_combo_box.setItemText(BackgroundGradientType.Circular,
translate('OpenLP.ThemeWizard', 'Circular'))
self.gradient_combo_box.setItemText(BackgroundGradientType.LeftTop, self.gradient_combo_box.setItemText(BackgroundGradientType.LeftTop,
translate('OpenLP.ThemeWizard', 'Top Left - Bottom Right')) translate('OpenLP.ThemeWizard', 'Top Left - Bottom Right'))
self.gradient_combo_box.setItemText(BackgroundGradientType.LeftBottom, self.gradient_combo_box.setItemText(BackgroundGradientType.LeftBottom,
@ -486,6 +489,6 @@ class Ui_ThemeWizard(object):
self.preview_page.setSubTitle(translate('OpenLP.ThemeWizard', 'Preview the theme and save it.')) self.preview_page.setSubTitle(translate('OpenLP.ThemeWizard', 'Preview the theme and save it.'))
self.theme_name_label.setText(translate('OpenLP.ThemeWizard', 'Theme name:')) self.theme_name_label.setText(translate('OpenLP.ThemeWizard', 'Theme name:'))
# Align all QFormLayouts towards each other. # Align all QFormLayouts towards each other.
label_width = max(self.background_label.minimumSizeHint().width(), label_width = max(self.background_label.minimumSizeHint().width(),
self.horizontal_label.minimumSizeHint().width()) self.horizontal_label.minimumSizeHint().width())
self.spacer.changeSize(label_width, 0, QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) self.spacer.changeSize(label_width, 0, QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)

View File

@ -303,4 +303,4 @@ class OpenLPWizard(QtGui.QWizard, RegistryProperties):
QtGui.QFileDialog.ShowDirsOnly) QtGui.QFileDialog.ShowDirsOnly)
if folder: if folder:
editbox.setText(folder) editbox.setText(folder)
Settings().setValue(self.plugin.settings_section + '/' + setting_name, folder) Settings().setValue(self.plugin.settings_section + '/' + setting_name, folder)

View File

@ -72,13 +72,18 @@ USER_AGENTS = {
'Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.71 Safari/537.36' 'Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.71 Safari/537.36'
], ],
'darwin': [ 'darwin': [
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_3) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31', 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_3) AppleWebKit/537.31 (KHTML, like Gecko) '
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_3) AppleWebKit/536.11 (KHTML, like Gecko) Chrome/20.0.1132.57 Safari/536.11', 'Chrome/26.0.1410.43 Safari/537.31',
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/536.11 (KHTML, like Gecko) Chrome/20.0.1132.47 Safari/536.11', 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_3) AppleWebKit/536.11 (KHTML, like Gecko) '
'Chrome/20.0.1132.57 Safari/536.11',
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/536.11 (KHTML, like Gecko) '
'Chrome/20.0.1132.47 Safari/536.11',
], ],
'linux2': [ 'linux2': [
'Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.22 (KHTML, like Gecko) Ubuntu Chromium/25.0.1364.160 Chrome/25.0.1364.160 Safari/537.22', 'Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.22 (KHTML, like Gecko) Ubuntu Chromium/25.0.1364.160 '
'Mozilla/5.0 (X11; CrOS armv7l 2913.260.0) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.99 Safari/537.11', 'Chrome/25.0.1364.160 Safari/537.22',
'Mozilla/5.0 (X11; CrOS armv7l 2913.260.0) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.99 '
'Safari/537.11',
'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.27 (KHTML, like Gecko) Chrome/26.0.1389.0 Safari/537.27' 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.27 (KHTML, like Gecko) Chrome/26.0.1389.0 Safari/537.27'
], ],
'default': [ 'default': [
@ -144,9 +149,9 @@ def get_application_version():
# If they are equal, then this tree is tarball with the source for the release. We do not want the revision # If they are equal, then this tree is tarball with the source for the release. We do not want the revision
# number in the full version. # number in the full version.
if tree_revision == tag_revision: if tree_revision == tag_revision:
full_version = tag_version full_version = tag_version
else: else:
full_version = '%s-bzr%s' % (tag_version, tree_revision) full_version = '%s-bzr%s' % (tag_version, tree_revision)
else: else:
# We're not running the development version, let's use the file. # We're not running the development version, let's use the file.
filepath = AppLocation.get_directory(AppLocation.VersionDir) filepath = AppLocation.get_directory(AppLocation.VersionDir)

View File

@ -295,7 +295,7 @@ class ActionList(object):
ActionList.shortcut_map[shortcuts[1]] = actions ActionList.shortcut_map[shortcuts[1]] = actions
else: else:
log.warn('Shortcut "%s" is removed from "%s" because another action already uses this shortcut.' % log.warn('Shortcut "%s" is removed from "%s" because another action already uses this shortcut.' %
(shortcuts[1], action.objectName())) (shortcuts[1], action.objectName()))
shortcuts.remove(shortcuts[1]) shortcuts.remove(shortcuts[1])
# Check the primary shortcut. # Check the primary shortcut.
existing_actions = ActionList.shortcut_map.get(shortcuts[0], []) existing_actions = ActionList.shortcut_map.get(shortcuts[0], [])
@ -306,7 +306,7 @@ class ActionList(object):
ActionList.shortcut_map[shortcuts[0]] = actions ActionList.shortcut_map[shortcuts[0]] = actions
else: else:
log.warn('Shortcut "%s" is removed from "%s" because another action already uses this shortcut.' % log.warn('Shortcut "%s" is removed from "%s" because another action already uses this shortcut.' %
(shortcuts[0], action.objectName())) (shortcuts[0], action.objectName()))
shortcuts.remove(shortcuts[0]) shortcuts.remove(shortcuts[0])
action.setShortcuts([QtGui.QKeySequence(shortcut) for shortcut in shortcuts]) action.setShortcuts([QtGui.QKeySequence(shortcut) for shortcut in shortcuts])

View File

@ -126,8 +126,9 @@ class LanguageManager(object):
log.info('Language file: \'%s\' written to conf file' % language) log.info('Language file: \'%s\' written to conf file' % language)
if message: if message:
QtGui.QMessageBox.information(None, QtGui.QMessageBox.information(None,
translate('OpenLP.LanguageManager', 'Language'), translate('OpenLP.LanguageManager', 'Language'),
translate('OpenLP.LanguageManager', 'Please restart OpenLP to use your new language setting.')) translate('OpenLP.LanguageManager', 'Please restart OpenLP to use your new '
'language setting.'))
@staticmethod @staticmethod
def init_qm_list(): def init_qm_list():