[Openlp-core] macOS Test Results: Passed
macOS tests passed! -- https://code.launchpad.net/~phill-ridout/openlp/path_fixes/+merge/369195 Your team OpenLP Core is requested to review the proposed merge of lp:~phill-ridout/openlp/path_fixes into lp:openlp. ___ Mailing list: https://launchpad.net/~openlp-core Post to : openlp-core@lists.launchpad.net Unsubscribe : https://launchpad.net/~openlp-core More help : https://help.launchpad.net/ListHelp
[Openlp-core] Linting: Passed
Linting passed! -- https://code.launchpad.net/~phill-ridout/openlp/path_fixes/+merge/369195 Your team OpenLP Core is requested to review the proposed merge of lp:~phill-ridout/openlp/path_fixes into lp:openlp. ___ Mailing list: https://launchpad.net/~openlp-core Post to : openlp-core@lists.launchpad.net Unsubscribe : https://launchpad.net/~openlp-core More help : https://help.launchpad.net/ListHelp
[Openlp-core] Linux Test Results: Passed
Linux tests passed! -- https://code.launchpad.net/~phill-ridout/openlp/path_fixes/+merge/369195 Your team OpenLP Core is requested to review the proposed merge of lp:~phill-ridout/openlp/path_fixes into lp:openlp. ___ Mailing list: https://launchpad.net/~openlp-core Post to : openlp-core@lists.launchpad.net Unsubscribe : https://launchpad.net/~openlp-core More help : https://help.launchpad.net/ListHelp
[Openlp-core] [Merge] lp:~phill-ridout/openlp/path_fixes into lp:openlp
Phill has proposed merging lp:~phill-ridout/openlp/path_fixes into lp:openlp. Commit message: Path fix ups Requested reviews: OpenLP Core (openlp-core) For more details, see: https://code.launchpad.net/~phill-ridout/openlp/path_fixes/+merge/369195 -- Your team OpenLP Core is requested to review the proposed merge of lp:~phill-ridout/openlp/path_fixes into lp:openlp. === modified file 'openlp/core/common/json.py' --- openlp/core/common/json.py 2019-05-26 10:30:37 + +++ openlp/core/common/json.py 2019-06-21 22:10:16 + @@ -111,6 +111,8 @@ :param dict obj: A decoded JSON object :return: The custom object from the serialized data if the custom object is registered, else obj """ +if '__Path__' in obj: +return PathSerializer.encode_json(obj, **self.kwargs) try: key = obj['json_meta']['class'] except KeyError: @@ -150,8 +152,8 @@ if isinstance(obj, JSONMixin): return obj.json_object() elif obj.__class__.__name__ in _registered_classes: -return _registered_classes[obj.__class__.__name__].json_object(obj) -return super().default(obj) +return _registered_classes[obj.__class__.__name__].json_object(obj, **self.kwargs) +return super().default(obj, **self.kwargs) def is_serializable(obj): @@ -174,17 +176,22 @@ :param kwargs: Contains any extra parameters. Not used! :return Path: The deserialized Path object """ -path = Path(*obj['parts']) +if '__Path__' in obj: +parts = obj['__Path__'] +else: +parts = obj['parts'] +path = Path(*parts) if base_path and not path.is_absolute(): return base_path / path return path @classmethod -def json_object(cls, obj, base_path=None, **kwargs): +def json_object(cls, obj, base_path=None, is_js=False, **kwargs): """ Create a dictionary that can be JSON decoded. :param Path base_path: If specified, an absolute path to make a relative path from. +:param bool is_js: Encode the path as a uri. For example for use in the js rendering code. :param kwargs: Contains any extra parameters. Not used! :return: The dictionary representation of this Path object. :rtype: dict[tuple] @@ -193,6 +200,8 @@ if base_path: with suppress(ValueError): path = path.relative_to(base_path) +if is_js is True: +return path.as_uri() json_dict = {'parts': path.parts} cls.attach_meta(json_dict) return json_dict === modified file 'openlp/core/common/settings.py' --- openlp/core/common/settings.py 2019-06-14 17:54:04 + +++ openlp/core/common/settings.py 2019-06-21 22:10:16 + @@ -612,7 +612,7 @@ elif isinstance(default_value, dict): return {} elif isinstance(setting, str): -if 'json_meta' in setting or setting.startswith('{'): +if 'json_meta' in setting or '__Path__' in setting or setting.startswith('{'): return json.loads(setting, cls=OpenLPJSONDecoder) # Convert the setting to the correct type. if isinstance(default_value, bool): === modified file 'openlp/core/display/html/display.js' --- openlp/core/display/html/display.js 2019-03-16 10:26:05 + +++ openlp/core/display/html/display.js 2019-06-21 22:10:16 + @@ -118,20 +118,6 @@ } /** - * The paths we get are JSON versions of Python Path objects, so let's just fix that. - * @private - * @param {object} path - The Path object - * @returns {string} The actual file path - */ -function _pathToString(path) { -var filename = path.__Path__.join("/").replace("//", "/"); -if (!filename.startsWith("/")) { -filename = "/" + filename; -} -return filename; -} - -/** * An audio player with a play list */ var AudioPlayer = function (audioElement) { @@ -676,13 +662,13 @@ } break; case BackgroundType.Image: -background_filename = _pathToString(theme.background_filename); -backgroundStyle["background-image"] = "url('file://" + background_filename + "')"; +backgroundStyle["background-image"] = "url('" + theme.background_filename + "')"; +console.warn(backgroundStyle["background-image"]); break; case BackgroundType.Video: -background_filename = _pathToString(theme.background_filename); backgroundStyle["background-color"] = theme.background_border_color; -backgroundHtml = ""; +backgroundHtml = ""; +console.warn(backgroundHtml); break; default: backgroundStyle["background"] = "#000"; === modified file 'openlp/core/display/window.py' --- openlp/core/display/window.py 2019-05-23 19:33:46 + +++ openlp/core/display/window.py 2019-06-21 22:10:16 + @@ -332,9 +332,9 @@
[Openlp-core] [Merge] lp:~phill-ridout/openlp/path_fixes into lp:openlp
The proposal to merge lp:~phill-ridout/openlp/path_fixes into lp:openlp has been updated. Status: Needs review => Superseded For more details, see: https://code.launchpad.net/~phill-ridout/openlp/path_fixes/+merge/369192 -- Your team OpenLP Core is requested to review the proposed merge of lp:~phill-ridout/openlp/path_fixes into lp:openlp. ___ Mailing list: https://launchpad.net/~openlp-core Post to : openlp-core@lists.launchpad.net Unsubscribe : https://launchpad.net/~openlp-core More help : https://help.launchpad.net/ListHelp
[Openlp-core] macOS Test Results: Passed
macOS tests passed! -- https://code.launchpad.net/~phill-ridout/openlp/path_fixes/+merge/369192 Your team OpenLP Core is requested to review the proposed merge of lp:~phill-ridout/openlp/path_fixes into lp:openlp. ___ Mailing list: https://launchpad.net/~openlp-core Post to : openlp-core@lists.launchpad.net Unsubscribe : https://launchpad.net/~openlp-core More help : https://help.launchpad.net/ListHelp
[Openlp-core] Linting: Passed
Linting passed! -- https://code.launchpad.net/~phill-ridout/openlp/path_fixes/+merge/369192 Your team OpenLP Core is requested to review the proposed merge of lp:~phill-ridout/openlp/path_fixes into lp:openlp. ___ Mailing list: https://launchpad.net/~openlp-core Post to : openlp-core@lists.launchpad.net Unsubscribe : https://launchpad.net/~openlp-core More help : https://help.launchpad.net/ListHelp
[Openlp-core] Linux Test Results: Passed
Linux tests passed! -- https://code.launchpad.net/~phill-ridout/openlp/path_fixes/+merge/369192 Your team OpenLP Core is requested to review the proposed merge of lp:~phill-ridout/openlp/path_fixes into lp:openlp. ___ Mailing list: https://launchpad.net/~openlp-core Post to : openlp-core@lists.launchpad.net Unsubscribe : https://launchpad.net/~openlp-core More help : https://help.launchpad.net/ListHelp
[Openlp-core] [Merge] lp:~phill-ridout/openlp/path_fixes into lp:openlp
Phill has proposed merging lp:~phill-ridout/openlp/path_fixes into lp:openlp. Commit message: Path fix ups Requested reviews: OpenLP Core (openlp-core) For more details, see: https://code.launchpad.net/~phill-ridout/openlp/path_fixes/+merge/369192 -- Your team OpenLP Core is requested to review the proposed merge of lp:~phill-ridout/openlp/path_fixes into lp:openlp. === modified file 'openlp/core/common/json.py' --- openlp/core/common/json.py 2019-05-26 10:30:37 + +++ openlp/core/common/json.py 2019-06-21 21:10:01 + @@ -111,6 +111,8 @@ :param dict obj: A decoded JSON object :return: The custom object from the serialized data if the custom object is registered, else obj """ +if '__Path__' in obj: +return PathSerializer.encode_json(obj, **self.kwargs) try: key = obj['json_meta']['class'] except KeyError: @@ -150,8 +152,8 @@ if isinstance(obj, JSONMixin): return obj.json_object() elif obj.__class__.__name__ in _registered_classes: -return _registered_classes[obj.__class__.__name__].json_object(obj) -return super().default(obj) +return _registered_classes[obj.__class__.__name__].json_object(obj, **self.kwargs) +return super().default(obj, **self.kwargs) def is_serializable(obj): @@ -174,17 +176,22 @@ :param kwargs: Contains any extra parameters. Not used! :return Path: The deserialized Path object """ -path = Path(*obj['parts']) +if '__Path__' in obj: +parts = obj['__Path__'] +else: +parts = obj['parts'] +path = Path(*parts) if base_path and not path.is_absolute(): return base_path / path return path @classmethod -def json_object(cls, obj, base_path=None, **kwargs): +def json_object(cls, obj, base_path=None, js_use=False, **kwargs): """ Create a dictionary that can be JSON decoded. :param Path base_path: If specified, an absolute path to make a relative path from. +:param bool js_use: Encode the path as a uri. For example for use in the js rendering code. :param kwargs: Contains any extra parameters. Not used! :return: The dictionary representation of this Path object. :rtype: dict[tuple] @@ -193,6 +200,8 @@ if base_path: with suppress(ValueError): path = path.relative_to(base_path) +if js_use is True: +return path.as_uri() json_dict = {'parts': path.parts} cls.attach_meta(json_dict) return json_dict === modified file 'openlp/core/common/settings.py' --- openlp/core/common/settings.py 2019-06-14 17:54:04 + +++ openlp/core/common/settings.py 2019-06-21 21:10:01 + @@ -612,7 +612,7 @@ elif isinstance(default_value, dict): return {} elif isinstance(setting, str): -if 'json_meta' in setting or setting.startswith('{'): +if 'json_meta' in setting or '__Path__' in setting or setting.startswith('{'): return json.loads(setting, cls=OpenLPJSONDecoder) # Convert the setting to the correct type. if isinstance(default_value, bool): === modified file 'openlp/core/display/html/display.js' --- openlp/core/display/html/display.js 2019-03-16 10:26:05 + +++ openlp/core/display/html/display.js 2019-06-21 21:10:01 + @@ -118,20 +118,6 @@ } /** - * The paths we get are JSON versions of Python Path objects, so let's just fix that. - * @private - * @param {object} path - The Path object - * @returns {string} The actual file path - */ -function _pathToString(path) { -var filename = path.__Path__.join("/").replace("//", "/"); -if (!filename.startsWith("/")) { -filename = "/" + filename; -} -return filename; -} - -/** * An audio player with a play list */ var AudioPlayer = function (audioElement) { @@ -676,13 +662,13 @@ } break; case BackgroundType.Image: -background_filename = _pathToString(theme.background_filename); -backgroundStyle["background-image"] = "url('file://" + background_filename + "')"; +backgroundStyle["background-image"] = "url('" + theme.background_filename + "')"; +console.warn(backgroundStyle["background-image"]); break; case BackgroundType.Video: -background_filename = _pathToString(theme.background_filename); backgroundStyle["background-color"] = theme.background_border_color; -backgroundHtml = ""; +backgroundHtml = ""; +console.warn(backgroundHtml); break; default: backgroundStyle["background"] = "#000"; === modified file 'openlp/core/display/window.py' --- openlp/core/display/window.py 2019-05-23 19:33:46 + +++ openlp/core/display/window.py 2019-06-21 21:10:01 + @@ -332,9 +332,9 @@
[Openlp-core] [Merge] lp:~phill-ridout/openlp/path_fixes into lp:openlp
The proposal to merge lp:~phill-ridout/openlp/path_fixes into lp:openlp has been updated. Status: Needs review => Superseded For more details, see: https://code.launchpad.net/~phill-ridout/openlp/path_fixes/+merge/369191 -- Your team OpenLP Core is requested to review the proposed merge of lp:~phill-ridout/openlp/path_fixes into lp:openlp. ___ Mailing list: https://launchpad.net/~openlp-core Post to : openlp-core@lists.launchpad.net Unsubscribe : https://launchpad.net/~openlp-core More help : https://help.launchpad.net/ListHelp
[Openlp-core] Linux Test Results: Failed
Linux tests failed, please see https://ci.openlp.io/job/MP-02-Linux_Tests/188/ for more details -- https://code.launchpad.net/~phill-ridout/openlp/path_fixes/+merge/369191 Your team OpenLP Core is requested to review the proposed merge of lp:~phill-ridout/openlp/path_fixes into lp:openlp. ___ Mailing list: https://launchpad.net/~openlp-core Post to : openlp-core@lists.launchpad.net Unsubscribe : https://launchpad.net/~openlp-core More help : https://help.launchpad.net/ListHelp
[Openlp-core] [Merge] lp:~phill-ridout/openlp/path_fixes into lp:openlp
Phill has proposed merging lp:~phill-ridout/openlp/path_fixes into lp:openlp. Commit message: Path fix ups Requested reviews: OpenLP Core (openlp-core) For more details, see: https://code.launchpad.net/~phill-ridout/openlp/path_fixes/+merge/369191 -- Your team OpenLP Core is requested to review the proposed merge of lp:~phill-ridout/openlp/path_fixes into lp:openlp. === modified file 'openlp/core/common/json.py' --- openlp/core/common/json.py 2019-05-26 10:30:37 + +++ openlp/core/common/json.py 2019-06-21 20:57:21 + @@ -111,6 +111,8 @@ :param dict obj: A decoded JSON object :return: The custom object from the serialized data if the custom object is registered, else obj """ +if '__Path__' in obj: +return PathSerializer.encode_json(obj, **self.kwargs) try: key = obj['json_meta']['class'] except KeyError: @@ -150,8 +152,8 @@ if isinstance(obj, JSONMixin): return obj.json_object() elif obj.__class__.__name__ in _registered_classes: -return _registered_classes[obj.__class__.__name__].json_object(obj) -return super().default(obj) +return _registered_classes[obj.__class__.__name__].json_object(obj, **self.kwargs) +return super().default(obj, **self.kwargs) def is_serializable(obj): @@ -174,17 +176,22 @@ :param kwargs: Contains any extra parameters. Not used! :return Path: The deserialized Path object """ -path = Path(*obj['parts']) +if '__Path__' in obj: +parts = obj['__Path__'] +else: +parts = obj['parts'] +path = Path(*parts) if base_path and not path.is_absolute(): return base_path / path return path @classmethod -def json_object(cls, obj, base_path=None, **kwargs): +def json_object(cls, obj, base_path=None, js_use=False, **kwargs): """ Create a dictionary that can be JSON decoded. :param Path base_path: If specified, an absolute path to make a relative path from. +:param bool js_use: Encode the path as a uri. For example for use in the js rendering code. :param kwargs: Contains any extra parameters. Not used! :return: The dictionary representation of this Path object. :rtype: dict[tuple] @@ -193,6 +200,8 @@ if base_path: with suppress(ValueError): path = path.relative_to(base_path) +if js_use is True: +return path.as_uri() json_dict = {'parts': path.parts} cls.attach_meta(json_dict) return json_dict === modified file 'openlp/core/common/settings.py' --- openlp/core/common/settings.py 2019-06-14 17:54:04 + +++ openlp/core/common/settings.py 2019-06-21 20:57:21 + @@ -612,7 +612,7 @@ elif isinstance(default_value, dict): return {} elif isinstance(setting, str): -if 'json_meta' in setting or setting.startswith('{'): +if 'json_meta' in setting or '__Path__' in setting or setting.startswith('{'): return json.loads(setting, cls=OpenLPJSONDecoder) # Convert the setting to the correct type. if isinstance(default_value, bool): === modified file 'openlp/core/display/html/display.js' --- openlp/core/display/html/display.js 2019-03-16 10:26:05 + +++ openlp/core/display/html/display.js 2019-06-21 20:57:21 + @@ -118,20 +118,6 @@ } /** - * The paths we get are JSON versions of Python Path objects, so let's just fix that. - * @private - * @param {object} path - The Path object - * @returns {string} The actual file path - */ -function _pathToString(path) { -var filename = path.__Path__.join("/").replace("//", "/"); -if (!filename.startsWith("/")) { -filename = "/" + filename; -} -return filename; -} - -/** * An audio player with a play list */ var AudioPlayer = function (audioElement) { @@ -676,13 +662,13 @@ } break; case BackgroundType.Image: -background_filename = _pathToString(theme.background_filename); -backgroundStyle["background-image"] = "url('file://" + background_filename + "')"; +backgroundStyle["background-image"] = "url('" + theme.background_filename + "')"; +console.warn(backgroundStyle["background-image"]); break; case BackgroundType.Video: -background_filename = _pathToString(theme.background_filename); backgroundStyle["background-color"] = theme.background_border_color; -backgroundHtml = ""; +backgroundHtml = ""; +console.warn(backgroundHtml); break; default: backgroundStyle["background"] = "#000"; === modified file 'openlp/core/display/window.py' --- openlp/core/display/window.py 2019-05-23 19:33:46 + +++ openlp/core/display/window.py 2019-06-21 20:57:21 + @@ -332,9 +332,9 @@
Re: [Openlp-core] [Merge] lp:~tomasgroth/openlp/presentation-load-speedup into lp:openlp
Review: Needs Information Just a question about os.path vs Path Diff comments: > > === modified file 'openlp/core/lib/serviceitem.py' > --- openlp/core/lib/serviceitem.py2019-05-24 22:11:11 + > +++ openlp/core/lib/serviceitem.py2019-06-20 20:25:58 + > @@ -254,18 +259,22 @@ > :param image: The command of/for the slide. > :param display_title: Title to show in gui/webinterface, optional. > :param notes: Notes to show in the webinteface, optional. > +:param file_hash: Sha256 hash checksum of the file. > """ > self.service_item_type = ServiceItemType.Command > # If the item should have a display title but this frame doesn't > have one, we make one up > if self.is_capable(ItemCapabilities.HasDisplayTitle) and not > display_title: > display_title = translate('OpenLP.ServiceItem', >'[slide > {frame:d}]').format(frame=len(self.slides) + 1) > +if file_hash: > +self.sha256_file_hash = file_hash > +else: > +file_location = os.path.join(path, file_name) Shouldn't we be using Path objects? > +self.sha256_file_hash = sha256_file_hash(file_location) > # Update image path to match servicemanager location if file was > loaded from service > if image and not self.has_original_files and self.name == > 'presentations': > -file_location = os.path.join(path, file_name) > -file_location_hash = md5_hash(file_location.encode('utf-8')) > -image = > os.path.join(AppLocation.get_section_data_path(self.name), 'thumbnails', > file_location_hash, > - ntpath.basename(image)) # TODO: Pathlib > +image = > os.path.join(str(AppLocation.get_section_data_path(self.name)), 'thumbnails', > + self.sha256_file_hash, > ntpath.basename(image)) > self.slides.append({'title': file_name, 'image': image, 'path': > path, 'display_title': display_title, > 'notes': notes, 'thumbnail': image}) > # if self.is_capable(ItemCapabilities.HasThumbnails): -- https://code.launchpad.net/~tomasgroth/openlp/presentation-load-speedup/+merge/367933 Your team OpenLP Core is subscribed to branch lp:openlp. ___ Mailing list: https://launchpad.net/~openlp-core Post to : openlp-core@lists.launchpad.net Unsubscribe : https://launchpad.net/~openlp-core More help : https://help.launchpad.net/ListHelp
Re: [Openlp-core] [Merge] lp:~johnmfl/openlp/delete_temp_songs_add_fields_dupsongreview into lp:openlp
Review: Approve Technically you are supposed to have a test included, but for this first time I'll let it pass. -- https://code.launchpad.net/~johnmfl/openlp/delete_temp_songs_add_fields_dupsongreview/+merge/369062 Your team OpenLP Core is subscribed to branch lp:openlp. ___ Mailing list: https://launchpad.net/~openlp-core Post to : openlp-core@lists.launchpad.net Unsubscribe : https://launchpad.net/~openlp-core More help : https://help.launchpad.net/ListHelp