Fixed smaller issue with modal.
This commit is contained in:
parent
17153d78b6
commit
b14e050ec0
|
@ -8,44 +8,39 @@ from view import modals
|
||||||
|
|
||||||
class ShowSenseLabelEdit(ClickMessage):
|
class ShowSenseLabelEdit(ClickMessage):
|
||||||
def update_model(self, model):
|
def update_model(self, model):
|
||||||
model.modal_shown = True
|
|
||||||
model.sense = self.get_arg(0, Sense)
|
model.sense = self.get_arg(0, Sense)
|
||||||
|
|
||||||
model.sense.make_copy()
|
model.sense.make_copy()
|
||||||
model.modal = lambda: modals.edit_sense_label(model.sense)
|
model.modal_set(lambda: modals.edit_sense_label(model.sense))
|
||||||
|
|
||||||
|
|
||||||
class ShowSenseDefinitionEdit(ClickMessage):
|
class ShowSenseDefinitionEdit(ClickMessage):
|
||||||
def update_model(self, model):
|
def update_model(self, model):
|
||||||
model.modal_shown = True
|
|
||||||
model.sense = self.get_arg(0, Sense)
|
model.sense = self.get_arg(0, Sense)
|
||||||
model.modal = lambda: modals.edit_sense_definition(model.sense)
|
model.modal_set(lambda: modals.edit_sense_definition(model.sense))
|
||||||
|
|
||||||
|
|
||||||
class ShowCommentEdit(ClickMessage):
|
class ShowCommentEdit(ClickMessage):
|
||||||
def update_model(self, model):
|
def update_model(self, model):
|
||||||
model.modal_shown = True
|
model.modal_set(lambda: modals.edit_comment(model.entry.comment))
|
||||||
model.modal = lambda: modals.edit_comment(model.entry.comment)
|
|
||||||
|
|
||||||
|
|
||||||
class ShowVariantsEdit(ClickMessage):
|
class ShowVariantsEdit(ClickMessage):
|
||||||
def update_model(self, model):
|
def update_model(self, model):
|
||||||
model.modal_shown = True
|
|
||||||
model.entry.make_copy()
|
model.entry.make_copy()
|
||||||
model.modal = lambda: modals.edit_variants(model.entry)
|
model.modal_set(lambda: modals.edit_variants(model.entry))
|
||||||
|
|
||||||
|
|
||||||
class ShowExampleEdit(CtrlClickMessage):
|
class ShowExampleEdit(CtrlClickMessage):
|
||||||
def update_model_noctrl(self, model):
|
def update_model_noctrl(self, model):
|
||||||
model.modal_shown = True
|
|
||||||
example = self.get_arg(0, Example)
|
example = self.get_arg(0, Example)
|
||||||
|
|
||||||
# if some are chosen, then show modal for choosing senses
|
# if some are chosen, then show modal for choosing senses
|
||||||
if len(model.chosen_examples) > 0 and example in model.chosen_examples:
|
if len(model.chosen_examples) > 0 and example in model.chosen_examples:
|
||||||
chosen_examples = model.chosen_examples
|
chosen_examples = model.chosen_examples
|
||||||
model.modal = lambda: modals.do_chosen_examples(chosen_examples, model.entry)
|
model.modal_set(lambda: modals.do_chosen_examples(chosen_examples, model.entry))
|
||||||
else:
|
else:
|
||||||
model.modal = lambda: modals.edit_example(example)
|
model.modal_set(lambda: modals.edit_example(example))
|
||||||
|
|
||||||
def update_model_ctrl(self, model):
|
def update_model_ctrl(self, model):
|
||||||
example = self.get_arg(0, Example)
|
example = self.get_arg(0, Example)
|
||||||
|
@ -61,16 +56,13 @@ class ShowExampleEdit(CtrlClickMessage):
|
||||||
|
|
||||||
class ShowExampleTranslationEdit(ClickMessage):
|
class ShowExampleTranslationEdit(ClickMessage):
|
||||||
def update_model(self, model):
|
def update_model(self, model):
|
||||||
model.modal_shown = True
|
|
||||||
example = self.get_arg(0, Example)
|
example = self.get_arg(0, Example)
|
||||||
example.make_copy()
|
example.make_copy()
|
||||||
model.modal = lambda: modals.edit_example_translation(example)
|
model.modal_set(lambda: modals.edit_example_translation(example))
|
||||||
|
|
||||||
|
|
||||||
class ShowEditTranslation(ClickMessage):
|
class ShowEditTranslation(ClickMessage):
|
||||||
def update_model(self, model):
|
def update_model(self, model):
|
||||||
model.modal_shown = True
|
|
||||||
|
|
||||||
# I need to get number of all clusters and cluster of self.arg
|
# I need to get number of all clusters and cluster of self.arg
|
||||||
translation = self.get_arg(0, Translation)
|
translation = self.get_arg(0, Translation)
|
||||||
for sense in model.entry.senses:
|
for sense in model.entry.senses:
|
||||||
|
@ -80,8 +72,8 @@ class ShowEditTranslation(ClickMessage):
|
||||||
if t == translation:
|
if t == translation:
|
||||||
# fount the one!
|
# fount the one!
|
||||||
translation.make_copy()
|
translation.make_copy()
|
||||||
model.modal = lambda: modals.edit_translation(
|
model.modal_set(lambda: modals.edit_translation(
|
||||||
translation, cidx, num_clusters, EditTranslation(translation, cidx))
|
translation, cidx, num_clusters, EditTranslation(translation, cidx)))
|
||||||
return
|
return
|
||||||
|
|
||||||
console.log("Should not be here!")
|
console.log("Should not be here!")
|
||||||
|
@ -89,15 +81,14 @@ class ShowEditTranslation(ClickMessage):
|
||||||
|
|
||||||
class ShowAddTranslation(ClickMessage):
|
class ShowAddTranslation(ClickMessage):
|
||||||
def update_model(self, model):
|
def update_model(self, model):
|
||||||
model.modal_shown = True
|
|
||||||
chosen_sense = self.get_arg(0, Sense)
|
chosen_sense = self.get_arg(0, Sense)
|
||||||
|
|
||||||
for sense in model.entry.senses:
|
for sense in model.entry.senses:
|
||||||
if sense == chosen_sense:
|
if sense == chosen_sense:
|
||||||
translation = Translation.new_empty()
|
translation = Translation.new_empty()
|
||||||
translation.make_copy()
|
translation.make_copy()
|
||||||
model.modal = lambda: modals.edit_translation(
|
model.modal_set(lambda: modals.edit_translation(
|
||||||
translation, -1, len(sense.translations), AddTranslation(translation, -1, sense))
|
translation, -1, len(sense.translations), AddTranslation(translation, -1, sense)))
|
||||||
return
|
return
|
||||||
|
|
||||||
console.log("Should not be here!")
|
console.log("Should not be here!")
|
||||||
|
@ -105,6 +96,5 @@ class ShowAddTranslation(ClickMessage):
|
||||||
|
|
||||||
class ShowEntryLabelsEdit(ClickMessage):
|
class ShowEntryLabelsEdit(ClickMessage):
|
||||||
def update_model(self, model):
|
def update_model(self, model):
|
||||||
model.modal_shown = True
|
|
||||||
model.entry.make_copy()
|
model.entry.make_copy()
|
||||||
model.modal = lambda: modals.edit_entry_labels(model.entry)
|
model.modal_set(lambda: modals.edit_entry_labels(model.entry))
|
||||||
|
|
|
@ -35,7 +35,7 @@ class Model:
|
||||||
def pre_reset(self):
|
def pre_reset(self):
|
||||||
# the reset before updating models
|
# the reset before updating models
|
||||||
self.menu_target = None
|
self.menu_target = None
|
||||||
self.modal_shown = False
|
self.modal_reset()
|
||||||
|
|
||||||
def post_reset(self):
|
def post_reset(self):
|
||||||
# the reset after updating the models
|
# the reset after updating the models
|
||||||
|
@ -43,6 +43,11 @@ class Model:
|
||||||
|
|
||||||
def modal_reset(self):
|
def modal_reset(self):
|
||||||
self.modal = lambda: []
|
self.modal = lambda: []
|
||||||
|
self.modal_shown = False
|
||||||
|
|
||||||
|
def modal_set(self, modal):
|
||||||
|
self.modal = modal
|
||||||
|
self.modal_shown = True
|
||||||
|
|
||||||
|
|
||||||
def import_xml(self, xml_text):
|
def import_xml(self, xml_text):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user