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

Commit

Permalink
possible solution to #257. needs review and unit testing.
Browse files Browse the repository at this point in the history
also consider #258.
  • Loading branch information
mfrasca committed Jan 5, 2016
1 parent f972205 commit 89ab8ce
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
16 changes: 12 additions & 4 deletions bauble/plugins/garden/accession.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
#
# Copyright 2008-2010 Brett Adams
# Copyright 2015 Mario Frasca <mario@anche.no>.
# Copyright 2015-2016 Mario Frasca <mario@anche.no>.
#
# This file is part of bauble.classic.
#
Expand Down Expand Up @@ -238,10 +238,18 @@ def remove_callback(accessions):


def acc_markup_func(acc):
"""provide the two lines describing object for SearchView row.
it is a global function because it's invoked from a global environment.
see issue #258
"""
Returns str(acc), acc.species_str()
"""
return utils.xml_safe(unicode(acc)), acc.species_str(markup=True)
first, second = utils.xml_safe(unicode(acc)), acc.species_str(markup=True)
suffix = _("%(1)s plant groups in %(2)s location(s)") % {
'1': len(set(acc.plants)),
'2': len(set(p.location for p in acc.plants))}
suffix = ('<span foreground="#555555" size="small" '
'weight="light"> - %s</span>') % suffix
return first + suffix, second


# TODO: accession should have a one-to-many relationship on verifications
Expand Down
6 changes: 4 additions & 2 deletions bauble/plugins/garden/plant.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
#
# Copyright 2008-2010 Brett Adams
# Copyright 2015 Mario Frasca <mario@anche.no>.
# Copyright 2015-2016 Mario Frasca <mario@anche.no>.
#
# This file is part of bauble.classic.
#
Expand Down Expand Up @@ -123,7 +123,9 @@ def remove_callback(plants):


def plant_markup_func(plant):
'''
'''provide the two lines describing object for SearchView row.
see issue #258
'''
sp_str = plant.accession.species_str(markup=True)
dead_color = "#9900ff"
Expand Down

0 comments on commit 89ab8ce

Please sign in to comment.