Exemplo n.º 1
0
 def col_defs(self):
     res = [
         SampleIdCol(self, 'sample', model_col=common.Value.id),
         Col(self, 'artefact', model_col=models.Sample.artefact_id),
     ]
     if not self.parameter:
         res.append(
             CategoryCol(self,
                         'type',
                         choices=get_distinct_values(
                             common.DomainElement.name),
                         model_col=common.DomainElement.name))
     if self.parameter:
         res.append(
             LinkCol(self,
                     'contribution',
                     get_object=lambda v: v.valueset.contribution))
     if self.contribution:
         pass
     if not self.language:
         res.extend([
             RegionCol(self,
                       'region',
                       choices=get_distinct_values(models.Location.region)),
             SubRegionCol(self, 'subregion'),
             Col(self,
                 'site',
                 model_col=models.Sample.site_name,
                 choices=get_distinct_values(models.Sample.site_name)),
         ])
     return res
Exemplo n.º 2
0
 def col_defs(self):
     return [
         IntegerIdCol(self, 'number'),
         LinkCol(self, 'name'),
         Col(
             self,
             'canton',
             sTitle='Canton',
             model_col=models.Variety.canton,
             choices=get_distinct_values(models.Variety.canton),
         ),
         Col(
             self,
             'group',
             sTitle='Dialect group',
             model_col=models.Variety.group,
             choices=get_distinct_values(models.Variety.group),
         ),
         #Col(self, 'population', model_col=models.Variety.population),
         Col(self,
             'recorded',
             model_col=models.Variety.recorded,
             sTitle='Date of recording'),
         Col(self,
             'latitude',
             sDescription='<small>The geographic latitude</small>'),
         Col(self,
             'longitude',
             sDescription='<small>The geographic longitude</small>'),
         LinkToMapCol(self, 'm'),
     ]
Exemplo n.º 3
0
 def col_defs(self):
     return [
         IntegerIdCol(self, 'id'),
         LinkCol(self, 'name', sTitle='Language structure dataset'),
         ContributorsCol(self,
                         'contributors',
                         bSearchable=False,
                         bSortable=False,
                         sTitle='Authors of dataset'),
         Col(self,
             'lexifier',
             choices=get_distinct_values(Lect.lexifier,
                                         key=lambda v: 'z' + v
                                         if v == 'Other' else v),
             get_obj=lambda item: item.language,
             model_col=Lect.lexifier),
         Col(self,
             'region',
             choices=get_distinct_values(Lect.region),
             get_obj=lambda item: item.language,
             model_col=Lect.region),
         CitationCol(self, 'cite', bSearchable=False, bSortable=False),
         IntegerIdCol(self,
                      'survey',
                      get_object=lambda c: c.language.survey,
                      bSearchable=False,
                      bSortable=False,
                      sTitle='Survey'),
     ]
Exemplo n.º 4
0
 def col_defs(self):
     return [
         LinkCol(self, 'name'),
         LinkToMapCol(self, '#'),
         Col(self,
             'region',
             model_col=Sample.region,
             choices=get_distinct_values(Sample.region)),
         Col(self, 'location', model_col=Sample.location),
         Col(self,
             'latitude',
             input_size='mini',
             sDescription='<small>The geographic latitude</small>'),
         Col(self,
             'longitude',
             input_size='mini',
             sDescription='<small>The geographic longitude</small>'),
         Col(self,
             'samplesize',
             input_size='mini',
             model_col=Sample.samplesize),
         LangCol(self,
                 'languoid',
                 get_object=lambda i: i.languoid,
                 model_col=Languoid.name),
         FamilyCol(self,
                   'family',
                   get_object=lambda i: i.languoid,
                   model_col=Languoid.family_name,
                   choices=get_distinct_values(Languoid.family_name)),
     ]
Exemplo n.º 5
0
 def col_defs(self):
     return [
         LinkCol(self, 'name'),
         Col(self,
             'experiments',
             model_col=models.Species.count_experiments,
             input_size='mini'),
         GBIFLinkCol(self,
                     'gbif',
                     sTitle='GBIF',
                     model_col=models.Species.gbif_name),
         Col(self,
             'class',
             model_col=models.Species.klass,
             choices=get_distinct_values(models.Species.klass)),
         Col(self,
             'order',
             model_col=models.Species.order,
             choices=get_distinct_values(models.Species.order)),
         Col(self,
             'family',
             model_col=models.Species.family,
             choices=get_distinct_values(models.Species.family)),
         Col(self,
             'genus',
             model_col=models.Species.genus,
             choices=get_distinct_values(models.Species.genus)),
     ]
Exemplo n.º 6
0
 def col_defs(self):
     res = Sentences.col_defs(self)
     return [
         res[1],
         res[4],
         LocationCol(self, 'settlement', choices=get_distinct_values(CounterpartExample.location)),
         RefsCol(self, 'source', choices=get_distinct_values(common.Source.name)),
         res[6]]
Exemplo n.º 7
0
 def col_defs(self):
     return [
         OrderNumberCol(self, 'id'),
         LinkCol(self, 'name', sTitle='Language'),
         ContributorsCol(self, 'contributors', bSearchable=False, bSortable=False),
         LexifierCol(self, 'lexifier', choices=get_distinct_values(
             Lect.lexifier, key=lambda v: 'z' + v if v == 'Other' else v)),
         RegionCol(self, 'region', choices=get_distinct_values(Lect.region)),
         CitationCol(self, 'cite', bSearchable=False, bSortable=False),
     ]
Exemplo n.º 8
0
 def col_defs(self):
     return [
         DetailsRowLinkCol(self, '#'),
         WordCol(self, 'name'),
         Col(self, 'pos', model_col=Entry.pos, choices=get_distinct_values(Entry.pos)),
         Col(self, 'aspect', model_col=Entry.aspect, choices=get_distinct_values(Entry.aspect)),
         Col(self, 'donor', sTitle='loan from', model_col=Entry.donor, choices=get_distinct_values(Entry.donor)),
         Col(self, 'dialect', model_col=Entry.dialect, choices=get_distinct_values(Entry.dialect)),
         Col(self, 'english', model_col=Entry.english),
         Col(self, 'german', model_col=Entry.german),
         Col(self, 'russian', model_col=Entry.russian),
     ]
Exemplo n.º 9
0
 def col_defs(self):
     return [
         WordCol(self, 'name'),
         VariantCol(self, 'variant'),
         Col(self, 'pos', model_col=Entry.pos, choices=get_distinct_values(Entry.pos)),
         Col(self, 'aspect', model_col=Entry.aspect, choices=get_distinct_values(Entry.aspect)),
         Col(self, 'plural', model_col=Entry.plural, choices=get_distinct_values(Entry.plural)),
         Col(self, 'donor', sTitle='loan from', model_col=Entry.donor, choices=get_distinct_values(Entry.donor)),
         DialectCol(
             self,
             'variety',
             model_col=common.Language.name,
             choices=[(l.id, l.name) for l in DBSession.query(common.Language)]),
     ]
Exemplo n.º 10
0
 def col_defs(self):
     return [
         DetailsRowLinkCol(self, '#'),
         WordCol(
             self,
             'form',
             get_obj=lambda i: i.unit,
             model_col=common.Unit.name),
         VariantCol(self, 'variant', get_object=lambda u: u.unit),
         Col(
             self,
             'english',
             get_obj=lambda i: i.unitparameter,
             model_col=common.UnitParameter.name),
         Col(
             self,
             'russian',
             get_obj=lambda i: i.unitparameter,
             model_col=Meaning.russian),
         Col(self, 'pos', get_object=lambda u: u.unit, model_col=Entry.pos),
         Col(self, 'aspect', get_object=lambda u: u.unit, model_col=Entry.aspect),
         Col(self, 'plural', get_object=lambda u: u.unit, model_col=Entry.plural),
         Col(
             self,
             'donor',
             choices=get_distinct_values(Entry.donor),
             get_object=lambda u: u.unit,
             model_col=Entry.donor),
         DialectCol(
             self,
             'variety',
             get_object=lambda u: u.unit.language,
             choices=[(l.id, l.name) for l in DBSession.query(common.Language)]),
     ]
Exemplo n.º 11
0
 def col_defs(self):
     return [
         IntegerIdCol(self, 'id'),
         LinkCol(self, 'name', sTitle='Language'),
         ContributorsCol(self, 'contributors', bSearchable=False, bSortable=False),
         Col(self, 'lexifier',
             choices=get_distinct_values(
                 Lect.lexifier, key=lambda v: 'z' + v if v == 'Other' else v),
             get_obj=lambda item: item.language,
             model_col=Lect.lexifier),
         Col(self, 'region',
             choices=get_distinct_values(Lect.region),
             get_obj=lambda item: item.language,
             model_col=Lect.region),
         CitationCol(self, 'cite', bSearchable=False, bSortable=False),
     ]
Exemplo n.º 12
0
    def col_defs(self):
        er_col = EcoregionCol(self, 'ecoregions', bSortable=False)
        if 'er' in self.req.params:
            er_col.js_args['sFilter'] = self.req.params['er']

        res = [
            LinkCol(self, 'name', sTitle='Species'),
            Col(self, 'description', sTitle='English name'),
            ClassificationCol(self, 'order', sTitle='Biological classification'),
            ThumbnailCol(self, 'thumbnail'),
            # TODO: second thumbnail?
        ]
        if self.languages:
            for i, lang in enumerate(self.languages):
                res.append(CommonNameCol(self, 'cn%s' % i, lang, self._langs[i]))
            res.append(CategoryCol(self, 'categories', self.languages, bSortable=False))

        res.extend([
            er_col,
            Col(self, 'countries',
                model_col=Species.countries_str,
                choices=get_distinct_values(Country.name),
                bSortable=False)])
        # TODO: characteristics col?
        return res
Exemplo n.º 13
0
 def col_defs(self):
     if self.parameter:
         return [
             LinkCol(self,
                     'sample',
                     model_col=Sample.name,
                     get_object=lambda i: i.valueset.language),
             Col(self,
                 'region',
                 model_col=Sample.region,
                 get_object=lambda i: i.valueset.language,
                 format=lambda i: i.valueset.language.region),
             FamilyCol(self,
                       'family',
                       get_object=lambda i: i.valueset.language.languoid,
                       model_col=Languoid.family_name,
                       choices=get_distinct_values(Languoid.family_name)),
             Col(self, 'value', model_col=Measurement.value),
             LinkToMapCol(self,
                          '#',
                          get_object=lambda i: i.valueset.language),
         ]
     if self.language:
         return [
             LinkCol(self,
                     'measure',
                     model_col=Parameter.name,
                     get_object=lambda i: i.valueset.parameter),
             Col(self,
                 'description',
                 get_object=lambda i: i.valueset.parameter,
                 model_col=Parameter.description),
             Col(self, 'value', model_col=Measurement.value),
         ]
     return Values.col_defs(self)
Exemplo n.º 14
0
 def col_defs(self):
     cols = Sources.col_defs(self)
     provider = LinkCol(self,
                        'provider',
                        choices=get_distinct_values(Provider.name),
                        model_col=Provider.name,
                        get_object=lambda i: i.provider)
     return cols[:-1] + [provider]
Exemplo n.º 15
0
 def col_defs(self):
     return [
         LinkCol(self, 'name'),
         Col(self,
             'sound_type',
             model_col=Feature.sound_type,
             choices=get_distinct_values(Feature.sound_type)),
         Col(self,
             'feature',
             model_col=Feature.feature,
             choices=get_distinct_values(Feature.feature)),
         Col(self, 'value', sTitle='Value', model_col=Feature.value),
         Col(self,
             'sounds',
             sTitle='# sounds',
             model_col=Feature.count_sounds),
     ]
Exemplo n.º 16
0
 def col_defs(self):
     return [
         DetailsRowLinkCol(self, 'more'),
         LinkCol(self, 'name', sTitle='Lemma'),
         SemanticDomainCol(self, 'semantic_domain'),
         Col(self, 'part_of_speech',
             choices=get_distinct_values(Entry.ps), model_col=Entry.ps),
     ]
Exemplo n.º 17
0
    def col_defs(self):
        ps = Col(self,
                 'prosodic_structure',
                 sTitle='Prosodic structure',
                 model_col=models.Form.prosodic_structure)
        if self.parameter:
            ps.choices = sorted((c for c, in DBSession.query(
                models.Form.prosodic_structure).join(common.ValueSet).filter(
                    common.ValueSet.parameter == self.parameter).distinct()
                                 if c),
                                key=lambda s: (len(s), s))

        res = [
            Col(self,
                'description',
                sTitle='TPPSR form',
                sClass="object-language"),
            IPACol(self, 'name', sTitle='IPA form', sClass="ipa-text"),
            Col(self,
                'segments',
                sTitle='Segments',
                model_col=models.Form.segments,
                sClass="ipa-text"),
            ps,
        ]
        if self.parameter:
            return [
                DialectCol(self,
                           'dialect',
                           get_object=lambda i: i.valueset.language,
                           model_col=common.Language.name),
                CantonCol(
                    self,
                    'canton',
                    get_object=lambda i: i.valueset.language,
                    choices=get_distinct_values(models.Variety.canton),
                ),
                LinkToMapCol(
                    self, 'm', get_object=lambda i: i.valueset.language),
            ] + res

        if self.language:
            return res + [
                ConceptCol(self,
                           'parameter',
                           sTitle=self.req.translate('Parameter'),
                           model_col=models.Concept.concepticon_gloss,
                           get_object=lambda i: i.valueset.parameter),
                Col(self,
                    'french',
                    sTitle='French gloss',
                    model_col=models.Concept.french_gloss,
                    get_object=lambda i: i.valueset.parameter),
            ]

        return res + [
            ValueSetCol(self, 'valueset', bSearchable=False, bSortable=False),
        ]
Exemplo n.º 18
0
 def col_defs(self):
     return [
         IntegerIdCol(self, 'id', sTitle='ID'),
         LinkCol(self, 'name'),
         Col(self, 'description', sTitle='Definition'),
         Col(self,
             'semantic_field',
             choices=get_distinct_values(ConceptSet.semanticfield),
             model_col=ConceptSet.semanticfield),
         Col(self,
             'ontological_category',
             choices=get_distinct_values(ConceptSet.ontological_category),
             model_col=ConceptSet.ontological_category),
         Col(self,
             'representation',
             sDescription='number of concept lists this concept appears in',
             model_col=ConceptSet.representation),
     ]
Exemplo n.º 19
0
 def col_defs(self):
     return [
         IntegerIdCol(self, 'id', sTitle='ID'),
         LinkCol(self, 'name'),
         Col(self, 'description', sTitle='Definition'),
         Col(self,
             'semantic_field',
             choices=get_distinct_values(ConceptSet.semanticfield),
             model_col=ConceptSet.semanticfield),
         Col(self,
             'ontological_category',
             choices=get_distinct_values(ConceptSet.ontological_category),
             model_col=ConceptSet.ontological_category),
         Col(self,
             'representation',
             sDescription='number of concept lists this concept appears in',
             model_col=ConceptSet.representation),
     ]
Exemplo n.º 20
0
 def col_defs(self):
     return list(
         filter(lambda col: not self.semanticfield or col.name != 'sf', [
             LWTCodeCol(self, 'lwt_code'),
             LinkCol(
                 self,
                 'name',
                 sTitle='Meaning',
                 sDescription=
                 "This column shows the labels of the Loanword Typology "
                 "meanings. By clicking on a meaning label, you get more information "
                 "about the meaning, as well as a list of all words that are counterparts "
                 "of that meaning."),
             CoreListCol(self, 'core_list'),
             Col(self,
                 'cat',
                 sTitle='Semantic category',
                 sDescription=
                 "Meanings were assigned to semantic categories with "
                 "word-class-like labels: nouns, verbs, adjectives, adverbs, function "
                 "words. No claim is made about the grammatical behavior of words "
                 "corresponding to these meanings. The categories are intended to be "
                 "purely semantic.",
                 model_col=Meaning.semantic_category,
                 choices=get_distinct_values(Meaning.semantic_category)),
             SemanticFieldCol(
                 self,
                 'sf',
                 sTitle='Semantic field',
                 sDescription=
                 "The first 22 fields are the fields of the Intercontinental "
                 "Dictionary Series meaning list, proposed by Mary Ritchie Key, and "
                 "ultimately based on Carl Darling Buck's (1949) Dictionary of selected "
                 "synonyms in the principal Indo-European languages. The other two fields "
                 "were added for the Loanword Typology project."),
             MeaningScoreCol(self,
                             'borrowed_score',
                             sDescription=literal(
                                 '%s' % hb_borrowed_score())),
             MeaningScoreCol(self,
                             'age_score',
                             sDescription=literal('%s' % hb_age_score())),
             MeaningScoreCol(self,
                             'simplicity_score',
                             sDescription=literal(
                                 '%s' % hb_simplicity_score())),
             Col(self,
                 'representation',
                 model_col=Meaning.representation,
                 sDescription=
                 "This column shows how many counterparts for this meaning "
                 "there are in the 41 languages. The number can be higher than 41 because "
                 "a language may have several counterparts for one meaning (\"synonyms\"),"
                 " and it may be lower than 41, because not all languages may have a "
                 "counterpart for a meaning. "),
         ]))
Exemplo n.º 21
0
 def col_defs(self):
     return [
         RecipientCol(self, 'recipient', sTitle='Recipient language'),
         DonorCol(self, 'donor', sTitle='Donor language'),
         Col(self, 'count_borrowed', sTitle='Number of borrowed affixes'),
         Col(self, 'count_interrel', sTitle='Number of interrelated affixes'),
         Col(self, 'area', choices=get_distinct_values(Pair.area)),
         ReliabilityCol(self, 'reliability'),
         LinkCol(self, 'details', model_col=Pair.name),
     ]
Exemplo n.º 22
0
 def col_defs(self):
     cols = Sources.col_defs(self)
     provider = LinkCol(
         self,
         "provider",
         choices=get_distinct_values(Provider.name),
         model_col=Provider.name,
         get_object=lambda i: i.provider,
     )
     return cols[:-1] + [provider]
Exemplo n.º 23
0
 def col_defs(self):
     return [
         DetailsRowLinkCol(self, '#', button_text='view'),
         Col(self, 'name', format=wrap_fname),
         ViewCol(self, 'view'),
         Col(self, 'size', format=lambda i: util.format_size(i)),
         Col(self, 'mime_type', sTitle='media type', choices=get_distinct_values(models.File.mime_type)),
         Col(self, 'date', model_col=models.File.date_created, bSearchable=False),
         # TODO: link to download!
         Col(self, 'id', sTitle='MD5 checksum'),
     ]
Exemplo n.º 24
0
 def col_defs(self):
     return [
         IdCol(self, 'id'),
         LinkCol(self, 'name', sTitle='Concept'),
         Col(self, 'Languages', model_col=Concept.representation),
         Col(self,
             'semantic_field',
             model_col=Concept.semanticfield,
             choices=get_distinct_values(Concept.semanticfield)),
         ConcepticonLink(self, 'Concepticon'),
     ]
Exemplo n.º 25
0
    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')

        def li(label, label_class, input_class, onclick, type_='checkbox', name='', checked=False):
            input_attrs = dict(
                type=type_,
                class_=input_class + ' inline',
                name=name,
                value=label,
                onclick=onclick)
            if checked:
                input_attrs['checked'] = 'checked'
            return HTML.label(
                HTML.input(**input_attrs),
                ' ',
                label,
                class_="%s" % label_class,
                style="margin-left:5px; margin-right:5px;",
            )

        def lexifier_li(lexifier):
            return li(
                lexifier,
                'stay-open',
                'stay-open lexifier',
                JS("APICS.toggle_languages")(self.eid),
                type_='radio',
                name='lexifier')

        for legend in super(FeatureMap, self).get_legends():
            yield legend

        items = [li(
            '--any--',
            'stay-open',
            'stay-open lexifier',
            JS("APICS.toggle_languages")(self.eid),
            type_="radio",
            name='lexifier',
            checked=True)]
        for l in get_distinct_values(
            Lect.lexifier, key=lambda v: 'z' + v if v == 'Other' else v
        ):
            items.append(lexifier_li(l))

        yield Legend(self, 'lexifier', items, stay_open=True)
Exemplo n.º 26
0
 def col_defs(self):
     return [
         LinkCol(self, 'name', sTitle='Concept'),
         Col(self, 'indonesian',
             model_col=Concept.indonesian,
             bSearchable=True),
         Col(self, '# lects', model_col=Concept.representation,
             bSearchable=False,
             sDescription='<small>The number of languages where this concept is given</small>'),
         Col(self, 'semantic_field', model_col=Concept.semanticfield, choices=get_distinct_values(Concept.semanticfield)),
         ConcepticonLink(self, 'Concepticon'),
     ]
Exemplo n.º 27
0
 def col_defs(self):
     return [
         IdCol(self, 'id', sTitle='Code'),
         LinkCol(self, 'name'),
         BiomeCol(self, 'category'),
         Col(self, 'status',
             sDescription=Ecoregion.gbl_stat.doc,
             model_col=Ecoregion.gbl_stat,
             choices=get_distinct_values(Ecoregion.gbl_stat)),
         LinkToMapCol(self, 'm', sTitle=''),
         Col(self, 'w', sTitle='', format=lambda i: external_link(i.wwf_url(), 'WWF'))
     ]
Exemplo n.º 28
0
 def col_defs(self):
     return [
         IdCol(self, "id"),
         LinkCol(self, "name", sTitle="Concept"),
         Col(self, "Languages", model_col=Concept.representation),
         Col(
             self,
             "semantic_field",
             model_col=Concept.semanticfield,
             choices=get_distinct_values(Concept.semanticfield),
         ),
         ConcepticonLink(self, "Concepticon"),
     ]
Exemplo n.º 29
0
 def col_defs(self):
     return [
         Col(self, 'ID', model_col=common.Parameter.id),
         LinkCol(self, 'gloss', model_col=common.Parameter.name),
         Col(self, 'domain',
             choices=get_distinct_values(models.Domain.name),
             get_object=lambda i: i.subdomain.domain,
             model_col=models.Domain.name),
         Col(self, 'subdomain',
             choices=get_distinct_values(models.Subdomain.name),
             get_object=lambda i: i.subdomain,
             model_col=models.Subdomain.name),
         ConcepticonCol(
             self, 'concepticon',
             input_size='mini',
             model_col=models.Concept.concepticon_id),
         TsammalexCol(
             self, 'tsammalex',
             input_size='mini',
             model_col=models.Concept.tsammalex_taxon),
         ImagesCol(self, 'images', model_col=models.Concept.count_images),
         VideosCol(self, 'videos', model_col=models.Concept.count_videos),
     ]
Exemplo n.º 30
0
 def col_defs(self):
     return [
         DetailsRowLinkCol(self, '#', button_text='watch'),
         Col(self, 'name'),
         Col(self, 'description', sTitle='Category', choices=get_distinct_values(models.Movie.description)),
         Col(self, 'duration', format=lambda i: util.format_duration(i)),
         PlaceCol(self, 'place'),
         #
         # TODO: avi/qt/mp4
         #
         FileCol(self, 'mp4'),
         FileCol(self, 'quicktime'),
         FileCol(self, 'avi', subtype='x-msvideo'),
     ]
Exemplo n.º 31
0
 def col_defs(self):
     return [
         LinkCol(self, 'name'),
         Col(self,
             '#',
             bSearchable=False,
             sDescription='Number of inventories',
             model_col=Variety.count_inventories),
         FamilyCol(self, 'family', Variety),
         Col(self, 'latitude'),
         Col(self, 'longitude'),
         Col(self, 'macroarea',
             model_col=Variety.macroarea,
             choices=get_distinct_values(Variety.macroarea)),
     ]
Exemplo n.º 32
0
 def col_defs(self):
     return [
         DetailsRowLinkCol(self, 'd'),
         LinkCol(self, 'name'),
         Col(self, 'description', sTitle='Title'),
         Col(self, 'year', input_size='mini'),
         Col(self, 'author'),
         Col(self, 'DLP', sTitle='DLP', model_col=models.Document.project_doc),
         Col(self, 'type',
             input_size='mini',
             model_col=models.Document.doctype,
             choices=get_distinct_values(models.Document.doctype)),
         DocumentCol(self, '#'),
         TypeCol(self, 'bibtex_type'),
     ]
Exemplo n.º 33
0
 def col_defs(self):
     type_col = Col(self,
                    'type',
                    model_col=models.Experiment.type,
                    choices=get_distinct_values(models.Experiment.type))
     if self.parameter:
         return [
             ValueNameCol(self, 'value'),
             LinkCol(self,
                     'language',
                     model_col=Language.name,
                     get_object=lambda i: i.valueset.language),
             Col(self,
                 'sample_size',
                 model_col=models.Experiment.sample_size),
             type_col,
             RefsCol(self, 'source'),
             DetailsRowLinkCol(self, '#', button_text='abstract'),
         ]
     if self.language:
         return [
             ValueNameCol(self, 'value'),
             Col(self,
                 'sample_size',
                 model_col=models.Experiment.sample_size),
             type_col,
             LinkCol(self,
                     'parameter',
                     model_col=Parameter.name,
                     get_object=lambda i: i.valueset.parameter),
             RefsCol(self, 'source'),
             DetailsRowLinkCol(self, '#', button_text='abstract'),
         ]
     return [
         ValueNameCol(self, 'value'),
         LinkCol(self,
                 'language',
                 model_col=Language.name,
                 get_object=lambda i: i.valueset.language),
         Col(self, 'sample_size', model_col=models.Experiment.sample_size),
         type_col,
         LinkCol(self,
                 'parameter',
                 model_col=Parameter.name,
                 get_object=lambda i: i.valueset.parameter),
         RefsCol(self, 'source'),
         DetailsRowLinkCol(self, '#', button_text='abstract'),
     ]
Exemplo n.º 34
0
 def col_defs(self):
     return [
         LinkCol(self, 'name'),
         IdCol(self, 'id', sTitle='WALS code', sClass='left'),
         Col(self, 'iso_codes', sTitle='ISO 639-3', model_col=WalsLanguage.iso_codes),
         LinkCol(self, 'genus', model_col=Genus.name, get_object=lambda i: i.genus),
         LinkCol(self, 'family',
                 model_col=Family.name,
                 get_object=lambda i: i.genus.family),
         Col(self, 'macroarea',
             model_col=WalsLanguage.macroarea,
             choices=get_distinct_values(WalsLanguage.macroarea)),
         Col(self, 'latitude'),
         Col(self, 'longitude'),
         CountriesCol(self, 'countries'),
     ]
Exemplo n.º 35
0
 def col_defs(self):
     cols= [
         LinkCol(
             self, 'language', model_col=common.Language.name,
             get_obj=lambda i: i.language),
         LinkCol(self, 'name'),
         Col(self, 'description'),
     ]
     if not self.crossgramdata:
         cols.append(LinkCol(
             self,
             'contribution',
             model_col=models.CrossgramData.name,
             get_obj=lambda i: i.contribution,
             choices=get_distinct_values(models.CrossgramData.name)))
     return cols
Exemplo n.º 36
0
 def col_defs(self):
     return [
         LinkCol(self, 'name'),
         Col(self,
             '#',
             bSearchable=False,
             sDescription='Number of inventories',
             model_col=Variety.count_inventories),
         FamilyCol(self, 'family', Variety),
         Col(self, 'latitude'),
         Col(self, 'longitude'),
         Col(self,
             'macroarea',
             model_col=Variety.macroarea,
             choices=get_distinct_values(Variety.macroarea)),
     ]
Exemplo n.º 37
0
 def col_defs(self):
     return [
         IdCol(self, 'id', sTitle='Code'),
         LinkCol(self, 'name'),
         BiomeCol(self, 'category'),
         Col(self,
             'status',
             sDescription=Ecoregion.gbl_stat.doc,
             model_col=Ecoregion.gbl_stat,
             choices=get_distinct_values(Ecoregion.gbl_stat)),
         LinkToMapCol(self, 'm', sTitle=''),
         Col(self,
             'w',
             sTitle='',
             format=lambda i: external_link(i.wwf_url(), 'WWF'))
     ]
Exemplo n.º 38
0
 def col_defs(self):
     return [
         LinkCol(self, 'name', sTitle=self.req._('Name')),
         Col(self,
             'Island',
             sTitle=self.req._('Island'),
             model_col=models.Variety.island,
             choices=get_distinct_values(models.Variety.island)),
         Col(self,
             'latitude',
             sDescription='<small>The geographic latitude</small>'),
         Col(self,
             'longitude',
             sDescription='<small>The geographic longitude</small>'),
         LinkToMapCol(self, 'm'),
     ]
Exemplo n.º 39
0
 def col_defs(self):
     res = [
         LinkCol(self, 'name'),
     ]
     if not self.contribution:
         res.append(
             LinkCol(self,
                     'featurelist',
                     model_col=Contribution.name,
                     choices=get_distinct_values(Contribution.name),
                     get_object=lambda o: o.valueset.contribution))
     if not self.parameter:
         res.append(
             LinkCol(self,
                     'metafeature',
                     model_col=Parameter.name,
                     get_object=lambda o: o.valueset.parameter))
     return res
Exemplo n.º 40
0
 def col_defs(self):
     res = [
         LinkCol(self, 'name', sTitle='primary text', sClass="object-language"),
         TsvCol(self, 'analyzed', sTitle='analyzed text'),
         TsvCol(self, 'gloss', sTitle='gloss', sClass="gloss"),
         Col(self,
             'description',
             sTitle=self.req.translate('translation'),
             sClass="translation"),
         DetailsRowLinkCol(self, 'd', button_text='show', sTitle='IGT'),
     ]
     if not self.dictionary:
         res.insert(-1, LinkCol(
             self,
             'dictionary',
             model_col=Dictionary.name,
             get_obj=lambda i: i.dictionary,
             choices=get_distinct_values(Dictionary.name)))
     return res
Exemplo n.º 41
0
 def col_defs(self):
     return [
         LinkToMapCol(self, 'm'),
         LinkCol(self, 'name'),
         SubGroupCol(self,
                     'subfamily',
                     choices=get_distinct_values(models.Doculect.subfamily),
                     model_col=models.Doculect.subfamily),
         Col(self, 'glottocode', model_col=models.Doculect.glotto_code),
         Col(self,
             'isocode',
             sTitle='ISO Code',
             model_col=models.Doculect.iso_code),
         Col(self,
             'latitude',
             sDescription='<small>The geographic latitude</small>'),
         Col(self,
             'longitude',
             sDescription='<small>The geographic longitude</small>'),
     ]
Exemplo n.º 42
0
 def col_defs(self):
     res = [
         LinkCol(self, 'name', sTitle='primary text', sClass="object-language"),
         TsvCol(self, 'analyzed', sTitle='analyzed text'),
         TsvCol(self, 'gloss', sTitle='gloss', sClass="gloss"),
         Col(self,
             'description',
             sTitle=self.req.translate('translation'),
             sClass="translation"),
     ]
     if self.dictionary and self.dictionary.count_example_audio:
         res.append(MediaCol(self, 'exaudio', 'audio', sTitle=''))
     res.append(DetailsRowLinkCol(self, 'd', button_text='show', sTitle='IGT'))
     if not self.dictionary:
         res.insert(-1, LinkCol(
             self,
             'dictionary',
             model_col=Dictionary.name,
             get_obj=lambda i: i.dictionary,
             choices=get_distinct_values(Dictionary.name)))
     return res
Exemplo n.º 43
0
 def col_defs(self):
     return list(filter(lambda col: not self.semanticfield or col.name != 'sf', [
         LWTCodeCol(self, 'lwt_code'),
         LinkCol(
             self, 'name', sTitle='Meaning',
             sDescription="This column shows the labels of the Loanword Typology "
             "meanings. By clicking on a meaning label, you get more information "
             "about the meaning, as well as a list of all words that are counterparts "
             "of that meaning."),
         CoreListCol(self, 'core_list'),
         Col(self, 'cat', sTitle='Semantic category',
             sDescription="Meanings were assigned to semantic categories with "
             "word-class-like labels: nouns, verbs, adjectives, adverbs, function "
             "words. No claim is made about the grammatical behavior of words "
             "corresponding to these meanings. The categories are intended to be "
             "purely semantic.",
             model_col=Meaning.semantic_category,
             choices=get_distinct_values(Meaning.semantic_category)),
         SemanticFieldCol(
             self, 'sf', sTitle='Semantic field',
             sDescription="The first 22 fields are the fields of the Intercontinental "
             "Dictionary Series meaning list, proposed by Mary Ritchie Key, and "
             "ultimately based on Carl Darling Buck's (1949) Dictionary of selected "
             "synonyms in the principal Indo-European languages. The other two fields "
             "were added for the Loanword Typology project."),
         MeaningScoreCol(
             self, 'borrowed_score', sDescription='%s' % hb_borrowed_score()),
         MeaningScoreCol(
             self, 'age_score', sDescription='%s' % hb_age_score()),
         MeaningScoreCol(
             self, 'simplicity_score', sDescription='%s' % hb_simplicity_score()),
         Col(self, 'representation',
             model_col=Meaning.representation,
             sDescription="This column shows how many counterparts for this meaning "
             "there are in the 41 languages. The number can be higher than 41 because "
             "a language may have several counterparts for one meaning (\"synonyms\"),"
             " and it may be lower than 41, because not all languages may have a "
             "counterpart for a meaning. "),
     ]))
Exemplo n.º 44
0
 def col_defs(self):
     return [
         LinkCol(self, 'name'),
         IdCol(self, 'id', sTitle='WALS code', sClass='left'),
         Col(self,
             'iso_codes',
             sTitle='ISO 639-3',
             model_col=WalsLanguage.iso_codes),
         LinkCol(self,
                 'genus',
                 model_col=Genus.name,
                 get_object=lambda i: i.genus),
         LinkCol(self,
                 'family',
                 model_col=Family.name,
                 get_object=lambda i: i.genus.family),
         Col(self,
             'macroarea',
             model_col=WalsLanguage.macroarea,
             choices=get_distinct_values(WalsLanguage.macroarea)),
         Col(self, 'latitude'),
         Col(self, 'longitude'),
         CountriesCol(self, 'countries'),
     ]
Exemplo n.º 45
0
 def __init__(self, dt, name, **kw):
     kw.setdefault('sTitle', dt.req.translate('Type'))
     kw.setdefault('choices', get_distinct_values(Sentence.type))
     super(TypeCol, self).__init__(dt, name, **kw)
Exemplo n.º 46
0
 def __init__(self, dt, name, language_cls, **kw):
     self._col = getattr(language_cls, 'macroarea')
     kw['choices'] = get_distinct_values(self._col)
     self.language_cls = language_cls
     Col.__init__(self, dt, name, **kw)
Exemplo n.º 47
0
 def __init__(self, dt, name, model_col, **kw):
     kw['model_col'] = model_col
     kw['choices'] = get_distinct_values(model_col)
     super(ClassCol, self).__init__(dt, name, **kw)
Exemplo n.º 48
0
 def __init__(self, dt, name, **kw):
     kw['choices'] = get_distinct_values(Languoid.lineage)
     kw['model_col'] = Languoid.lineage
     Col.__init__(self, dt, name, **kw)
Exemplo n.º 49
0
 def __init__(self, dt, name, cls, attribute = 'combinatory_status', **kw):
     self._col = getattr(cls, attribute)
     self.attribute = attribute
     kw['choices'] = get_distinct_values(self._col)
     Col.__init__(self, dt, name, **kw)
Exemplo n.º 50
0
 def __init__(self, dt, name, **kw):
     kw.setdefault('sTitle', dt.req.translate('Type'))
     kw.setdefault('choices', get_distinct_values(Sentence.type))
     super(TypeCol, self).__init__(dt, name, **kw)
Exemplo n.º 51
0
 def __init__(self, dt, name, **kw):
     kw['sFilter'] = LanguoidStatus.established.value
     kw['choices'] = get_distinct_values(Languoid.status)
     super(StatusCol, self).__init__(dt, name, **kw)
Exemplo n.º 52
0
    def col_defs(self):
        name_col = ValueNameCol(self, 'value')
        if self.parameter and self.parameter.domain:
            name_col.choices = [(de.name, de.description)
                                for de in self.parameter.domain]

        cols = []
        if self.parameter:
            cols = [
                LinkCol(self,
                        'Name',
                        model_col=common.Language.name,
                        get_object=lambda i: i.valueset.language),
                Col(self,
                    'Glottocode',
                    model_col=common.Language.id,
                    get_object=lambda i: i.valueset.language),
                LinkCol(
                    self,
                    'Contributor',
                    model_col=common.Contributor.name,
                    get_object=lambda i: i.valueset.contribution.
                    contributor_assocs[0].contributor,
                )
            ]
        elif self.language:
            cols = [
                IdCol(self,
                      'Feature Id',
                      sClass='left',
                      model_col=common.Parameter.id,
                      get_object=lambda i: i.valueset.parameter),
                LinkCol(self,
                        'Feature',
                        model_col=common.Parameter.name,
                        get_object=lambda i: i.valueset.parameter)
            ]
        elif self.family:
            cols = [
                LinkCol(self,
                        'Name',
                        model_col=common.Language.name,
                        get_object=lambda i: i.valueset.language)
            ]
            if not self.feature:
                cols.extend([
                    IdCol(self,
                          'Feature Id',
                          sClass='left',
                          model_col=common.Parameter.id,
                          get_object=lambda i: i.valueset.parameter),
                    LinkCol(
                        self,
                        'Feature',
                        model_col=common.Parameter.name,
                        get_object=lambda i: i.valueset.parameter,
                        choices=get_distinct_values(common.Parameter.name),
                    )
                ])

        cols = cols + [
            name_col,
            RefsCol(self,
                    'Source',
                    model_col=common.ValueSet.source,
                    get_object=lambda i: i.valueset),
            Col(self, 'Comment', model_col=common.Value.description),
            #Col(self, 'Contributed By', model_col=common.Contribution.name,
            #        get_object=lambda i: i.valueset.contribution)
        ]
        return cols
Exemplo n.º 53
0
 def __init__(self, dt, name, **kw):
     kw['choices'] = [(sd, sd.replace('_', ' ')) for sd in get_distinct_values(Entry.sd)]
     kw['model_col'] = Entry.sd
     Col.__init__(self, dt, name, **kw)
Exemplo n.º 54
0
    def col_defs(self):
        get_word = lambda item: item.word
        get_vocabulary = lambda item: item.valueset.contribution
        get_meaning = lambda item: item.valueset.parameter
        word_form_col = LinkCol(
            self, 'word_form',
            model_col=Word.name,
            get_object=get_word,
            sDescription="<p>The word is given in the usual orthography or "
            "transcription, and in the usual citation form.</p><p>Click on a word to "
            "get more information than is shown in this table.</p>")
        borrowed_col = Col(
            self, 'borrowed', sTitle='Borrowed status',
            model_col=Word.borrowed,
            get_object=get_word,
            choices=get_distinct_values(Word.borrowed),
            sDescription="<p>There are five borrowed statuses, reflecting decreasing "
            "likelihood that the word is a loanword:</p><ol>"
            "<li>clearly borrowed</li><li>probably borrowed</li><li>perhaps borrowed</li>"
            "<li>very little evidence for borrowing</li>"
            "<li>no evidence for borrowing</li></ol>")

        if self.parameter:
            return [
                IntegerIdCol(
                    self, 'vocid',
                    sTitle='Voc. ID',
                    model_col=common.Contribution.id,
                    get_object=get_vocabulary,
                    sDescription="The vocabulary ID corresponds to the ordering to the "
                    "chapters on the book <em>Loanwords in the World's Languages</em>. "
                    "Languages are listed in rough geographical order from west to east, "
                    "from Africa via Europe to Asia and the Americas, so that "
                    "geographically adjacent languages are next to each other."),
                VocabularyCol(self, 'vocabulary', get_object=get_vocabulary),
                word_form_col,
                borrowed_col,
                CounterpartScoreCol(self, 'borrowed_score'),
                CounterpartScoreCol(self, 'age_score'),
                CounterpartScoreCol(self, 'simplicity_score'),
            ]
        if self.contribution:
            return [
                word_form_col,
                LWTCodeCol(
                    self, 'lwt_code',
                    get_object=get_meaning),
                LinkCol(
                    self, 'meaning',
                    model_col=common.Parameter.name,
                    get_object=get_meaning,
                    sDescription="This column shows the labels of the Loanword Typology "
                    "meanings. By clicking on a meaning label, you get more information "
                    "about the meaning, as well as a list of all words that are "
                    "counterparts of that meaning."),
                CoreListCol(self, 'core_list', get_object=get_meaning),
                borrowed_col,
                SourceWordsCol(
                    self, 'source_words',
                    bSearchable=False,
                    bSortable=False,
                    sDescription="For (possible) loanwords, this column shows the words "
                    "in the source languages that served as models."),
            ]

        return []  # pragma: no cover
Exemplo n.º 55
0
    def col_defs(self):
        get_word = lambda item: item.word
        get_vocabulary = lambda item: item.valueset.contribution
        get_meaning = lambda item: item.valueset.parameter
        word_form_col = LinkCol(
            self,
            'word_form',
            model_col=Word.name,
            get_object=get_word,
            sDescription=literal(
                "<p>The word is given in the usual orthography or "
                "transcription, and in the usual citation form.</p><p>Click on a word to "
                "get more information than is shown in this table.</p>"))
        borrowed_col = Col(
            self,
            'borrowed',
            sTitle='Borrowed status',
            model_col=Word.borrowed,
            get_object=get_word,
            choices=get_distinct_values(Word.borrowed),
            sDescription=literal(
                "<p>There are five borrowed statuses, reflecting decreasing "
                "likelihood that the word is a loanword:</p><ol>"
                "<li>clearly borrowed</li><li>probably borrowed</li><li>perhaps borrowed</li>"
                "<li>very little evidence for borrowing</li>"
                "<li>no evidence for borrowing</li></ol>"))

        if self.parameter:
            return [
                IntegerIdCol(
                    self,
                    'vocid',
                    sTitle='Voc. ID',
                    model_col=common.Contribution.id,
                    get_object=get_vocabulary,
                    sDescription=
                    "The vocabulary ID corresponds to the ordering to the "
                    "chapters on the book <em>Loanwords in the World's Languages</em>. "
                    "Languages are listed in rough geographical order from west to east, "
                    "from Africa via Europe to Asia and the Americas, so that "
                    "geographically adjacent languages are next to each other."
                ),
                VocabularyCol(self, 'vocabulary', get_object=get_vocabulary),
                word_form_col,
                borrowed_col,
                CounterpartScoreCol(self, 'borrowed_score'),
                CounterpartScoreCol(self, 'age_score'),
                CounterpartScoreCol(self, 'simplicity_score'),
            ]
        if self.contribution:
            return [
                word_form_col,
                LWTCodeCol(self, 'lwt_code', get_object=get_meaning),
                LinkCol(
                    self,
                    'meaning',
                    model_col=common.Parameter.name,
                    get_object=get_meaning,
                    sDescription=
                    "This column shows the labels of the Loanword Typology "
                    "meanings. By clicking on a meaning label, you get more information "
                    "about the meaning, as well as a list of all words that are "
                    "counterparts of that meaning."),
                CoreListCol(self, 'core_list', get_object=get_meaning),
                borrowed_col,
                SourceWordsCol(
                    self,
                    'source_words',
                    bSearchable=False,
                    bSortable=False,
                    sDescription=
                    "For (possible) loanwords, this column shows the words "
                    "in the source languages that served as models."),
            ]

        return []  # pragma: no cover
Exemplo n.º 56
0
    def col_defs(self):
        kw = {}
        if self.language:
            kw['bSearchable'] = False
            kw['bSortable'] = False
        name_col = ApicsValueNameCol(self, 'value', **kw)
        if self.parameter and self.parameter.domain:
            name_col.choices = [de.name for de in self.parameter.domain]

        class ValueLanguageCol(LinkCol):
            def search(self, qs):
                if self.dt.language:
                    return ValueSet.language_pk == int(qs)
                if self.dt.parameter:
                    return icontains(self.dt.vs_lang.name, qs)

            def order(self):
                if self.dt.parameter:
                    return cast(self.dt.vs_lang.id, Integer)
                if self.dt.language:
                    return ValueSet.language_pk

        lang_col = ValueLanguageCol(
            self,
            'language',
            model_col=Language.name,
            get_obj=lambda item: item.valueset.language,
            bSearchable=bool(self.parameter or self.language),
            bSortable=bool(self.parameter or self.language))
        if self.language:
            if self.language.lects:
                lang_col.choices = [
                    (l.pk, l.name) for l in [self.language] + self.language.lects]
                lang_col.js_args['sTitle'] = 'lect'
            else:
                lang_col = None

        get_param = lambda i: i.valueset.parameter
        if self.parameter:
            return nfilter([
                lang_col,
                name_col,
                Col(self,
                    'lexifier',
                    format=lambda i: i.valueset.language.lexifier,
                    model_col=self.vs_lect.lexifier,
                    choices=get_distinct_values(
                        Lect.lexifier,
                        key=lambda v: 'z' + v if v == 'Other' else v)),
                LinkToMapCol(
                    self, 'm', get_object=lambda i: None
                    if i.valueset.language.language_pk else i.valueset.language),
                DetailsRowLinkCol(self, 'more')
                if self.parameter.feature_type != 'sociolinguistic' else None,
                RefsCol(self, 'source')
                if self.parameter.feature_type != 'segment' else None,
            ])
        if self.language:
            return nfilter([
                IntegerIdCol(self, 'id', get_obj=get_param, model_col=Parameter.id),
                LinkCol(self, 'parameter', get_obj=get_param, model_col=Parameter.name),
                name_col,
                lang_col,
                DetailsRowLinkCol(self, 'more'),
                RefsCol(self, 'source'),
            ])
        return [
            LinkCol(self, 'parameter', get_obj=get_param, model_col=Parameter.name),
            name_col,
            lang_col,
            DetailsRowLinkCol(self, 'more'),
            RefsCol(self, 'source'),
        ]
Exemplo n.º 57
0
 def __init__(self, dt, name, model_col, **kw):
     kw['model_col'] = model_col
     kw['choices'] = get_distinct_values(model_col)
     super(ClassCol, self).__init__(dt, name, **kw)
Exemplo n.º 58
0
 def __init__(self, dt, name, **kw):
     #kw['sFilter'] = LanguoidStatus.
     kw['choices'] = get_distinct_values(Languoid.status)
     super(StatusCol, self).__init__(dt, name, **kw)
Exemplo n.º 59
0
 def __init__(self, dt, name, **kw):
     kw['choices'] = get_distinct_values(Transcription.datatype)
     super(DatatypeCol, self).__init__(dt, name, **kw)