model.modal now a function and multiple sense labels

This commit is contained in:
2019-11-12 00:34:52 +01:00
parent 75755ef3c5
commit 58adffb104
10 changed files with 66 additions and 21 deletions

View File

@@ -29,20 +29,22 @@ class ShowSenseLabelEdit(GenericShowModal):
def update_model(self, model):
super().update_model(model)
model.sense = self.arg
model.modal = modals.edit_sense_label(self.arg)
model.sense.temporary_labels = model.sense.labels[:]
model.modal = lambda: modals.edit_sense_label(model.sense)
class ShowSenseDefinitionEdit(GenericShowModal):
def update_model(self, model):
super().update_model(model)
model.sense = self.arg
model.modal = modals.edit_sense_definition(self.arg)
model.modal = lambda: modals.edit_sense_definition(self.arg)
class ShowCommentEdit(ClickMessage):
def update_model(self, model):
model.modal_shown = True
model.modal = modals.edit_comment(model.entry.comment)
model.modal = lambda: modals.edit_comment(model.entry.comment)
class ShowEditTranslation(GenericShowModal):
@@ -57,7 +59,8 @@ class ShowEditTranslation(GenericShowModal):
for t in cluster:
if t == translation:
# fount the one!
model.modal = modals.edit_translation(translation, cidx, num_clusters, EditTranslation, (translation, cidx))
model.modal = lambda: modals.edit_translation(
translation, cidx, num_clusters, EditTranslation, (translation, cidx))
return
console.log("Should not be here!")
@@ -70,7 +73,8 @@ class ShowAddTranslation(GenericShowModal):
for sense in model.entry.senses:
if sense == chosen_sense:
model.modal = modals.edit_translation(sense, -1, len(sense.translations), AddTranslation, sense)
model.modal = lambda: modals.edit_translation(
sense, -1, len(sense.translations), AddTranslation, sense)
return
console.log("Should not be here!")