forked from openlp/openlp
rename param js_use to is_js
This commit is contained in:
parent
3e2e272776
commit
a432a57452
@ -186,12 +186,12 @@ class PathSerializer(JSONMixin, register_names=('Path', 'PosixPath', 'WindowsPat
|
|||||||
return path
|
return path
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def json_object(cls, obj, base_path=None, js_use=False, **kwargs):
|
def json_object(cls, obj, base_path=None, is_js=False, **kwargs):
|
||||||
"""
|
"""
|
||||||
Create a dictionary that can be JSON decoded.
|
Create a dictionary that can be JSON decoded.
|
||||||
|
|
||||||
:param Path base_path: If specified, an absolute path to make a relative path from.
|
: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 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!
|
:param kwargs: Contains any extra parameters. Not used!
|
||||||
:return: The dictionary representation of this Path object.
|
:return: The dictionary representation of this Path object.
|
||||||
:rtype: dict[tuple]
|
:rtype: dict[tuple]
|
||||||
@ -200,7 +200,7 @@ class PathSerializer(JSONMixin, register_names=('Path', 'PosixPath', 'WindowsPat
|
|||||||
if base_path:
|
if base_path:
|
||||||
with suppress(ValueError):
|
with suppress(ValueError):
|
||||||
path = path.relative_to(base_path)
|
path = path.relative_to(base_path)
|
||||||
if js_use is True:
|
if is_js is True:
|
||||||
return path.as_uri()
|
return path.as_uri()
|
||||||
json_dict = {'parts': path.parts}
|
json_dict = {'parts': path.parts}
|
||||||
cls.attach_meta(json_dict)
|
cls.attach_meta(json_dict)
|
||||||
|
@ -332,9 +332,9 @@ class DisplayWindow(QtWidgets.QWidget):
|
|||||||
theme_copy = copy.deepcopy(theme)
|
theme_copy = copy.deepcopy(theme)
|
||||||
theme_copy.background_type = 'image'
|
theme_copy.background_type = 'image'
|
||||||
theme_copy.background_filename = self.checkerboard_path
|
theme_copy.background_filename = self.checkerboard_path
|
||||||
exported_theme = theme_copy.export_theme(js_use=True)
|
exported_theme = theme_copy.export_theme(is_js=True)
|
||||||
else:
|
else:
|
||||||
exported_theme = theme.export_theme(js_use=True)
|
exported_theme = theme.export_theme(is_js=True)
|
||||||
self.run_javascript('Display.setTheme({theme});'.format(theme=exported_theme))
|
self.run_javascript('Display.setTheme({theme});'.format(theme=exported_theme))
|
||||||
|
|
||||||
def get_video_types(self):
|
def get_video_types(self):
|
||||||
|
@ -225,18 +225,18 @@ class Theme(object):
|
|||||||
jsn = json.loads(theme, cls=OpenLPJSONDecoder)
|
jsn = json.loads(theme, cls=OpenLPJSONDecoder)
|
||||||
self.expand_json(jsn)
|
self.expand_json(jsn)
|
||||||
|
|
||||||
def export_theme(self, theme_path=None, js_use=False):
|
def export_theme(self, theme_path=None, is_js=False):
|
||||||
"""
|
"""
|
||||||
Loop through the fields and build a dictionary of them
|
Loop through the fields and build a dictionary of them
|
||||||
|
|
||||||
:param pathlib.Path | None theme_path:
|
:param pathlib.Path | None theme_path:
|
||||||
:param bool js_use: For internal use, for example with the theme js code.
|
:param bool is_js: For internal use, for example with the theme js code.
|
||||||
:return str: The json encoded theme object
|
:return str: The json encoded theme object
|
||||||
"""
|
"""
|
||||||
theme_data = {}
|
theme_data = {}
|
||||||
for attr, value in self.__dict__.items():
|
for attr, value in self.__dict__.items():
|
||||||
theme_data["{attr}".format(attr=attr)] = value
|
theme_data["{attr}".format(attr=attr)] = value
|
||||||
return json.dumps(theme_data, cls=OpenLPJSONEncoder, base_path=theme_path, js_use=js_use)
|
return json.dumps(theme_data, cls=OpenLPJSONEncoder, base_path=theme_path, is_js=is_js)
|
||||||
|
|
||||||
def parse(self, xml):
|
def parse(self, xml):
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user