Fixed display for definition - v4.1 #13

Merged
matic_t merged 1 commits from mt-definition-list-ui into master 2020-12-05 14:30:28 +00:00

View File

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