Editing explanation and examples, adding senses

This commit is contained in:
2019-11-15 22:24:32 +01:00
parent 78a80c03a7
commit f0f95b16c0
8 changed files with 70 additions and 13 deletions

View File

@@ -1,6 +1,7 @@
from message.message import Message, ClickMessage
from message.translation_edit import AddTranslation ,EditTranslation
from model.sense import NewSense
import modals
@@ -16,7 +17,10 @@ class GenericShowModal(ClickMessage):
class ShowMenu(ClickMessage):
def __init__(self, event, translation):
super().__init__(event)
self.menu_location = (event.layerX, event.layerY)
location_x = event.currentTarget.offsetLeft
location_y = event.currentTarget.offsetTop + event.currentTarget.offsetHeight
self.menu_location = (location_x, location_y)
console.log(self.menu_location, event.currentTarget)
self.translation = translation
def update_model(self, model):
@@ -39,6 +43,12 @@ class ShowSenseDefinitionEdit(GenericShowModal):
super().update_model(model)
model.sense = self.arg
model.modal = lambda: modals.edit_sense_definition(self.arg)
class ShowSenseAdd(GenericShowModal):
def update_model(self, model):
super().update_model(model)
model.modal = lambda: modals.add_sense(NewSense())
class ShowCommentEdit(ClickMessage):
@@ -47,6 +57,12 @@ class ShowCommentEdit(ClickMessage):
model.modal = lambda: modals.edit_comment(model.entry.comment)
class ShowExampleEdit(GenericShowModal):
def update_model(self, model):
super().update_model(model)
model.modal = lambda: modals.edit_example(self.arg)
class ShowEditTranslation(GenericShowModal):
def update_model(self, model):
model.modal_shown = True