|
|
@ -3,6 +3,7 @@ from message import *
|
|
|
|
import random
|
|
|
|
import random
|
|
|
|
from view.utils import *
|
|
|
|
from view.utils import *
|
|
|
|
from model import Translation, Sense, Example
|
|
|
|
from model import Translation, Sense, Example
|
|
|
|
|
|
|
|
from browser import document
|
|
|
|
|
|
|
|
|
|
|
|
from export import export_to_xml
|
|
|
|
from export import export_to_xml
|
|
|
|
|
|
|
|
|
|
|
@ -88,7 +89,7 @@ class View:
|
|
|
|
def view_sense(sense, senseNum, model):
|
|
|
|
def view_sense(sense, senseNum, model):
|
|
|
|
examples = [View.view_example(example, model) for example in sense.examples]
|
|
|
|
examples = [View.view_example(example, model) for example in sense.examples]
|
|
|
|
|
|
|
|
|
|
|
|
return h("div.elm-div", {}, [
|
|
|
|
result = h("div.elm-div", {}, [
|
|
|
|
h("div.sense-num", {"on": {"click": msg(ShowSenseMenu(sense))}}, str(senseNum + 1)),
|
|
|
|
h("div.sense-num", {"on": {"click": msg(ShowSenseMenu(sense))}}, str(senseNum + 1)),
|
|
|
|
h("div.sense", {}, [
|
|
|
|
h("div.sense", {}, [
|
|
|
|
h("span.sense-label-list", { "on": { "click": msg(ShowSenseLabelEdit(sense)) }}, [
|
|
|
|
h("span.sense-label-list", { "on": { "click": msg(ShowSenseLabelEdit(sense)) }}, [
|
|
|
@ -96,6 +97,7 @@ class View:
|
|
|
|
h("span.sense-definition", { "on": { "click": msg(ShowSenseDefinitionEdit(sense)) }}, sense.definition["indicator"]),
|
|
|
|
h("span.sense-definition", { "on": { "click": msg(ShowSenseDefinitionEdit(sense)) }}, sense.definition["indicator"]),
|
|
|
|
h("div", {}, View.view_translations(sense.translations, sense, model)),
|
|
|
|
h("div", {}, View.view_translations(sense.translations, sense, model)),
|
|
|
|
h("div", {}, examples)])])
|
|
|
|
h("div", {}, examples)])])
|
|
|
|
|
|
|
|
return result
|
|
|
|
|
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
@staticmethod
|
|
|
|
def view_example(example, model):
|
|
|
|
def view_example(example, model):
|
|
|
@ -105,21 +107,21 @@ class View:
|
|
|
|
|
|
|
|
|
|
|
|
return h("div.example", {}, [
|
|
|
|
return h("div.example", {}, [
|
|
|
|
h("div.example-dot", {"on": {"click": msg(ShowExampleMenu(example))} }, "▣"),
|
|
|
|
h("div.example-dot", {"on": {"click": msg(ShowExampleMenu(example))} }, "▣"),
|
|
|
|
h(example_tag, {"on": {"click": msg(ShowExampleEdit(example))} }, [
|
|
|
|
h(example_tag, {}, [
|
|
|
|
h("span.example-text", {}, example.text),
|
|
|
|
h("span.example-text", {"on": {"click": msg(ShowExampleEdit(example))}}, example.text),
|
|
|
|
h("div.example-translation-list", {}, [
|
|
|
|
h("div.example-translation-list", {}, [
|
|
|
|
h("div.example-translation", {}, [
|
|
|
|
h("div.example-translation", {}, [
|
|
|
|
h("span.example-arrow", {}, "↪"),
|
|
|
|
h("span.example-arrow", {}, "↪"),
|
|
|
|
h("span", {}, t)])
|
|
|
|
vt
|
|
|
|
for t in example.translations])])])
|
|
|
|
]) for vt in View.view_translations(example.translations, example, model)])])])
|
|
|
|
|
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
@staticmethod
|
|
|
|
def view_translations(translations, sense, model):
|
|
|
|
def view_translations(translations, parent, model):
|
|
|
|
result = []
|
|
|
|
result = []
|
|
|
|
for cluster in translations:
|
|
|
|
for cluster in translations:
|
|
|
|
result.append(h("div.translation-div-cluster", {}, [View.view_one_translation(t, model) for t in cluster]))
|
|
|
|
result.append(h("div.translation-div-cluster", {}, [View.view_one_translation(t, model) for t in cluster]))
|
|
|
|
|
|
|
|
|
|
|
|
result.append(h("button.add-button", {"on": {"click": msg(ShowAddTranslation(sense))}}, "+"))
|
|
|
|
result.append(h("button.add-button", {"on": {"click": msg(ShowAddTranslation(parent))}}, "+"))
|
|
|
|
return result
|
|
|
|
return result
|
|
|
|
|
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
@staticmethod
|
|
|
|