Merge pull request 'Fixed display for definition - v4.1' (#13) from mt-definition-list-ui into master

Reviewed-on: #13
This commit is contained in:
matic_t 2020-12-05 14:30:27 +00:00
commit 6da81807df

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)),