Beispiel #1
0
    def init(cls):
        if 'GardenPlugin' in pluginmgr.plugins:
            species_context_menu.insert(1, add_accession_action)
            vernname_context_menu.insert(1, add_accession_action)

        mapper_search = search.get_strategy('MapperSearch')

        mapper_search.add_meta(('family', 'fam'), Family, ['family'])
        SearchView.row_meta[Family].set(children="genera",
                                        infobox=FamilyInfoBox,
                                        context_menu=family_context_menu)

        mapper_search.add_meta(('genus', 'gen'), Genus, ['genus'])
        SearchView.row_meta[Genus].set(children="species",
                                       infobox=GenusInfoBox,
                                       context_menu=genus_context_menu)

        from functools import partial
        search.add_strategy(SynonymSearch)
        mapper_search.add_meta(
            ('species', 'sp'), Species,
            ['sp', 'sp2', 'infrasp1', 'infrasp2', 'infrasp3', 'infrasp4'])
        SearchView.row_meta[Species].set(children=partial(
            db.natsort, 'accessions'),
                                         infobox=SpeciesInfoBox,
                                         context_menu=species_context_menu)

        mapper_search.add_meta(('vernacular', 'vern', 'common'),
                               VernacularName, ['name'])
        SearchView.row_meta[VernacularName].set(
            children=partial(db.natsort, 'species.accessions'),
            infobox=VernacularNameInfoBox,
            context_menu=vernname_context_menu)

        mapper_search.add_meta(('geography', 'geo'), Geography, ['name'])
        SearchView.row_meta[Geography].set(children=get_species_in_geography)

        ## now it's the turn of the DefaultView
        logger.debug('PlantsPlugin::init, registering splash info box')
        DefaultView.infoboxclass = SplashInfoBox

        if bauble.gui is not None:
            bauble.gui.add_to_insert_menu(FamilyEditor, _('Family'))
            bauble.gui.add_to_insert_menu(GenusEditor, _('Genus'))
            bauble.gui.add_to_insert_menu(SpeciesEditorMenuItem, _('Species'))

        if sys.platform == 'win32':
            # TODO: for some reason using the cross as the hybrid
            # character doesn't work on windows
            Species.hybrid_char = 'x'
Beispiel #2
0
    def init(cls):
        if 'GardenPlugin' in pluginmgr.plugins:
            species_context_menu.insert(1, add_accession_action)
            vernname_context_menu.insert(1, add_accession_action)

        mapper_search = search.get_strategy('MapperSearch')

        mapper_search.add_meta(('family', 'fam'), Family, ['family'])
        SearchView.row_meta[Family].set(children="genera",
                                        infobox=FamilyInfoBox,
                                        context_menu=family_context_menu)

        mapper_search.add_meta(('genus', 'gen'), Genus, ['genus'])
        SearchView.row_meta[Genus].set(children="species",
                                       infobox=GenusInfoBox,
                                       context_menu=genus_context_menu)

        from functools import partial
        search.add_strategy(SynonymSearch)
        mapper_search.add_meta(('species', 'sp'), Species,
                               ['sp', 'sp2', 'infrasp1', 'infrasp2',
                                'infrasp3', 'infrasp4'])
        SearchView.row_meta[Species].set(
            children=partial(db.natsort, 'accessions'),
            infobox=SpeciesInfoBox,
            context_menu=species_context_menu)

        mapper_search.add_meta(('vernacular', 'vern', 'common'),
                               VernacularName, ['name'])
        SearchView.row_meta[VernacularName].set(
            children=partial(db.natsort, 'species.accessions'),
            infobox=VernacularNameInfoBox,
            context_menu=vernname_context_menu)

        mapper_search.add_meta(('geography', 'geo'), Geography, ['name'])
        SearchView.row_meta[Geography].set(children=get_species_in_geography)

        ## now it's the turn of the DefaultView
        logger.debug('PlantsPlugin::init, registering splash info box')
        DefaultView.infoboxclass = SplashInfoBox

        if bauble.gui is not None:
            bauble.gui.add_to_insert_menu(FamilyEditor, _('Family'))
            bauble.gui.add_to_insert_menu(GenusEditor, _('Genus'))
            bauble.gui.add_to_insert_menu(SpeciesEditorMenuItem, _('Species'))

        if sys.platform == 'win32':
            # TODO: for some reason using the cross as the hybrid
            # character doesn't work on windows
            Species.hybrid_char = 'x'
    def init(cls):
        if 'GardenPlugin' in pluginmgr.plugins:
            species_context_menu.insert(1, add_accession_action)
            vernname_context_menu.insert(1, add_accession_action)

        mapper_search = search.get_strategy('MapperSearch')

        mapper_search.add_meta(('family', 'fam'), Family, ['family'])
        SearchView.view_meta[Family].set(children="genera",
                                         infobox=FamilyInfoBox,
                                         context_menu=family_context_menu,
                                         markup_func=family_markup_func)

        mapper_search.add_meta(('genus', 'gen'), Genus, ['genus'])
        SearchView.view_meta[Genus].set(children="species",
                                        infobox=GenusInfoBox,
                                        context_menu=genus_context_menu,
                                        markup_func=genus_markup_func)

        search.add_strategy(SynonymSearch)
        mapper_search.add_meta(('species', 'sp'), Species,
                               ['sp', 'sp2', 'infrasp1', 'infrasp2',
                                'infrasp3', 'infrasp4'])
        SearchView.view_meta[Species].set(children=species_get_kids,
                                          infobox=SpeciesInfoBox,
                                          context_menu=species_context_menu,
                                          markup_func=species_markup_func)

        mapper_search.add_meta(('vernacular', 'vern', 'common'),
                               VernacularName, ['name'])
        SearchView.view_meta[VernacularName].set(
            children=vernname_get_kids,
            infobox=VernacularNameInfoBox,
            context_menu=vernname_context_menu,
            markup_func=vernname_markup_func)

        mapper_search.add_meta(('geography', 'geo'), Geography, ['name'])
        SearchView.view_meta[Geography].set(children=get_species_in_geography)

        if bauble.gui is not None:
            bauble.gui.add_to_insert_menu(FamilyEditor, _('Family'))
            bauble.gui.add_to_insert_menu(GenusEditor, _('Genus'))
            bauble.gui.add_to_insert_menu(SpeciesEditorMenuItem, _('Species'))

        if sys.platform == 'win32':
            # TODO: for some reason using the cross as the hybrid
            # character doesn't work on windows
            Species.hybrid_char = 'x'
Beispiel #4
0
    def init(cls):
        if 'GardenPlugin' in pluginmgr.plugins:
            species_context_menu.insert(1, add_accession_action)
            vernname_context_menu.insert(1, add_accession_action)

        mapper_search = search.get_strategy('MapperSearch')

        mapper_search.add_meta(('family', 'fam'), Family, ['family'])
        SearchView.view_meta[Family].set(children="genera",
                                         infobox=FamilyInfoBox,
                                         context_menu=family_context_menu,
                                         markup_func=family_markup_func)

        mapper_search.add_meta(('genus', 'gen'), Genus, ['genus'])
        SearchView.view_meta[Genus].set(children="species",
                                        infobox=GenusInfoBox,
                                        context_menu=genus_context_menu,
                                        markup_func=genus_markup_func)

        search.add_strategy(SynonymSearch)
        mapper_search.add_meta(
            ('species', 'sp'), Species,
            ['sp', 'sp2', 'infrasp1', 'infrasp2', 'infrasp3', 'infrasp4'])
        SearchView.view_meta[Species].set(children=species_get_kids,
                                          infobox=SpeciesInfoBox,
                                          context_menu=species_context_menu,
                                          markup_func=species_markup_func)

        mapper_search.add_meta(('vernacular', 'vern', 'common'),
                               VernacularName, ['name'])
        SearchView.view_meta[VernacularName].set(
            children=vernname_get_kids,
            infobox=VernacularNameInfoBox,
            context_menu=vernname_context_menu,
            markup_func=vernname_markup_func)

        mapper_search.add_meta(('geography', 'geo'), Geography, ['name'])
        SearchView.view_meta[Geography].set(children=get_species_in_geography)

        if bauble.gui is not None:
            bauble.gui.add_to_insert_menu(FamilyEditor, _('Family'))
            bauble.gui.add_to_insert_menu(GenusEditor, _('Genus'))
            bauble.gui.add_to_insert_menu(SpeciesEditorMenuItem, _('Species'))

        if sys.platform == 'win32':
            # TODO: for some reason using the cross as the hybrid
            # character doesn't work on windows
            Species.hybrid_char = 'x'
Beispiel #5
0
    def init(cls):
        from bauble.plugins.plants import Species
        mapper_search = search.get_strategy('MapperSearch')

        from functools import partial
        mapper_search.add_meta(('accession', 'acc'), Accession, ['code'])
        SearchView.row_meta[Accession].set(
            children=partial(db.natsort, "plants"),
            infobox=AccessionInfoBox,
            context_menu=acc_context_menu)

        mapper_search.add_meta(('location', 'loc'), Location, ['name', 'code'])
        SearchView.row_meta[Location].set(
            children=partial(db.natsort, 'plants'),
            infobox=LocationInfoBox,
            context_menu=loc_context_menu)

        mapper_search.add_meta(('plant', 'plants'), Plant, ['code'])
        search.add_strategy(PlantSearch)  # special search value strategy
        #search.add_strategy(SpeciesSearch)  # special search value strategy
        SearchView.row_meta[Plant].set(
            infobox=PlantInfoBox,
            context_menu=plant_context_menu)

        mapper_search.add_meta(('contact', 'contacts', 'person', 'org',
                                'source'), SourceDetail, ['name'])

        def sd_kids(detail):
            session = object_session(detail)
            results = session.query(Accession).join(Source).\
                join(SourceDetail).options(eagerload('species')).\
                filter(SourceDetail.id == detail.id).all()
            return results
        SearchView.row_meta[SourceDetail].set(
            children=sd_kids,
            infobox=SourceDetailInfoBox,
            context_menu=source_detail_context_menu)

        mapper_search.add_meta(('collection', 'col', 'coll'),
                               Collection, ['locale'])
        coll_kids = lambda coll: sorted(coll.source.accession.plants,
                                        key=utils.natsort_key)
        SearchView.row_meta[Collection].set(
            children=coll_kids,
            infobox=AccessionInfoBox,
            context_menu=collection_context_menu)

        # done here b/c the Species table is not part of this plugin
        SearchView.row_meta[Species].child = "accessions"

        if bauble.gui is not None:
            bauble.gui.add_to_insert_menu(AccessionEditor, _('Accession'))
            bauble.gui.add_to_insert_menu(PlantEditor, _('Plant'))
            bauble.gui.add_to_insert_menu(LocationEditor, _('Location'))
            bauble.gui.add_to_insert_menu(SourceDetailEditor, _('Contact'))

        # if the plant delimiter isn't in the bauble meta then add the default
        import bauble.meta as meta
        meta.get_default(plant_delimiter_key, default_plant_delimiter)

        institution = Institution()
        if not institution.name:
            start_institution_editor()
Beispiel #6
0
    def init(cls):
        from bauble.plugins.plants import Species
        mapper_search = search.get_strategy('MapperSearch')

        from functools import partial
        mapper_search.add_meta(('accession', 'acc'), Accession, ['code'])
        SearchView.row_meta[Accession].set(children=partial(
            db.natsort, "plants"),
                                           infobox=AccessionInfoBox,
                                           context_menu=acc_context_menu)

        mapper_search.add_meta(('location', 'loc'), Location, ['name', 'code'])
        SearchView.row_meta[Location].set(children=partial(
            db.natsort, 'plants'),
                                          infobox=LocationInfoBox,
                                          context_menu=loc_context_menu)

        mapper_search.add_meta(('plant', 'plants'), Plant, ['code'])
        search.add_strategy(PlantSearch)  # special search value strategy
        #search.add_strategy(SpeciesSearch)  # special search value strategy
        SearchView.row_meta[Plant].set(infobox=PlantInfoBox,
                                       context_menu=plant_context_menu)

        mapper_search.add_meta(
            ('contact', 'contacts', 'person', 'org', 'source'), SourceDetail,
            ['name'])

        def sd_kids(detail):
            session = object_session(detail)
            results = session.query(Accession).join(Source).\
                join(SourceDetail).options(eagerload('species')).\
                filter(SourceDetail.id == detail.id).all()
            return results

        SearchView.row_meta[SourceDetail].set(
            children=sd_kids,
            infobox=SourceDetailInfoBox,
            context_menu=source_detail_context_menu)

        mapper_search.add_meta(('collection', 'col', 'coll'), Collection,
                               ['locale'])
        coll_kids = lambda coll: sorted(coll.source.accession.plants,
                                        key=utils.natsort_key)
        SearchView.row_meta[Collection].set(
            children=coll_kids,
            infobox=AccessionInfoBox,
            context_menu=collection_context_menu)

        # done here b/c the Species table is not part of this plugin
        SearchView.row_meta[Species].child = "accessions"

        if bauble.gui is not None:
            bauble.gui.add_to_insert_menu(AccessionEditor, _('Accession'))
            bauble.gui.add_to_insert_menu(PlantEditor, _('Plant'))
            bauble.gui.add_to_insert_menu(LocationEditor, _('Location'))
            #bauble.gui.add_to_insert_menu(ContactEditor, _('Contact'))

        # if the plant delimiter isn't in the bauble meta then add the default
        import bauble.meta as meta
        meta.get_default(plant_delimiter_key, default_plant_delimiter)

        institution = Institution()
        if not institution.name:
            start_institution_editor()