Status: | Superseded |
---|---|
Proposed branch: | lp:~phill-ridout/openlp/fixes-II |
Merge into: | lp:openlp |
Diff against target: |
707 lines (+88/-85) 26 files modified
openlp/core/app.py (+8/-10) openlp/core/common/__init__.py (+5/-5) openlp/core/display/window.py (+1/-1) openlp/core/lib/mediamanageritem.py (+5/-6) openlp/core/lib/theme.py (+1/-1) openlp/core/server.py (+2/-1) openlp/core/ui/firsttimewizard.py (+1/-1) openlp/core/ui/mainwindow.py (+11/-10) openlp/core/ui/servicemanager.py (+21/-13) openlp/core/ui/slidecontroller.py (+1/-1) openlp/core/widgets/dialogs.py (+1/-1) openlp/core/widgets/layouts.py (+1/-1) openlp/core/widgets/views.py (+3/-3) openlp/plugins/bibles/lib/importers/csvbible.py (+1/-1) openlp/plugins/images/lib/mediaitem.py (+1/-2) openlp/plugins/presentations/lib/mediaitem.py (+8/-10) openlp/plugins/songs/lib/importers/presentationmanager.py (+1/-1) openlp/plugins/songs/lib/importers/songbeamer.py (+1/-1) openlp/plugins/songs/lib/importers/worshipassistant.py (+1/-1) tests/functional/openlp_core/common/test_common.py (+2/-2) tests/functional/openlp_core/common/test_init.py (+3/-3) tests/functional/openlp_core/test_app.py (+2/-2) tests/functional/openlp_core/test_server.py (+3/-2) tests/functional/openlp_core/ui/test_mainwindow.py (+1/-2) tests/functional/openlp_core/ui/test_thememanager.py (+2/-2) tests/functional/openlp_plugins/bibles/test_csvimport.py (+1/-2) |
To merge this branch: | bzr merge lp:~phill-ridout/openlp/fixes-II |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
OpenLP Core | Pending | ||
Review via email: mp+366950@code.launchpad.net |
This proposal supersedes a proposal from 2019-05-04.
This proposal has been superseded by a proposal from 2019-05-04.
Commit message
Just to trigger the tests :-)
Description of the change
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 | # |
Revision history for this message
Raoul Snyman (raoul-snyman) wrote : Posted in a previous version of this proposal | # |
Linux tests passed!
Revision history for this message
Raoul Snyman (raoul-snyman) wrote : Posted in a previous version of this proposal | # |
Linting failed, please see https:/
Unmerged revisions
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'openlp/core/app.py' | |||
2 | --- openlp/core/app.py 2019-05-01 19:22:01 +0000 | |||
3 | +++ openlp/core/app.py 2019-05-04 18:26:49 +0000 | |||
4 | @@ -287,12 +287,12 @@ | |||
5 | 287 | return QtWidgets.QApplication.event(self, event) | 287 | return QtWidgets.QApplication.event(self, event) |
6 | 288 | 288 | ||
7 | 289 | 289 | ||
9 | 290 | def parse_options(args=None): | 290 | def parse_options(): |
10 | 291 | """ | 291 | """ |
11 | 292 | Parse the command line arguments | 292 | Parse the command line arguments |
12 | 293 | 293 | ||
15 | 294 | :param args: list of command line arguments | 294 | :return: An :object:`argparse.Namespace` insatnce containing the parsed args. |
16 | 295 | :return: a tuple of parsed options of type optparse.Value and a list of remaining argsZ | 295 | :rtype: argparse.Namespace |
17 | 296 | """ | 296 | """ |
18 | 297 | # Set up command line options. | 297 | # Set up command line options. |
19 | 298 | parser = argparse.ArgumentParser(prog='openlp') | 298 | parser = argparse.ArgumentParser(prog='openlp') |
20 | @@ -307,9 +307,9 @@ | |||
21 | 307 | dir_name=os.path.join('<AppDir>', '..', '..'))) | 307 | dir_name=os.path.join('<AppDir>', '..', '..'))) |
22 | 308 | parser.add_argument('-w', '--no-web-server', dest='no_web_server', action='store_true', | 308 | parser.add_argument('-w', '--no-web-server', dest='no_web_server', action='store_true', |
23 | 309 | help='Turn off the Web and Socket Server ') | 309 | help='Turn off the Web and Socket Server ') |
27 | 310 | parser.add_argument('rargs', nargs='?', default=[]) | 310 | parser.add_argument('rargs', nargs='*', default=[]) |
28 | 311 | # Parse command line options and deal with them. Use args supplied pragmatically if possible. | 311 | # Parse command line options and deal with them. |
29 | 312 | return parser.parse_args(args) if args else parser.parse_args() | 312 | return parser.parse_args() |
30 | 313 | 313 | ||
31 | 314 | 314 | ||
32 | 315 | def set_up_logging(log_path): | 315 | def set_up_logging(log_path): |
33 | @@ -328,13 +328,11 @@ | |||
34 | 328 | print('Logging to: {name}'.format(name=file_path)) | 328 | print('Logging to: {name}'.format(name=file_path)) |
35 | 329 | 329 | ||
36 | 330 | 330 | ||
38 | 331 | def main(args=None): | 331 | def main(): |
39 | 332 | """ | 332 | """ |
40 | 333 | The main function which parses command line options and then runs | 333 | The main function which parses command line options and then runs |
41 | 334 | |||
42 | 335 | :param args: Some args | ||
43 | 336 | """ | 334 | """ |
45 | 337 | args = parse_options(args) | 335 | args = parse_options() |
46 | 338 | qt_args = ['--disable-web-security'] | 336 | qt_args = ['--disable-web-security'] |
47 | 339 | # qt_args = [] | 337 | # qt_args = [] |
48 | 340 | if args and args.loglevel.lower() in ['d', 'debug']: | 338 | if args and args.loglevel.lower() in ['d', 'debug']: |
49 | 341 | 339 | ||
50 | === modified file 'openlp/core/common/__init__.py' | |||
51 | --- openlp/core/common/__init__.py 2019-04-13 13:00:22 +0000 | |||
52 | +++ openlp/core/common/__init__.py 2019-05-04 18:26:49 +0000 | |||
53 | @@ -134,8 +134,8 @@ | |||
54 | 134 | importlib.import_module(module_name) | 134 | importlib.import_module(module_name) |
55 | 135 | except (ImportError, OSError): | 135 | except (ImportError, OSError): |
56 | 136 | # On some platforms importing vlc.py might cause OSError exceptions. (e.g. Mac OS X) | 136 | # On some platforms importing vlc.py might cause OSError exceptions. (e.g. Mac OS X) |
59 | 137 | log.warning('Failed to import {module_name} on path {extension_path}' | 137 | log.exception('Failed to import {module_name} on path {extension_path}' |
60 | 138 | .format(module_name=module_name, extension_path=extension_path)) | 138 | .format(module_name=module_name, extension_path=extension_path)) |
61 | 139 | 139 | ||
62 | 140 | 140 | ||
63 | 141 | def path_to_module(path): | 141 | def path_to_module(path): |
64 | @@ -463,8 +463,8 @@ | |||
65 | 463 | Utility function to incrementally detect the file encoding. | 463 | Utility function to incrementally detect the file encoding. |
66 | 464 | 464 | ||
67 | 465 | :param openlp.core.common.path.Path file_path: Filename for the file to determine the encoding for. | 465 | :param openlp.core.common.path.Path file_path: Filename for the file to determine the encoding for. |
70 | 466 | :return: A dict with the keys 'encoding' and 'confidence' | 466 | :return: The name of the encoding detected |
71 | 467 | :rtype: dict[str, float] | 467 | :rtype: str |
72 | 468 | """ | 468 | """ |
73 | 469 | detector = UniversalDetector() | 469 | detector = UniversalDetector() |
74 | 470 | try: | 470 | try: |
75 | @@ -477,7 +477,7 @@ | |||
76 | 477 | except OSError: | 477 | except OSError: |
77 | 478 | log.exception('Error detecting file encoding') | 478 | log.exception('Error detecting file encoding') |
78 | 479 | finally: | 479 | finally: |
80 | 480 | return detector.close() | 480 | return detector.close()['encoding'] |
81 | 481 | 481 | ||
82 | 482 | 482 | ||
83 | 483 | def normalize_str(irregular_string): | 483 | def normalize_str(irregular_string): |
84 | 484 | 484 | ||
85 | === modified file 'openlp/core/display/window.py' | |||
86 | --- openlp/core/display/window.py 2019-04-13 13:00:22 +0000 | |||
87 | +++ openlp/core/display/window.py 2019-05-04 18:26:49 +0000 | |||
88 | @@ -180,7 +180,7 @@ | |||
89 | 180 | """ | 180 | """ |
90 | 181 | Set the URL of the webview | 181 | Set the URL of the webview |
91 | 182 | 182 | ||
93 | 183 | :param str url: The URL to set | 183 | :param QtCore.QUrl | str url: The URL to set |
94 | 184 | """ | 184 | """ |
95 | 185 | if not isinstance(url, QtCore.QUrl): | 185 | if not isinstance(url, QtCore.QUrl): |
96 | 186 | url = QtCore.QUrl(url) | 186 | url = QtCore.QUrl(url) |
97 | 187 | 187 | ||
98 | === modified file 'openlp/core/lib/mediamanageritem.py' | |||
99 | --- openlp/core/lib/mediamanageritem.py 2019-04-28 19:21:23 +0000 | |||
100 | +++ openlp/core/lib/mediamanageritem.py 2019-05-04 18:26:49 +0000 | |||
101 | @@ -29,7 +29,6 @@ | |||
102 | 29 | 29 | ||
103 | 30 | from openlp.core.common.i18n import UiStrings, translate | 30 | from openlp.core.common.i18n import UiStrings, translate |
104 | 31 | from openlp.core.common.mixins import RegistryProperties | 31 | from openlp.core.common.mixins import RegistryProperties |
105 | 32 | from openlp.core.common.path import path_to_str, str_to_path | ||
106 | 33 | from openlp.core.common.registry import Registry | 32 | from openlp.core.common.registry import Registry |
107 | 34 | from openlp.core.common.settings import Settings | 33 | from openlp.core.common.settings import Settings |
108 | 35 | from openlp.core.lib import ServiceItemContext | 34 | from openlp.core.lib import ServiceItemContext |
109 | @@ -333,7 +332,7 @@ | |||
110 | 333 | self.validate_and_load(file_paths) | 332 | self.validate_and_load(file_paths) |
111 | 334 | self.application.set_normal_cursor() | 333 | self.application.set_normal_cursor() |
112 | 335 | 334 | ||
114 | 336 | def load_file(self, data): | 335 | def handle_mime_data(self, data): |
115 | 337 | """ | 336 | """ |
116 | 338 | Turn file from Drag and Drop into an array so the Validate code can run it. | 337 | Turn file from Drag and Drop into an array so the Validate code can run it. |
117 | 339 | 338 | ||
118 | @@ -379,11 +378,11 @@ | |||
119 | 379 | duplicates_found = False | 378 | duplicates_found = False |
120 | 380 | files_added = False | 379 | files_added = False |
121 | 381 | for file_path in file_paths: | 380 | for file_path in file_paths: |
123 | 382 | if path_to_str(file_path) in full_list: | 381 | if file_path in full_list: |
124 | 383 | duplicates_found = True | 382 | duplicates_found = True |
125 | 384 | else: | 383 | else: |
126 | 385 | files_added = True | 384 | files_added = True |
128 | 386 | full_list.append(path_to_str(file_path)) | 385 | full_list.append(file_path) |
129 | 387 | if full_list and files_added: | 386 | if full_list and files_added: |
130 | 388 | if target_group is None: | 387 | if target_group is None: |
131 | 389 | self.list_view.clear() | 388 | self.list_view.clear() |
132 | @@ -416,8 +415,8 @@ | |||
133 | 416 | file_paths = [] | 415 | file_paths = [] |
134 | 417 | for index in range(self.list_view.count()): | 416 | for index in range(self.list_view.count()): |
135 | 418 | list_item = self.list_view.item(index) | 417 | list_item = self.list_view.item(index) |
138 | 419 | filename = list_item.data(QtCore.Qt.UserRole) | 418 | file_path = list_item.data(QtCore.Qt.UserRole) |
139 | 420 | file_paths.append(str_to_path(filename)) | 419 | file_paths.append(file_path) |
140 | 421 | return file_paths | 420 | return file_paths |
141 | 422 | 421 | ||
142 | 423 | def load_list(self, load_list, target_group): | 422 | def load_list(self, load_list, target_group): |
143 | 424 | 423 | ||
144 | === modified file 'openlp/core/lib/theme.py' | |||
145 | --- openlp/core/lib/theme.py 2019-04-13 13:00:22 +0000 | |||
146 | +++ openlp/core/lib/theme.py 2019-05-04 18:26:49 +0000 | |||
147 | @@ -333,7 +333,7 @@ | |||
148 | 333 | else: | 333 | else: |
149 | 334 | # make string value unicode | 334 | # make string value unicode |
150 | 335 | if not isinstance(value, str): | 335 | if not isinstance(value, str): |
152 | 336 | value = str(str(value), 'utf-8') | 336 | value = str(value, 'utf-8') |
153 | 337 | # None means an empty string so lets have one. | 337 | # None means an empty string so lets have one. |
154 | 338 | if value == 'None': | 338 | if value == 'None': |
155 | 339 | value = '' | 339 | value = '' |
156 | 340 | 340 | ||
157 | === modified file 'openlp/core/server.py' | |||
158 | --- openlp/core/server.py 2019-04-13 13:00:22 +0000 | |||
159 | +++ openlp/core/server.py 2019-05-04 18:26:49 +0000 | |||
160 | @@ -22,6 +22,7 @@ | |||
161 | 22 | from PyQt5 import QtCore, QtNetwork | 22 | from PyQt5 import QtCore, QtNetwork |
162 | 23 | 23 | ||
163 | 24 | from openlp.core.common.mixins import LogMixin | 24 | from openlp.core.common.mixins import LogMixin |
164 | 25 | from openlp.core.common.path import Path | ||
165 | 25 | from openlp.core.common.registry import Registry | 26 | from openlp.core.common.registry import Registry |
166 | 26 | 27 | ||
167 | 27 | 28 | ||
168 | @@ -97,7 +98,7 @@ | |||
169 | 97 | msg = self.in_stream.readLine() | 98 | msg = self.in_stream.readLine() |
170 | 98 | if msg: | 99 | if msg: |
171 | 99 | self.log_debug("socket msg = " + msg) | 100 | self.log_debug("socket msg = " + msg) |
173 | 100 | Registry().get('service_manager').on_load_service_clicked(msg) | 101 | Registry().get('service_manager').load_service(Path(msg)) |
174 | 101 | 102 | ||
175 | 102 | def close_server(self): | 103 | def close_server(self): |
176 | 103 | """ | 104 | """ |
177 | 104 | 105 | ||
178 | === modified file 'openlp/core/ui/firsttimewizard.py' | |||
179 | --- openlp/core/ui/firsttimewizard.py 2019-04-13 13:00:22 +0000 | |||
180 | +++ openlp/core/ui/firsttimewizard.py 2019-05-04 18:26:49 +0000 | |||
181 | @@ -78,7 +78,7 @@ | |||
182 | 78 | """ | 78 | """ |
183 | 79 | nominal_width = 141 # Icon width of 133 + 4 each side | 79 | nominal_width = 141 # Icon width of 133 + 4 each side |
184 | 80 | max_items_per_row = self.viewport().width() // nominal_width or 1 # or 1 to avoid divide by 0 errors | 80 | max_items_per_row = self.viewport().width() // nominal_width or 1 # or 1 to avoid divide by 0 errors |
186 | 81 | col_size = (self.viewport().width() - 1) / max_items_per_row | 81 | col_size = (self.viewport().width() - 1) // max_items_per_row |
187 | 82 | self.setGridSize(QtCore.QSize(col_size, 140)) | 82 | self.setGridSize(QtCore.QSize(col_size, 140)) |
188 | 83 | 83 | ||
189 | 84 | 84 | ||
190 | 85 | 85 | ||
191 | === modified file 'openlp/core/ui/mainwindow.py' | |||
192 | --- openlp/core/ui/mainwindow.py 2019-04-13 13:00:22 +0000 | |||
193 | +++ openlp/core/ui/mainwindow.py 2019-05-04 18:26:49 +0000 | |||
194 | @@ -22,7 +22,7 @@ | |||
195 | 22 | """ | 22 | """ |
196 | 23 | This is the main window, where all the action happens. | 23 | This is the main window, where all the action happens. |
197 | 24 | """ | 24 | """ |
199 | 25 | import sys | 25 | import os |
200 | 26 | from datetime import datetime | 26 | from datetime import datetime |
201 | 27 | from distutils import dir_util | 27 | from distutils import dir_util |
202 | 28 | from distutils.errors import DistutilsFileError | 28 | from distutils.errors import DistutilsFileError |
203 | @@ -475,7 +475,6 @@ | |||
204 | 475 | super(MainWindow, self).__init__() | 475 | super(MainWindow, self).__init__() |
205 | 476 | Registry().register('main_window', self) | 476 | Registry().register('main_window', self) |
206 | 477 | self.clipboard = self.application.clipboard() | 477 | self.clipboard = self.application.clipboard() |
207 | 478 | self.arguments = ''.join(self.application.args) | ||
208 | 479 | # Set up settings sections for the main application (not for use by plugins). | 478 | # Set up settings sections for the main application (not for use by plugins). |
209 | 480 | self.ui_settings_section = 'user interface' | 479 | self.ui_settings_section = 'user interface' |
210 | 481 | self.general_settings_section = 'core' | 480 | self.general_settings_section = 'core' |
211 | @@ -632,8 +631,8 @@ | |||
212 | 632 | # if self.live_controller.display.isVisible(): | 631 | # if self.live_controller.display.isVisible(): |
213 | 633 | # self.live_controller.display.setFocus() | 632 | # self.live_controller.display.setFocus() |
214 | 634 | self.activateWindow() | 633 | self.activateWindow() |
217 | 635 | if self.arguments: | 634 | if self.application.args: |
218 | 636 | self.open_cmd_line_files(self.arguments) | 635 | self.open_cmd_line_files(self.application.args) |
219 | 637 | elif Settings().value(self.general_settings_section + '/auto open'): | 636 | elif Settings().value(self.general_settings_section + '/auto open'): |
220 | 638 | self.service_manager_contents.load_last_file() | 637 | self.service_manager_contents.load_last_file() |
221 | 639 | # This will store currently used layout preset so it remains enabled on next startup. | 638 | # This will store currently used layout preset so it remains enabled on next startup. |
222 | @@ -1339,7 +1338,7 @@ | |||
223 | 1339 | self.application.set_normal_cursor() | 1338 | self.application.set_normal_cursor() |
224 | 1340 | self.log_exception('Data copy failed {err}'.format(err=str(why))) | 1339 | self.log_exception('Data copy failed {err}'.format(err=str(why))) |
225 | 1341 | err_text = translate('OpenLP.MainWindow', | 1340 | err_text = translate('OpenLP.MainWindow', |
227 | 1342 | 'OpenLP Data directory copy failed\n\n{err}').format(err=str(why)), | 1341 | 'OpenLP Data directory copy failed\n\n{err}').format(err=str(why)) |
228 | 1343 | QtWidgets.QMessageBox.critical(self, translate('OpenLP.MainWindow', 'New Data Directory Error'), | 1342 | QtWidgets.QMessageBox.critical(self, translate('OpenLP.MainWindow', 'New Data Directory Error'), |
229 | 1344 | err_text, | 1343 | err_text, |
230 | 1345 | QtWidgets.QMessageBox.StandardButtons(QtWidgets.QMessageBox.Ok)) | 1344 | QtWidgets.QMessageBox.StandardButtons(QtWidgets.QMessageBox.Ok)) |
231 | @@ -1354,11 +1353,13 @@ | |||
232 | 1354 | settings.remove('advanced/data path') | 1353 | settings.remove('advanced/data path') |
233 | 1355 | self.application.set_normal_cursor() | 1354 | self.application.set_normal_cursor() |
234 | 1356 | 1355 | ||
236 | 1357 | def open_cmd_line_files(self, filename): | 1356 | def open_cmd_line_files(self, args): |
237 | 1358 | """ | 1357 | """ |
238 | 1359 | Open files passed in through command line arguments | 1358 | Open files passed in through command line arguments |
239 | 1359 | |||
240 | 1360 | :param list[str] args: List of remaining positionall arguments | ||
241 | 1360 | """ | 1361 | """ |
246 | 1361 | if not isinstance(filename, str): | 1362 | for arg in args: |
247 | 1362 | filename = str(filename, sys.getfilesystemencoding()) | 1363 | file_name = os.path.expanduser(arg) |
248 | 1363 | if filename.endswith(('.osz', '.oszl')): | 1364 | if os.path.isfile(file_name): |
249 | 1364 | self.service_manager_contents.load_file(Path(filename)) | 1365 | self.service_manager_contents.load_file(Path(file_name)) |
250 | 1365 | 1366 | ||
251 | === modified file 'openlp/core/ui/servicemanager.py' | |||
252 | --- openlp/core/ui/servicemanager.py 2019-04-13 13:00:22 +0000 | |||
253 | +++ openlp/core/ui/servicemanager.py 2019-05-04 18:26:49 +0000 | |||
254 | @@ -38,7 +38,7 @@ | |||
255 | 38 | from openlp.core.common.i18n import UiStrings, format_time, translate | 38 | from openlp.core.common.i18n import UiStrings, format_time, translate |
256 | 39 | from openlp.core.common.json import OpenLPJsonDecoder, OpenLPJsonEncoder | 39 | from openlp.core.common.json import OpenLPJsonDecoder, OpenLPJsonEncoder |
257 | 40 | from openlp.core.common.mixins import LogMixin, RegistryProperties | 40 | from openlp.core.common.mixins import LogMixin, RegistryProperties |
259 | 41 | from openlp.core.common.path import Path, str_to_path | 41 | from openlp.core.common.path import Path |
260 | 42 | from openlp.core.common.registry import Registry, RegistryBase | 42 | from openlp.core.common.registry import Registry, RegistryBase |
261 | 43 | from openlp.core.common.settings import Settings | 43 | from openlp.core.common.settings import Settings |
262 | 44 | from openlp.core.lib import build_icon | 44 | from openlp.core.lib import build_icon |
263 | @@ -430,11 +430,20 @@ | |||
264 | 430 | return False | 430 | return False |
265 | 431 | self.new_file() | 431 | self.new_file() |
266 | 432 | 432 | ||
268 | 433 | def on_load_service_clicked(self, load_file=None): | 433 | def on_load_service_clicked(self, checked): |
269 | 434 | """ | ||
270 | 435 | Handle the `fileOpenItem` action | ||
271 | 436 | |||
272 | 437 | :param bool checked: Not used. | ||
273 | 438 | :rtype: None | ||
274 | 439 | """ | ||
275 | 440 | self.load_service() | ||
276 | 441 | |||
277 | 442 | def load_service(self, file_path=None): | ||
278 | 434 | """ | 443 | """ |
279 | 435 | Loads the service file and saves the existing one it there is one unchanged. | 444 | Loads the service file and saves the existing one it there is one unchanged. |
280 | 436 | 445 | ||
282 | 437 | :param load_file: The service file to the loaded. Will be None is from menu so selection will be required. | 446 | :param openlp.core.common.path.Path | None file_path: The service file to the loaded. |
283 | 438 | """ | 447 | """ |
284 | 439 | if self.is_modified(): | 448 | if self.is_modified(): |
285 | 440 | result = self.save_modified_service() | 449 | result = self.save_modified_service() |
286 | @@ -442,7 +451,7 @@ | |||
287 | 442 | return False | 451 | return False |
288 | 443 | elif result == QtWidgets.QMessageBox.Save: | 452 | elif result == QtWidgets.QMessageBox.Save: |
289 | 444 | self.decide_save_method() | 453 | self.decide_save_method() |
291 | 445 | if not load_file: | 454 | if not file_path: |
292 | 446 | file_path, filter_used = FileDialog.getOpenFileName( | 455 | file_path, filter_used = FileDialog.getOpenFileName( |
293 | 447 | self.main_window, | 456 | self.main_window, |
294 | 448 | translate('OpenLP.ServiceManager', 'Open File'), | 457 | translate('OpenLP.ServiceManager', 'Open File'), |
295 | @@ -450,8 +459,6 @@ | |||
296 | 450 | translate('OpenLP.ServiceManager', 'OpenLP Service Files (*.osz *.oszl)')) | 459 | translate('OpenLP.ServiceManager', 'OpenLP Service Files (*.osz *.oszl)')) |
297 | 451 | if not file_path: | 460 | if not file_path: |
298 | 452 | return False | 461 | return False |
299 | 453 | else: | ||
300 | 454 | file_path = str_to_path(load_file) | ||
301 | 455 | Settings().setValue(self.main_window.service_manager_settings_section + '/last directory', file_path.parent) | 462 | Settings().setValue(self.main_window.service_manager_settings_section + '/last directory', file_path.parent) |
302 | 456 | self.load_file(file_path) | 463 | self.load_file(file_path) |
303 | 457 | 464 | ||
304 | @@ -670,8 +677,9 @@ | |||
305 | 670 | 677 | ||
306 | 671 | def load_file(self, file_path): | 678 | def load_file(self, file_path): |
307 | 672 | """ | 679 | """ |
310 | 673 | Load an existing service file | 680 | Load an existing service file. |
311 | 674 | :param file_path: | 681 | |
312 | 682 | :param openlp.core.common.path.Path file_path: The service file to load. | ||
313 | 675 | """ | 683 | """ |
314 | 676 | if not file_path.exists(): | 684 | if not file_path.exists(): |
315 | 677 | return False | 685 | return False |
316 | @@ -1520,12 +1528,12 @@ | |||
317 | 1520 | event.setDropAction(QtCore.Qt.CopyAction) | 1528 | event.setDropAction(QtCore.Qt.CopyAction) |
318 | 1521 | event.accept() | 1529 | event.accept() |
319 | 1522 | for url in link.urls(): | 1530 | for url in link.urls(): |
324 | 1523 | file_name = url.toLocalFile() | 1531 | file_path = Path(url.toLocalFile()) |
325 | 1524 | if file_name.endswith('.osz'): | 1532 | if file_path.suffix == '.osz': |
326 | 1525 | self.on_load_service_clicked(file_name) | 1533 | self.load_service(file_path) |
327 | 1526 | elif file_name.endswith('.oszl'): | 1534 | elif file_path.suffix == '.oszl': |
328 | 1527 | # todo correct | 1535 | # todo correct |
330 | 1528 | self.on_load_service_clicked(file_name) | 1536 | self.load_service(file_path) |
331 | 1529 | elif link.hasText(): | 1537 | elif link.hasText(): |
332 | 1530 | plugin = link.text() | 1538 | plugin = link.text() |
333 | 1531 | item = self.service_manager_list.itemAt(event.pos()) | 1539 | item = self.service_manager_list.itemAt(event.pos()) |
334 | 1532 | 1540 | ||
335 | === modified file 'openlp/core/ui/slidecontroller.py' | |||
336 | --- openlp/core/ui/slidecontroller.py 2019-04-13 13:00:22 +0000 | |||
337 | +++ openlp/core/ui/slidecontroller.py 2019-05-04 18:26:49 +0000 | |||
338 | @@ -112,7 +112,7 @@ | |||
339 | 112 | 112 | ||
340 | 113 | class InfoLabel(QtWidgets.QLabel): | 113 | class InfoLabel(QtWidgets.QLabel): |
341 | 114 | """ | 114 | """ |
343 | 115 | InfoLabel is a subclassed QLabel. Created to provide the ablilty to add a ellipsis if the text is cut off. Original | 115 | InfoLabel is a subclassed QLabel. Created to provide the ability to add a ellipsis if the text is cut off. Original |
344 | 116 | source: https://stackoverflow.com/questions/11446478/pyside-pyqt-truncate-text-in-qlabel-based-on-minimumsize | 116 | source: https://stackoverflow.com/questions/11446478/pyside-pyqt-truncate-text-in-qlabel-based-on-minimumsize |
345 | 117 | """ | 117 | """ |
346 | 118 | 118 | ||
347 | 119 | 119 | ||
348 | === modified file 'openlp/core/widgets/dialogs.py' | |||
349 | --- openlp/core/widgets/dialogs.py 2019-04-13 13:00:22 +0000 | |||
350 | +++ openlp/core/widgets/dialogs.py 2019-05-04 18:26:49 +0000 | |||
351 | @@ -35,7 +35,7 @@ | |||
352 | 35 | :type caption: str | 35 | :type caption: str |
353 | 36 | :type directory: openlp.core.common.path.Path | 36 | :type directory: openlp.core.common.path.Path |
354 | 37 | :type options: QtWidgets.QFileDialog.Options | 37 | :type options: QtWidgets.QFileDialog.Options |
356 | 38 | :rtype: tuple[openlp.core.common.path.Path, str] | 38 | :rtype: openlp.core.common.path.Path |
357 | 39 | """ | 39 | """ |
358 | 40 | args, kwargs = replace_params(args, kwargs, ((2, 'directory', path_to_str),)) | 40 | args, kwargs = replace_params(args, kwargs, ((2, 'directory', path_to_str),)) |
359 | 41 | 41 | ||
360 | 42 | 42 | ||
361 | === modified file 'openlp/core/widgets/layouts.py' | |||
362 | --- openlp/core/widgets/layouts.py 2019-04-13 13:00:22 +0000 | |||
363 | +++ openlp/core/widgets/layouts.py 2019-05-04 18:26:49 +0000 | |||
364 | @@ -37,7 +37,7 @@ | |||
365 | 37 | """ | 37 | """ |
366 | 38 | Create a layout. | 38 | Create a layout. |
367 | 39 | 39 | ||
369 | 40 | :param PyQt5.QtWidgets.QWidget parent: The parent widget, can be None. | 40 | :param QtWidgets.QWidget | None parent: The parent widget |
370 | 41 | :param float aspect_ratio: The aspect ratio as a float (e.g. 16.0/9.0) | 41 | :param float aspect_ratio: The aspect ratio as a float (e.g. 16.0/9.0) |
371 | 42 | """ | 42 | """ |
372 | 43 | super().__init__(parent) | 43 | super().__init__(parent) |
373 | 44 | 44 | ||
374 | === modified file 'openlp/core/widgets/views.py' | |||
375 | --- openlp/core/widgets/views.py 2019-04-13 13:00:22 +0000 | |||
376 | +++ openlp/core/widgets/views.py 2019-05-04 18:26:49 +0000 | |||
377 | @@ -39,7 +39,7 @@ | |||
378 | 39 | """ | 39 | """ |
379 | 40 | Process the data from a drag and drop operation. | 40 | Process the data from a drag and drop operation. |
380 | 41 | 41 | ||
382 | 42 | :param PyQt5.QtCore.QMimeData mime_data: The mime data from the drag and drop opperation. | 42 | :param QtCore.QMimeData mime_data: The mime data from the drag and drop opperation. |
383 | 43 | :return: A list of file paths that were dropped | 43 | :return: A list of file paths that were dropped |
384 | 44 | :rtype: list[openlp.core.common.path.Path] | 44 | :rtype: list[openlp.core.common.path.Path] |
385 | 45 | """ | 45 | """ |
386 | @@ -297,7 +297,7 @@ | |||
387 | 297 | """ | 297 | """ |
388 | 298 | self.setAcceptDrops(True) | 298 | self.setAcceptDrops(True) |
389 | 299 | self.setDragDropMode(QtWidgets.QAbstractItemView.DragDrop) | 299 | self.setDragDropMode(QtWidgets.QAbstractItemView.DragDrop) |
391 | 300 | Registry().register_function(('%s_dnd' % self.mime_data_text), self.parent().load_file) | 300 | Registry().register_function(('%s_dnd' % self.mime_data_text), self.parent().handle_mime_data) |
392 | 301 | 301 | ||
393 | 302 | def clear(self, search_while_typing=False): | 302 | def clear(self, search_while_typing=False): |
394 | 303 | """ | 303 | """ |
395 | @@ -412,7 +412,7 @@ | |||
396 | 412 | """ | 412 | """ |
397 | 413 | self.setAcceptDrops(True) | 413 | self.setAcceptDrops(True) |
398 | 414 | self.setDragDropMode(QtWidgets.QAbstractItemView.DragDrop) | 414 | self.setDragDropMode(QtWidgets.QAbstractItemView.DragDrop) |
400 | 415 | Registry().register_function(('%s_dnd' % self.mime_data_text), self.parent().load_file) | 415 | Registry().register_function(('%s_dnd' % self.mime_data_text), self.parent().handle_mime_data) |
401 | 416 | Registry().register_function(('%s_dnd_internal' % self.mime_data_text), self.parent().dnd_move_internal) | 416 | Registry().register_function(('%s_dnd_internal' % self.mime_data_text), self.parent().dnd_move_internal) |
402 | 417 | 417 | ||
403 | 418 | def mouseMoveEvent(self, event): | 418 | def mouseMoveEvent(self, event): |
404 | 419 | 419 | ||
405 | === modified file 'openlp/plugins/bibles/lib/importers/csvbible.py' | |||
406 | --- openlp/plugins/bibles/lib/importers/csvbible.py 2019-04-13 13:00:22 +0000 | |||
407 | +++ openlp/plugins/bibles/lib/importers/csvbible.py 2019-05-04 18:26:49 +0000 | |||
408 | @@ -102,7 +102,7 @@ | |||
409 | 102 | :rtype: list[namedtuple] | 102 | :rtype: list[namedtuple] |
410 | 103 | """ | 103 | """ |
411 | 104 | try: | 104 | try: |
413 | 105 | encoding = get_file_encoding(file_path)['encoding'] | 105 | encoding = get_file_encoding(file_path) |
414 | 106 | with file_path.open('r', encoding=encoding, newline='') as csv_file: | 106 | with file_path.open('r', encoding=encoding, newline='') as csv_file: |
415 | 107 | csv_reader = csv.reader(csv_file, delimiter=',', quotechar='"') | 107 | csv_reader = csv.reader(csv_file, delimiter=',', quotechar='"') |
416 | 108 | return [results_tuple(*line) for line in csv_reader] | 108 | return [results_tuple(*line) for line in csv_reader] |
417 | 109 | 109 | ||
418 | === modified file 'openlp/plugins/images/lib/mediaitem.py' | |||
419 | --- openlp/plugins/images/lib/mediaitem.py 2019-04-13 13:00:22 +0000 | |||
420 | +++ openlp/plugins/images/lib/mediaitem.py 2019-05-04 18:26:49 +0000 | |||
421 | @@ -401,10 +401,9 @@ | |||
422 | 401 | Process a list for files either from the File Dialog or from Drag and Drop. | 401 | Process a list for files either from the File Dialog or from Drag and Drop. |
423 | 402 | This method is overloaded from MediaManagerItem. | 402 | This method is overloaded from MediaManagerItem. |
424 | 403 | 403 | ||
426 | 404 | :param files: A List of strings containing the filenames of the files to be loaded | 404 | :param list[openlp.core.common.path.Path] file_paths: A List of paths to be loaded |
427 | 405 | :param target_group: The QTreeWidgetItem of the group that will be the parent of the added files | 405 | :param target_group: The QTreeWidgetItem of the group that will be the parent of the added files |
428 | 406 | """ | 406 | """ |
429 | 407 | file_paths = [Path(file) for file in file_paths] | ||
430 | 408 | self.application.set_normal_cursor() | 407 | self.application.set_normal_cursor() |
431 | 409 | self.load_list(file_paths, target_group) | 408 | self.load_list(file_paths, target_group) |
432 | 410 | last_dir = file_paths[0].parent | 409 | last_dir = file_paths[0].parent |
433 | 411 | 410 | ||
434 | === modified file 'openlp/plugins/presentations/lib/mediaitem.py' | |||
435 | --- openlp/plugins/presentations/lib/mediaitem.py 2019-04-13 13:00:22 +0000 | |||
436 | +++ openlp/plugins/presentations/lib/mediaitem.py 2019-05-04 18:26:49 +0000 | |||
437 | @@ -24,7 +24,7 @@ | |||
438 | 24 | from PyQt5 import QtCore, QtWidgets | 24 | from PyQt5 import QtCore, QtWidgets |
439 | 25 | 25 | ||
440 | 26 | from openlp.core.common.i18n import UiStrings, get_natural_key, translate | 26 | from openlp.core.common.i18n import UiStrings, get_natural_key, translate |
442 | 27 | from openlp.core.common.path import path_to_str, str_to_path | 27 | from openlp.core.common.path import path_to_str |
443 | 28 | from openlp.core.common.registry import Registry | 28 | from openlp.core.common.registry import Registry |
444 | 29 | from openlp.core.common.settings import Settings | 29 | from openlp.core.common.settings import Settings |
445 | 30 | from openlp.core.lib import ServiceItemContext, build_icon, check_item_selected, create_thumb, validate_thumb | 30 | from openlp.core.lib import ServiceItemContext, build_icon, check_item_selected, create_thumb, validate_thumb |
446 | @@ -127,7 +127,7 @@ | |||
447 | 127 | """ | 127 | """ |
448 | 128 | self.list_view.setIconSize(QtCore.QSize(88, 50)) | 128 | self.list_view.setIconSize(QtCore.QSize(88, 50)) |
449 | 129 | file_paths = Settings().value(self.settings_section + '/presentations files') | 129 | file_paths = Settings().value(self.settings_section + '/presentations files') |
451 | 130 | self.load_list([path_to_str(path) for path in file_paths], initial_load=True) | 130 | self.load_list(file_paths, initial_load=True) |
452 | 131 | self.populate_display_types() | 131 | self.populate_display_types() |
453 | 132 | 132 | ||
454 | 133 | def populate_display_types(self): | 133 | def populate_display_types(self): |
455 | @@ -158,7 +158,6 @@ | |||
456 | 158 | 158 | ||
457 | 159 | :param list[openlp.core.common.path.Path] file_paths: List of file paths to add to the media manager. | 159 | :param list[openlp.core.common.path.Path] file_paths: List of file paths to add to the media manager. |
458 | 160 | """ | 160 | """ |
459 | 161 | file_paths = [str_to_path(filename) for filename in file_paths] | ||
460 | 162 | current_paths = self.get_file_list() | 161 | current_paths = self.get_file_list() |
461 | 163 | titles = [file_path.name for file_path in current_paths] | 162 | titles = [file_path.name for file_path in current_paths] |
462 | 164 | self.application.set_busy_cursor() | 163 | self.application.set_busy_cursor() |
463 | @@ -175,7 +174,7 @@ | |||
464 | 175 | if not file_path.exists(): | 174 | if not file_path.exists(): |
465 | 176 | item_name = QtWidgets.QListWidgetItem(file_name) | 175 | item_name = QtWidgets.QListWidgetItem(file_name) |
466 | 177 | item_name.setIcon(UiIcons().delete) | 176 | item_name.setIcon(UiIcons().delete) |
468 | 178 | item_name.setData(QtCore.Qt.UserRole, path_to_str(file_path)) | 177 | item_name.setData(QtCore.Qt.UserRole, file_path) |
469 | 179 | item_name.setToolTip(str(file_path)) | 178 | item_name.setToolTip(str(file_path)) |
470 | 180 | self.list_view.addItem(item_name) | 179 | self.list_view.addItem(item_name) |
471 | 181 | else: | 180 | else: |
472 | @@ -211,7 +210,7 @@ | |||
473 | 211 | 'This type of presentation is not supported.')) | 210 | 'This type of presentation is not supported.')) |
474 | 212 | continue | 211 | continue |
475 | 213 | item_name = QtWidgets.QListWidgetItem(file_name) | 212 | item_name = QtWidgets.QListWidgetItem(file_name) |
477 | 214 | item_name.setData(QtCore.Qt.UserRole, path_to_str(file_path)) | 213 | item_name.setData(QtCore.Qt.UserRole, file_path) |
478 | 215 | item_name.setIcon(icon) | 214 | item_name.setIcon(icon) |
479 | 216 | item_name.setToolTip(str(file_path)) | 215 | item_name.setToolTip(str(file_path)) |
480 | 217 | self.list_view.addItem(item_name) | 216 | self.list_view.addItem(item_name) |
481 | @@ -230,8 +229,7 @@ | |||
482 | 230 | self.application.set_busy_cursor() | 229 | self.application.set_busy_cursor() |
483 | 231 | self.main_window.display_progress_bar(len(row_list)) | 230 | self.main_window.display_progress_bar(len(row_list)) |
484 | 232 | for item in items: | 231 | for item in items: |
487 | 233 | file_path = str_to_path(item.data(QtCore.Qt.UserRole)) | 232 | self.clean_up_thumbnails(item.data(QtCore.Qt.UserRole)) |
486 | 234 | self.clean_up_thumbnails(file_path) | ||
488 | 235 | self.main_window.increment_progress_bar() | 233 | self.main_window.increment_progress_bar() |
489 | 236 | self.main_window.finished_progress_bar() | 234 | self.main_window.finished_progress_bar() |
490 | 237 | for row in row_list: | 235 | for row in row_list: |
491 | @@ -278,7 +276,7 @@ | |||
492 | 278 | if len(items) > 1: | 276 | if len(items) > 1: |
493 | 279 | return False | 277 | return False |
494 | 280 | if file_path is None: | 278 | if file_path is None: |
496 | 281 | file_path = str_to_path(items[0].data(QtCore.Qt.UserRole)) | 279 | file_path = items[0].data(QtCore.Qt.UserRole) |
497 | 282 | file_type = file_path.suffix.lower()[1:] | 280 | file_type = file_path.suffix.lower()[1:] |
498 | 283 | if not self.display_type_combo_box.currentText(): | 281 | if not self.display_type_combo_box.currentText(): |
499 | 284 | return False | 282 | return False |
500 | @@ -293,7 +291,7 @@ | |||
501 | 293 | service_item.theme = -1 | 291 | service_item.theme = -1 |
502 | 294 | for bitem in items: | 292 | for bitem in items: |
503 | 295 | if file_path is None: | 293 | if file_path is None: |
505 | 296 | file_path = str_to_path(bitem.data(QtCore.Qt.UserRole)) | 294 | file_path = bitem.data(QtCore.Qt.UserRole) |
506 | 297 | path, file_name = file_path.parent, file_path.name | 295 | path, file_name = file_path.parent, file_path.name |
507 | 298 | service_item.title = file_name | 296 | service_item.title = file_name |
508 | 299 | if file_path.exists(): | 297 | if file_path.exists(): |
509 | @@ -329,7 +327,7 @@ | |||
510 | 329 | service_item.processor = self.display_type_combo_box.currentText() | 327 | service_item.processor = self.display_type_combo_box.currentText() |
511 | 330 | service_item.add_capability(ItemCapabilities.ProvidesOwnDisplay) | 328 | service_item.add_capability(ItemCapabilities.ProvidesOwnDisplay) |
512 | 331 | for bitem in items: | 329 | for bitem in items: |
514 | 332 | file_path = str_to_path(bitem.data(QtCore.Qt.UserRole)) | 330 | file_path = bitem.data(QtCore.Qt.UserRole) |
515 | 333 | path, file_name = file_path.parent, file_path.name | 331 | path, file_name = file_path.parent, file_path.name |
516 | 334 | service_item.title = file_name | 332 | service_item.title = file_name |
517 | 335 | if file_path.exists(): | 333 | if file_path.exists(): |
518 | 336 | 334 | ||
519 | === modified file 'openlp/plugins/songs/lib/importers/presentationmanager.py' | |||
520 | --- openlp/plugins/songs/lib/importers/presentationmanager.py 2019-04-13 13:00:22 +0000 | |||
521 | +++ openlp/plugins/songs/lib/importers/presentationmanager.py 2019-05-04 18:26:49 +0000 | |||
522 | @@ -48,7 +48,7 @@ | |||
523 | 48 | tree = etree.parse(str(file_path), parser=etree.XMLParser(recover=True)) | 48 | tree = etree.parse(str(file_path), parser=etree.XMLParser(recover=True)) |
524 | 49 | except etree.XMLSyntaxError: | 49 | except etree.XMLSyntaxError: |
525 | 50 | # Try to detect encoding and use it | 50 | # Try to detect encoding and use it |
527 | 51 | encoding = get_file_encoding(file_path)['encoding'] | 51 | encoding = get_file_encoding(file_path) |
528 | 52 | # Open file with detected encoding and remove encoding declaration | 52 | # Open file with detected encoding and remove encoding declaration |
529 | 53 | text = file_path.read_text(encoding=encoding) | 53 | text = file_path.read_text(encoding=encoding) |
530 | 54 | text = re.sub(r'.+\?>\n', '', text) | 54 | text = re.sub(r'.+\?>\n', '', text) |
531 | 55 | 55 | ||
532 | === modified file 'openlp/plugins/songs/lib/importers/songbeamer.py' | |||
533 | --- openlp/plugins/songs/lib/importers/songbeamer.py 2019-04-13 13:00:22 +0000 | |||
534 | +++ openlp/plugins/songs/lib/importers/songbeamer.py 2019-05-04 18:26:49 +0000 | |||
535 | @@ -124,7 +124,7 @@ | |||
536 | 124 | self.chord_table = None | 124 | self.chord_table = None |
537 | 125 | if file_path.is_file(): | 125 | if file_path.is_file(): |
538 | 126 | # Detect the encoding | 126 | # Detect the encoding |
540 | 127 | self.input_file_encoding = get_file_encoding(file_path)['encoding'] | 127 | self.input_file_encoding = get_file_encoding(file_path) |
541 | 128 | # The encoding should only be ANSI (cp1252), UTF-8, Unicode, Big-Endian-Unicode. | 128 | # The encoding should only be ANSI (cp1252), UTF-8, Unicode, Big-Endian-Unicode. |
542 | 129 | # So if it doesn't start with 'u' we default to cp1252. See: | 129 | # So if it doesn't start with 'u' we default to cp1252. See: |
543 | 130 | # https://forum.songbeamer.com/viewtopic.php?p=419&sid=ca4814924e37c11e4438b7272a98b6f2 | 130 | # https://forum.songbeamer.com/viewtopic.php?p=419&sid=ca4814924e37c11e4438b7272a98b6f2 |
544 | 131 | 131 | ||
545 | === modified file 'openlp/plugins/songs/lib/importers/worshipassistant.py' | |||
546 | --- openlp/plugins/songs/lib/importers/worshipassistant.py 2019-04-13 13:00:22 +0000 | |||
547 | +++ openlp/plugins/songs/lib/importers/worshipassistant.py 2019-05-04 18:26:49 +0000 | |||
548 | @@ -82,7 +82,7 @@ | |||
549 | 82 | Receive a CSV file to import. | 82 | Receive a CSV file to import. |
550 | 83 | """ | 83 | """ |
551 | 84 | # Get encoding | 84 | # Get encoding |
553 | 85 | encoding = get_file_encoding(self.import_source)['encoding'] | 85 | encoding = get_file_encoding(self.import_source) |
554 | 86 | with self.import_source.open('r', encoding=encoding) as songs_file: | 86 | with self.import_source.open('r', encoding=encoding) as songs_file: |
555 | 87 | songs_reader = csv.DictReader(songs_file, escapechar='\\') | 87 | songs_reader = csv.DictReader(songs_file, escapechar='\\') |
556 | 88 | try: | 88 | try: |
557 | 89 | 89 | ||
558 | === modified file 'tests/functional/openlp_core/common/test_common.py' | |||
559 | --- tests/functional/openlp_core/common/test_common.py 2019-04-13 13:00:22 +0000 | |||
560 | +++ tests/functional/openlp_core/common/test_common.py 2019-05-04 18:26:49 +0000 | |||
561 | @@ -88,7 +88,7 @@ | |||
562 | 88 | extension_loader('glob') | 88 | extension_loader('glob') |
563 | 89 | 89 | ||
564 | 90 | # THEN: The `ImportError` should be caught and logged | 90 | # THEN: The `ImportError` should be caught and logged |
566 | 91 | assert mocked_logger.warning.called | 91 | assert mocked_logger.exception.called |
567 | 92 | 92 | ||
568 | 93 | def test_extension_loader_os_error(self): | 93 | def test_extension_loader_os_error(self): |
569 | 94 | """ | 94 | """ |
570 | @@ -106,7 +106,7 @@ | |||
571 | 106 | extension_loader('glob') | 106 | extension_loader('glob') |
572 | 107 | 107 | ||
573 | 108 | # THEN: The `OSError` should be caught and logged | 108 | # THEN: The `OSError` should be caught and logged |
575 | 109 | assert mocked_logger.warning.called | 109 | assert mocked_logger.exception.called |
576 | 110 | 110 | ||
577 | 111 | def test_de_hump_conversion(self): | 111 | def test_de_hump_conversion(self): |
578 | 112 | """ | 112 | """ |
579 | 113 | 113 | ||
580 | === modified file 'tests/functional/openlp_core/common/test_init.py' | |||
581 | --- tests/functional/openlp_core/common/test_init.py 2019-04-13 13:00:22 +0000 | |||
582 | +++ tests/functional/openlp_core/common/test_init.py 2019-05-04 18:26:49 +0000 | |||
583 | @@ -322,7 +322,7 @@ | |||
584 | 322 | mocked_open.assert_called_once_with('rb') | 322 | mocked_open.assert_called_once_with('rb') |
585 | 323 | assert mocked_universal_detector_inst.feed.mock_calls == [call(b'data' * 256)] | 323 | assert mocked_universal_detector_inst.feed.mock_calls == [call(b'data' * 256)] |
586 | 324 | mocked_universal_detector_inst.close.assert_called_once_with() | 324 | mocked_universal_detector_inst.close.assert_called_once_with() |
588 | 325 | assert result == encoding_result | 325 | assert result == 'UTF-8' |
589 | 326 | 326 | ||
590 | 327 | def test_get_file_encoding_eof(self): | 327 | def test_get_file_encoding_eof(self): |
591 | 328 | """ | 328 | """ |
592 | @@ -344,7 +344,7 @@ | |||
593 | 344 | mocked_open.assert_called_once_with('rb') | 344 | mocked_open.assert_called_once_with('rb') |
594 | 345 | assert mocked_universal_detector_inst.feed.mock_calls == [call(b'data' * 256), call(b'data' * 4)] | 345 | assert mocked_universal_detector_inst.feed.mock_calls == [call(b'data' * 256), call(b'data' * 4)] |
595 | 346 | mocked_universal_detector_inst.close.assert_called_once_with() | 346 | mocked_universal_detector_inst.close.assert_called_once_with() |
597 | 347 | assert result == encoding_result | 347 | assert result == 'UTF-8' |
598 | 348 | 348 | ||
599 | 349 | def test_get_file_encoding_oserror(self): | 349 | def test_get_file_encoding_oserror(self): |
600 | 350 | """ | 350 | """ |
601 | @@ -367,4 +367,4 @@ | |||
602 | 367 | mocked_log.exception.assert_called_once_with('Error detecting file encoding') | 367 | mocked_log.exception.assert_called_once_with('Error detecting file encoding') |
603 | 368 | mocked_universal_detector_inst.feed.assert_not_called() | 368 | mocked_universal_detector_inst.feed.assert_not_called() |
604 | 369 | mocked_universal_detector_inst.close.assert_called_once_with() | 369 | mocked_universal_detector_inst.close.assert_called_once_with() |
606 | 370 | assert result == encoding_result | 370 | assert result == 'UTF-8' |
607 | 371 | 371 | ||
608 | === modified file 'tests/functional/openlp_core/test_app.py' | |||
609 | --- tests/functional/openlp_core/test_app.py 2019-05-01 19:22:01 +0000 | |||
610 | +++ tests/functional/openlp_core/test_app.py 2019-05-04 18:26:49 +0000 | |||
611 | @@ -138,7 +138,7 @@ | |||
612 | 138 | assert args.loglevel == 'warning', 'The log level should be set to warning' | 138 | assert args.loglevel == 'warning', 'The log level should be set to warning' |
613 | 139 | assert args.no_error_form is False, 'The no_error_form should be set to False' | 139 | assert args.no_error_form is False, 'The no_error_form should be set to False' |
614 | 140 | assert args.portable is False, 'The portable flag should be set to false' | 140 | assert args.portable is False, 'The portable flag should be set to false' |
616 | 141 | assert args.rargs == 'dummy_temp', 'The service file should not be blank' | 141 | assert args.rargs == ['dummy_temp'], 'The service file should not be blank' |
617 | 142 | 142 | ||
618 | 143 | 143 | ||
619 | 144 | def test_parse_options_file_and_debug(): | 144 | def test_parse_options_file_and_debug(): |
620 | @@ -155,7 +155,7 @@ | |||
621 | 155 | assert args.loglevel == ' debug', 'The log level should be set to debug' | 155 | assert args.loglevel == ' debug', 'The log level should be set to debug' |
622 | 156 | assert args.no_error_form is False, 'The no_error_form should be set to False' | 156 | assert args.no_error_form is False, 'The no_error_form should be set to False' |
623 | 157 | assert args.portable is False, 'The portable flag should be set to false' | 157 | assert args.portable is False, 'The portable flag should be set to false' |
625 | 158 | assert args.rargs == 'dummy_temp', 'The service file should not be blank' | 158 | assert args.rargs == ['dummy_temp'], 'The service file should not be blank' |
626 | 159 | 159 | ||
627 | 160 | 160 | ||
628 | 161 | @skip('Figure out why this is causing a segfault') | 161 | @skip('Figure out why this is causing a segfault') |
629 | 162 | 162 | ||
630 | === modified file 'tests/functional/openlp_core/test_server.py' | |||
631 | --- tests/functional/openlp_core/test_server.py 2019-04-13 13:00:22 +0000 | |||
632 | +++ tests/functional/openlp_core/test_server.py 2019-05-04 18:26:49 +0000 | |||
633 | @@ -22,6 +22,7 @@ | |||
634 | 22 | from unittest import TestCase | 22 | from unittest import TestCase |
635 | 23 | from unittest.mock import MagicMock, patch | 23 | from unittest.mock import MagicMock, patch |
636 | 24 | 24 | ||
637 | 25 | from openlp.core.common.path import Path | ||
638 | 25 | from openlp.core.common.registry import Registry | 26 | from openlp.core.common.registry import Registry |
639 | 26 | from openlp.core.server import Server | 27 | from openlp.core.server import Server |
640 | 27 | from tests.helpers.testmixin import TestMixin | 28 | from tests.helpers.testmixin import TestMixin |
641 | @@ -83,8 +84,8 @@ | |||
642 | 83 | self.server._on_ready_read() | 84 | self.server._on_ready_read() |
643 | 84 | 85 | ||
644 | 85 | # THEN: the service will be loaded | 86 | # THEN: the service will be loaded |
647 | 86 | assert service_manager.on_load_service_clicked.call_count == 1 | 87 | assert service_manager.load_service.call_count == 1 |
648 | 87 | service_manager.on_load_service_clicked.assert_called_once_with(file_name) | 88 | service_manager.load_service.assert_called_once_with(Path(file_name)) |
649 | 88 | 89 | ||
650 | 89 | @patch("PyQt5.QtCore.QTextStream") | 90 | @patch("PyQt5.QtCore.QTextStream") |
651 | 90 | def test_post_to_server(self, mocked_stream): | 91 | def test_post_to_server(self, mocked_stream): |
652 | 91 | 92 | ||
653 | === modified file 'tests/functional/openlp_core/ui/test_mainwindow.py' | |||
654 | --- tests/functional/openlp_core/ui/test_mainwindow.py 2019-04-13 13:00:22 +0000 | |||
655 | +++ tests/functional/openlp_core/ui/test_mainwindow.py 2019-05-04 18:26:49 +0000 | |||
656 | @@ -96,7 +96,7 @@ | |||
657 | 96 | 96 | ||
658 | 97 | # WHEN the argument is processed | 97 | # WHEN the argument is processed |
659 | 98 | with patch.object(self.main_window.service_manager, 'load_file') as mocked_load_file: | 98 | with patch.object(self.main_window.service_manager, 'load_file') as mocked_load_file: |
661 | 99 | self.main_window.open_cmd_line_files(service) | 99 | self.main_window.open_cmd_line_files([service]) |
662 | 100 | 100 | ||
663 | 101 | # THEN the service from the arguments is loaded | 101 | # THEN the service from the arguments is loaded |
664 | 102 | mocked_load_file.assert_called_with(Path(service)) | 102 | mocked_load_file.assert_called_with(Path(service)) |
665 | @@ -108,7 +108,6 @@ | |||
666 | 108 | """ | 108 | """ |
667 | 109 | # GIVEN a non service file as an argument to openlp | 109 | # GIVEN a non service file as an argument to openlp |
668 | 110 | service = 'run_openlp.py' | 110 | service = 'run_openlp.py' |
669 | 111 | self.main_window.arguments = service | ||
670 | 112 | 111 | ||
671 | 113 | # WHEN the argument is processed | 112 | # WHEN the argument is processed |
672 | 114 | self.main_window.open_cmd_line_files(service) | 113 | self.main_window.open_cmd_line_files(service) |
673 | 115 | 114 | ||
674 | === modified file 'tests/functional/openlp_core/ui/test_thememanager.py' | |||
675 | --- tests/functional/openlp_core/ui/test_thememanager.py 2019-04-13 13:00:22 +0000 | |||
676 | +++ tests/functional/openlp_core/ui/test_thememanager.py 2019-05-04 18:26:49 +0000 | |||
677 | @@ -143,7 +143,7 @@ | |||
678 | 143 | mocked_theme.export_theme.return_value = "{}" | 143 | mocked_theme.export_theme.return_value = "{}" |
679 | 144 | 144 | ||
680 | 145 | # WHEN: Calling _write_theme with a theme with a name with special characters in it | 145 | # WHEN: Calling _write_theme with a theme with a name with special characters in it |
682 | 146 | theme_manager._write_theme(mocked_theme, None, None) | 146 | theme_manager._write_theme(mocked_theme) |
683 | 147 | 147 | ||
684 | 148 | # THEN: It should have been created | 148 | # THEN: It should have been created |
685 | 149 | assert os.path.exists(os.path.join(self.temp_folder, 'theme 愛 name', 'theme 愛 name.json')) is True, \ | 149 | assert os.path.exists(os.path.join(self.temp_folder, 'theme 愛 name', 'theme 愛 name.json')) is True, \ |
686 | @@ -224,7 +224,7 @@ | |||
687 | 224 | theme_manager = ThemeManager(None) | 224 | theme_manager = ThemeManager(None) |
688 | 225 | 225 | ||
689 | 226 | # WHEN: unzip_theme is called | 226 | # WHEN: unzip_theme is called |
691 | 227 | theme_manager.unzip_theme('theme.file', 'folder') | 227 | theme_manager.unzip_theme(Path('theme.file'), Path('folder')) |
692 | 228 | 228 | ||
693 | 229 | # THEN: The critical_error_message_box should have been called | 229 | # THEN: The critical_error_message_box should have been called |
694 | 230 | assert mocked_critical_error_message_box.call_count == 1, 'Should have been called once' | 230 | assert mocked_critical_error_message_box.call_count == 1, 'Should have been called once' |
695 | 231 | 231 | ||
696 | === modified file 'tests/functional/openlp_plugins/bibles/test_csvimport.py' | |||
697 | --- tests/functional/openlp_plugins/bibles/test_csvimport.py 2019-04-13 13:00:22 +0000 | |||
698 | +++ tests/functional/openlp_plugins/bibles/test_csvimport.py 2019-05-04 18:26:49 +0000 | |||
699 | @@ -136,8 +136,7 @@ | |||
700 | 136 | mocked_enter_file = MagicMock() | 136 | mocked_enter_file = MagicMock() |
701 | 137 | mocked_csv_file.open.return_value.__enter__.return_value = mocked_enter_file | 137 | mocked_csv_file.open.return_value.__enter__.return_value = mocked_enter_file |
702 | 138 | 138 | ||
705 | 139 | with patch('openlp.plugins.bibles.lib.importers.csvbible.get_file_encoding', | 139 | with patch('openlp.plugins.bibles.lib.importers.csvbible.get_file_encoding', return_value='utf-8'), \ |
704 | 140 | return_value={'encoding': 'utf-8', 'confidence': 0.99}), \ | ||
706 | 141 | patch('openlp.plugins.bibles.lib.importers.csvbible.csv.reader', | 140 | patch('openlp.plugins.bibles.lib.importers.csvbible.csv.reader', |
707 | 142 | return_value=iter(test_data)) as mocked_reader: | 141 | return_value=iter(test_data)) as mocked_reader: |
708 | 143 | 142 |
Linux tests failed, please see https:/ /ci.openlp. io/job/ MP-02-Linux_ Tests/142/ for more details