actually not showing components without representation

This commit is contained in:
Ozbolt Menegatti 2019-06-01 10:35:23 +02:00
parent 7d1bfbf73e
commit 119b85568f

12
wani.py
View File

@ -177,9 +177,6 @@ class ComponentRepresentation:
def render(self): def render(self):
if self.rendition_text is None: if self.rendition_text is None:
self.rendition_text = self._render() self.rendition_text = self._render()
def rendition(self):
return "" if self.rendition_text is None else self.rendition_text
def _render(self): def _render(self):
raise NotImplementedError("Not implemented for class: {}".format(type(self))) raise NotImplementedError("Not implemented for class: {}".format(type(self)))
@ -502,8 +499,13 @@ class ComponentRendition:
rep.render() rep.render()
for cid, reps in representations.items(): for cid, reps in representations.items():
rep = " ".join(rep.rendition() for rep in reps) reps = [rep.rendition_text for rep in reps]
matches.representations[cid] = rep if len(reps) == 0:
pass
elif all(r is None for r in reps):
matches.representations[cid] = None
else:
matches.representations[cid] = " ".join(("" if r is None else r) for r in reps)
# # just need to set representation to first group, # # just need to set representation to first group,
# # but in correct order, agreements last! # # but in correct order, agreements last!