Fixed display for definition

This commit is contained in:
matic_t 2020-12-05 06:29:29 -08:00
parent 975f6f88be
commit d93d42bf4d

View File

@ -37,11 +37,20 @@ class Sense(Data):
def view(self, model, sense_num): def view(self, model, sense_num):
examples = [example.view(model, self) for example in self.examples] examples = [example.view(model, self) for example in self.examples]
definition = "" indicator = None
explanation = None
for x in self.definitions: for x in self.definitions:
if x["type"] == "indicator": if indicator is None and x["type"] == "indicator":
definition = x.value indicator = x.value
break if explanation is None and x["type"] == "explanation":
explanation = x.value
if indicator:
definition = indicator
if explanation:
definition += ", " + explanation
else:
definition = explanation
result = h("div.elm-div", {}, [ result = h("div.elm-div", {}, [
h("div.sense-num", {"on": {"click": M.msg(M.ShowSenseMenu, self)}}, str(sense_num + 1)), h("div.sense-num", {"on": {"click": M.msg(M.ShowSenseMenu, self)}}, str(sense_num + 1)),