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:
app_path = os.path.abspath(os.path.split(sys.argv[0])[0])
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:
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:

View File

@ -91,4 +91,4 @@ class OpenLPMixin(object):
Common log exception handler which prints the calling path
"""
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:
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.DefaultColor = translate('OpenLP.Ui', 'Default Color:')
self.DefaultServiceName = translate('OpenLP.Ui', 'Service %Y-%m-%d %H-%M',
'This may not contain any of the following characters: /\\?*|<>\[\]":+\n'
'See http://docs.python.org/library/datetime.html#strftime-strptime-behavior for more information.')
'This may not contain any of the following characters: /\\?*|<>\[\]":+\n'
'See http://docs.python.org/library/datetime'
'.html#strftime-strptime-behavior for more information.')
self.Delete = translate('OpenLP.Ui', '&Delete')
self.DisplayStyle = translate('OpenLP.Ui', 'Display style:')
self.Duplicate = translate('OpenLP.Ui', 'Duplicate Error')
@ -132,7 +133,7 @@ class UiStrings(object):
self.Service = translate('OpenLP.Ui', 'Service')
self.Split = translate('OpenLP.Ui', 'Optional &Split')
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.StopPlaySlidesInLoop = translate('OpenLP.Ui', 'Stop Play Slides in Loop')
self.StopPlaySlidesToEnd = translate('OpenLP.Ui', 'Stop Play Slides to End')

View File

@ -63,4 +63,4 @@ class FileDialog(QtGui.QFileDialog):
UiStrings().FileNotFoundMessage % file)
continue
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;
word-wrap: break-word;
-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 {
-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:
padding_bottom = '0'
lyrics = '%s word-wrap: break-word; ' \
'text-align: %s; vertical-align: %s; font-family: %s; ' \
'font-size: %spt; color: %s; line-height: %d%%; margin: 0;' \
'padding: 0; padding-bottom: %s; padding-left: %spx; width: %spx; height: %spx; ' % \
'text-align: %s; vertical-align: %s; font-family: %s; ' \
'font-size: %spt; color: %s; line-height: %d%%; margin: 0;' \
'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,
theme_data.font_main_color, 100 + int(theme_data.font_main_line_adjustment), padding_bottom,
left_margin, width, height)
theme_data.font_main_color, 100 + int(theme_data.font_main_line_adjustment), padding_bottom,
left_margin, width, height)
if theme_data.font_main_italics:
lyrics += 'font-style:italic; '
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 source: The source describes the image's origin. Possible values are described in the
: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
match with the display ratio.
:param background: A ``QtGui.QColor`` object specifying the colour to be used to fill the gabs if the image's
ratio does not match with the display ratio.
"""
self.path = path

View File

@ -393,4 +393,4 @@ class Plugin(QtCore.QObject, RegistryProperties):
"""
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
default.
: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::
: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::
(<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.
"""
self.tabTitleVisible = UiStrings().Advanced
self.tab_title_visible = UiStrings().Advanced
self.ui_group_box.setTitle(translate('OpenLP.AdvancedTab', 'UI Settings'))
self.data_directory_group_box.setTitle(translate('OpenLP.AdvancedTab', 'Data Location'))
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 '
'OpenLP data files. These files WILL be replaced during a copy.'))
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'))
# 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()
if not os.path.exists(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'
'This data directory was previously changed from the OpenLP '
'default location. If the new location was on removable '
@ -537,8 +538,9 @@ class AdvancedTab(SettingsTab):
# Make sure they want to change the data.
answer = QtGui.QMessageBox.question(self, translate('OpenLP.AdvancedTab', 'Confirm Data Directory Change'),
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 '
'will be changed when OpenLP is closed.').replace('%s', new_data_path),
'location of the OpenLP data directory to:\n\n%s\n\nThe data '
'directory will be changed when OpenLP is closed.').
replace('%s', new_data_path),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes |
QtGui.QMessageBox.No),
QtGui.QMessageBox.No)
@ -561,8 +563,9 @@ class AdvancedTab(SettingsTab):
# default.
answer = QtGui.QMessageBox.question(self, translate('OpenLP.AdvancedTab', 'Reset Data Directory'),
translate('OpenLP.AdvancedTab', 'Are you sure you want to change the '
'location of the OpenLP data directory to the default location?\n\nThis'
' location will be used after OpenLP is closed.'),
'location of the OpenLP data directory to the default '
'location?\n\nThis location will be used after OpenLP is '
'closed.'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes |
QtGui.QMessageBox.No),
QtGui.QMessageBox.No)
@ -588,7 +591,7 @@ class AdvancedTab(SettingsTab):
else:
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.
"""
@ -602,8 +605,8 @@ class AdvancedTab(SettingsTab):
translate('OpenLP.AdvancedTab',
'WARNING: \n\nThe location you have selected \n\n%s\n\n'
'appears to contain OpenLP data files. Do you wish to '
'replace these files with the current data files?').replace
('%s', os.path.abspath(data_path,)),
'replace these files with the current data files?').
replace('%s', os.path.abspath(data_path,)),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes |
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',
icon=':/general/general_open.png',
click=self.on_attach_file_button_clicked)
self.button_box = create_button_box(exception_dialog, 'button_box',
['close'], [self.send_report_button,
self.save_report_button, self.attach_tile_button])
self.button_box = create_button_box(exception_dialog, 'button_box', ['close'],
[self.send_report_button, self.save_report_button, self.attach_tile_button])
self.exception_layout.addWidget(self.button_box)
self.retranslateUi(exception_dialog)

View File

@ -157,7 +157,8 @@ class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog, RegistryProperties):
'--- Exception Traceback ---\n%s\n'
'--- System information ---\n%s\n'
'--- Library Versions ---\n%s\n')
filename = QtGui.QFileDialog.getSaveFileName(self,
filename = QtGui.QFileDialog.getSaveFileName(
self,
translate('OpenLP.ExceptionForm', 'Save Crash Report'),
Settings().value(self.settings_section + '/last directory'),
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.
"""
body = translate('OpenLP.ExceptionForm',
'*OpenLP Bug Report*\n'
'Version: %s\n\n'
'--- Details of the Exception. ---\n\n%s\n\n '
'--- Exception Traceback ---\n%s\n'
'--- System information ---\n%s\n'
'--- Library Versions ---\n%s\n',
'Please add the information that bug reports are favoured written '
'in English.')
'*OpenLP Bug Report*\n'
'Version: %s\n\n'
'--- Details of the Exception. ---\n\n%s\n\n '
'--- Exception Traceback ---\n%s\n'
'--- System information ---\n%s\n'
'--- Library Versions ---\n%s\n',
'Please add the information that bug reports are favoured written in English.')
content = self._create_report()
source = ''
exception = ''

View File

@ -57,4 +57,4 @@ class FileRenameForm(QtGui.QDialog, Ui_FileRenameDialog, RegistryProperties):
else:
self.setWindowTitle(translate('OpenLP.FileRenameForm', 'File Rename'))
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.
"""
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:
return translate('OpenLP.FormattingTagForm',
'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.addStretch()
self.list_data_grid_layout.addLayout(self.edit_button_layout)
self.button_box = create_button_box(formatting_tag_dialog, 'button_box',
['cancel', 'save', 'defaults'])
self.button_box = create_button_box(formatting_tag_dialog, 'button_box', ['cancel', 'save', 'defaults'])
self.save_button = self.button_box.button(QtGui.QDialogButtonBox.Save)
self.save_button.setObjectName('save_button')
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)
#self.tag_table_widget.selectRow(pre_row - 1)
self.tag_table_widget.resizeRowsToContents()

View File

@ -223,7 +223,8 @@ class GeneralTab(SettingsTab):
self.save_check_service_check_box.setText(translate('OpenLP.GeneralTab',
'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_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_spin_box.setSuffix(translate('OpenLP.GeneralTab', ' sec'))
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.
"""
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
"""
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.
QtGui.QMessageBox.information(self, translate('OpenLP.MainWindow', 'Import settings'),
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))
self.settings_imported = True
self.clean_up()
@ -1042,8 +1042,8 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow, RegistryProperties):
ret = QtGui.QMessageBox.question(self, translate('OpenLP.MainWindow', 'Close OpenLP'),
translate('OpenLP.MainWindow', 'Are you sure you want to close '
'OpenLP?'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes | QtGui
.QMessageBox.No),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes |
QtGui.QMessageBox.No),
QtGui.QMessageBox.Yes)
if ret == QtGui.QMessageBox.Yes:
self.clean_up()
@ -1234,16 +1234,15 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow, RegistryProperties):
self.recent_files_menu.clear()
for file_id, filename in enumerate(recent_files_to_display):
log.debug('Recent file name: %s', filename)
action = create_action(self, '',
text='&%d %s' % (file_id + 1,
action = create_action(self, '', text='&%d %s' % (file_id + 1,
os.path.splitext(os.path.basename(str(filename)))[0]), data=filename,
triggers=self.service_manager_contents.on_recent_service_clicked)
self.recent_files_menu.addAction(action)
clear_recent_files_action = create_action(self, '',
text=translate('OpenLP.MainWindow', 'Clear List', 'Clear List of '
'recent files'),
'recent files'),
statustip=translate('OpenLP.MainWindow', 'Clear the list of recent '
'files.'),
'files.'),
enabled=bool(self.recent_files),
triggers=self.clear_recent_file_menu)
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()
log.exception('Data copy failed %s' % str(why))
QtGui.QMessageBox.critical(self, translate('OpenLP.MainWindow', 'New Data Directory Error'),
translate('OpenLP.MainWindow',
'OpenLP Data directory copy failed\n\n%s').replace('%s', str(why)),
translate('OpenLP.MainWindow', 'OpenLP Data directory copy failed\n\n%s').
replace('%s', str(why)),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
return False
else:
@ -1365,5 +1364,3 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow, RegistryProperties):
if self.new_data_path == AppLocation.get_directory(AppLocation.DataDir):
settings.remove('advanced/data path')
self.application.set_normal_cursor()

View File

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

View File

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

View File

@ -291,4 +291,4 @@ class VlcPlayer(MediaPlayer):
'<br/> <strong>' + translate('Media.player', 'Audio') +
'</strong><br/>' + str(AUDIO_EXT) + '<br/><strong>' +
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:
status_text = translate('OpenLP.PluginForm', '%s (Disabled)')
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
for item in self.service_manager.service_items:
# 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:
file_name = QtGui.QFileDialog.getSaveFileName(self.main_window, UiStrings().SaveService, path,
translate('OpenLP.ServiceManager',
'OpenLP Service Files (*.osz);; OpenLP Service Files - lite '
'(*.oszl)'))
'OpenLP Service Files (*.osz);; OpenLP Service '
'Files - lite (*.oszl)'))
else:
file_name = QtGui.QFileDialog.getSaveFileName(self.main_window, UiStrings().SaveService, path,
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)
QtGui.QMessageBox.information(self, translate('OpenLP.ServiceManager', 'Corrupt File'),
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()
return
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())
tips = []
if service_item_from_item.temporary_edit:
tips.append('<strong>%s:</strong> <em>%s</em>' %
(translate('OpenLP.ServiceManager', 'Edit'),
tips.append('<strong>%s:</strong> <em>%s</em>' % (translate('OpenLP.ServiceManager', 'Edit'),
(translate('OpenLP.ServiceManager', 'Service copy only'))))
if service_item_from_item.theme and service_item_from_item.theme != -1:
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):
"""
Finds the first selected ServiceItem in the list and returns the position of the service_item_from_item and its selected
child item. For example, if the third child item (in the Slidecontroller known as slide) in the second service
item is selected this will return::
Finds the first selected ServiceItem in the list and returns the position of the service_item_from_item and its
selected child item. For example, if the third child item (in the Slidecontroller known as slide) in the
second service item is selected this will return::
(1, 2)
"""
@ -1632,4 +1632,4 @@ class ServiceManager(OpenLPMixin, RegistryMixin, QtGui.QWidget, Ui_ServiceManage
Print a Service Order Sheet.
"""
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
"""
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
"""
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'),
translate('OpenLP.ShortcutListDialog', 'Do you want to restore all '
'shortcuts to their defaults?'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes |
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes |
QtGui.QMessageBox.No)) == QtGui.QMessageBox.No:
return
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())
self.toolbar.setSizePolicy(size_toolbar_policy)
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',
tooltip=translate('OpenLP.SlideController', 'Move to previous.'),
can_shortcuts=True, context=QtCore.Qt.WidgetWithChildrenShortcut,
category=self.category, triggers=self.on_slide_selected_previous)
self.toolbar.addAction(self.previous_item)
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',
tooltip=translate('OpenLP.SlideController', 'Move to next.'),
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.toolbar.add_toolbar_widget(self.hide_menu)
self.blank_screen = create_action(self, 'blankScreen',
text=translate('OpenLP.SlideController', 'Blank Screen'),
text=translate('OpenLP.SlideController', 'Blank Screen'),
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)
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',
checked=False, can_shortcuts=True, category=self.category,
triggers=self.on_theme_display)
self.desktop_screen = create_action(self, 'desktopScreen',
text=translate('OpenLP.SlideController', 'Show Desktop'),
text=translate('OpenLP.SlideController', 'Show Desktop'),
icon=':/slides/slide_desktop.png',
checked=False, can_shortcuts=True, category=self.category,
triggers=self.on_hide_display)
@ -255,15 +255,16 @@ class SlideController(DisplayController, RegistryProperties):
self.toolbar.add_toolbar_widget(self.delay_spin_box)
else:
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)
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)
self.toolbar.addSeparator()
self.toolbar.add_toolbar_action('editSong', icon=':/general/general_edit.png',
tooltip=translate('OpenLP.SlideController', 'Edit and reload song preview.')
, triggers=self.on_edit_song)
tooltip=translate('OpenLP.SlideController',
'Edit and reload song preview.'),
triggers=self.on_edit_song)
self.controller_layout.addWidget(self.toolbar)
# Build the Media Toolbar
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"')}
]
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'),
can_shortcuts=True,
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.
**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.
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".
"""
try:
@ -456,17 +457,17 @@ class SlideController(DisplayController, RegistryProperties):
"""
self.previous_service = create_action(parent, 'previousService',
text=translate('OpenLP.SlideController', 'Previous Service'),
can_shortcuts=True, context=QtCore.Qt.WidgetWithChildrenShortcut,
can_shortcuts=True, context=QtCore.Qt.WidgetWithChildrenShortcut,
category=self.category,
triggers=self.service_previous)
self.next_service = create_action(parent, 'nextService',
text=translate('OpenLP.SlideController', 'Next Service'),
can_shortcuts=True, context=QtCore.Qt.WidgetWithChildrenShortcut,
can_shortcuts=True, context=QtCore.Qt.WidgetWithChildrenShortcut,
category=self.category,
triggers=self.service_next)
self.escape_item = create_action(parent, 'escapeItem',
text=translate('OpenLP.SlideController', 'Escape Item'),
can_shortcuts=True, context=QtCore.Qt.WidgetWithChildrenShortcut,
can_shortcuts=True, context=QtCore.Qt.WidgetWithChildrenShortcut,
category=self.category,
triggers=self.live_escape)
@ -1325,7 +1326,7 @@ class SlideController(DisplayController, RegistryProperties):
"""
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
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()
if end > self.item['service_item'].media_length:
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'))
return
elif start > end:
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'))
return
self.item['service_item'].start_time = start
@ -94,4 +94,4 @@ class StartTimeForm(QtGui.QDialog, Ui_StartTimeDialog, RegistryProperties):
seconds -= 3600 * hours
minutes = seconds // 60
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):
QtGui.QMessageBox.critical(self, translate('OpenLP.ThemeWizard', 'Background Image Empty'),
translate('OpenLP.ThemeWizard', '_you have not selected a '
'background image. Please select one before continuing.'))
'background image. Please select one before continuing.'))
return False
else:
return True
@ -540,4 +540,4 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard, RegistryProperties):
new_color = QtGui.QColorDialog.getColor(QtGui.QColor(field), self)
if new_color.isValid():
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'),
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),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes |
QtGui.QMessageBox.No),
@ -753,4 +753,4 @@ class ThemeManager(OpenLPMixin, RegistryMixin, QtGui.QWidget, Ui_ThemeManager, R
% (theme, plugin.name))
return False
return True
return False
return False

View File

@ -385,10 +385,10 @@ class Ui_ThemeWizard(object):
QtCore.SLOT('setDisabled(bool)'))
QtCore.QObject.connect(self.footer_position_check_box, QtCore.SIGNAL('toggled(bool)'), self.footer_y_spin_box,
QtCore.SLOT('setDisabled(bool)'))
QtCore.QObject.connect(self.footer_position_check_box, QtCore.SIGNAL('toggled(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.SLOT('setDisabled(bool)'))
QtCore.QObject.connect(self.footer_position_check_box, QtCore.SIGNAL('toggled(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.SLOT('setDisabled(bool)'))
def retranslateUi(self, themeWizard):
"""
@ -409,15 +409,18 @@ class Ui_ThemeWizard(object):
self.background_combo_box.setItemText(BackgroundType.Gradient,
translate('OpenLP.ThemeWizard', 'Gradient'))
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.gradient_start_label.setText(translate('OpenLP.ThemeWizard', 'Starting color:'))
self.gradient_end_label.setText(translate('OpenLP.ThemeWizard', 'Ending color:'))
self.gradient_type_label.setText(translate('OpenLP.ThemeWizard', 'Gradient:'))
self.gradient_combo_box.setItemText(BackgroundGradientType.Horizontal,
translate('OpenLP.ThemeWizard', 'Horizontal'))
self.gradient_combo_box.setItemText(BackgroundGradientType.Vertical, translate('OpenLP.ThemeWizard', 'Vertical'))
self.gradient_combo_box.setItemText(BackgroundGradientType.Circular, translate('OpenLP.ThemeWizard', 'Circular'))
self.gradient_combo_box.setItemText(BackgroundGradientType.Vertical,
translate('OpenLP.ThemeWizard', 'Vertical'))
self.gradient_combo_box.setItemText(BackgroundGradientType.Circular,
translate('OpenLP.ThemeWizard', 'Circular'))
self.gradient_combo_box.setItemText(BackgroundGradientType.LeftTop,
translate('OpenLP.ThemeWizard', 'Top Left - Bottom Right'))
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.theme_name_label.setText(translate('OpenLP.ThemeWizard', 'Theme name:'))
# 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.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)
if 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'
],
'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_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',
'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_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': [
'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; CrOS armv7l 2913.260.0) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.99 Safari/537.11',
'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; 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'
],
'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
# number in the full version.
if tree_revision == tag_revision:
full_version = tag_version
full_version = tag_version
else:
full_version = '%s-bzr%s' % (tag_version, tree_revision)
full_version = '%s-bzr%s' % (tag_version, tree_revision)
else:
# We're not running the development version, let's use the file.
filepath = AppLocation.get_directory(AppLocation.VersionDir)

View File

@ -295,7 +295,7 @@ class ActionList(object):
ActionList.shortcut_map[shortcuts[1]] = actions
else:
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])
# Check the primary shortcut.
existing_actions = ActionList.shortcut_map.get(shortcuts[0], [])
@ -306,7 +306,7 @@ class ActionList(object):
ActionList.shortcut_map[shortcuts[0]] = actions
else:
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])
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)
if message:
QtGui.QMessageBox.information(None,
translate('OpenLP.LanguageManager', 'Language'),
translate('OpenLP.LanguageManager', 'Please restart OpenLP to use your new language setting.'))
translate('OpenLP.LanguageManager', 'Language'),
translate('OpenLP.LanguageManager', 'Please restart OpenLP to use your new '
'language setting.'))
@staticmethod
def init_qm_list():