Adding variants and labels to entry, not yet done.

This commit is contained in:
2019-11-18 20:27:11 +01:00
parent a058a50017
commit 4bdb3bfc7f
8 changed files with 68 additions and 19 deletions

View File

@@ -1,7 +1,7 @@
from message.simple_messages import NoReset, Reset, ModalNotOkClose
from message.translation_edit import EditTranslation, MoveRight, MoveLeft, BinTranslation
from message.show_messages import ShowMenu, ShowEditTranslation, ShowSenseLabelEdit, ShowSenseDefinitionEdit, ShowCommentEdit, ShowAddTranslation, ShowSenseAdd, ShowExampleEdit, ShowExampleTranslationEdit
from message.simple_edits import EditSenseLabel, EditSenseDefinition, EditComment, AddSenseLabel, AddSense, EditExample, AddExampleTranslation, EditExampleTranslation, AddToLabelList
from message.show_messages import ShowMenu, ShowEditTranslation, ShowSenseLabelEdit, ShowSenseDefinitionEdit, ShowCommentEdit, ShowAddTranslation, ShowSenseAdd, ShowExampleEdit, ShowExampleTranslationEdit, ShowVariantsEdit
from message.simple_edits import EditSenseLabel, EditSenseDefinition, EditComment, AddSenseLabel, AddSense, EditExample, AddExampleTranslation, EditExampleTranslation, AddToLabelList, AddToGenericList, EditVariants
from message.message import msg

View File

@@ -46,6 +46,13 @@ class ShowCommentEdit(ClickMessage):
model.modal = lambda: modals.edit_comment(model.entry.comment)
class ShowVariantsEdit(ClickMessage):
def update_model(self, model):
model.modal_shown = True
model.entry.make_copy()
model.modal = lambda: modals.edit_variants(model.entry)
class ShowExampleEdit(ClickMessage):
def update_model(self, model):
model.modal_shown = True

View File

@@ -24,11 +24,10 @@ class AddSenseLabel(NoReset):
sense.copy().labels.append("")
class AddExampleTranslation(NoReset):
class AddToGenericList(NoReset):
def update_model(self, model):
example = self.get_arg(0, Example)
# just adding to the copy to show in the modal
example.copy().translations.append("")
list_getter = self.get_arg(0)
list_getter().append("")
class AddToLabelList(NoReset):
@@ -69,4 +68,11 @@ class EditExample(QuestionMessage):
def update_model(self, model):
example = self.get_arg(0, Example)
example.example = self.new_text
class EditVariants(Message):
def update_model(self, model):
variants = common_accessors.generic_list_getter()
model.entry.variants = variants