Merge lp:~phill-ridout/openlp/fixes-III into lp:openlp

Proposed by Phill
Status: Superseded
Proposed branch: lp:~phill-ridout/openlp/fixes-III
Merge into: lp:openlp
Diff against target: 765 lines (+218/-152)
26 files modified
openlp/core/common/__init__.py (+4/-4)
openlp/core/common/i18n.py (+3/-3)
openlp/core/lib/db.py (+1/-1)
openlp/core/lib/formattingtags.py (+91/-90)
openlp/core/projectors/manager.py (+2/-2)
openlp/core/projectors/pjlink.py (+1/-1)
openlp/core/projectors/sourceselectform.py (+3/-3)
openlp/core/ui/__init__.py (+1/-1)
openlp/core/ui/formattingtagcontroller.py (+1/-1)
openlp/core/ui/icons.py (+3/-3)
openlp/core/ui/shortcutlistdialog.py (+1/-1)
openlp/core/ui/shortcutlistform.py (+1/-1)
openlp/core/widgets/views.py (+3/-3)
openlp/core/widgets/widgets.py (+2/-2)
openlp/plugins/bibles/lib/manager.py (+1/-1)
openlp/plugins/bibles/lib/mediaitem.py (+1/-1)
openlp/plugins/presentations/lib/impresscontroller.py (+5/-11)
openlp/plugins/songs/lib/__init__.py (+10/-8)
openlp/plugins/songs/lib/importers/easyworship.py (+2/-2)
openlp/plugins/songs/lib/importers/foilpresenter.py (+1/-1)
openlp/plugins/songs/lib/importers/openoffice.py (+1/-3)
openlp/plugins/songs/lib/importers/opspro.py (+2/-2)
openlp/plugins/songs/lib/importers/propresenter.py (+4/-4)
openlp/plugins/songs/lib/importers/videopsalm.py (+1/-1)
openlp/plugins/songs/lib/openlyricsxml.py (+1/-1)
tests/functional/openlp_core/lib/test_theme.py (+72/-1)
To merge this branch: bzr merge lp:~phill-ridout/openlp/fixes-III
Reviewer Review Type Date Requested Status
Tomas Groth Pending
Review via email: mp+370336@code.launchpad.net

This proposal supersedes a proposal from 2019-07-03.

This proposal has been superseded by a proposal from 2019-07-18.

Commit message

Minor fixes and changes

To post a comment you must log in.
Revision history for this message
Raoul Snyman (raoul-snyman) wrote : Posted in a previous version of this proposal

Linux tests failed, please see https://ci.openlp.io/job/MP-02-Linux_Tests/206/ for more details

Revision history for this message
Tomas Groth (tomasgroth) wrote : Posted in a previous version of this proposal

Tests fails

review: Needs Fixing
Revision history for this message
Raoul Snyman (raoul-snyman) wrote :

Linux tests passed!

Revision history for this message
Raoul Snyman (raoul-snyman) wrote :

Linting failed, please see https://ci.openlp.io/job/MP-03-Linting/139/ for more details

lp:~phill-ridout/openlp/fixes-III updated
2886. By Phill

Lint fix

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'openlp/core/common/__init__.py'
2--- openlp/core/common/__init__.py 2019-07-03 06:30:01 +0000
3+++ openlp/core/common/__init__.py 2019-07-18 19:27:13 +0000
4@@ -45,7 +45,7 @@
5 FIRST_CAMEL_REGEX = re.compile('(.)([A-Z][a-z]+)')
6 SECOND_CAMEL_REGEX = re.compile('([a-z0-9])([A-Z])')
7 CONTROL_CHARS = re.compile(r'[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x9F]')
8-INVALID_FILE_CHARS = re.compile(r'[\\/:\*\?"<>\|\+\[\]%]')
9+INVALID_FILE_CHARS = re.compile(r'[\\/:*?"<>|+\[\]%]')
10 IMAGES_FILTER = None
11 REPLACMENT_CHARS_MAP = str.maketrans({'\u2018': '\'', '\u2019': '\'', '\u201c': '"', '\u201d': '"', '\u2026': '...',
12 '\u2013': '-', '\u2014': '-', '\v': '\n\n', '\f': '\n\n'})
13@@ -103,21 +103,21 @@
14 logger.error(log_string)
15
16
17-def extension_loader(glob_pattern, excluded_files=[]):
18+def extension_loader(glob_pattern, excluded_files=None):
19 """
20 A utility function to find and load OpenLP extensions, such as plugins, presentation and media controllers and
21 importers.
22
23 :param str glob_pattern: A glob pattern used to find the extension(s) to be imported. Should be relative to the
24 application directory. i.e. plugins/*/*plugin.py
25- :param list[str] excluded_files: A list of file names to exclude that the glob pattern may find.
26+ :param list[str] | None excluded_files: A list of file names to exclude that the glob pattern may find.
27 :rtype: None
28 """
29 from openlp.core.common.applocation import AppLocation
30 app_dir = AppLocation.get_directory(AppLocation.AppDir)
31 for extension_path in app_dir.glob(glob_pattern):
32 extension_path = extension_path.relative_to(app_dir)
33- if extension_path.name in excluded_files:
34+ if extension_path.name in (excluded_files or []):
35 continue
36 log.debug('Attempting to import %s', extension_path)
37 module_name = path_to_module(extension_path)
38
39=== modified file 'openlp/core/common/i18n.py'
40--- openlp/core/common/i18n.py 2019-06-28 18:09:25 +0000
41+++ openlp/core/common/i18n.py 2019-07-18 19:27:13 +0000
42@@ -338,8 +338,8 @@
43 Override the default object creation method to return a single instance.
44 """
45 if not cls.__instance__:
46- cls.__instance__ = object.__new__(cls)
47- cls.load(cls)
48+ cls.__instance__ = super().__new__(cls)
49+ cls.__instance__.load()
50 return cls.__instance__
51
52 def load(self):
53@@ -503,7 +503,7 @@
54 """
55 return local_time.strftime(match.group())
56
57- return re.sub(r'\%[a-zA-Z]', match_formatting, text)
58+ return re.sub(r'%[a-zA-Z]', match_formatting, text)
59
60
61 def get_locale_key(string, numeric=False):
62
63=== modified file 'openlp/core/lib/db.py'
64--- openlp/core/lib/db.py 2019-05-22 20:46:51 +0000
65+++ openlp/core/lib/db.py 2019-07-18 19:27:13 +0000
66@@ -265,7 +265,7 @@
67 """
68 if not database_exists(url):
69 log.warning("Database {db} doesn't exist - skipping upgrade checks".format(db=url))
70- return (0, 0)
71+ return 0, 0
72
73 log.debug('Checking upgrades for DB {db}'.format(db=url))
74
75
76=== modified file 'openlp/core/lib/formattingtags.py'
77--- openlp/core/lib/formattingtags.py 2019-04-13 13:00:22 +0000
78+++ openlp/core/lib/formattingtags.py 2019-07-18 19:27:13 +0000
79@@ -59,97 +59,98 @@
80 """
81 temporary_tags = [tag for tag in FormattingTags.html_expands if tag.get('temporary')]
82 FormattingTags.html_expands = []
83- base_tags = []
84+ base_tags = [
85+ {
86+ 'desc': translate('OpenLP.FormattingTags', 'Red'),
87+ 'start tag': '{r}',
88+ 'start html': '<span style="-webkit-text-fill-color:red">',
89+ 'end tag': '{/r}', 'end html': '</span>', 'protected': True,
90+ 'temporary': False
91+ }, {
92+ 'desc': translate('OpenLP.FormattingTags', 'Black'),
93+ 'start tag': '{b}',
94+ 'start html': '<span style="-webkit-text-fill-color:black">',
95+ 'end tag': '{/b}', 'end html': '</span>', 'protected': True,
96+ 'temporary': False
97+ }, {
98+ 'desc': translate('OpenLP.FormattingTags', 'Blue'),
99+ 'start tag': '{bl}',
100+ 'start html': '<span style="-webkit-text-fill-color:blue">',
101+ 'end tag': '{/bl}', 'end html': '</span>', 'protected': True,
102+ 'temporary': False
103+ }, {
104+ 'desc': translate('OpenLP.FormattingTags', 'Yellow'),
105+ 'start tag': '{y}',
106+ 'start html': '<span style="-webkit-text-fill-color:yellow">',
107+ 'end tag': '{/y}', 'end html': '</span>', 'protected': True,
108+ 'temporary': False
109+ }, {
110+ 'desc': translate('OpenLP.FormattingTags', 'Green'),
111+ 'start tag': '{g}',
112+ 'start html': '<span style="-webkit-text-fill-color:green">',
113+ 'end tag': '{/g}', 'end html': '</span>', 'protected': True,
114+ 'temporary': False
115+ }, {
116+ 'desc': translate('OpenLP.FormattingTags', 'Pink'),
117+ 'start tag': '{pk}',
118+ 'start html': '<span style="-webkit-text-fill-color:#FFC0CB">',
119+ 'end tag': '{/pk}', 'end html': '</span>', 'protected': True,
120+ 'temporary': False
121+ }, {
122+ 'desc': translate('OpenLP.FormattingTags', 'Orange'),
123+ 'start tag': '{o}',
124+ 'start html': '<span style="-webkit-text-fill-color:#FFA500">',
125+ 'end tag': '{/o}', 'end html': '</span>', 'protected': True,
126+ 'temporary': False
127+ }, {
128+ 'desc': translate('OpenLP.FormattingTags', 'Purple'),
129+ 'start tag': '{pp}',
130+ 'start html': '<span style="-webkit-text-fill-color:#800080">',
131+ 'end tag': '{/pp}', 'end html': '</span>', 'protected': True,
132+ 'temporary': False
133+ }, {
134+ 'desc': translate('OpenLP.FormattingTags', 'White'),
135+ 'start tag': '{w}',
136+ 'start html': '<span style="-webkit-text-fill-color:white">',
137+ 'end tag': '{/w}', 'end html': '</span>', 'protected': True,
138+ 'temporary': False
139+ }, {
140+ 'desc': translate('OpenLP.FormattingTags', 'Superscript'),
141+ 'start tag': '{su}', 'start html': '<sup>',
142+ 'end tag': '{/su}', 'end html': '</sup>', 'protected': True,
143+ 'temporary': False
144+ }, {
145+ 'desc': translate('OpenLP.FormattingTags', 'Subscript'),
146+ 'start tag': '{sb}', 'start html': '<sub>',
147+ 'end tag': '{/sb}', 'end html': '</sub>', 'protected': True,
148+ 'temporary': False
149+ }, {
150+ 'desc': translate('OpenLP.FormattingTags', 'Paragraph'),
151+ 'start tag': '{p}', 'start html': '<p>', 'end tag': '{/p}',
152+ 'end html': '</p>', 'protected': True,
153+ 'temporary': False
154+ }, {
155+ 'desc': translate('OpenLP.FormattingTags', 'Bold'),
156+ 'start tag': '{st}', 'start html': '<strong>',
157+ 'end tag': '{/st}', 'end html': '</strong>',
158+ 'protected': True, 'temporary': False
159+ }, {
160+ 'desc': translate('OpenLP.FormattingTags', 'Italics'),
161+ 'start tag': '{it}', 'start html': '<em>', 'end tag': '{/it}',
162+ 'end html': '</em>', 'protected': True, 'temporary': False
163+ }, {
164+ 'desc': translate('OpenLP.FormattingTags', 'Underline'),
165+ 'start tag': '{u}',
166+ 'start html': '<span style="text-decoration: underline;">',
167+ 'end tag': '{/u}', 'end html': '</span>', 'protected': True,
168+ 'temporary': False
169+ }, {
170+ 'desc': translate('OpenLP.FormattingTags', 'Break'),
171+ 'start tag': '{br}', 'start html': '<br>', 'end tag': '',
172+ 'end html': '', 'protected': True,
173+ 'temporary': False
174+ }]
175 # Append the base tags.
176- base_tags.append({
177- 'desc': translate('OpenLP.FormattingTags', 'Red'),
178- 'start tag': '{r}',
179- 'start html': '<span style="-webkit-text-fill-color:red">',
180- 'end tag': '{/r}', 'end html': '</span>', 'protected': True,
181- 'temporary': False})
182- base_tags.append({
183- 'desc': translate('OpenLP.FormattingTags', 'Black'),
184- 'start tag': '{b}',
185- 'start html': '<span style="-webkit-text-fill-color:black">',
186- 'end tag': '{/b}', 'end html': '</span>', 'protected': True,
187- 'temporary': False})
188- base_tags.append({
189- 'desc': translate('OpenLP.FormattingTags', 'Blue'),
190- 'start tag': '{bl}',
191- 'start html': '<span style="-webkit-text-fill-color:blue">',
192- 'end tag': '{/bl}', 'end html': '</span>', 'protected': True,
193- 'temporary': False})
194- base_tags.append({
195- 'desc': translate('OpenLP.FormattingTags', 'Yellow'),
196- 'start tag': '{y}',
197- 'start html': '<span style="-webkit-text-fill-color:yellow">',
198- 'end tag': '{/y}', 'end html': '</span>', 'protected': True,
199- 'temporary': False})
200- base_tags.append({
201- 'desc': translate('OpenLP.FormattingTags', 'Green'),
202- 'start tag': '{g}',
203- 'start html': '<span style="-webkit-text-fill-color:green">',
204- 'end tag': '{/g}', 'end html': '</span>', 'protected': True,
205- 'temporary': False})
206- base_tags.append({
207- 'desc': translate('OpenLP.FormattingTags', 'Pink'),
208- 'start tag': '{pk}',
209- 'start html': '<span style="-webkit-text-fill-color:#FFC0CB">',
210- 'end tag': '{/pk}', 'end html': '</span>', 'protected': True,
211- 'temporary': False})
212- base_tags.append({
213- 'desc': translate('OpenLP.FormattingTags', 'Orange'),
214- 'start tag': '{o}',
215- 'start html': '<span style="-webkit-text-fill-color:#FFA500">',
216- 'end tag': '{/o}', 'end html': '</span>', 'protected': True,
217- 'temporary': False})
218- base_tags.append({
219- 'desc': translate('OpenLP.FormattingTags', 'Purple'),
220- 'start tag': '{pp}',
221- 'start html': '<span style="-webkit-text-fill-color:#800080">',
222- 'end tag': '{/pp}', 'end html': '</span>', 'protected': True,
223- 'temporary': False})
224- base_tags.append({
225- 'desc': translate('OpenLP.FormattingTags', 'White'),
226- 'start tag': '{w}',
227- 'start html': '<span style="-webkit-text-fill-color:white">',
228- 'end tag': '{/w}', 'end html': '</span>', 'protected': True,
229- 'temporary': False})
230- base_tags.append({
231- 'desc': translate('OpenLP.FormattingTags', 'Superscript'),
232- 'start tag': '{su}', 'start html': '<sup>',
233- 'end tag': '{/su}', 'end html': '</sup>', 'protected': True,
234- 'temporary': False})
235- base_tags.append({
236- 'desc': translate('OpenLP.FormattingTags', 'Subscript'),
237- 'start tag': '{sb}', 'start html': '<sub>',
238- 'end tag': '{/sb}', 'end html': '</sub>', 'protected': True,
239- 'temporary': False})
240- base_tags.append({
241- 'desc': translate('OpenLP.FormattingTags', 'Paragraph'),
242- 'start tag': '{p}', 'start html': '<p>', 'end tag': '{/p}',
243- 'end html': '</p>', 'protected': True,
244- 'temporary': False})
245- base_tags.append({
246- 'desc': translate('OpenLP.FormattingTags', 'Bold'),
247- 'start tag': '{st}', 'start html': '<strong>',
248- 'end tag': '{/st}', 'end html': '</strong>',
249- 'protected': True, 'temporary': False})
250- base_tags.append({
251- 'desc': translate('OpenLP.FormattingTags', 'Italics'),
252- 'start tag': '{it}', 'start html': '<em>', 'end tag': '{/it}',
253- 'end html': '</em>', 'protected': True, 'temporary': False})
254- base_tags.append({
255- 'desc': translate('OpenLP.FormattingTags', 'Underline'),
256- 'start tag': '{u}',
257- 'start html': '<span style="text-decoration: underline;">',
258- 'end tag': '{/u}', 'end html': '</span>', 'protected': True,
259- 'temporary': False})
260- base_tags.append({
261- 'desc': translate('OpenLP.FormattingTags', 'Break'),
262- 'start tag': '{br}', 'start html': '<br>', 'end tag': '',
263- 'end html': '', 'protected': True,
264- 'temporary': False})
265 FormattingTags.add_html_tags(base_tags)
266 FormattingTags.add_html_tags(temporary_tags)
267 user_expands_string = str(Settings().value('formattingTags/html_tags'))
268
269=== modified file 'openlp/core/projectors/manager.py'
270--- openlp/core/projectors/manager.py 2019-04-13 13:00:22 +0000
271+++ openlp/core/projectors/manager.py 2019-07-18 19:27:13 +0000
272@@ -344,14 +344,14 @@
273 """
274 log.debug('Checking for UDP port {port} listener deletion'.format(port=port))
275 if port not in self.pjlink_udp:
276- log.warn('UDP listener for port {port} not there - skipping delete'.format(port=port))
277+ log.warning('UDP listener for port {port} not there - skipping delete'.format(port=port))
278 return
279 keep_port = False
280 for item in self.projector_list:
281 if port == item.link.port:
282 keep_port = True
283 if keep_port:
284- log.warn('UDP listener for port {port} needed for other projectors - skipping delete'.format(port=port))
285+ log.warning('UDP listener for port {port} needed for other projectors - skipping delete'.format(port=port))
286 return
287 Registry().execute('udp_broadcast_remove', port=port)
288 del self.pjlink_udp[port]
289
290=== modified file 'openlp/core/projectors/pjlink.py'
291--- openlp/core/projectors/pjlink.py 2019-05-11 09:07:40 +0000
292+++ openlp/core/projectors/pjlink.py 2019-07-18 19:27:13 +0000
293@@ -552,7 +552,7 @@
294 data = data_in.strip()
295 self.receive_data_signal()
296 # Initial packet checks
297- if (len(data) < 7):
298+ if len(data) < 7:
299 self._trash_buffer(msg='get_data(): Invalid packet - length')
300 return
301 elif len(data) > self.max_size:
302
303=== modified file 'openlp/core/projectors/sourceselectform.py'
304--- openlp/core/projectors/sourceselectform.py 2019-04-13 13:00:22 +0000
305+++ openlp/core/projectors/sourceselectform.py 2019-07-18 19:27:13 +0000
306@@ -177,7 +177,7 @@
307 :param height: Remove default height parameter in kwargs
308 """
309 self.tabSize = QtCore.QSize(kwargs.pop('width', 100), kwargs.pop('height', 25))
310- QtWidgets.QTabBar.__init__(self, parent, *args, **kwargs)
311+ super().__init__(parent)
312
313 def paintEvent(self, event):
314 """
315@@ -215,11 +215,11 @@
316 Based on thread discussion
317 http://www.riverbankcomputing.com/pipermail/pyqt/2005-December/011724.html
318 """
319- def __init__(self, parent, *args):
320+ def __init__(self, parent):
321 """
322 Initialize FingerTabWidget instance
323 """
324- QtWidgets.QTabWidget.__init__(self, parent, *args)
325+ super().__init__(parent)
326 self.setTabBar(FingerTabBarWidget(self))
327
328
329
330=== modified file 'openlp/core/ui/__init__.py'
331--- openlp/core/ui/__init__.py 2019-05-03 17:26:37 +0000
332+++ openlp/core/ui/__init__.py 2019-07-18 19:27:13 +0000
333@@ -93,4 +93,4 @@
334 self.resizeRowsToContents()
335
336
337-__all__ = ['SingleColumnTableWidget', 'DisplayControllerType']
338+__all__ = ['AlertLocation', 'DisplayControllerType', 'HideMode', 'SingleColumnTableWidget']
339
340=== modified file 'openlp/core/ui/formattingtagcontroller.py'
341--- openlp/core/ui/formattingtagcontroller.py 2019-06-28 18:09:25 +0000
342+++ openlp/core/ui/formattingtagcontroller.py 2019-07-18 19:27:13 +0000
343@@ -40,7 +40,7 @@
344 """
345 self.html_tag_regex = re.compile(
346 r'<(?:(?P<close>/(?=[^\s/>]+>))?'
347- r'(?P<tag>[^\s/!\?>]+)(?:\s+[^\s=]+="[^"]*")*\s*(?P<empty>/)?'
348+ r'(?P<tag>[^\s/!?>]+)(?:\s+[^\s=]+="[^"]*")*\s*(?P<empty>/)?'
349 r'|(?P<cdata>!\[CDATA\[(?:(?!\]\]>).)*\]\])'
350 r'|(?P<procinst>\?(?:(?!\?>).)*\?)'
351 r'|(?P<comment>!--(?:(?!-->).)*--))>')
352
353=== modified file 'openlp/core/ui/icons.py'
354--- openlp/core/ui/icons.py 2019-04-13 13:00:22 +0000
355+++ openlp/core/ui/icons.py 2019-07-18 19:27:13 +0000
356@@ -45,8 +45,8 @@
357 Override the default object creation method to return a single instance.
358 """
359 if not cls.__instance__:
360- cls.__instance__ = object.__new__(cls)
361- cls.load(cls)
362+ cls.__instance__ = super().__new__(cls)
363+ cls.__instance__.load()
364 return cls.__instance__
365
366 def load(self):
367@@ -164,7 +164,7 @@
368 'video': {'icon': 'fa.file-video-o'},
369 'volunteer': {'icon': 'fa.group'}
370 }
371- self.load_icons(self, icon_list)
372+ self.load_icons(icon_list)
373
374 def load_icons(self, icon_list):
375 """
376
377=== modified file 'openlp/core/ui/shortcutlistdialog.py'
378--- openlp/core/ui/shortcutlistdialog.py 2019-04-13 13:00:22 +0000
379+++ openlp/core/ui/shortcutlistdialog.py 2019-07-18 19:27:13 +0000
380@@ -101,7 +101,7 @@
381 self.primary_push_button = CaptureShortcutButton(shortcutListDialog)
382 self.primary_push_button.setObjectName('primary_push_button')
383 self.primary_push_button.setMinimumSize(QtCore.QSize(84, 0))
384- self.primary_push_button.setIcon(UiIcons.shortcuts)
385+ self.primary_push_button.setIcon(UiIcons().shortcuts)
386 self.primary_layout.addWidget(self.primary_push_button)
387 self.clear_primary_button = QtWidgets.QToolButton(shortcutListDialog)
388 self.clear_primary_button.setObjectName('clear_primary_button')
389
390=== modified file 'openlp/core/ui/shortcutlistform.py'
391--- openlp/core/ui/shortcutlistform.py 2019-04-13 13:00:22 +0000
392+++ openlp/core/ui/shortcutlistform.py 2019-07-18 19:27:13 +0000
393@@ -34,7 +34,7 @@
394 from openlp.core.ui.shortcutlistdialog import Ui_ShortcutListDialog
395
396
397-REMOVE_AMPERSAND = re.compile(r'&{1}')
398+REMOVE_AMPERSAND = re.compile(r'&')
399
400 log = logging.getLogger(__name__)
401
402
403=== modified file 'openlp/core/widgets/views.py'
404--- openlp/core/widgets/views.py 2019-05-23 19:33:46 +0000
405+++ openlp/core/widgets/views.py 2019-07-18 19:27:13 +0000
406@@ -80,7 +80,7 @@
407 An empty ``ServiceItem`` is used by default. replace_service_manager_item() needs to be called to make this
408 widget display something.
409 """
410- super(QtWidgets.QTableWidget, self).__init__(parent)
411+ super().__init__(parent)
412 self._setup(screen_ratio)
413
414 def _setup(self, screen_ratio):
415@@ -124,7 +124,7 @@
416 max_img_row_height = Settings().value('advanced/slide max height')
417 # Adjust for row height cap if in use.
418 if isinstance(max_img_row_height, int):
419- if max_img_row_height > 0 and height > max_img_row_height:
420+ if 0 < max_img_row_height < height:
421 height = max_img_row_height
422 elif max_img_row_height < 0:
423 # If auto setting, show that number of slides, or if the resulting slides too small, 100px.
424@@ -219,7 +219,7 @@
425 slide_height = width // self.screen_ratio
426 max_img_row_height = Settings().value('advanced/slide max height')
427 if isinstance(max_img_row_height, int):
428- if max_img_row_height > 0 and slide_height > max_img_row_height:
429+ if 0 < max_img_row_height < slide_height:
430 slide_height = max_img_row_height
431 elif max_img_row_height < 0:
432 # If auto setting, show that number of slides, or if the resulting slides too small, 100px.
433
434=== modified file 'openlp/core/widgets/widgets.py'
435--- openlp/core/widgets/widgets.py 2019-06-12 18:04:47 +0000
436+++ openlp/core/widgets/widgets.py 2019-07-18 19:27:13 +0000
437@@ -194,11 +194,11 @@
438
439
440 class ScreenSelectionWidget(QtWidgets.QWidget):
441- def __init__(self, parent=None, screens=[]):
442+ def __init__(self, parent=None, screens=None):
443 super().__init__(parent)
444 self.current_screen = None
445 self.identify_labels = []
446- self.screens = screens
447+ self.screens = screens or []
448 self.timer = QtCore.QTimer()
449 self.timer.setSingleShot(True)
450 self.timer.setInterval(3000)
451
452=== modified file 'openlp/plugins/bibles/lib/manager.py'
453--- openlp/plugins/bibles/lib/manager.py 2019-05-22 06:47:00 +0000
454+++ openlp/plugins/bibles/lib/manager.py 2019-07-18 19:27:13 +0000
455@@ -401,4 +401,4 @@
456 self.db_cache[bible].finalise()
457
458
459-__all__ = ['BibleFormat']
460+__all__ = ['BibleFormat', 'BibleManager']
461
462=== modified file 'openlp/plugins/bibles/lib/mediaitem.py'
463--- openlp/plugins/bibles/lib/mediaitem.py 2019-04-13 13:00:22 +0000
464+++ openlp/plugins/bibles/lib/mediaitem.py 2019-07-18 19:27:13 +0000
465@@ -109,7 +109,7 @@
466 :param kwargs: Keyword arguments to pass to the super method. (dict)
467 """
468 self.clear_icon = UiIcons().square
469- self.save_results_icon = UiIcons.save
470+ self.save_results_icon = UiIcons().save
471 self.sort_icon = UiIcons().sort
472 self.bible = None
473 self.second_bible = None
474
475=== modified file 'openlp/plugins/presentations/lib/impresscontroller.py'
476--- openlp/plugins/presentations/lib/impresscontroller.py 2019-06-04 20:03:19 +0000
477+++ openlp/plugins/presentations/lib/impresscontroller.py 2019-07-18 19:27:13 +0000
478@@ -55,7 +55,7 @@
479 class SlideShowListenerImport(XSlideShowListenerObj.__class__):
480 pass
481 except (AttributeError, pywintypes.com_error):
482- class SlideShowListenerImport():
483+ class SlideShowListenerImport(object):
484 pass
485
486 # Declare an empty exception to match the exception imported from UNO
487@@ -76,7 +76,7 @@
488 except ImportError:
489 uno_available = False
490
491- class SlideShowListenerImport():
492+ class SlideShowListenerImport(object):
493 pass
494
495 log = logging.getLogger(__name__)
496@@ -233,9 +233,7 @@
497 self.conf_provider = self.manager.createInstanceWithContext(
498 'com.sun.star.configuration.ConfigurationProvider', uno.getComponentContext())
499 # Setup lookup properties to get Impress settings
500- properties = []
501- properties.append(self.create_property('nodepath', 'org.openoffice.Office.Impress'))
502- properties = tuple(properties)
503+ properties = tuple(self.create_property('nodepath', 'org.openoffice.Office.Impress'))
504 try:
505 # Get an updateable configuration view
506 impress_conf_props = self.conf_provider.createInstanceWithArguments(
507@@ -311,9 +309,7 @@
508 if desktop is None:
509 return False
510 self.desktop = desktop
511- properties = []
512- properties.append(self.controller.create_property('Hidden', True))
513- properties = tuple(properties)
514+ properties = tuple(self.controller.create_property('Hidden', True))
515 try:
516 self.document = desktop.loadComponentFromURL(url, '_blank', 0, properties)
517 except Exception:
518@@ -338,9 +334,7 @@
519 return
520 temp_folder_path = self.get_temp_folder()
521 thumb_dir_url = temp_folder_path.as_uri()
522- properties = []
523- properties.append(self.controller.create_property('FilterName', 'impress_png_Export'))
524- properties = tuple(properties)
525+ properties = tuple(self.controller.create_property('FilterName', 'impress_png_Export'))
526 doc = self.document
527 pages = doc.getDrawPages()
528 if not pages:
529
530=== modified file 'openlp/plugins/songs/lib/__init__.py'
531--- openlp/plugins/songs/lib/__init__.py 2019-04-13 13:00:22 +0000
532+++ openlp/plugins/songs/lib/__init__.py 2019-07-18 19:27:13 +0000
533@@ -615,14 +615,16 @@
534 :return: The transposed chord.
535 """
536 # See https://en.wikipedia.org/wiki/Musical_note#12-tone_chromatic_scale
537- notes_sharp_notation = {}
538- notes_flat_notation = {}
539- notes_sharp_notation['german'] = ['C', 'C#', 'D', 'D#', 'E', 'F', 'F#', 'G', 'G#', 'A', 'A#', 'H']
540- notes_flat_notation['german'] = ['C', 'Db', 'D', 'Eb', 'Fb', 'F', 'Gb', 'G', 'Ab', 'A', 'B', 'H']
541- notes_sharp_notation['english'] = ['C', 'C#', 'D', 'D#', 'E', 'F', 'F#', 'G', 'G#', 'A', 'A#', 'B']
542- notes_flat_notation['english'] = ['C', 'Db', 'D', 'Eb', 'Fb', 'F', 'Gb', 'G', 'Ab', 'A', 'Bb', 'B']
543- notes_sharp_notation['neo-latin'] = ['Do', 'Do#', 'Re', 'Re#', 'Mi', 'Fa', 'Fa#', 'Sol', 'Sol#', 'La', 'La#', 'Si']
544- notes_flat_notation['neo-latin'] = ['Do', 'Reb', 'Re', 'Mib', 'Fab', 'Fa', 'Solb', 'Sol', 'Lab', 'La', 'Sib', 'Si']
545+ notes_sharp_notation = {
546+ 'german': ['C', 'C#', 'D', 'D#', 'E', 'F', 'F#', 'G', 'G#', 'A', 'A#', 'H'],
547+ 'english': ['C', 'C#', 'D', 'D#', 'E', 'F', 'F#', 'G', 'G#', 'A', 'A#', 'B'],
548+ 'neo-latin': ['Do', 'Do#', 'Re', 'Re#', 'Mi', 'Fa', 'Fa#', 'Sol', 'Sol#', 'La', 'La#', 'Si']
549+ }
550+ notes_flat_notation = {
551+ 'german': ['C', 'Db', 'D', 'Eb', 'Fb', 'F', 'Gb', 'G', 'Ab', 'A', 'B', 'H'],
552+ 'english': ['C', 'Db', 'D', 'Eb', 'Fb', 'F', 'Gb', 'G', 'Ab', 'A', 'Bb', 'B'],
553+ 'neo-latin': ['Do', 'Reb', 'Re', 'Mib', 'Fab', 'Fa', 'Solb', 'Sol', 'Lab', 'La', 'Sib', 'Si']
554+ }
555 chord_split = chord.replace('♭', 'b').split('/')
556 transposed_chord = ''
557 last_chord = ''
558
559=== modified file 'openlp/plugins/songs/lib/importers/easyworship.py'
560--- openlp/plugins/songs/lib/importers/easyworship.py 2019-05-22 06:47:00 +0000
561+++ openlp/plugins/songs/lib/importers/easyworship.py 2019-07-18 19:27:13 +0000
562@@ -118,8 +118,8 @@
563 # 40/48/56 Entry count int32le 4 Number of items in the schedule
564 # 44/52/60 Entry length int16le 2 Length of schedule entries: 0x0718 = 1816
565 # Get file version
566- type, = struct.unpack('<38s', self.ews_file.read(38))
567- version = type.decode()[-3:]
568+ file_type, = struct.unpack('<38s', self.ews_file.read(38))
569+ version = file_type.decode()[-3:]
570 # Set fileposition based on filetype/version
571 file_pos = 0
572 if version == ' 5':
573
574=== modified file 'openlp/plugins/songs/lib/importers/foilpresenter.py'
575--- openlp/plugins/songs/lib/importers/foilpresenter.py 2019-04-13 13:00:22 +0000
576+++ openlp/plugins/songs/lib/importers/foilpresenter.py 2019-07-18 19:27:13 +0000
577@@ -302,7 +302,7 @@
578 break
579 author_temp = []
580 for author in strings:
581- temp = re.split(r',(?=\D{2})|(?<=\D),|\/(?=\D{3,})|(?<=\D);', author)
582+ temp = re.split(r',(?=\D{2})|(?<=\D),|/(?=\D{3,})|(?<=\D);', author)
583 for tempx in temp:
584 author_temp.append(tempx)
585 for author in author_temp:
586
587=== modified file 'openlp/plugins/songs/lib/importers/openoffice.py'
588--- openlp/plugins/songs/lib/importers/openoffice.py 2019-04-13 13:00:22 +0000
589+++ openlp/plugins/songs/lib/importers/openoffice.py 2019-07-18 19:27:13 +0000
590@@ -145,9 +145,7 @@
591 """
592 self.file_path = file_path
593 url = file_path.as_uri()
594- properties = []
595- properties.append(self.create_property('Hidden', True))
596- properties = tuple(properties)
597+ properties = tuple(self.create_property('Hidden', True))
598 try:
599 self.document = self.desktop.loadComponentFromURL(url, '_blank', 0, properties)
600 if not self.document.supportsService("com.sun.star.presentation.PresentationDocument") and not \
601
602=== modified file 'openlp/plugins/songs/lib/importers/opspro.py'
603--- openlp/plugins/songs/lib/importers/opspro.py 2019-04-13 13:00:22 +0000
604+++ openlp/plugins/songs/lib/importers/opspro.py 2019-07-18 19:27:13 +0000
605@@ -136,8 +136,8 @@
606 verse_text = re.sub(r'^\d+\r\n', '', verse_text)
607 verse_def = 'v' + verse_number.group(1)
608 # Detect verse tags
609- elif re.match(r'^.+?\:\r\n', verse_text):
610- tag_match = re.match(r'^(.+?)\:\r\n(.*)', verse_text, flags=re.DOTALL)
611+ elif re.match(r'^.+?:\r\n', verse_text):
612+ tag_match = re.match(r'^(.+?):\r\n(.*)', verse_text, flags=re.DOTALL)
613 tag = tag_match.group(1).lower()
614 tag = tag.split(' ')[0]
615 verse_text = tag_match.group(2)
616
617=== modified file 'openlp/plugins/songs/lib/importers/propresenter.py'
618--- openlp/plugins/songs/lib/importers/propresenter.py 2019-05-22 06:47:00 +0000
619+++ openlp/plugins/songs/lib/importers/propresenter.py 2019-07-18 19:27:13 +0000
620@@ -80,7 +80,7 @@
621 self.parse_author(author)
622
623 # ProPresenter 4
624- if(self.version >= 400 and self.version < 500):
625+ if 400 <= self.version < 500:
626 self.copyright = root.get('CCLICopyrightInfo')
627 self.ccli_number = root.get('CCLILicenseNumber')
628 count = 0
629@@ -95,7 +95,7 @@
630 self.add_verse(words, "v{count}".format(count=count))
631
632 # ProPresenter 5
633- elif(self.version >= 500 and self.version < 600):
634+ elif 500 <= self.version < 600:
635 self.copyright = root.get('CCLICopyrightInfo')
636 self.ccli_number = root.get('CCLILicenseNumber')
637 count = 0
638@@ -111,7 +111,7 @@
639 self.add_verse(words, "v{count:d}".format(count=count))
640
641 # ProPresenter 6
642- elif(self.version >= 600 and self.version < 700):
643+ elif 600 <= self.version < 700:
644 self.copyright = root.get('CCLICopyrightYear')
645 self.ccli_number = root.get('CCLISongNumber')
646 count = 0
647@@ -128,7 +128,7 @@
648 b64Data = contents.text
649 data = base64.standard_b64decode(b64Data)
650 words = None
651- if(contents.get('rvXMLIvarName') == "RTFData"):
652+ if contents.get('rvXMLIvarName') == "RTFData":
653 words, encoding = strip_rtf(data.decode())
654 break
655 if words:
656
657=== modified file 'openlp/plugins/songs/lib/importers/videopsalm.py'
658--- openlp/plugins/songs/lib/importers/videopsalm.py 2019-05-22 06:47:00 +0000
659+++ openlp/plugins/songs/lib/importers/videopsalm.py 2019-07-18 19:27:13 +0000
660@@ -75,7 +75,7 @@
661 c = next(file_content_it)
662 processed_content += '"' + c
663 # Remove control characters
664- elif (c < chr(32)):
665+ elif c < chr(32):
666 processed_content += ' '
667 # Handle escaped characters
668 elif c == '\\':
669
670=== modified file 'openlp/plugins/songs/lib/openlyricsxml.py'
671--- openlp/plugins/songs/lib/openlyricsxml.py 2019-06-28 19:26:46 +0000
672+++ openlp/plugins/songs/lib/openlyricsxml.py 2019-07-18 19:27:13 +0000
673@@ -221,7 +221,7 @@
674 """
675 IMPLEMENTED_VERSION = '0.8'
676 START_TAGS_REGEX = re.compile(r'\{(\w+)\}')
677- END_TAGS_REGEX = re.compile(r'\{\/(\w+)\}')
678+ END_TAGS_REGEX = re.compile(r'\{/(\w+)\}')
679 VERSE_TAG_SPLITTER = re.compile('([a-zA-Z]+)([0-9]*)([a-zA-Z]?)')
680
681 def __init__(self, manager):
682
683=== modified file 'tests/functional/openlp_core/lib/test_theme.py'
684--- tests/functional/openlp_core/lib/test_theme.py 2019-04-13 13:00:22 +0000
685+++ tests/functional/openlp_core/lib/test_theme.py 2019-07-18 19:27:13 +0000
686@@ -25,7 +25,78 @@
687 from pathlib import Path
688 from unittest import TestCase
689
690-from openlp.core.lib.theme import Theme
691+from openlp.core.lib.theme import BackgroundType, Theme
692+
693+
694+class TestBackgroundType(TestCase):
695+ """
696+ Test the BackgroundType enum methods.
697+ """
698+ def test_solid_to_string(self):
699+ """
700+ Test the to_string method of :class:`BackgroundType`
701+ """
702+ # GIVEN: A BackgroundType member
703+ background_type = BackgroundType.Solid
704+
705+ # WHEN: Calling BackgroundType.to_string
706+ # THEN: The string equivalent should have been returned
707+ assert BackgroundType.to_string(background_type) == 'solid'
708+
709+ def test_gradient_to_string(self):
710+ """
711+ Test the to_string method of :class:`BackgroundType`
712+ """
713+ # GIVEN: A BackgroundType member
714+ background_type = BackgroundType.Gradient
715+
716+ # WHEN: Calling BackgroundType.to_string
717+ # THEN: The string equivalent should have been returned
718+ assert BackgroundType.to_string(background_type) == 'gradient'
719+
720+ def test_image_to_string(self):
721+ """
722+ Test the to_string method of :class:`BackgroundType`
723+ """
724+ # GIVEN: A BackgroundType member
725+ background_type = BackgroundType.Image
726+
727+ # WHEN: Calling BackgroundType.to_string
728+ # THEN: The string equivalent should have been returned
729+ assert BackgroundType.to_string(background_type) == 'image'
730+
731+ def test_transparent_to_string(self):
732+ """
733+ Test the to_string method of :class:`BackgroundType`
734+ """
735+ # GIVEN: A BackgroundType member
736+ background_type = BackgroundType.Transparent
737+
738+ # WHEN: Calling BackgroundType.to_string
739+ # THEN: The string equivalent should have been returned
740+ assert BackgroundType.to_string(background_type) == 'transparent'
741+
742+ def test_video_to_string(self):
743+ """
744+ Test the to_string method of :class:`BackgroundType`
745+ """
746+ # GIVEN: A BackgroundType member
747+ background_type = BackgroundType.Video
748+
749+ # WHEN: Calling BackgroundType.to_string
750+ # THEN: The string equivalent should have been returned
751+ assert BackgroundType.to_string(background_type) == 'video'
752+
753+ def test_stream_to_string(self):
754+ """
755+ Test the to_string method of :class:`BackgroundType`
756+ """
757+ # GIVEN: A BackgroundType member
758+ background_type = BackgroundType.Stream
759+
760+ # WHEN: Calling BackgroundType.to_string
761+ # THEN: The string equivalent should have been returned
762+ assert BackgroundType.to_string(background_type) == 'stream'
763
764
765 class TestTheme(TestCase):