Adding data_change to use to signal to Screenful that save button nedds a litle star
This commit is contained in:
@@ -12,8 +12,13 @@ def get_translation_location(entry, translation):
|
||||
if search_translation == translation:
|
||||
return (si, ci, ti), (sense, cluster)
|
||||
|
||||
|
||||
class TranslationEditMessage(ClickMessage):
|
||||
def data_change(self):
|
||||
return True
|
||||
|
||||
|
||||
class EditTranslation(ClickMessage):
|
||||
class EditTranslation(TranslationEditMessage):
|
||||
def update_model(self, model):
|
||||
self.translation = self.get_arg(0, Translation)
|
||||
self.old_cluster_idx = self.get_arg(1, int)
|
||||
@@ -60,7 +65,7 @@ class EditTranslation(ClickMessage):
|
||||
sense.translations.splice(cidx, 1)
|
||||
|
||||
|
||||
class MoveRight(ClickMessage):
|
||||
class MoveRight(TranslationEditMessage):
|
||||
def update_model(self, model):
|
||||
translation = self.get_arg(0, Translation)
|
||||
(_, _, idx), (_, cluster) = get_translation_location(model.entry, translation)
|
||||
@@ -69,7 +74,7 @@ class MoveRight(ClickMessage):
|
||||
model.translation = None
|
||||
|
||||
|
||||
class MoveLeft(ClickMessage):
|
||||
class MoveLeft(TranslationEditMessage):
|
||||
def update_model(self, model):
|
||||
translation = self.get_arg(0, Translation)
|
||||
(_, _, idx), (_, cluster) = get_translation_location(model.entry, translation)
|
||||
@@ -78,7 +83,7 @@ class MoveLeft(ClickMessage):
|
||||
model.translation = None
|
||||
|
||||
|
||||
class BinTranslation(ClickMessage):
|
||||
class BinTranslation(TranslationEditMessage):
|
||||
def update_model(self, model):
|
||||
translation = self.get_arg(0, Translation)
|
||||
(_, cidx, tidx), (sense, cluster) = get_translation_location(model.entry, translation)
|
||||
@@ -90,7 +95,7 @@ class BinTranslation(ClickMessage):
|
||||
model.translation = None
|
||||
|
||||
|
||||
class AddTranslation(EditTranslation):
|
||||
class AddTranslation(TranslationEditMessage):
|
||||
def handle_cluster_change(self, new_cluster_idx, _):
|
||||
# we need to cheat here
|
||||
# sense was actually given in constructor in third place
|
||||
|
||||
Reference in New Issue
Block a user