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.
25 lines
789 B
25 lines
789 B
5 years ago
|
from model import Translation, Sense
|
||
|
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
|