Editing explanation and examples, adding senses
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user