From 920ce87cfcc332dcf5140148b66e82231e57c437 Mon Sep 17 00:00:00 2001 From: matic_t Date: Fri, 30 Oct 2020 05:55:11 -0700 Subject: [PATCH] fix definitions --- src/view/modals.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/view/modals.py b/src/view/modals.py index 67e5a72..f636d88 100644 --- a/src/view/modals.py +++ b/src/view/modals.py @@ -185,8 +185,13 @@ def move_examples_to_sense(example_list, entry): sense_of_first_example = example_senses[0] options = [h("p", {}, "Choose sense for examples")] + definition = "" + for x in sense.definitions: + if x["type"] == "indicator": + definition = x.value + break for idx, sense in enumerate(entry.senses): - text = "{}: {}".format(idx + 1, sense.definition["indicator"]) + text = "{}: {}".format(idx + 1, definition) id_ = "choose-example-{}".format(idx) props = {"type": "radio", "name": "choose-example"} @@ -215,7 +220,12 @@ def ske_list(search_term, data, page_num, senses, ske_kinds): ske_list_hidden = True else: list_contents.append(h("span.error", {}, "Something went wrong in SKE: {}".format(data))) - + definitions = [] + for sense in senses: + for x in sense.definitions: + if x["type"] == "indicator": + definitions.append(x.value) + break contents = [ h("div.flex.four", {}, [ h("select#ske-select.fourth", {}, [ @@ -240,6 +250,6 @@ def ske_list(search_term, data, page_num, senses, ske_kinds): h("div.flex.three", {}, [ h("span.third", {}, "Vstavi v:"), h("select#ske-sense-select.two-third", {}, [ h("option", {}, "{} {}".format( - idx + 1, sense.definition["indicator"])) for idx, sense in enumerate(senses)])])] + idx + 1, definition)) for idx, definition in enumerate(definitions)])])] return modal_template(contents, "SKE", (message.SkeInsert, data))