From 8820b5700f8ea5a43ae9a825cd757f05a9acd796 Mon Sep 17 00:00:00 2001 From: Ozbolt Menegatti Date: Sun, 5 Jan 2020 09:54:38 +0100 Subject: [PATCH] XML2Console now CHK to simply check two xml side to side --- src/view/utils.py | 17 +++++++++++++++++ src/view/view.py | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/view/utils.py b/src/view/utils.py index c4c32ff..48592c7 100644 --- a/src/view/utils.py +++ b/src/view/utils.py @@ -1,2 +1,19 @@ +from export import export_to_xml +from browser import window + + def clean_label(label): return label.replace("-- ", "") + + +def check_export(model): + exported_string = export_to_xml(model) + model.import_xml(exported_string) + exported_string_2 = export_to_xml(model) + + if exported_string == exported_string_2: + window.console.log("OK") + else: + window.console.log("NOT OK!") + window.console.log(exported_string) + window.console.log(exported_string_2) diff --git a/src/view/view.py b/src/view/view.py index c8ae563..ea7f5ff 100644 --- a/src/view/view.py +++ b/src/view/view.py @@ -25,7 +25,7 @@ class View: def _view(self): return h("div", {"on": { "click": msg(Reset()) }}, [ View.view_entry(self.model.entry, self.model), - # h("button.blk", {"on": { "click": lambda _: console.log(export_to_xml(self.model)) } }, "XML2Console"), + h("button.blk", {"on": { "click": lambda _: check_export(self.model) } }, "CHK"), View.view_menu(self.model.menu_location, self.model.menu_target), View.view_modal(self.model.modal_shown, self.model.modal)])