You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
1012 B
32 lines
1012 B
from model import Translation, Sense, Example
|
|
from message.simple_messages import ClickMessage
|
|
|
|
|
|
class ShowMenu(ClickMessage):
|
|
def on_event(self, event):
|
|
location_x = event.currentTarget.offsetLeft
|
|
location_y = event.currentTarget.offsetTop + event.currentTarget.offsetHeight
|
|
self.menu_location = (location_x, location_y)
|
|
super().on_event(event)
|
|
|
|
|
|
class ShowTranslationMenu(ShowMenu):
|
|
def update_model(self, model):
|
|
model.menu_location = self.menu_location
|
|
model.translation = self.get_arg(0, Translation)
|
|
model.menu_target = model.translation
|
|
|
|
|
|
class ShowSenseMenu(ShowMenu):
|
|
def update_model(self, model):
|
|
model.menu_location = self.menu_location
|
|
sense = self.get_arg(0, 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
|