Skip to content
This repository has been archived by the owner on Mar 22, 2018. It is now read-only.

Commit

Permalink
work in progress but functional.
Browse files Browse the repository at this point in the history
  • Loading branch information
mfrasca committed Jan 7, 2016
1 parent 580a1eb commit 23009ce
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 114 deletions.
8 changes: 0 additions & 8 deletions bauble/plugins/plants/family.py
Original file line number Diff line number Diff line change
Expand Up @@ -853,14 +853,6 @@ def update(self, row):
self.set_sensitive(True)


class IPNIFamilyButton(web.IPNIButton):

_base_uri = "http://www.ipni.org/ipni/advPlantNameSearch.do?"\
"find_family=%(family)s&" \
"find_isAPNIRecord=on& find_isGCIRecord=on&" \
"find_isIKRecord=on&output_format=normal"


class FamilyInfoBox(InfoBox):
'''
'''
Expand Down
8 changes: 4 additions & 4 deletions bauble/plugins/plants/genus.py
Original file line number Diff line number Diff line change
Expand Up @@ -1009,10 +1009,10 @@ def __init__(self):
{'name': 'ITISButton', '_base_uri': "http://www.itis.gov/servlet/SingleRpt/SingleRpt?search_topic=Scientific_Name&search_value=%s&search_kingdom=Plant&search_span=containing&categories=All&source=html&search_credRating=All", '_space': '%20', 'title': _("Search ITIS"), 'tooltip': _("Search the Intergrated Taxonomic Information System"), },
{'name': 'GRINButton', '_base_uri': "http://www.ars-grin.gov/cgi-bin/npgs/swish/accboth?query=%s&submit=Submit+Text+Query&si=0", '_space': '+', 'title': _("Search NPGS/GRIN"), 'tooltip': _('Search National Plant Germplasm System'), },
{'name': 'ALAButton', '_base_uri': "http://bie.ala.org.au/search?q=%s", '_space': '+', 'title': _("Search ALA"), 'tooltip': _("Search the Atlas of Living Australia"), },
{'name': 'IPNIButton', '_base_uri': "http://www.ipni.org/ipni/advPlantNameSearch.do?find_genus=%(genus)s&find_species=%(sp)s&find_isAPNIRecord=on& find_isGCIRecord=on&find_isIKRecord=on&output_format=normal", '_space': ' ', 'title': _("Search IPNI"), 'tooltip': _("Search the International Plant Names Index"), },
{'name': 'BGCIButton', '_base_uri': "http://www.bgci.org/plant_search.php?action=Find&ftrGenus=%(genus)s&ftrRedList=&ftrSpecies=%(sp)s&ftrRedList1997=&ftrEpithet=&ftrCWR=&x=0&y=0#results", '_space': ' ', 'title': _("Search BGCI"), 'tooltip': _("Search Botanic Gardens Conservation International"), },
{'name': 'TPLButton', '_base_uri': "http://www.theplantlist.org/tpl1.1/search?q=%(genus)s+%(sp)s", '_space': '+', 'title': _("Search TPL"), 'tooltip': _("Search The Plant List online database"), },
{'name': 'TropicosButton', '_base_uri': "http://tropicos.org/NameSearch.aspx?name=%(genus)s+%(sp)s", '_space': '+', 'title': _("Search Tropicos"), 'tooltip': _("Search Tropicos (MissouriBG) online database"), },
{'name': 'IPNIButton', '_base_uri': "http://www.ipni.org/ipni/advPlantNameSearch.do?find_genus=%(genus)s&find_isAPNIRecord=on& find_isGCIRecord=on&find_isIKRecord=on&output_format=normal", '_space': ' ', 'title': _("Search IPNI"), 'tooltip': _("Search the International Plant Names Index"), },
{'name': 'BGCIButton', '_base_uri': "http://www.bgci.org/plant_search.php?action=Find&ftrGenus=%(genus)s&ftrRedList=&ftrRedList1997=&ftrEpithet=&ftrCWR=&x=0&y=0#results", '_space': ' ', 'title': _("Search BGCI"), 'tooltip': _("Search Botanic Gardens Conservation International"), },
{'name': 'TPLButton', '_base_uri': "http://www.theplantlist.org/tpl1.1/search?q=%(genus)s", '_space': '+', 'title': _("Search TPL"), 'tooltip': _("Search The Plant List online database"), },
{'name': 'TropicosButton', '_base_uri': "http://tropicos.org/NameSearch.aspx?name=%(genus)s", '_space': '+', 'title': _("Search Tropicos"), 'tooltip': _("Search Tropicos (MissouriBG) online database"), },
]
InfoBox.__init__(self)
filename = os.path.join(paths.lib_dir(), 'plugins', 'plants',
Expand Down
10 changes: 5 additions & 5 deletions bauble/plugins/plants/species.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,11 +406,11 @@ def __init__(self):
{'name': 'ITISButton', '_base_uri': "http://www.itis.gov/servlet/SingleRpt/SingleRpt?search_topic=Scientific_Name&search_value=%s&search_kingdom=Plant&search_span=containing&categories=All&source=html&search_credRating=All", '_space': '%20', 'title': _("Search ITIS"), 'tooltip': _("Search the Intergrated Taxonomic Information System"), },
{'name': 'GRINButton', '_base_uri': "http://www.ars-grin.gov/cgi-bin/npgs/swish/accboth?query=%s&submit=Submit+Text+Query&si=0", '_space': '+', 'title': _("Search NPGS/GRIN"), 'tooltip': _('Search National Plant Germplasm System'), },
{'name': 'ALAButton', '_base_uri': "http://bie.ala.org.au/search?q=%s", '_space': '+', 'title': _("Search ALA"), 'tooltip': _("Search the Atlas of Living Australia"), },
{'name': 'WikipediaButton', '_base_uri': "http://en.wikipedia.org/wiki/%(genus)s_%(sp)s", '_space': '+', 'title': _("Search Wikipedia"), 'tooltip': _("open the wikipedia page about this species"), },
{'name': 'IPNIButton', '_base_uri': "http://www.ipni.org/ipni/advPlantNameSearch.do?find_genus=%(genus)s&find_species=%(sp)s&find_isAPNIRecord=on& find_isGCIRecord=on&find_isIKRecord=on&output_format=normal", '_space': ' ', 'title': _("Search IPNI"), 'tooltip': _("Search the International Plant Names Index"), },
{'name': 'BGCIButton', '_base_uri': "http://www.bgci.org/plant_search.php?action=Find&ftrGenus=%(genus)s&ftrRedList=&ftrSpecies=%(sp)s&ftrRedList1997=&ftrEpithet=&ftrCWR=&x=0&y=0#results", '_space': ' ', 'title': _("Search BGCI"), 'tooltip': _("Search Botanic Gardens Conservation International"), },
{'name': 'TPLButton', '_base_uri': "http://www.theplantlist.org/tpl1.1/search?q=%(genus)s+%(sp)s", '_space': '+', 'title': _("Search TPL"), 'tooltip': _("Search The Plant List online database"), },
{'name': 'TropicosButton', '_base_uri': "http://tropicos.org/NameSearch.aspx?name=%(genus)s+%(sp)s", '_space': '+', 'title': _("Search Tropicos"), 'tooltip': _("Search Tropicos (MissouriBG) online database"), },
{'name': 'WikipediaButton', '_base_uri': "http://en.wikipedia.org/wiki/%(genus.genus)s_%(sp)s", '_space': '+', 'title': _("Search Wikipedia"), 'tooltip': _("open the wikipedia page about this species"), },
{'name': 'IPNIButton', '_base_uri': "http://www.ipni.org/ipni/advPlantNameSearch.do?find_genus=%(genus.genus)s&find_species=%(sp)s&find_isAPNIRecord=on& find_isGCIRecord=on&find_isIKRecord=on&output_format=normal", '_space': ' ', 'title': _("Search IPNI"), 'tooltip': _("Search the International Plant Names Index"), },
{'name': 'BGCIButton', '_base_uri': "http://www.bgci.org/plant_search.php?action=Find&ftrGenus=%(genus.genus)s&ftrRedList=&ftrSpecies=%(sp)s&ftrRedList1997=&ftrEpithet=&ftrCWR=&x=0&y=0#results", '_space': ' ', 'title': _("Search BGCI"), 'tooltip': _("Search Botanic Gardens Conservation International"), },
{'name': 'TPLButton', '_base_uri': "http://www.theplantlist.org/tpl1.1/search?q=%(genus.genus)s+%(sp)s", '_space': '+', 'title': _("Search TPL"), 'tooltip': _("Search The Plant List online database"), },
{'name': 'TropicosButton', '_base_uri': "http://tropicos.org/NameSearch.aspx?name=%(genus.genus)s+%(sp)s", '_space': '+', 'title': _("Search Tropicos"), 'tooltip': _("Search Tropicos (MissouriBG) online database"), },
]
super(SpeciesInfoPage, self).__init__()
filename = os.path.join(paths.lib_dir(), 'plugins', 'plants',
Expand Down
101 changes: 4 additions & 97 deletions bauble/utils/web.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class BaubleLinkButton(gtk.LinkButton):
_space = "_"
title = _("Search")
tooltip = None
pt = re.compile(ur'%\(([a-z_]*)\)s')
pt = re.compile(ur'%\(([a-z_\.]*)\)s')

def __init__(self, title=_("Search"), tooltip=None):
super(BaubleLinkButton, self).__init__("", self.title)
Expand All @@ -53,101 +53,8 @@ def set_string(self, row):
else:
values = {}
for key in self.fields:
value = getattr(row, key, '-')
value = row
for step in key.split('.'):
value = getattr(value, step, '-')
values[key] = (value == str(value)) and value or ''
self.set_uri(self._base_uri % values)

set_keywords = set_string


GoogleButton = type(
'GoogleButton', (BaubleLinkButton, ),
{'_base_uri': "http://www.google.com/search?q=%s",
'_space': '+',
'title': _("Search Google"),
'tooltip': None, })


GBIFButton = type(
'GBIFButton', (BaubleLinkButton, ),
{'_base_uri': "http://www.gbif.org/species/search?q=%s",
'_space': '+',
'title': _("Search GBIF"),
'tooltip': _("Search the Global Biodiversity Information Facility"), })


TPLButton = type(
'TPLButton', (BaubleLinkButton, ),
{'_base_uri': "http://www.theplantlist.org/tpl1.1/search?" +
"q=%(genus)s+%(sp)s",
'_space': '+',
'title': _("Search TPL"),
'tooltip': _("Search The Plant List online database"), })


TropicosButton = type(
'TropicosButton', (BaubleLinkButton, ),
{'_base_uri': "http://tropicos.org/NameSearch.aspx?" +
"name=%(genus)s+%(sp)s",
'_space': '+',
'title': _("Search Tropicos"),
'tooltip': _("Search Tropicos (MissouriBG) online database"), })


WikipediaButton = type(
'WikipediaButton', (BaubleLinkButton, ),
{'_base_uri': "http://en.wikipedia.org/wiki/%(genus)s_%(sp)s",
'_space': '+',
'title': _("Search Wikipedia"),
'tooltip': _("open the wikipedia page about this species"), })


ITISButton = type(
'ITISButton', (BaubleLinkButton, ),
{'_base_uri': "http://www.itis.gov/servlet/SingleRpt/SingleRpt?"
"search_topic=Scientific_Name"
"&search_value=%s"
"&search_kingdom=Plant"
"&search_span=containing"
"&categories=All&source=html&search_credRating=All",
'_space': '%20',
'title': _("Search ITIS"),
'tooltip': _("Search the Intergrated Taxonomic Information System"), })


BGCIButton = type(
'BGCIButton', (BaubleLinkButton, ),
{'_base_uri': "http://www.bgci.org/plant_search.php?action=Find"
"&ftrGenus=%(genus)s&ftrRedList=&ftrSpecies=%(sp)s"
"&ftrRedList1997=&ftrEpithet=&ftrCWR=&x=0&y=0#results",
'_space': ' ',
'title': _("Search BGCI"),
'tooltip': _("Search Botanic Gardens Conservation International"), })


IPNIButton = type(
'IPNIButton', (BaubleLinkButton, ),
{'_base_uri': "http://www.ipni.org/ipni/advPlantNameSearch.do?"
"find_genus=%(genus)s&find_species=%(sp)s&"
"find_isAPNIRecord=on& find_isGCIRecord=on&"
"find_isIKRecord=on&output_format=normal",
'_space': ' ',
'title': _("Search IPNI"),
'tooltip': _("Search the International Plant Names Index"), })


GRINButton = type(
'GRINButton', (BaubleLinkButton, ),
{'_base_uri': "http://www.ars-grin.gov/cgi-bin/npgs/swish/accboth?"
"query=%s&submit=Submit+Text+Query&si=0",
'_space': '+',
'title': _("Search NPGS/GRIN"),
'tooltip': _('Search National Plant Germplasm System'), })


ALAButton = type(
'ALAButton', (BaubleLinkButton, ),
{'_base_uri': "http://bie.ala.org.au/search?q=%s",
'_space': '+',
'title': _("Search ALA"),
'tooltip': _("Search the Atlas of Living Australia"), })

0 comments on commit 23009ce

Please sign in to comment.