Fix pep8 errors

This commit is contained in:
Simon Hanna 2016-01-09 17:26:14 +01:00
parent bf4225838e
commit afaf54a142
50 changed files with 101 additions and 126 deletions

View File

@ -252,7 +252,8 @@ class Settings(QtCore.QSettings):
'shortcuts/blankScreen': [QtGui.QKeySequence(QtCore.Qt.Key_Period)],
'shortcuts/collapse': [QtGui.QKeySequence(QtCore.Qt.Key_Minus)],
'shortcuts/desktopScreen': [QtGui.QKeySequence(QtCore.Qt.Key_D)],
'shortcuts/delete': [QtGui.QKeySequence(QtGui.QKeySequence.Delete), QtGui.QKeySequence(QtCore.Qt.Key_Delete)],
'shortcuts/delete': [QtGui.QKeySequence(QtGui.QKeySequence.Delete),
QtGui.QKeySequence(QtCore.Qt.Key_Delete)],
'shortcuts/down': [QtGui.QKeySequence(QtCore.Qt.Key_Down)],
'shortcuts/editSong': [],
'shortcuts/escapeItem': [QtGui.QKeySequence(QtCore.Qt.Key_Escape)],
@ -329,7 +330,8 @@ class Settings(QtCore.QSettings):
'shortcuts/moveBottom': [QtGui.QKeySequence(QtCore.Qt.Key_End)],
'shortcuts/moveDown': [QtGui.QKeySequence(QtCore.Qt.Key_PageDown)],
'shortcuts/nextTrackItem': [],
'shortcuts/nextItem_live': [QtGui.QKeySequence(QtCore.Qt.Key_Down), QtGui.QKeySequence(QtCore.Qt.Key_PageDown)],
'shortcuts/nextItem_live': [QtGui.QKeySequence(QtCore.Qt.Key_Down),
QtGui.QKeySequence(QtCore.Qt.Key_PageDown)],
'shortcuts/nextItem_preview': [QtGui.QKeySequence(QtCore.Qt.Key_Down),
QtGui.QKeySequence(QtCore.Qt.Key_PageDown)],
'shortcuts/nextService': [QtGui.QKeySequence(QtCore.Qt.Key_Right)],
@ -339,7 +341,8 @@ class Settings(QtCore.QSettings):
QtGui.QKeySequence(QtCore.Qt.ALT + QtCore.Qt.Key_F1)],
'shortcuts/openService': [],
'shortcuts/saveService': [],
'shortcuts/previousItem_live': [QtGui.QKeySequence(QtCore.Qt.Key_Up), QtGui.QKeySequence(QtCore.Qt.Key_PageUp)],
'shortcuts/previousItem_live': [QtGui.QKeySequence(QtCore.Qt.Key_Up),
QtGui.QKeySequence(QtCore.Qt.Key_PageUp)],
'shortcuts/playbackPause': [],
'shortcuts/playbackPlay': [],
'shortcuts/playbackStop': [],

View File

@ -531,6 +531,7 @@ def words_split(line):
line = line.replace('\n', ' ')
return line.split(' ')
def get_start_tags(raw_text):
"""
Tests the given text for not closed formatting tags and returns a tuple consisting of three unicode strings::
@ -566,4 +567,3 @@ def get_start_tags(raw_text):
# Remove the indexes.
html_tags = [tag[1] for tag in html_tags]
return raw_text + ''.join(end_tags), ''.join(start_tags), ''.join(html_tags)

View File

@ -224,7 +224,7 @@ class ScreenList(object):
y = window.y() + (window.height() // 2)
for screen in self.screen_list:
size = screen['size']
if x >= size.x() and x <= (size.x() + size.width()) and y >= size.y() and y <= (size.y() + size.height()):
if size.x() <= x <= (size.x() + size.width()) and size.y() <= y <= (size.y() + size.height()):
return screen['number']
def load_screen_settings(self):

View File

@ -40,8 +40,7 @@ class AboutForm(QtWidgets.QDialog, UiAboutDialog):
"""
Do some initialisation stuff
"""
super(AboutForm, self).__init__(parent, QtCore.Qt.WindowSystemMenuHint
| QtCore.Qt.WindowTitleHint)
super(AboutForm, self).__init__(parent, QtCore.Qt.WindowSystemMenuHint | QtCore.Qt.WindowTitleHint)
self._setup()
def _setup(self):

View File

@ -89,8 +89,7 @@ class ExceptionForm(QtWidgets.QDialog, Ui_ExceptionDialog, RegistryProperties):
"""
Constructor.
"""
super(ExceptionForm, self).__init__(None, QtCore.Qt.WindowSystemMenuHint
| QtCore.Qt.WindowTitleHint)
super(ExceptionForm, self).__init__(None, QtCore.Qt.WindowSystemMenuHint | QtCore.Qt.WindowTitleHint)
self.setupUi(self)
self.settings_section = 'crashreport'
self.report_text = '**OpenLP Bug Report**\n' \

View File

@ -39,7 +39,7 @@ class FileRenameForm(QtWidgets.QDialog, Ui_FileRenameDialog, RegistryProperties)
Constructor
"""
super(FileRenameForm, self).__init__(Registry().get('main_window'),
QtCore.Qt.WindowSystemMenuHint | QtCore.Qt.WindowTitleHint)
QtCore.Qt.WindowSystemMenuHint | QtCore.Qt.WindowTitleHint)
self._setup()
def _setup(self):

View File

@ -37,8 +37,7 @@ class FirstTimeLanguageForm(QtWidgets.QDialog, Ui_FirstTimeLanguageDialog):
"""
Constructor
"""
super(FirstTimeLanguageForm, self).__init__(parent, QtCore.Qt.WindowSystemMenuHint
| QtCore.Qt.WindowTitleHint)
super(FirstTimeLanguageForm, self).__init__(parent, QtCore.Qt.WindowSystemMenuHint | QtCore.Qt.WindowTitleHint)
self.setupUi(self)
self.qm_list = LanguageManager.get_qm_list()
self.language_combo_box.addItem('Autodetect')

View File

@ -51,8 +51,7 @@ class FormattingTagForm(QtWidgets.QDialog, Ui_FormattingTagDialog, FormattingTag
"""
Constructor
"""
super(FormattingTagForm, self).__init__(parent, QtCore.Qt.WindowSystemMenuHint
| QtCore.Qt.WindowTitleHint)
super(FormattingTagForm, self).__init__(parent, QtCore.Qt.WindowSystemMenuHint | QtCore.Qt.WindowTitleHint)
self.setupUi(self)
self._setup()

View File

@ -326,10 +326,10 @@ class WebkitPlayer(MediaPlayer):
controller = display.controller
if controller.media_info.is_flash:
seek = seek_value
display.frame.evaluateJavaScript('show_flash("seek", null, null, "%s");' % (seek))
display.frame.evaluateJavaScript('show_flash("seek", null, null, "%s");' % seek)
else:
seek = float(seek_value) / 1000
display.frame.evaluateJavaScript('show_video("seek", null, null, null, "%f");' % (seek))
display.frame.evaluateJavaScript('show_video("seek", null, null, null, "%f");' % seek)
def reset(self, display):
"""

View File

@ -41,8 +41,7 @@ class PluginForm(QtWidgets.QDialog, Ui_PluginViewDialog, RegistryProperties):
"""
Constructor
"""
super(PluginForm, self).__init__(parent, QtCore.Qt.WindowSystemMenuHint
| QtCore.Qt.WindowTitleHint)
super(PluginForm, self).__init__(parent, QtCore.Qt.WindowSystemMenuHint | QtCore.Qt.WindowTitleHint)
self.active_plugin = None
self.programatic_change = False
self.setupUi(self)

View File

@ -113,7 +113,7 @@ class PrintServiceForm(QtWidgets.QDialog, Ui_PrintServiceDialog, RegistryPropert
Constructor
"""
super(PrintServiceForm, self).__init__(Registry().get('main_window'),
QtCore.Qt.WindowSystemMenuHint | QtCore.Qt.WindowTitleHint)
QtCore.Qt.WindowSystemMenuHint | QtCore.Qt.WindowTitleHint)
self.printer = QtPrintSupport.QPrinter()
self.print_dialog = QtPrintSupport.QPrintDialog(self.printer, self)
self.document = QtGui.QTextDocument()

View File

@ -144,8 +144,7 @@ class ProjectorEditForm(QDialog, Ui_ProjectorEditForm):
editProjector = pyqtSignal(object)
def __init__(self, parent=None, projectordb=None):
super(ProjectorEditForm, self).__init__(parent, QtCore.Qt.WindowSystemMenuHint
| QtCore.Qt.WindowTitleHint)
super(ProjectorEditForm, self).__init__(parent, QtCore.Qt.WindowSystemMenuHint | QtCore.Qt.WindowTitleHint)
self.projectordb = projectordb
self.setupUi(self)
self.button_box.accepted.connect(self.accept_me)

View File

@ -236,8 +236,7 @@ class SourceSelectTabs(QDialog):
:param projectordb: ProjectorDB session to use
"""
log.debug('Initializing SourceSelectTabs()')
super(SourceSelectTabs, self).__init__(parent, QtCore.Qt.WindowSystemMenuHint
| QtCore.Qt.WindowTitleHint)
super(SourceSelectTabs, self).__init__(parent, QtCore.Qt.WindowSystemMenuHint | QtCore.Qt.WindowTitleHint)
self.setMinimumWidth(350)
self.projectordb = projectordb
self.edit = edit
@ -386,8 +385,7 @@ class SourceSelectSingle(QDialog):
"""
log.debug('Initializing SourceSelectSingle()')
self.projectordb = projectordb
super(SourceSelectSingle, self).__init__(parent, QtCore.Qt.WindowSystemMenuHint
| QtCore.Qt.WindowTitleHint)
super(SourceSelectSingle, self).__init__(parent, QtCore.Qt.WindowSystemMenuHint | QtCore.Qt.WindowTitleHint)
self.edit = edit
if self.edit:
title = translate('OpenLP.SourceSelectForm', 'Edit Projector Source Text')

View File

@ -38,7 +38,7 @@ class ServiceItemEditForm(QtWidgets.QDialog, Ui_ServiceItemEditDialog, RegistryP
Constructor
"""
super(ServiceItemEditForm, self).__init__(Registry().get('main_window'),
QtCore.Qt.WindowSystemMenuHint | QtCore.Qt.WindowTitleHint)
QtCore.Qt.WindowSystemMenuHint | QtCore.Qt.WindowTitleHint)
self.setupUi(self)
self.item_list = []
self.list_widget.currentRowChanged.connect(self.on_current_row_changed)

View File

@ -1131,6 +1131,7 @@ class ServiceManager(OpenLPMixin, RegistryMixin, QtWidgets.QWidget, Ui_ServiceMa
:param item: The service item to be checked
"""
pos = item.data(0, QtCore.Qt.UserRole)
print('{}: {}; {}'.format(pos, len(self.service_items), item.text()))
self.service_items[pos - 1]['expanded'] = False
def on_expand_all(self, field=None):
@ -1149,6 +1150,7 @@ class ServiceManager(OpenLPMixin, RegistryMixin, QtWidgets.QWidget, Ui_ServiceMa
:param item: The service item to be checked
"""
pos = item.data(0, QtCore.Qt.UserRole)
print('{}: {}; {}'.format(pos, len(self.service_items), item.text()))
self.service_items[pos - 1]['expanded'] = True
def on_service_top(self, field=None):
@ -1666,4 +1668,3 @@ def get_parent_item_data(item):
return item.data(0, QtCore.Qt.UserRole)
else:
return parent_item.data(0, QtCore.Qt.UserRole)

View File

@ -38,7 +38,7 @@ class ServiceNoteForm(QtWidgets.QDialog, RegistryProperties):
Constructor
"""
super(ServiceNoteForm, self).__init__(Registry().get('main_window'),
QtCore.Qt.WindowSystemMenuHint | QtCore.Qt.WindowTitleHint)
QtCore.Qt.WindowSystemMenuHint | QtCore.Qt.WindowTitleHint)
self.setupUi()
self.retranslateUi()

View File

@ -46,8 +46,7 @@ class SettingsForm(QtWidgets.QDialog, Ui_SettingsDialog, RegistryProperties):
"""
Registry().register('settings_form', self)
Registry().register_function('bootstrap_post_set_up', self.bootstrap_post_set_up)
super(SettingsForm, self).__init__(parent, QtCore.Qt.WindowSystemMenuHint
| QtCore.Qt.WindowTitleHint)
super(SettingsForm, self).__init__(parent, QtCore.Qt.WindowSystemMenuHint | QtCore.Qt.WindowTitleHint)
self.processes = []
self.setupUi(self)
self.setting_list_widget.currentRowChanged.connect(self.list_item_changed)

View File

@ -44,8 +44,7 @@ class ShortcutListForm(QtWidgets.QDialog, Ui_ShortcutListDialog, RegistryPropert
"""
Constructor
"""
super(ShortcutListForm, self).__init__(parent, QtCore.Qt.WindowSystemMenuHint
| QtCore.Qt.WindowTitleHint)
super(ShortcutListForm, self).__init__(parent, QtCore.Qt.WindowSystemMenuHint | QtCore.Qt.WindowTitleHint)
self.setupUi(self)
self.changed_actions = {}
self.action_list = ActionList.get_instance()

View File

@ -39,7 +39,7 @@ class StartTimeForm(QtWidgets.QDialog, Ui_StartTimeDialog, RegistryProperties):
Constructor
"""
super(StartTimeForm, self).__init__(Registry().get('main_window'),
QtCore.Qt.WindowSystemMenuHint | QtCore.Qt.WindowTitleHint)
QtCore.Qt.WindowSystemMenuHint | QtCore.Qt.WindowTitleHint)
self.setupUi(self)
def exec(self):

View File

@ -37,7 +37,7 @@ class AlertForm(QtWidgets.QDialog, Ui_AlertDialog):
Initialise the alert form
"""
super(AlertForm, self).__init__(Registry().get('main_window'),
QtCore.Qt.WindowSystemMenuHint | QtCore.Qt.WindowTitleHint)
QtCore.Qt.WindowSystemMenuHint | QtCore.Qt.WindowTitleHint)
self.manager = plugin.manager
self.plugin = plugin
self.item_id = None

View File

@ -69,8 +69,8 @@ class BibleImportForm(OpenLPWizard):
"""
self.manager = manager
self.web_bible_list = {}
super(BibleImportForm, self).__init__(
parent, bible_plugin, 'bibleImportWizard', ':/wizards/wizard_importbible.bmp')
super(BibleImportForm, self).__init__(parent, bible_plugin,
'bibleImportWizard', ':/wizards/wizard_importbible.bmp')
def setupUi(self, image):
"""

View File

@ -49,8 +49,7 @@ class BookNameForm(QDialog, Ui_BookNameDialog):
"""
Constructor
"""
super(BookNameForm, self).__init__(parent, QtCore.Qt.WindowSystemMenuHint
| QtCore.Qt.WindowTitleHint)
super(BookNameForm, self).__init__(parent, QtCore.Qt.WindowSystemMenuHint | QtCore.Qt.WindowTitleHint)
self.setupUi(self)
self.custom_signals()
self.book_names = BibleStrings().BookNames

View File

@ -45,8 +45,7 @@ class EditBibleForm(QtWidgets.QDialog, Ui_EditBibleDialog, RegistryProperties):
"""
Constructor
"""
super(EditBibleForm, self).__init__(parent, QtCore.Qt.WindowSystemMenuHint
| QtCore.Qt.WindowTitleHint)
super(EditBibleForm, self).__init__(parent, QtCore.Qt.WindowSystemMenuHint | QtCore.Qt.WindowTitleHint)
self.media_item = media_item
self.book_names = BibleStrings().BookNames
self.setupUi(self)

View File

@ -47,8 +47,7 @@ class LanguageForm(QDialog, Ui_LanguageDialog):
"""
Constructor
"""
super(LanguageForm, self).__init__(parent, QtCore.Qt.WindowSystemMenuHint
| QtCore.Qt.WindowTitleHint)
super(LanguageForm, self).__init__(parent, QtCore.Qt.WindowSystemMenuHint | QtCore.Qt.WindowTitleHint)
self.setupUi(self)
def exec(self, bible_name):

View File

@ -44,8 +44,7 @@ class EditCustomForm(QtWidgets.QDialog, Ui_CustomEditDialog):
"""
Constructor
"""
super(EditCustomForm, self).__init__(parent, QtCore.Qt.WindowSystemMenuHint
| QtCore.Qt.WindowTitleHint)
super(EditCustomForm, self).__init__(parent, QtCore.Qt.WindowSystemMenuHint | QtCore.Qt.WindowTitleHint)
self.manager = manager
self.media_item = media_item
self.setupUi(self)

View File

@ -39,8 +39,7 @@ class EditCustomSlideForm(QtWidgets.QDialog, Ui_CustomSlideEditDialog):
"""
Constructor
"""
super(EditCustomSlideForm, self).__init__(parent, QtCore.Qt.WindowSystemMenuHint
| QtCore.Qt.WindowTitleHint)
super(EditCustomSlideForm, self).__init__(parent, QtCore.Qt.WindowSystemMenuHint | QtCore.Qt.WindowTitleHint)
self.setupUi(self)
# Connecting signals and slots
self.insert_button.clicked.connect(self.on_insert_button_clicked)

View File

@ -190,7 +190,7 @@ class CustomMediaItem(MediaManagerItem):
if QtWidgets.QMessageBox.question(
self, UiStrings().ConfirmDelete,
translate('CustomPlugin.MediaItem',
'Are you sure you want to delete the "%d" selected custom slide(s)?') %len(items),
'Are you sure you want to delete the "%d" selected custom slide(s)?') % len(items),
QtWidgets.QMessageBox.StandardButtons(
QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No),
QtWidgets.QMessageBox.Yes) == QtWidgets.QMessageBox.No:

View File

@ -35,8 +35,7 @@ class AddGroupForm(QtWidgets.QDialog, Ui_AddGroupDialog):
"""
Constructor
"""
super(AddGroupForm, self).__init__(parent, QtCore.Qt.WindowSystemMenuHint
| QtCore.Qt.WindowTitleHint)
super(AddGroupForm, self).__init__(parent, QtCore.Qt.WindowSystemMenuHint | QtCore.Qt.WindowTitleHint)
self.setupUi(self)
def exec(self, clear=True, show_top_level_group=False, selected_group=None):

View File

@ -33,8 +33,7 @@ class ChooseGroupForm(QtWidgets.QDialog, Ui_ChooseGroupDialog):
"""
Constructor
"""
super(ChooseGroupForm, self).__init__(parent, QtCore.Qt.WindowSystemMenuHint
| QtCore.Qt.WindowTitleHint)
super(ChooseGroupForm, self).__init__(parent, QtCore.Qt.WindowSystemMenuHint | QtCore.Qt.WindowTitleHint)
self.setupUi(self)
def exec(self, selected_group=None):

View File

@ -52,8 +52,7 @@ class MediaClipSelectorForm(QtWidgets.QDialog, Ui_MediaClipSelector, RegistryPro
"""
Constructor
"""
super(MediaClipSelectorForm, self).__init__(parent, QtCore.Qt.WindowSystemMenuHint
| QtCore.Qt.WindowTitleHint)
super(MediaClipSelectorForm, self).__init__(parent, QtCore.Qt.WindowSystemMenuHint | QtCore.Qt.WindowTitleHint)
self.vlc_instance = None
self.vlc_media_player = None
self.vlc_media = None

View File

@ -48,7 +48,7 @@
<div data-role="controlgroup">
<a href="#service-manager" data-role="button" data-icon="arrow-r" data-iconpos="right">${service_manager}</a>
<a href="#slide-controller" data-role="button" data-icon="arrow-r" data-iconpos="right">${slide_controller}</a>
<a href="#alerts" data-role="button" data-icon="arrow-r" data-iconpos="right">${alerts}</a>
<a class="hidden" href="#alerts" data-role="button" data-icon="arrow-r" data-iconpos="right">${alerts}</a>
<a href="#search" data-role="button" data-icon="arrow-r" data-iconpos="right">${search}</a>
</div>
</div>
@ -62,7 +62,7 @@
<ul>
<li><a href="#service-manager" data-theme="e">${service}</a></li>
<li><a href="#slide-controller">${slides}</a></li>
<li><a href="#alerts">${alerts}</a></li>
<li class="hidden"><a href="#alerts">${alerts}</a></li>
<li><a href="#search">${search}</a></li>
</ul>
</div>
@ -93,7 +93,7 @@
<ul>
<li><a href="#service-manager">${service}</a></li>
<li><a href="#slide-controller" data-theme="e">${slides}</a></li>
<li><a href="#alerts">${alerts}</a></li>
<li class="hidden"><a href="#alerts">${alerts}</a></li>
<li><a href="#search">${search}</a></li>
</ul>
</div>
@ -144,7 +144,7 @@
<ul>
<li><a href="#service-manager">${service}</a></li>
<li><a href="#slide-controller">${slides}</a></li>
<li><a href="#alerts">${alerts}</a></li>
<li class="hidden"><a href="#alerts">${alerts}</a></li>
<li><a href="#search" data-theme="e">${search}</a></li>
</ul>
</div>

View File

@ -29,3 +29,7 @@
.ui-li .ui-btn-text a.ui-link-inherit{
white-space: normal;
}
.hidden {
display: none;
}

View File

@ -35,8 +35,7 @@ class AuthorsForm(QtWidgets.QDialog, Ui_AuthorsDialog):
"""
Set up the screen and common data
"""
super(AuthorsForm, self).__init__(parent, QtCore.Qt.WindowSystemMenuHint
| QtCore.Qt.WindowTitleHint)
super(AuthorsForm, self).__init__(parent, QtCore.Qt.WindowSystemMenuHint | QtCore.Qt.WindowTitleHint)
self.setupUi(self)
self.auto_display_name = False
self.first_name_edit.textEdited.connect(self.on_first_name_edited)

View File

@ -55,8 +55,7 @@ class EditSongForm(QtWidgets.QDialog, Ui_EditSongDialog, RegistryProperties):
"""
Constructor
"""
super(EditSongForm, self).__init__(parent, QtCore.Qt.WindowSystemMenuHint
| QtCore.Qt.WindowTitleHint)
super(EditSongForm, self).__init__(parent, QtCore.Qt.WindowSystemMenuHint | QtCore.Qt.WindowTitleHint)
self.media_item = media_item
self.song = None
# can this be automated?

View File

@ -41,8 +41,7 @@ class EditVerseForm(QtWidgets.QDialog, Ui_EditVerseDialog):
"""
Constructor
"""
super(EditVerseForm, self).__init__(parent, QtCore.Qt.WindowSystemMenuHint
| QtCore.Qt.WindowTitleHint)
super(EditVerseForm, self).__init__(parent, QtCore.Qt.WindowSystemMenuHint | QtCore.Qt.WindowTitleHint)
self.setupUi(self)
self.has_single_verse = False
self.insert_button.clicked.connect(self.on_insert_button_clicked)

View File

@ -37,8 +37,7 @@ class MediaFilesForm(QtWidgets.QDialog, Ui_MediaFilesDialog):
log.info('%s MediaFilesForm loaded', __name__)
def __init__(self, parent):
super(MediaFilesForm, self).__init__(parent, QtCore.Qt.WindowSystemMenuHint
| QtCore.Qt.WindowTitleHint)
super(MediaFilesForm, self).__init__(parent, QtCore.Qt.WindowSystemMenuHint | QtCore.Qt.WindowTitleHint)
self.setupUi(self)
def populate_files(self, files):

View File

@ -38,8 +38,7 @@ class SongBookForm(QtWidgets.QDialog, Ui_SongBookDialog):
"""
Constructor
"""
super(SongBookForm, self).__init__(parent, QtCore.Qt.WindowSystemMenuHint
| QtCore.Qt.WindowTitleHint)
super(SongBookForm, self).__init__(parent, QtCore.Qt.WindowSystemMenuHint | QtCore.Qt.WindowTitleHint)
self.setupUi(self)
def exec(self, clear=True):

View File

@ -84,58 +84,56 @@ class SongExportForm(OpenLPWizard):
"""
# The page with all available songs.
self.available_songs_page = QtWidgets.QWizardPage()
self.available_songs_page.setObjectName('available_songs_page')
self.available_songs_layout = QtWidgets.QHBoxLayout(self.available_songs_page)
self.available_songs_layout.setObjectName('available_songs_layout')
self.vertical_layout = QtWidgets.QVBoxLayout()
self.vertical_layout.setObjectName('vertical_layout')
available_songs_layout = QtWidgets.QHBoxLayout(self.available_songs_page)
available_songs_layout.setObjectName('available_songs_layout')
vertical_layout = QtWidgets.QVBoxLayout()
vertical_layout.setObjectName('vertical_layout')
self.available_list_widget = QtWidgets.QListWidget(self.available_songs_page)
self.available_list_widget.setObjectName('available_list_widget')
self.vertical_layout.addWidget(self.available_list_widget)
self.horizontal_layout = QtWidgets.QHBoxLayout()
self.horizontal_layout.setObjectName('horizontal_layout')
vertical_layout.addWidget(self.available_list_widget)
horizontal_layout = QtWidgets.QHBoxLayout()
horizontal_layout.setObjectName('horizontal_layout')
self.search_label = QtWidgets.QLabel(self.available_songs_page)
self.search_label.setObjectName('search_label')
self.horizontal_layout.addWidget(self.search_label)
horizontal_layout.addWidget(self.search_label)
self.search_line_edit = QtWidgets.QLineEdit(self.available_songs_page)
self.search_line_edit.setObjectName('search_line_edit')
self.horizontal_layout.addWidget(self.search_line_edit)
horizontal_layout.addWidget(self.search_line_edit)
spacer_item = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.horizontal_layout.addItem(spacer_item)
horizontal_layout.addItem(spacer_item)
self.uncheck_button = QtWidgets.QPushButton(self.available_songs_page)
self.uncheck_button.setObjectName('uncheck_button')
self.horizontal_layout.addWidget(self.uncheck_button)
horizontal_layout.addWidget(self.uncheck_button)
self.check_button = QtWidgets.QPushButton(self.available_songs_page)
self.check_button.setObjectName('selectButton')
self.horizontal_layout.addWidget(self.check_button)
self.vertical_layout.addLayout(self.horizontal_layout)
self.available_songs_layout.addLayout(self.vertical_layout)
horizontal_layout.addWidget(self.check_button)
vertical_layout.addLayout(horizontal_layout)
available_songs_layout.addLayout(vertical_layout)
self.addPage(self.available_songs_page)
# The page with the selected songs.
self.export_song_page = QtWidgets.QWizardPage()
self.export_song_page.setObjectName('available_songs_page')
self.export_song_layout = QtWidgets.QHBoxLayout(self.export_song_page)
self.export_song_layout.setObjectName('export_song_layout')
self.grid_layout = QtWidgets.QGridLayout()
self.grid_layout.setObjectName('range_layout')
export_song_layout = QtWidgets.QHBoxLayout(self.export_song_page)
export_song_layout.setObjectName('export_song_layout')
grid_layout = QtWidgets.QGridLayout()
grid_layout.setObjectName('range_layout')
self.selected_list_widget = QtWidgets.QListWidget(self.export_song_page)
self.selected_list_widget.setObjectName('selected_list_widget')
self.grid_layout.addWidget(self.selected_list_widget, 1, 0, 1, 1)
# FIXME: self.horizontal_layout is already defined above?!?!?
self.horizontal_layout = QtWidgets.QHBoxLayout()
self.horizontal_layout.setObjectName('horizontal_layout')
grid_layout.addWidget(self.selected_list_widget, 1, 0, 1, 1)
horizontal_layout = QtWidgets.QHBoxLayout()
horizontal_layout.setObjectName('horizontal_layout')
self.directory_label = QtWidgets.QLabel(self.export_song_page)
self.directory_label.setObjectName('directory_label')
self.horizontal_layout.addWidget(self.directory_label)
horizontal_layout.addWidget(self.directory_label)
self.directory_line_edit = QtWidgets.QLineEdit(self.export_song_page)
self.directory_line_edit.setObjectName('directory_line_edit')
self.horizontal_layout.addWidget(self.directory_line_edit)
horizontal_layout.addWidget(self.directory_line_edit)
self.directory_button = QtWidgets.QToolButton(self.export_song_page)
self.directory_button.setIcon(build_icon(':/exports/export_load.png'))
self.directory_button.setObjectName('directory_button')
self.horizontal_layout.addWidget(self.directory_button)
self.grid_layout.addLayout(self.horizontal_layout, 0, 0, 1, 1)
self.export_song_layout.addLayout(self.grid_layout)
horizontal_layout.addWidget(self.directory_button)
grid_layout.addLayout(horizontal_layout, 0, 0, 1, 1)
export_song_layout.addLayout(grid_layout)
self.addPage(self.export_song_page)
def retranslateUi(self):
@ -308,6 +306,7 @@ def find_list_widget_items(list_widget, text=''):
item for item in list_widget.findItems(text, QtCore.Qt.MatchContains)
]
def on_item_activated(item):
"""
Called, when an item in the *available_list_widget* has been triggered.
@ -317,4 +316,3 @@ def on_item_activated(item):
:param item: The *QListWidgetItem* which was triggered.
"""
item.setCheckState(QtCore.Qt.Unchecked if item.checkState() else QtCore.Qt.Checked)

View File

@ -44,8 +44,7 @@ class SongMaintenanceForm(QtWidgets.QDialog, Ui_SongMaintenanceDialog, RegistryP
"""
Constructor
"""
super(SongMaintenanceForm, self).__init__(parent, QtCore.Qt.WindowSystemMenuHint
| QtCore.Qt.WindowTitleHint)
super(SongMaintenanceForm, self).__init__(parent, QtCore.Qt.WindowSystemMenuHint | QtCore.Qt.WindowTitleHint)
self.setupUi(self)
self.manager = manager
self.author_form = AuthorsForm(self)

View File

@ -81,8 +81,7 @@ class SongSelectForm(QtWidgets.QDialog, Ui_SongSelectDialog):
"""
def __init__(self, parent=None, plugin=None, db_manager=None):
QtWidgets.QDialog.__init__(self, parent, QtCore.Qt.WindowSystemMenuHint
| QtCore.Qt.WindowTitleHint)
QtWidgets.QDialog.__init__(self, parent, QtCore.Qt.WindowSystemMenuHint | QtCore.Qt.WindowTitleHint)
self.plugin = plugin
self.db_manager = db_manager
self.setup_ui(self)

View File

@ -38,8 +38,7 @@ class TopicsForm(QtWidgets.QDialog, Ui_TopicsDialog):
"""
Constructor
"""
super(TopicsForm, self).__init__(parent, QtCore.Qt.WindowSystemMenuHint
| QtCore.Qt.WindowTitleHint)
super(TopicsForm, self).__init__(parent, QtCore.Qt.WindowSystemMenuHint | QtCore.Qt.WindowTitleHint)
self.setupUi(self)
def exec(self, clear=True):

View File

@ -541,4 +541,3 @@ def to_str(element):
if element is not None:
return str(element)
return ''

View File

@ -365,7 +365,7 @@ class SongMediaItem(MediaManagerItem):
if QtWidgets.QMessageBox.question(
self, UiStrings().ConfirmDelete,
translate('SongsPlugin.MediaItem',
'Are you sure you want to delete the "%d" selected song(s)?') % len(items),
'Are you sure you want to delete the "%d" selected song(s)?') % len(items),
QtWidgets.QMessageBox.StandardButtons(QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No),
QtWidgets.QMessageBox.Yes) == QtWidgets.QMessageBox.No:
return

View File

@ -36,8 +36,8 @@ class SongUsageDeleteForm(QtWidgets.QDialog, Ui_SongUsageDeleteDialog, RegistryP
Constructor
"""
self.manager = manager
super(SongUsageDeleteForm, self).__init__(parent, QtCore.Qt.WindowSystemMenuHint
| QtCore.Qt.WindowTitleHint)
super(SongUsageDeleteForm, self).__init__(parent, QtCore.Qt.WindowSystemMenuHint |
QtCore.Qt.WindowTitleHint)
self.setupUi(self)
self.button_box.clicked.connect(self.on_button_box_clicked)
@ -48,13 +48,14 @@ class SongUsageDeleteForm(QtWidgets.QDialog, Ui_SongUsageDeleteDialog, RegistryP
:param button: The button pressed
"""
if self.button_box.standardButton(button) == QtWidgets.QDialogButtonBox.Ok:
ret = QtWidgets.QMessageBox.question(
self,
translate('SongUsagePlugin.SongUsageDeleteForm', 'Delete Selected Song Usage Events?'),
translate('SongUsagePlugin.SongUsageDeleteForm',
'Are you sure you want to delete selected Song Usage data?'),
QtWidgets.QMessageBox.StandardButtons(QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No),
QtWidgets.QMessageBox.No)
ret = QtWidgets.QMessageBox.question(self,
translate('SongUsagePlugin.SongUsageDeleteForm',
'Delete Selected Song Usage Events?'),
translate('SongUsagePlugin.SongUsageDeleteForm',
'Are you sure you want to delete selected Song Usage data?'),
QtWidgets.QMessageBox.StandardButtons(QtWidgets.QMessageBox.Yes |
QtWidgets.QMessageBox.No),
QtWidgets.QMessageBox.No)
if ret == QtWidgets.QMessageBox.Yes:
delete_date = self.delete_calendar.selectedDate().toPyDate()
self.manager.delete_all_objects(SongUsageItem, SongUsageItem.usagedate <= delete_date)

View File

@ -44,8 +44,7 @@ class SongUsageDetailForm(QtWidgets.QDialog, Ui_SongUsageDetailDialog, RegistryP
"""
Initialise the form
"""
super(SongUsageDetailForm, self).__init__(parent, QtCore.Qt.WindowSystemMenuHint
| QtCore.Qt.WindowTitleHint)
super(SongUsageDetailForm, self).__init__(parent, QtCore.Qt.WindowSystemMenuHint | QtCore.Qt.WindowTitleHint)
self.plugin = plugin
self.setupUi(self)

View File

@ -226,7 +226,7 @@ class SongUsagePlugin(Plugin):
"""
self.song_usage_detail_form.initialise()
self.song_usage_detail_form.exec()
@staticmethod
def about():
"""

View File

@ -75,7 +75,6 @@ class TestMediaManagerItem(TestCase, TestMixin):
self.assertTrue(mmi.has_delete_icon, 'By default a delete icon should be present')
self.assertFalse(mmi.add_to_service_item, 'There should be no add_to_service icon by default')
@patch(u'openlp.core.lib.mediamanageritem.Settings')
@patch(u'openlp.core.lib.mediamanageritem.MediaManagerItem.on_live_click')
def on_double_clicked_go_live_test(self, mocked_on_live_click, MockedSettings):

View File

@ -185,4 +185,3 @@ class TestProjectorDB(TestCase):
# THEN: Projector should have the same source entry
item = self.projector.get_projector_by_id(item_id)
self.assertTrue(compare_source(item.source_list[0], source))

View File

@ -40,7 +40,7 @@ class TestSongFormat(TestCase):
# WHEN: Retrieving the format list
# THEN: All SongFormats should be returned
self.assertEquals(len(SongFormat.get_format_list()), len(SongFormat.__attributes__),
"The returned SongFormats don't match the stored ones")
"The returned SongFormats don't match the stored ones")
def test_get_attributed_no_attributes(self):
"""
@ -51,7 +51,7 @@ class TestSongFormat(TestCase):
for song_format in SongFormat.get_format_list():
# THEN: All attributes associated with the SongFormat should be returned
self.assertEquals(SongFormat.get(song_format), SongFormat.__attributes__[song_format],
"The returned attributes don't match the stored ones")
"The returned attributes don't match the stored ones")
def test_get_attributed_single_attribute(self):
"""
@ -63,13 +63,13 @@ class TestSongFormat(TestCase):
for attribute in SongFormat.get(song_format).keys():
# THEN: Return the attribute
self.assertEquals(SongFormat.get(song_format, attribute), SongFormat.get(song_format)[attribute],
"The returned attribute doesn't match the stored one")
"The returned attribute doesn't match the stored one")
# WHEN: Retrieving an attribute that was not overridden
for attribute in SongFormat.__defaults__.keys():
if attribute not in SongFormat.get(song_format).keys():
# THEN: Return the default value
self.assertEquals(SongFormat.get(song_format, attribute), SongFormat.__defaults__[attribute],
"The returned attribute does not match the default values stored")
"The returned attribute does not match the default values stored")
def test_get_attributed_multiple_attributes(self):
"""
@ -80,5 +80,5 @@ class TestSongFormat(TestCase):
for song_format in SongFormat.get_format_list():
# THEN: Return all attributes that were specified
self.assertEquals(len(SongFormat.get(song_format, 'canDisable', 'availability')), 2,
"Did not return the correct number of attributes when retrieving multiple attributes at once")
"Did not return the correct number of attributes"
" when retrieving multiple attributes at once")

View File

@ -103,5 +103,3 @@ class TestProjectorEditForm(TestCase, TestMixin):
'Projector edit form should be marked as existing entry')
self.assertTrue((item.ip is TEST1_DATA['ip'] and item.name is TEST1_DATA['name']),
'Projector edit form should have TEST1_DATA() instance to edit')