|
|
|
@ -20,7 +20,7 @@ class View:
|
|
|
|
|
def _view(self):
|
|
|
|
|
return h("div", {"on": { "click": msg(Reset()) }}, [
|
|
|
|
|
View.view_entry(self.model.entry),
|
|
|
|
|
# h("button.blk", {"on": { "click": lambda _: console.log(export_to_xml(self.model)) } }, "XML2Console"),
|
|
|
|
|
h("button.blk", {"on": { "click": lambda _: console.log(export_to_xml(self.model)) } }, "XML2Console"),
|
|
|
|
|
View.view_menu(self.model.menu_location, self.model.menu_shown, self.model.translation),
|
|
|
|
|
View.view_modal(self.model.modal_shown, self.model.modal)])
|
|
|
|
|
|
|
|
|
@ -35,26 +35,42 @@ class View:
|
|
|
|
|
h("span#grammar", {}, entry.grammar)]),
|
|
|
|
|
View.view_entry_button_section(entry),
|
|
|
|
|
h("div#sense-container", {}, view_sense_list),
|
|
|
|
|
h("button.add-button", {"on": {"click": msg(ShowSenseAdd())}}, "+")])
|
|
|
|
|
h("button.add-button", {"on": {"click": msg(AddSense())}}, "+")])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
|
def view_entry_button_section(entry):
|
|
|
|
|
clk = lambda cls: {"on": {"click": msg(cls)}}
|
|
|
|
|
buttons = [
|
|
|
|
|
h("button.warning", clk(ShowCommentEdit()), "Comment"),
|
|
|
|
|
h("button.normal", clk(ShowVariantsEdit()), "Variants"),
|
|
|
|
|
h("button.success", clk(ShowEntryLabelsEdit()), "Labels")]
|
|
|
|
|
h("button.success", clk(ShowEntryLabelsEdit()), "Labels"),
|
|
|
|
|
h("button.warning", clk(ShowCommentEdit()), "Comment")]
|
|
|
|
|
|
|
|
|
|
if entry.comment == "" and len(entry.labels) == 0 and len(entry.variants) == 0:
|
|
|
|
|
return h("div", {}, buttons)
|
|
|
|
|
view_buttons = []
|
|
|
|
|
view_table = []
|
|
|
|
|
|
|
|
|
|
labels = ", ".join([val for _, val in entry.labels])
|
|
|
|
|
return h("table", {}, [
|
|
|
|
|
h("tr", {}, [ h("td", {}, buttons[0]), h("td", {}, entry.comment)]),
|
|
|
|
|
h("tr", {}, [ h("td", {}, buttons[1]), h("td", {}, ", ".join(entry.variants))]),
|
|
|
|
|
h("tr", {}, [ h("td", {}, buttons[2]), h("td", {}, labels)])])
|
|
|
|
|
|
|
|
|
|
if len(entry.variants) == 0:
|
|
|
|
|
view_buttons.append(buttons[0])
|
|
|
|
|
else:
|
|
|
|
|
view_table.append((buttons[0], ", ".join(entry.variants)))
|
|
|
|
|
|
|
|
|
|
if len(entry.labels) == 0:
|
|
|
|
|
view_buttons.append(buttons[1])
|
|
|
|
|
else:
|
|
|
|
|
labels = ", ".join([val for _, val in entry.labels])
|
|
|
|
|
view_table.append((buttons[1], labels))
|
|
|
|
|
|
|
|
|
|
if entry.comment == "":
|
|
|
|
|
view_buttons.append(buttons[2])
|
|
|
|
|
else:
|
|
|
|
|
view_table.append((buttons[2], entry.comment))
|
|
|
|
|
|
|
|
|
|
table_rows = [
|
|
|
|
|
h("tr", {}, [ h("td", {}, btn), h("td", {}, content)])
|
|
|
|
|
for btn, content in view_table]
|
|
|
|
|
|
|
|
|
|
view_buttons.append(h("table", {}, table_rows))
|
|
|
|
|
return h("div", {}, view_buttons)
|
|
|
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
|
def view_sense(sense, senseNum):
|
|
|
|
|