forked from openlp/openlp
PEP8
This commit is contained in:
parent
7af1ca1d49
commit
285e12bc9d
@ -476,9 +476,9 @@ class MediaController(RegistryMixin, OpenLPMixin, RegistryProperties):
|
|||||||
controller.media_info.media_type = MediaType.CD
|
controller.media_info.media_type = MediaType.CD
|
||||||
else:
|
else:
|
||||||
controller.media_info.media_type = MediaType.DVD
|
controller.media_info.media_type = MediaType.DVD
|
||||||
controller.media_info.start_time = start/1000
|
controller.media_info.start_time = start / 1000
|
||||||
controller.media_info.end_time = end/1000
|
controller.media_info.end_time = end / 1000
|
||||||
controller.media_info.length = (end - start)/1000
|
controller.media_info.length = (end - start) / 1000
|
||||||
controller.media_info.title_track = title
|
controller.media_info.title_track = title
|
||||||
controller.media_info.audio_track = audio_track
|
controller.media_info.audio_track = audio_track
|
||||||
controller.media_info.subtitle_track = subtitle_track
|
controller.media_info.subtitle_track = subtitle_track
|
||||||
|
@ -256,6 +256,3 @@ class SystemPlayer(MediaPlayer):
|
|||||||
'</strong><br/>' + str(self.audio_extensions_list) +
|
'</strong><br/>' + str(self.audio_extensions_list) +
|
||||||
'<br/><strong>' + translate('Media.player', 'Video') +
|
'<br/><strong>' + translate('Media.player', 'Video') +
|
||||||
'</strong><br/>' + str(self.video_extensions_list) + '<br/>')
|
'</strong><br/>' + str(self.video_extensions_list) + '<br/>')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -45,18 +45,18 @@ from openlp.core.ui.projector.editform import ProjectorEditForm
|
|||||||
from openlp.core.ui.projector.sourceselectform import SourceSelectTabs, SourceSelectSingle
|
from openlp.core.ui.projector.sourceselectform import SourceSelectTabs, SourceSelectSingle
|
||||||
|
|
||||||
# Dict for matching projector status to display icon
|
# Dict for matching projector status to display icon
|
||||||
STATUS_ICONS = {S_NOT_CONNECTED: ':/projector/projector_item_disconnect.png',
|
STATUS_ICONS = {S_NOT_CONNECTED: ':/projector/projector_item_disconnect.png',
|
||||||
S_CONNECTING: ':/projector/projector_item_connect.png',
|
S_CONNECTING: ':/projector/projector_item_connect.png',
|
||||||
S_CONNECTED: ':/projector/projector_off.png',
|
S_CONNECTED: ':/projector/projector_off.png',
|
||||||
S_OFF: ':/projector/projector_off.png',
|
S_OFF: ':/projector/projector_off.png',
|
||||||
S_INITIALIZE: ':/projector/projector_off.png',
|
S_INITIALIZE: ':/projector/projector_off.png',
|
||||||
S_STANDBY: ':/projector/projector_off.png',
|
S_STANDBY: ':/projector/projector_off.png',
|
||||||
S_WARMUP: ':/projector/projector_warmup.png',
|
S_WARMUP: ':/projector/projector_warmup.png',
|
||||||
S_ON: ':/projector/projector_on.png',
|
S_ON: ':/projector/projector_on.png',
|
||||||
S_COOLDOWN: ':/projector/projector_cooldown.png',
|
S_COOLDOWN: ':/projector/projector_cooldown.png',
|
||||||
E_ERROR: ':/projector/projector_error.png',
|
E_ERROR: ':/projector/projector_error.png',
|
||||||
E_NETWORK: ':/projector/projector_not_connected_error.png',
|
E_NETWORK: ':/projector/projector_not_connected_error.png',
|
||||||
E_AUTHENTICATION: ':/projector/projector_not_connected_error.png',
|
E_AUTHENTICATION: ':/projector/projector_not_connected_error.png',
|
||||||
E_UNKNOWN_SOCKET_ERROR: ':/projector/projector_not_connected_error.png',
|
E_UNKNOWN_SOCKET_ERROR: ':/projector/projector_not_connected_error.png',
|
||||||
E_NOT_CONNECTED: ':/projector/projector_not_connected_error.png'
|
E_NOT_CONNECTED: ':/projector/projector_not_connected_error.png'
|
||||||
}
|
}
|
||||||
|
@ -443,7 +443,7 @@ class SourceSelectSingle(QDialog):
|
|||||||
QtWidgets.QDialogButtonBox.Cancel)
|
QtWidgets.QDialogButtonBox.Cancel)
|
||||||
self.button_box.clicked.connect(self.button_clicked)
|
self.button_box.clicked.connect(self.button_clicked)
|
||||||
self.layout.addWidget(self.button_box)
|
self.layout.addWidget(self.button_box)
|
||||||
self.setMinimumHeight(key_count*25)
|
self.setMinimumHeight(key_count * 25)
|
||||||
set_button_tooltip(self.button_box)
|
set_button_tooltip(self.button_box)
|
||||||
selected = super(SourceSelectSingle, self).exec()
|
selected = super(SourceSelectSingle, self).exec()
|
||||||
return selected
|
return selected
|
||||||
|
@ -181,7 +181,7 @@ class AlertForm(QtWidgets.QDialog, Ui_AlertDialog):
|
|||||||
'You have not entered a parameter to be replaced.\n'
|
'You have not entered a parameter to be replaced.\n'
|
||||||
'Do you want to continue anyway?'),
|
'Do you want to continue anyway?'),
|
||||||
QtWidgets.QMessageBox.StandardButtons(
|
QtWidgets.QMessageBox.StandardButtons(
|
||||||
QtWidgets.QMessageBox.No | QtWidgets.QMessageBox.Yes)
|
QtWidgets.QMessageBox.No | QtWidgets.QMessageBox.Yes)
|
||||||
) == QtWidgets.QMessageBox.No:
|
) == QtWidgets.QMessageBox.No:
|
||||||
self.parameter_edit.setFocus()
|
self.parameter_edit.setFocus()
|
||||||
return False
|
return False
|
||||||
@ -194,7 +194,7 @@ class AlertForm(QtWidgets.QDialog, Ui_AlertDialog):
|
|||||||
'The alert text does not contain \'<>\'.\n'
|
'The alert text does not contain \'<>\'.\n'
|
||||||
'Do you want to continue anyway?'),
|
'Do you want to continue anyway?'),
|
||||||
QtWidgets.QMessageBox.StandardButtons(
|
QtWidgets.QMessageBox.StandardButtons(
|
||||||
QtWidgets.QMessageBox.No | QtWidgets.QMessageBox.Yes)
|
QtWidgets.QMessageBox.No | QtWidgets.QMessageBox.Yes)
|
||||||
) == QtWidgets.QMessageBox.No:
|
) == QtWidgets.QMessageBox.No:
|
||||||
self.parameter_edit.setFocus()
|
self.parameter_edit.setFocus()
|
||||||
return False
|
return False
|
||||||
|
@ -193,7 +193,7 @@ class CustomMediaItem(MediaManagerItem):
|
|||||||
'Are you sure you want to delete the %n selected custom slide(s)?',
|
'Are you sure you want to delete the %n selected custom slide(s)?',
|
||||||
'', QtCore.QCoreApplication.CodecForTr, len(items)),
|
'', QtCore.QCoreApplication.CodecForTr, len(items)),
|
||||||
QtWidgets.QMessageBox.StandardButtons(
|
QtWidgets.QMessageBox.StandardButtons(
|
||||||
QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No),
|
QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No),
|
||||||
QtWidgets.QMessageBox.Yes) == QtWidgets.QMessageBox.No:
|
QtWidgets.QMessageBox.Yes) == QtWidgets.QMessageBox.No:
|
||||||
return
|
return
|
||||||
row_list = [item.row() for item in self.list_view.selectedIndexes()]
|
row_list = [item.row() for item in self.list_view.selectedIndexes()]
|
||||||
|
@ -184,13 +184,13 @@ class PptviewDocument(PresentationDocument):
|
|||||||
# check if it is a slide
|
# check if it is a slide
|
||||||
match = re.search("slides/slide(.+)\.xml", zip_info.filename)
|
match = re.search("slides/slide(.+)\.xml", zip_info.filename)
|
||||||
if match:
|
if match:
|
||||||
index = int(match.group(1))-1
|
index = int(match.group(1)) - 1
|
||||||
node_type = 'ctrTitle'
|
node_type = 'ctrTitle'
|
||||||
list_to_add = titles
|
list_to_add = titles
|
||||||
# or a note
|
# or a note
|
||||||
match = re.search("notesSlides/notesSlide(.+)\.xml", zip_info.filename)
|
match = re.search("notesSlides/notesSlide(.+)\.xml", zip_info.filename)
|
||||||
if match:
|
if match:
|
||||||
index = int(match.group(1))-1
|
index = int(match.group(1)) - 1
|
||||||
node_type = 'body'
|
node_type = 'body'
|
||||||
list_to_add = notes
|
list_to_add = notes
|
||||||
# if it is one of our files, index shouldn't be -1
|
# if it is one of our files, index shouldn't be -1
|
||||||
|
@ -281,9 +281,9 @@ class EditSongForm(QtWidgets.QDialog, Ui_EditSongDialog, RegistryProperties):
|
|||||||
return True
|
return True
|
||||||
if len(tags) % 2 != 0:
|
if len(tags) % 2 != 0:
|
||||||
return False
|
return False
|
||||||
for i in range(len(tags)-1):
|
for i in range(len(tags) - 1):
|
||||||
if tags[i+1] == "{/" + tags[i][1:]:
|
if tags[i + 1] == "{/" + tags[i][1:]:
|
||||||
del tags[i:i+2]
|
del tags[i:i + 2]
|
||||||
return self._validate_tags(tags, False)
|
return self._validate_tags(tags, False)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@ -123,7 +123,7 @@ class EasyWorshipSongImport(SongImport):
|
|||||||
log.debug('Given ews file is of unknown version.')
|
log.debug('Given ews file is of unknown version.')
|
||||||
return
|
return
|
||||||
entry_count = self.get_i32(file_pos)
|
entry_count = self.get_i32(file_pos)
|
||||||
entry_length = self.get_i16(file_pos+4)
|
entry_length = self.get_i16(file_pos + 4)
|
||||||
file_pos += 6
|
file_pos += 6
|
||||||
self.import_wizard.progress_bar.setMaximum(entry_count)
|
self.import_wizard.progress_bar.setMaximum(entry_count)
|
||||||
# Loop over songs
|
# Loop over songs
|
||||||
|
@ -171,12 +171,12 @@ class OpenSongImport(SongImport):
|
|||||||
topics = set(self.topics)
|
topics = set(self.topics)
|
||||||
if 'theme' in fields:
|
if 'theme' in fields:
|
||||||
theme = str(root.theme)
|
theme = str(root.theme)
|
||||||
subthemes = theme[theme.find(':')+1:].split('/')
|
subthemes = theme[theme.find(':') + 1:].split('/')
|
||||||
for topic in subthemes:
|
for topic in subthemes:
|
||||||
topics.add(topic.strip())
|
topics.add(topic.strip())
|
||||||
if 'alttheme' in fields:
|
if 'alttheme' in fields:
|
||||||
theme = str(root.alttheme)
|
theme = str(root.alttheme)
|
||||||
subthemes = theme[theme.find(':')+1:].split('/')
|
subthemes = theme[theme.find(':') + 1:].split('/')
|
||||||
for topic in subthemes:
|
for topic in subthemes:
|
||||||
topics.add(topic.strip())
|
topics.add(topic.strip())
|
||||||
self.topics = list(topics)
|
self.topics = list(topics)
|
||||||
|
@ -94,7 +94,7 @@ OPTIONAL_MODULES = [
|
|||||||
('mysql.connector', '(MySQL support)', True),
|
('mysql.connector', '(MySQL support)', True),
|
||||||
('psycopg2', '(PostgreSQL support)', True),
|
('psycopg2', '(PostgreSQL support)', True),
|
||||||
('nose', '(testing framework)', True),
|
('nose', '(testing framework)', True),
|
||||||
('mock', '(testing module)', sys.version_info[1] < 3),
|
('mock', '(testing module)', sys.version_info[1] < 3),
|
||||||
('jenkins', '(access jenkins api - package name: jenkins-webapi)', True),
|
('jenkins', '(access jenkins api - package name: jenkins-webapi)', True),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -96,7 +96,7 @@ for row in bug_rows:
|
|||||||
# <div class="context-publication"><h1>Merge ... into...
|
# <div class="context-publication"><h1>Merge ... into...
|
||||||
div_branches = soup.find('div', class_='context-publication')
|
div_branches = soup.find('div', class_='context-publication')
|
||||||
branches = div_branches.h1.contents[0]
|
branches = div_branches.h1.contents[0]
|
||||||
target_branch = '+branch/' + branches[(branches.find(' into lp:')+9):]
|
target_branch = '+branch/' + branches[(branches.find(' into lp:') + 9):]
|
||||||
|
|
||||||
# Check that we are in the right branch
|
# Check that we are in the right branch
|
||||||
bzr_info_output = subprocess.check_output(['bzr', 'info'])
|
bzr_info_output = subprocess.check_output(['bzr', 'info'])
|
||||||
|
@ -43,7 +43,7 @@ class TestInitFunctions(TestMixin, TestCase):
|
|||||||
self.assertEquals(args.loglevel, 'warning', 'The log level should be set to warning')
|
self.assertEquals(args.loglevel, 'warning', 'The log level should be set to warning')
|
||||||
self.assertFalse(args.no_error_form, 'The no_error_form should be set to False')
|
self.assertFalse(args.no_error_form, 'The no_error_form should be set to False')
|
||||||
self.assertFalse(args.portable, 'The portable flag should be set to false')
|
self.assertFalse(args.portable, 'The portable flag should be set to false')
|
||||||
self.assertEquals(args.style, None, 'There are no style flags to be processed')
|
self.assertEquals(args.style, None, 'There are no style flags to be processed')
|
||||||
self.assertEquals(args.rargs, [], 'The service file should be blank')
|
self.assertEquals(args.rargs, [], 'The service file should be blank')
|
||||||
|
|
||||||
def parse_options_debug_test(self):
|
def parse_options_debug_test(self):
|
||||||
@ -60,7 +60,7 @@ class TestInitFunctions(TestMixin, TestCase):
|
|||||||
self.assertEquals(args.loglevel, ' debug', 'The log level should be set to debug')
|
self.assertEquals(args.loglevel, ' debug', 'The log level should be set to debug')
|
||||||
self.assertFalse(args.no_error_form, 'The no_error_form should be set to False')
|
self.assertFalse(args.no_error_form, 'The no_error_form should be set to False')
|
||||||
self.assertFalse(args.portable, 'The portable flag should be set to false')
|
self.assertFalse(args.portable, 'The portable flag should be set to false')
|
||||||
self.assertEquals(args.style, None, 'There are no style flags to be processed')
|
self.assertEquals(args.style, None, 'There are no style flags to be processed')
|
||||||
self.assertEquals(args.rargs, [], 'The service file should be blank')
|
self.assertEquals(args.rargs, [], 'The service file should be blank')
|
||||||
|
|
||||||
def parse_options_debug_and_portable_test(self):
|
def parse_options_debug_and_portable_test(self):
|
||||||
@ -77,7 +77,7 @@ class TestInitFunctions(TestMixin, TestCase):
|
|||||||
self.assertEquals(args.loglevel, 'warning', 'The log level should be set to warning')
|
self.assertEquals(args.loglevel, 'warning', 'The log level should be set to warning')
|
||||||
self.assertFalse(args.no_error_form, 'The no_error_form should be set to False')
|
self.assertFalse(args.no_error_form, 'The no_error_form should be set to False')
|
||||||
self.assertTrue(args.portable, 'The portable flag should be set to true')
|
self.assertTrue(args.portable, 'The portable flag should be set to true')
|
||||||
self.assertEquals(args.style, None, 'There are no style flags to be processed')
|
self.assertEquals(args.style, None, 'There are no style flags to be processed')
|
||||||
self.assertEquals(args.rargs, [], 'The service file should be blank')
|
self.assertEquals(args.rargs, [], 'The service file should be blank')
|
||||||
|
|
||||||
def parse_options_all_no_file_test(self):
|
def parse_options_all_no_file_test(self):
|
||||||
@ -94,7 +94,7 @@ class TestInitFunctions(TestMixin, TestCase):
|
|||||||
self.assertEquals(args.loglevel, ' debug', 'The log level should be set to debug')
|
self.assertEquals(args.loglevel, ' debug', 'The log level should be set to debug')
|
||||||
self.assertFalse(args.no_error_form, 'The no_error_form should be set to False')
|
self.assertFalse(args.no_error_form, 'The no_error_form should be set to False')
|
||||||
self.assertFalse(args.portable, 'The portable flag should be set to false')
|
self.assertFalse(args.portable, 'The portable flag should be set to false')
|
||||||
self.assertEquals(args.style, None, 'There are no style flags to be processed')
|
self.assertEquals(args.style, None, 'There are no style flags to be processed')
|
||||||
self.assertEquals(args.rargs, [], 'The service file should be blank')
|
self.assertEquals(args.rargs, [], 'The service file should be blank')
|
||||||
|
|
||||||
def parse_options_file_test(self):
|
def parse_options_file_test(self):
|
||||||
@ -111,7 +111,7 @@ class TestInitFunctions(TestMixin, TestCase):
|
|||||||
self.assertEquals(args.loglevel, 'warning', 'The log level should be set to warning')
|
self.assertEquals(args.loglevel, 'warning', 'The log level should be set to warning')
|
||||||
self.assertFalse(args.no_error_form, 'The no_error_form should be set to False')
|
self.assertFalse(args.no_error_form, 'The no_error_form should be set to False')
|
||||||
self.assertFalse(args.portable, 'The portable flag should be set to false')
|
self.assertFalse(args.portable, 'The portable flag should be set to false')
|
||||||
self.assertEquals(args.style, None, 'There are no style flags to be processed')
|
self.assertEquals(args.style, None, 'There are no style flags to be processed')
|
||||||
self.assertEquals(args.rargs, 'dummy_temp', 'The service file should not be blank')
|
self.assertEquals(args.rargs, 'dummy_temp', 'The service file should not be blank')
|
||||||
|
|
||||||
def parse_options_file_and_debug_test(self):
|
def parse_options_file_and_debug_test(self):
|
||||||
@ -128,7 +128,7 @@ class TestInitFunctions(TestMixin, TestCase):
|
|||||||
self.assertEquals(args.loglevel, ' debug', 'The log level should be set to debug')
|
self.assertEquals(args.loglevel, ' debug', 'The log level should be set to debug')
|
||||||
self.assertFalse(args.no_error_form, 'The no_error_form should be set to False')
|
self.assertFalse(args.no_error_form, 'The no_error_form should be set to False')
|
||||||
self.assertFalse(args.portable, 'The portable flag should be set to false')
|
self.assertFalse(args.portable, 'The portable flag should be set to false')
|
||||||
self.assertEquals(args.style, None, 'There are no style flags to be processed')
|
self.assertEquals(args.style, None, 'There are no style flags to be processed')
|
||||||
self.assertEquals(args.rargs, 'dummy_temp', 'The service file should not be blank')
|
self.assertEquals(args.rargs, 'dummy_temp', 'The service file should not be blank')
|
||||||
|
|
||||||
def parse_options_two_files_test(self):
|
def parse_options_two_files_test(self):
|
||||||
|
@ -119,7 +119,7 @@ class TestFieldDesc:
|
|||||||
TEST_DATA_ENCODING = 'cp1252'
|
TEST_DATA_ENCODING = 'cp1252'
|
||||||
CODE_PAGE_MAPPINGS = [
|
CODE_PAGE_MAPPINGS = [
|
||||||
(852, 'cp1250'), (737, 'cp1253'), (775, 'cp1257'), (855, 'cp1251'), (857, 'cp1254'),
|
(852, 'cp1250'), (737, 'cp1253'), (775, 'cp1257'), (855, 'cp1251'), (857, 'cp1254'),
|
||||||
(866, 'cp1251'), (869, 'cp1253'), (862, 'cp1255'), (874, 'cp874')]
|
(866, 'cp1251'), (869, 'cp1253'), (862, 'cp1255'), (874, 'cp874')]
|
||||||
TEST_FIELD_DESCS = [
|
TEST_FIELD_DESCS = [
|
||||||
TestFieldDesc('Title', FieldType.String, 50),
|
TestFieldDesc('Title', FieldType.String, 50),
|
||||||
TestFieldDesc('Text Percentage Bottom', FieldType.Int16, 2), TestFieldDesc('RecID', FieldType.Int32, 4),
|
TestFieldDesc('Text Percentage Bottom', FieldType.Int16, 2), TestFieldDesc('RecID', FieldType.Int32, 4),
|
||||||
|
@ -119,7 +119,7 @@ class TestMediaItem(TestCase, TestMixin):
|
|||||||
|
|
||||||
# THEN: I get the following Array returned
|
# THEN: I get the following Array returned
|
||||||
self.assertEqual(service_item.raw_footer, ['My Song', 'Words: another author', 'Music: my author',
|
self.assertEqual(service_item.raw_footer, ['My Song', 'Words: another author', 'Music: my author',
|
||||||
'Translation: translator', 'My copyright'],
|
'Translation: translator', 'My copyright'],
|
||||||
'The array should be returned correctly with a song, two authors and copyright')
|
'The array should be returned correctly with a song, two authors and copyright')
|
||||||
self.assertEqual(author_list, ['another author', 'my author', 'translator'],
|
self.assertEqual(author_list, ['another author', 'my author', 'translator'],
|
||||||
'The author list should be returned correctly with two authors')
|
'The author list should be returned correctly with two authors')
|
||||||
|
@ -82,7 +82,7 @@ class TestSongSelectImport(TestCase, TestMixin):
|
|||||||
self.assertFalse(result, 'The login method should have returned False')
|
self.assertFalse(result, 'The login method should have returned False')
|
||||||
|
|
||||||
@patch('openlp.plugins.songs.lib.songselect.build_opener')
|
@patch('openlp.plugins.songs.lib.songselect.build_opener')
|
||||||
def login_except_test(self, mocked_build_opener):
|
def login_except_test(self, mocked_build_opener):
|
||||||
"""
|
"""
|
||||||
Test that when logging in to SongSelect fails, the login method raises URLError
|
Test that when logging in to SongSelect fails, the login method raises URLError
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user