def get_legends(self): def img(spec): return HTML.img(src=svg.data_url(svg.icon(spec)), height='20', width='20', style='margin-left: 0.5em;') def desc(text): return HTML.span(text, style='margin-left: 0.5em; margin-right: 0.5em;') values = [desc('Most extensive description is a ...')] for sdt in get_parameter('med').domain: icon = self.de_to_icon['med'][sdt.id.split('-')[1]] values.append( HTML.label( HTML.input( type='checkbox', checked='checked', id='marker-toggle-sdt-' + str(sdt.number), onclick='GLOTTOLOG3.LangdocStatus.toggleMarkers()'), img(icon.shape + 'ffffff' if self.focus == 'ed' else 'c' + icon.color), desc(sdt.name))) values.append(desc('Language is ...')) for ed in get_parameter('aes').domain: icon = self.de_to_icon['aes'][ed.id.split('-')[1]] values.append((HTML.label( HTML.input(type='checkbox', checked='checked', id='marker-toggle-ed-' + str(ed.number), onclick='GLOTTOLOG3.LangdocStatus.toggleMarkers()'), img('c' + icon.color if self.focus == 'ed' else icon.shape + 'ffffff'), desc(ed.name.lower())))) yield Legend(self, 'values', values, label='Legend')
def get_legends(self): from glottolog3.util import languoid_link if self.req.matchdict.get('ext') == 'bigmap.html': def value_li(l): return ( HTML.img(height="20", width="20", src=self.icon_map[l.pk]), literal(' '), languoid_link(self.req, l), literal(' '), HTML.label( HTML.input( type="checkbox", onclick="GLOTTOLOG3.filterMarkers(this);", class_="checkbox inline", checked="checked", value=str(l.pk)), class_="checkbox inline", title="click to toggle markers"), ) ls = [l for l in self.ctx.children if l.level != LanguoidLevel.dialect] if self.ctx.latitude: ls = [self.ctx] + ls yield Legend( self, 'languoids', [value_li(l) for l in ls], label='Legend', stay_open=True) for legend in super(LanguoidMap, self).get_legends(): yield legend
def get_legends(self): def img(spec): return HTML.img( src=self.icon_map[spec], height='20', width='20', style='margin-left: 0.5em;') def desc(text): return HTML.span(text, style='margin-left: 0.5em; margin-right: 0.5em;') values = [desc('Most extensive description is a ...')] for sdt in SIMPLIFIED_DOCTYPES: values.append( HTML.label( HTML.input( type='checkbox', checked='checked', id='marker-toggle-sdt-' + str(sdt.ord), onclick='GLOTTOLOG3.LangdocStatus.toggleMarkers()'), img(sdt.shape + 'ffffff' if self.focus == 'ed' else 'c' + sdt.color), desc(sdt.name))) values.append(desc('Language is ...')) for ed in ENDANGERMENTS: values.append(( HTML.label( HTML.input( type='checkbox', checked='checked', id='marker-toggle-ed-' + str(ed.ord), onclick='GLOTTOLOG3.LangdocStatus.toggleMarkers()'), img('c' + ed.color if self.focus == 'ed' else ed.shape + 'ffffff'), desc(ed.name.lower())))) yield Legend(self, 'values', values, label='Legend')
def get_legends(self): if self.ctx.multivalued: def value_li(de): return HTML.label( map_marker_img(self.req, de), literal(de.abbr), style='margin-left: 1em; margin-right: 1em;') yield Legend(self, 'values', map(value_li, self.ctx.domain), label='Legend') for legend in super(FeatureMap, self).get_legends(): yield legend yield FilterLegend(self, 'APICS.getLexifier', col=self.col, dt=self.dt)
def get_legends(self): items = [] for biome in DBSession.query(Biome)\ .filter(Biome.description != 'ffffff')\ .order_by(as_int(Biome.id)): items.append( HTML.label( HTML.span( literal(' '), style='background-color: #%s;' % biome.description, class_='biome-color'), literal(biome.name), style='margin-left: 1em; margin-right: 1em;')) yield Legend(self, 'categories', items)
def get_legends(self): items = [] seen = set() def item(lang, label): return HTML.div(map_marker_img(self.req, lang), ' ', label, style="padding-left: 5px") for lang in DBSession.query(models.Doculect).order_by( models.Doculect.subfamily): if lang.subfamily not in seen: items.append(item(lang, lang.subfamily)) seen.add(lang.subfamily) yield Legend(self, 'subfamilies', items, label='Legend', stay_open=True) for legend in Map.get_legends(self): yield legend
def get_legends(self): items = [] seen = set() def item(lang, label): return HTML.div(map_marker_img(self.req, lang), ' ', label, style="padding-left: 5px") for lang in DBSession.query(Variety).order_by(Variety.subgroup): if lang.subgroup: if lang.subgroup not in seen: items.append(item(lang, lang.subgroup)) seen.add(lang.subgroup) else: family = lang.family.name if lang.family else 'Isolate' if family not in seen: items.append(item(lang, family)) seen.add(family) yield Legend(self, 'sub-groups', items, label='Legend', stay_open=True) for legend in Map.get_legends(self): yield legend
def get_legends(self): yield Legend(self, 'values', list(legend_items(self.req)), label='Legend')