example translations and sense translation now unified, should behave very simmilary

- import
- export
- view
- edite translation events
This commit is contained in:
2020-01-23 22:51:15 +01:00
parent b84d43bf9d
commit 513cffbbd9
9 changed files with 100 additions and 67 deletions

View File

@@ -94,25 +94,31 @@ class ShowEditTranslation(ClickMessage):
# fount the one!
translation.make_copy()
model.modal_set(lambda: modals.edit_translation(
translation, cidx, num_clusters, EditTranslation(translation, cidx)))
translation, (cidx, num_clusters), EditTranslation(translation, cidx)))
return
console.log("Should not be here!")
# if here, that his must be example translation
translation.make_copy()
model.modal_set(lambda: modals.edit_translation(
translation, None, EditTranslation(translation, -1)))
class ShowAddTranslation(ClickMessage):
def update_model(self, model):
chosen_sense = self.get_arg(0, Sense)
chosen_sense_or_example = self.get_arg(0)
for sense in model.entry.senses:
if sense == chosen_sense:
translation = Translation.new_empty()
translation.make_copy()
model.modal_set(lambda: modals.edit_translation(
translation, -1, len(sense.translations), AddTranslation(translation, -1, sense)))
return
console.log("Should not be here!")
if isinstance(chosen_sense_or_example, Sense):
cluster = (-1, len(chosen_sense_or_example.translations))
else:
cluster = None
translation = Translation.new_empty()
translation.make_copy()
model.modal_set(lambda: modals.edit_translation(
translation,
cluster,
AddTranslation(translation, -1, chosen_sense_or_example)))
class ShowEntryLabelsEdit(ClickMessage):