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

Commit

Permalink
it's->its (but misses translations now); some minor documentation edits.
Browse files Browse the repository at this point in the history
  • Loading branch information
mfrasca committed Apr 5, 2015
1 parent 57cd668 commit d5a6a88
Show file tree
Hide file tree
Showing 11 changed files with 82 additions and 43 deletions.
4 changes: 2 additions & 2 deletions bauble/connmgr.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,11 +292,11 @@ def remove_connection(self, name):
def on_remove_button_clicked(self, button, data=None):
"""
remove the connection from connection list, this does not affect
the database or it's data
the database or its data
"""
msg = (_('Are you sure you want to remove "%s"?\n\n'
'<i>Note: This only removes the connection to the database '
'and does not affect the database or it\'s data</i>')
'and does not affect the database or its data</i>')
% self.current_name)

if not utils.yes_no_dialog(msg):
Expand Down
2 changes: 1 addition & 1 deletion bauble/editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -826,7 +826,7 @@ class GenericModelViewPresenterEditor(object):
GenericModelViewPresenterEditor assume that model is an instance
of object mapped to a SQLAlchemy table
The editor creates it's own session and merges the model into
The editor creates its own session and merges the model into
it. If the model is already in another session that original
session will not be effected.
Expand Down
4 changes: 2 additions & 2 deletions bauble/pluginmgr.py
Original file line number Diff line number Diff line change
Expand Up @@ -430,8 +430,8 @@ class View(gtk.VBox):

def __init__(self, *args, **kwargs):
"""
If a class extends this View and provides it's own __init__ it *must*
call it's parent (this) __init__
If a class extends this View and provides its own __init__ it *must*
call its parent (this) __init__
"""
super(View, self).__init__(*args, **kwargs)

Expand Down
7 changes: 6 additions & 1 deletion bauble/plugins/garden/location.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,11 @@ def __str__(self):
else:
return str(self.code)

def has_accessions(self):
'''true if location is linked to at least one accession
'''

return False


class LocationEditorView(GenericEditorView):
Expand All @@ -115,7 +120,7 @@ class LocationEditorView(GenericEditorView):
'later to refer to this location.'),
'loc_desc_textview': _('Any information that might be relevant to '\
'the location such as where it is or what\'s '\
'it\'s purpose')
'its purpose')
}

def __init__(self, parent=None):
Expand Down
6 changes: 6 additions & 0 deletions bauble/plugins/plants/family.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,12 @@ def str(family, qualifier=False):
return ' '.join([s for s in [
family.family, family.qualifier] if s not in (None, '')])

def has_accessions(self):
'''true if family is linked to at least one accession
'''

return False


class FamilyNote(db.Base):
"""
Expand Down
19 changes: 10 additions & 9 deletions bauble/plugins/plants/genus.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,12 @@ def str(genus, author=False):
xml.sax.saxutils.escape(genus.author)]
if s not in ('', None)])

def has_accessions(self):
'''true if genus is linked to at least one accession
'''

return False


class GenusNote(db.Base):
"""
Expand Down Expand Up @@ -765,35 +771,30 @@ def __init__(self, widgets):

def on_family_clicked(*args):
select_in_search_results(self.current_obj.family)

utils.make_label_clickable(self.widgets.gen_fam_data,
on_family_clicked)
utils.make_label_clickable(self.widgets.gen_fam_data, on_family_clicked)

def on_nsp_clicked(*args):
g = self.current_obj
cmd = 'species where genus.genus="%s" and genus.qualifier="%s"' \
% (g.genus, g.qualifier)
bauble.gui.send_command(cmd)
utils.make_label_clickable(self.widgets.gen_nsp_data,
on_nsp_clicked)
utils.make_label_clickable(self.widgets.gen_nsp_data, on_nsp_clicked)

def on_nacc_clicked(*args):
g = self.current_obj
cmd = 'acc where species.genus.genus="%s" ' \
'and species.genus.qualifier="%s"' \
% (g.genus, g.qualifier)
bauble.gui.send_command(cmd)
utils.make_label_clickable(self.widgets.gen_nacc_data,
on_nacc_clicked)
utils.make_label_clickable(self.widgets.gen_nacc_data, on_nacc_clicked)

def on_nplants_clicked(*args):
g = self.current_obj
cmd = 'plant where accession.species.genus.genus="%s" and ' \
'accession.species.genus.qualifier="%s"' \
% (g.genus, g.qualifier)
bauble.gui.send_command(cmd)
utils.make_label_clickable(self.widgets.gen_nplants_data,
on_nplants_clicked)
utils.make_label_clickable(self.widgets.gen_nplants_data, on_nplants_clicked)

def update(self, row):
'''
Expand Down
31 changes: 23 additions & 8 deletions bauble/plugins/plants/species_model.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,22 @@
# -*- coding: utf-8 -*-
#
# species_model.py
# Copyright 2008-2010 Brett Adams
# Copyright 2012-2015 Mario Frasca <mario@anche.no>.
#
# This file is part of bauble.classic.
#
# bauble.classic is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# bauble.classic is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with bauble.classic. If not, see <http://www.gnu.org/licenses/>.

import traceback
import xml.sax.saxutils as sax
Expand Down Expand Up @@ -197,19 +213,18 @@ class Species(db.Base):
def __init__(self, *args, **kwargs):
super(Species, self).__init__(*args, **kwargs)


def __str__(self):
'''
returns a string representation of this species,
calls Species.str(self)
'''
return Species.str(self)


def _get_default_vernacular_name(self):
if self._default_vernacular_name is None:
return None
return self._default_vernacular_name.vernacular_name

def _set_default_vernacular_name(self, vn):
if vn is None:
del self.default_vernacular_name
Expand All @@ -233,7 +248,6 @@ def distribution_str(self):
dist = ['%s' % d for d in self.distribution]
return unicode(', ').join(sorted(dist))


def markup(self, authors=False):
'''
returns this object as a string with markup
Expand All @@ -243,7 +257,6 @@ def markup(self, authors=False):
'''
return Species.str(self, authors, True)


# in PlantPlugins.init() we set this to 'x' for win32
hybrid_char = utils.utf8(u'\u2a09') # U+2A09

Expand Down Expand Up @@ -331,6 +344,11 @@ def str(species, authors=False, markup=False):
s = utils.utf8(' '.join(filter(lambda x: x not in ('', None), parts)))
return s

def has_accessions(self):
'''true if species is linked to at least one accession
'''

return False

infrasp_attr = {1: {'rank': 'infrasp1_rank',
'epithet': 'infrasp1',
Expand All @@ -345,7 +363,6 @@ def str(species, authors=False, markup=False):
'epithet': 'infrasp4',
'author': 'infrasp4_author'}}


def get_infrasp(self, level):
"""
level should be 1-4
Expand All @@ -354,7 +371,6 @@ def get_infrasp(self, level):
getattr(self, self.infrasp_attr[level]['epithet']), \
getattr(self, self.infrasp_attr[level]['author'])


def set_infrasp(self, level, rank, epithet, author=None):
"""
level should be 1-4
Expand All @@ -364,7 +380,6 @@ def set_infrasp(self, level, rank, epithet, author=None):
setattr(self, self.infrasp_attr[level]['author'], author)



class SpeciesNote(db.Base):
"""
Notes for the species table
Expand Down
26 changes: 14 additions & 12 deletions bauble/search.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# encoding: utf-8
# -*- coding: utf-8 -*-
#
# Copyright 2008, 2009, 2010 Brett Adams
# Copyright 2014 Mario Frasca <mario@anche.no>.
# Copyright 2014-2015 Mario Frasca <mario@anche.no>.
#
# This file is part of bauble.classic.
#
Expand Down Expand Up @@ -259,6 +259,14 @@ def __repr__(self):


class DomainExpressionAction(object):
"""created when the parser hits a domain_expression token.
Searching using domain expressions is a little more magical than an
explicit query. you give a domain, a binary_operator and a value,
the domain expression will return all object with at least one
property (as passed to add_meta) matching (according to the binop)
the value.
"""

def __init__(self, t):
self.domain = t[0]
Expand All @@ -269,16 +277,6 @@ def __repr__(self):
return "%s %s %s" % (self.domain, self.cond, self.values)

def invoke(self, search_strategy):
"""
Called when the parser hits a domain_expression token.
Searching using domain expressions is a little more magical
and queries mapper properties that were passed to add_meta()
To do a case sensitive search for a specific string use the
double equals, '=='
"""

try:
if self.domain in search_strategy._shorthand:
self.domain = search_strategy._shorthand[self.domain]
Expand All @@ -288,6 +286,10 @@ def invoke(self, search_strategy):

query = search_strategy._session.query(cls)

## here is the place where to optionally filter out unrepresented
## domain values. each domain class should define its own 'I have
## accessions' filter. see issue #42

result = set()

# select all objects from the domain
Expand Down
5 changes: 3 additions & 2 deletions bauble/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -785,13 +785,14 @@ def reset_sequence(column):

def make_label_clickable(label, on_clicked, *args):
"""
:param label: a gtk.Label that has a gtk.EventBox as it's parent
:param label: a gtk.Label that has a gtk.EventBox as its parent
:param on_clicked: callback to be called when the label is clicked
on_clicked(label, event, data)
"""
eventbox = label.parent

check(eventbox != None and isinstance(eventbox, gtk.EventBox),
'label must have an gtk.EventBox as it\'s parent')
'label must have an gtk.EventBox as its parent')
label.__pressed = False
def on_enter_notify(*args):
label.modify_fg(gtk.STATE_NORMAL, gtk.gdk.color_parse("blue"))
Expand Down
2 changes: 1 addition & 1 deletion doc/report.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Using the Mako Report Formatter
-------------------------------

The Mako report formatter uses the Mako template language for
generating reports. More information about Mako and it's language can
generating reports. More information about Mako and its language can
be found at `makotemplates.org <http://www.makotemplates.org>`_.

The Mako templating system should already be installed on your
Expand Down
19 changes: 14 additions & 5 deletions doc/searching.rst
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ max% then it search for all value that start with max. If you search
for %max it searches for all values that end in max. The string %max%a
would search for all value that contain max and end in a.

For more information about the different search domain see…..TODO
For more information about the different search domain and their short-hand
aliases, see search-domains_ .

If expression are invalid they are usually used as search by value
searchs. For example the search string ``gen=`` will execute a search by
Expand All @@ -111,6 +112,14 @@ are located in Block 10.
Searching with queries usually requires some knowledge of the Bauble
internals and database table layouts.

A couple of useful examples:

Which locations are in use:
``location where plants.id!=0``

Which genera are associated to at least one accession:
``genus where species.accession.id!=0``

.. _search-domains:

Domains
Expand All @@ -122,16 +131,16 @@ expression. The queries do not use the default columns.


:Domains:
fam, family: Search :class:`bauble.plugins.plants.Family`
family, fam: Search :class:`bauble.plugins.plants.Family`

gen, genus: Search :class:`bauble.plugins.plants.Genus`
genus, gen: Search :class:`bauble.plugins.plants.Genus`

sp: Search :class:`bauble.plugins.plants.Species`
species, sp: Search :class:`bauble.plugins.plants.Species`

geography: Search :class:`bauble.plugins.plants.Geography`

acc: Search :class:`bauble.plugins.garden.Accession`

plant: Search :class:`bauble.plugins.garden.Plant`

loc, location: Search :class:`bauble.plugins.garden.Location`
location, loc: Search :class:`bauble.plugins.garden.Location`

0 comments on commit d5a6a88

Please sign in to comment.