First example of sense menu, maybe will delete later, for testing now.
This commit is contained in:
parent
c2c5e94aa7
commit
f5842c2536
|
@ -2,7 +2,7 @@ from message.simple_messages import NoReset, Reset, ModalNotOkClose, ClickMessag
|
||||||
from message.translation_edit import EditTranslation, MoveRight, MoveLeft, BinTranslation
|
from message.translation_edit import EditTranslation, MoveRight, MoveLeft, BinTranslation
|
||||||
from message.show_messages import ShowEntryLabelsEdit, ShowEditTranslation, ShowSenseLabelEdit, ShowSenseDefinitionEdit, ShowCommentEdit, ShowAddTranslation, ShowExampleEdit, ShowExampleTranslationEdit, ShowVariantsEdit
|
from message.show_messages import ShowEntryLabelsEdit, ShowEditTranslation, ShowSenseLabelEdit, ShowSenseDefinitionEdit, ShowCommentEdit, ShowAddTranslation, ShowExampleEdit, ShowExampleTranslationEdit, ShowVariantsEdit
|
||||||
from message.simple_edits import EditSenseLabel, EditSenseDefinition, EditComment, AddSenseLabel, AddSense, EditExample, AddExampleTranslation, EditExampleTranslation, DoChosenExamples, AddToLabelList, AddToGenericList, EditVariants, EditEntryLabels
|
from message.simple_edits import EditSenseLabel, EditSenseDefinition, EditComment, AddSenseLabel, AddSense, EditExample, AddExampleTranslation, EditExampleTranslation, DoChosenExamples, AddToLabelList, AddToGenericList, EditVariants, EditEntryLabels
|
||||||
from message.show_menu import ShowTranslationMenu, ShowSenseMenu
|
from message.show_menu import ShowTranslationMenu, ShowSenseMenu, ShowExampleMenu
|
||||||
from message.sense_edit import SenseMoveUp, SenseMoveDown, SenseBin
|
from message.sense_edit import SenseMoveUp, SenseMoveDown, SenseBin
|
||||||
|
|
||||||
from message.message import msg
|
from message.message import msg
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from model import Translation, Sense
|
from model import Translation, Sense, Example
|
||||||
from message.simple_messages import ClickMessage
|
from message.simple_messages import ClickMessage
|
||||||
|
|
||||||
|
|
||||||
|
@ -22,3 +22,10 @@ class ShowSenseMenu(ShowMenu):
|
||||||
model.menu_location = self.menu_location
|
model.menu_location = self.menu_location
|
||||||
sense = self.get_arg(0, Sense)
|
sense = self.get_arg(0, Sense)
|
||||||
model.menu_target = sense
|
model.menu_target = sense
|
||||||
|
|
||||||
|
|
||||||
|
class ShowExampleMenu(ShowMenu):
|
||||||
|
def update_model(self, model):
|
||||||
|
model.menu_location = self.menu_location
|
||||||
|
example = self.get_arg(0, Example)
|
||||||
|
model.menu_target = example
|
||||||
|
|
|
@ -2,7 +2,7 @@ from lib.snabbdom import h, patch
|
||||||
from message import *
|
from message import *
|
||||||
import random
|
import random
|
||||||
from view.utils import *
|
from view.utils import *
|
||||||
from model import Translation, Sense
|
from model import Translation, Sense, Example
|
||||||
|
|
||||||
from export import export_to_xml
|
from export import export_to_xml
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ class View:
|
||||||
example_tag += ".example-chosen"
|
example_tag += ".example-chosen"
|
||||||
|
|
||||||
return h("div.example", {}, [
|
return h("div.example", {}, [
|
||||||
h("div.example-dot", {}, "▣"),
|
h("div.example-dot", {"on": {"click": msg(ShowExampleMenu(example))} }, "▣"),
|
||||||
h(example_tag, {"on": {"click": msg(ShowExampleEdit(example))} }, [
|
h(example_tag, {"on": {"click": msg(ShowExampleEdit(example))} }, [
|
||||||
h("span.example-text", {}, example.text),
|
h("span.example-text", {}, example.text),
|
||||||
h("div.example-translation-list", {}, [
|
h("div.example-translation-list", {}, [
|
||||||
|
@ -161,6 +161,12 @@ class View:
|
||||||
h("button.shyButton", { "on": {"click": msg(SenseMoveUp(sense))}}, "↑"),
|
h("button.shyButton", { "on": {"click": msg(SenseMoveUp(sense))}}, "↑"),
|
||||||
h("button.shyButton", { "on": {"click": msg(SenseMoveDown(sense))}}, "↓"),
|
h("button.shyButton", { "on": {"click": msg(SenseMoveDown(sense))}}, "↓"),
|
||||||
h("button.shyButton", { "on": {"click": msg(SenseBin(sense))}}, "🗑")])
|
h("button.shyButton", { "on": {"click": msg(SenseBin(sense))}}, "🗑")])
|
||||||
|
|
||||||
|
elif type(menu_target) is Example:
|
||||||
|
return h("span.popup-menu", { "style": style }, [
|
||||||
|
h("button.shyButton", {}, "a"),
|
||||||
|
h("button.shyButton", {}, "b"),
|
||||||
|
h("button.shyButton", {}, "🗑")])
|
||||||
else:
|
else:
|
||||||
console.log("Should not be heree!!")
|
console.log("Should not be heree!!")
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user