Skip to content

Commit

Permalink
Merge pull request #292 from Ghini/ghini-1.0-dev
Browse files Browse the repository at this point in the history
publish early
  • Loading branch information
mfrasca authored Oct 13, 2017
2 parents 7cc432b + 721107c commit b375520
Show file tree
Hide file tree
Showing 45 changed files with 283 additions and 40 deletions.
13 changes: 13 additions & 0 deletions .github/issue_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
### Expected behaviour

### Actual behaviour

### Steps to reproduce the behaviour

##### How to set up the same initial situation

##### Which actions to take in sequence, which contribute to create the critical situation

##### Last step, with the unexpected result

##### Opinions and suggestions
13 changes: 12 additions & 1 deletion bauble/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# -*- coding: utf-8 -*-
#
# Copyright (c) 2005,2006,2007,2008,2009 Brett Adams <[email protected]>
# Copyright (c) 2012-2016 Mario Frasca <[email protected]>
# Copyright (c) 2012-2017 Mario Frasca <[email protected]>
# Copyright 2017 Jardín Botánico de Quito
#
# This file is part of ghini.desktop.
#
Expand Down Expand Up @@ -47,6 +48,16 @@ def pb_set_fraction(fraction):
if gui is not None and gui.progressbar is not None:
gui.progressbar.set_fraction(fraction)

def pb_grab():
if gui is not None and gui.progressbar is not None:
gui.set_busy(True)
gui.progressbar.show()
gui.progressbar.set_fraction(0)

def pb_release():
if gui is not None and gui.progressbar is not None:
gui.progressbar.hide()
gui.set_busy(False)

def main_is_frozen():
"""
Expand Down
3 changes: 2 additions & 1 deletion bauble/connmgr.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# -*- coding: utf-8 -*-
#
# Copyright 2008-2010 Brett Adams
# Copyright 2015-2016 Mario Frasca <[email protected]>.
# Copyright 2015-2017 Mario Frasca <[email protected]>.
# Copyright 2017 Jardín Botánico de Quito
#
# This file is part of ghini.desktop.
#
Expand Down
3 changes: 2 additions & 1 deletion bauble/db.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# -*- coding: utf-8 -*-
#
# Copyright 2005-2010 Brett Adams <[email protected]>
# Copyright 2015 Mario Frasca <[email protected]>.
# Copyright 2015-2017 Mario Frasca <[email protected]>.
# Copyright 2017 Jardín Botánico de Quito
#
# This file is part of ghini.desktop.
#
Expand Down
3 changes: 2 additions & 1 deletion bauble/editor.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# -*- coding: utf-8 -*-
#
# Copyright 2008-2010 Brett Adams
# Copyright 2015 Mario Frasca <[email protected]>.
# Copyright 2015-2017 Mario Frasca <[email protected]>.
# Copyright 2017 Jardín Botánico de Quito
#
# This file is part of ghini.desktop.
#
Expand Down
3 changes: 2 additions & 1 deletion bauble/i18n.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
# Copyright (c) 2005,2006,2007,2008,2009 Brett Adams <[email protected]>
# Copyright (c) 2006 Mark Mruss http://www.learningpython.com
# Copyright (c) 2007 Kopfgeldjaeger
# Copyright (c) 2012-2015 Mario Frasca <[email protected]>
# Copyright (c) 2012-2017 Mario Frasca <[email protected]>
# Copyright 2017 Jardín Botánico de Quito
#
# This file is part of ghini.desktop.
#
Expand Down
1 change: 1 addition & 0 deletions bauble/pluginmgr.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#
# Copyright 2008-2010 Brett Adams
# Copyright 2012-2015 Mario Frasca <[email protected]>.
# Copyright 2017 Jardín Botánico de Quito
#
# This file is part of ghini.desktop.
#
Expand Down
4 changes: 3 additions & 1 deletion bauble/plugins/abcd/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#
# Copyright (c) 2005,2006,2007,2008,2009 Brett Adams <[email protected]>
# Copyright (c) 2012-2016 Mario Frasca <[email protected]>
# Copyright 2017 Jardín Botánico de Quito
#
# This file is part of ghini.desktop.
#
Expand Down Expand Up @@ -339,7 +340,8 @@ def start(self, filename=None, plants=None):
if d.run() == gtk.RESPONSE_ACCEPT:
filename = d.get_filename()
d.destroy()
return filename
if not filename:
return

if plants:
nplants = len(plants)
Expand Down
1 change: 1 addition & 0 deletions bauble/plugins/garden/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#
# Copyright 2008-2010 Brett Adams
# Copyright 2015 Mario Frasca <[email protected]>.
# Copyright 2017 Jardín Botánico de Quito
#
# This file is part of ghini.desktop.
#
Expand Down
1 change: 1 addition & 0 deletions bauble/plugins/garden/accession.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#
# Copyright 2008-2010 Brett Adams
# Copyright 2015-2016 Mario Frasca <[email protected]>.
# Copyright 2017 Jardín Botánico de Quito
#
# This file is part of ghini.desktop.
#
Expand Down
1 change: 1 addition & 0 deletions bauble/plugins/garden/aggregateclient.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
#
# Copyright 2017 Mario Frasca <[email protected]>.
# Copyright 2017 Jardín Botánico de Quito
#
# This file is part of ghini.desktop.
#
Expand Down
29 changes: 25 additions & 4 deletions bauble/plugins/garden/exporttopocket.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
#
# Copyright 2017 Mario Frasca <[email protected]>.
# Copyright 2017 Jardín Botánico de Quito
#
# This file is part of ghini.desktop.
#
Expand Down Expand Up @@ -28,7 +29,7 @@
from bauble import pluginmgr


import gtk
import gtk, gobject
import os


Expand Down Expand Up @@ -80,6 +81,8 @@ def create_pocket(filename):

def export_to_pocket(filename, include_private=True):
from bauble.plugins.plants import Species
from bauble import pb_set_fraction, pb_grab, pb_release
gobject.idle_add(pb_grab)
session = db.Session()
plant_query = (session.query(Plant)
.order_by(Plant.code)
Expand All @@ -98,6 +101,7 @@ def export_to_pocket(filename, include_private=True):
import sqlite3
cn = sqlite3.connect(filename)
cr = cn.cursor()
count = 1
for i in species:
try:
cr.execute('INSERT INTO "species" '
Expand All @@ -108,6 +112,9 @@ def export_to_pocket(filename, include_private=True):
i.infraspecific_author or i.sp_author or ''))
except Exception, e:
logger.info("error exporting species %s: %s %s" % (i.id, type(e), e))
gobject.idle_add(pb_set_fraction, 0.05 * count / len(species))
count += 1
count = 1
for i in accessions:
try:
try:
Expand All @@ -120,6 +127,9 @@ def export_to_pocket(filename, include_private=True):
(i.id, i.code, i.species_id, source_name, i.date_accd))
except Exception, e:
logger.info("error exporting accession %s: %s %s" % (i.id, type(e), e))
gobject.idle_add(pb_set_fraction, 0.05 + 0.4 * count / len(accessions))
count += 1
count = 1
for i in plants:
try:
cr.execute('INSERT INTO "plant" '
Expand All @@ -128,8 +138,11 @@ def export_to_pocket(filename, include_private=True):
(i.id, i.accession_id, "." + i.code, i.location.code, i.date_of_death, len(i.pictures)))
except Exception, e:
logger.info("error exporting plant %s: %s %s" % (i.id, type(e), e))
gobject.idle_add(pb_set_fraction, 0.45 + 0.55 * count / len(plants))
count += 1
cn.commit()
session.close()
gobject.idle_add(pb_release)
return True


Expand All @@ -145,8 +158,16 @@ def start(self):
gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL))
if d.run() == gtk.RESPONSE_ACCEPT:
pocket = d.get_filename()
if os.path.isfile(pocket):
try:
os.unlink(pocket)
create_pocket(pocket)
export_to_pocket(pocket)
except:
pass
else:
pocket = None
d.destroy()
if pocket:
create_pocket(pocket)
from threading import Thread
thread = Thread(target=export_to_pocket,
args=[pocket])
thread.start()
1 change: 1 addition & 0 deletions bauble/plugins/garden/institution.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#
# Copyright 2008-2010 Brett Adams
# Copyright 2015 Mario Frasca <[email protected]>.
# Copyright 2017 Jardín Botánico de Quito
#
# This file is part of ghini.desktop.
#
Expand Down
1 change: 1 addition & 0 deletions bauble/plugins/garden/plant.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#
# Copyright 2008-2010 Brett Adams
# Copyright 2015-2017 Mario Frasca <[email protected]>.
# Copyright 2017 Jardín Botánico de Quito
#
# This file is part of ghini.desktop.
#
Expand Down
1 change: 1 addition & 0 deletions bauble/plugins/garden/source.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#
# Copyright 2008-2010 Brett Adams
# Copyright 2015-2016 Mario Frasca <[email protected]>.
# Copyright 2017 Jardín Botánico de Quito
#
# This file is part of ghini.desktop.
#
Expand Down
1 change: 1 addition & 0 deletions bauble/plugins/garden/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#
# Copyright 2008-2010 Brett Adams
# Copyright 2015,2017 Mario Frasca <[email protected]>.
# Copyright 2017 Jardín Botánico de Quito
#
# This file is part of ghini.desktop.
#
Expand Down
1 change: 1 addition & 0 deletions bauble/plugins/imex/csv_.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#
# Copyright 2008-2010 Brett Adams
# Copyright 2012-2015 Mario Frasca <[email protected]>.
# Copyright 2017 Jardín Botánico de Quito
#
# This file is part of ghini.desktop.
#
Expand Down
1 change: 1 addition & 0 deletions bauble/plugins/plants/family.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#
# Copyright 2008-2010 Brett Adams
# Copyright 2014-2015 Mario Frasca <[email protected]>.
# Copyright 2017 Jardín Botánico de Quito
#
# This file is part of ghini.desktop.
#
Expand Down
1 change: 1 addition & 0 deletions bauble/plugins/plants/genus.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#
# Copyright 2008-2010 Brett Adams
# Copyright 2015 Mario Frasca <[email protected]>.
# Copyright 2017 Jardín Botánico de Quito
#
# This file is part of ghini.desktop.
#
Expand Down
1 change: 1 addition & 0 deletions bauble/plugins/plants/species.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#
# Copyright 2008-2010 Brett Adams
# Copyright 2012-2015 Mario Frasca <[email protected]>.
# Copyright 2017 Jardín Botánico de Quito
#
# This file is part of ghini.desktop.
#
Expand Down
1 change: 1 addition & 0 deletions bauble/plugins/plants/species_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#
# Copyright 2008-2010 Brett Adams
# Copyright 2012-2016 Mario Frasca <[email protected]>.
# Copyright 2017 Jardín Botánico de Quito
#
# This file is part of ghini.desktop.
#
Expand Down
1 change: 1 addition & 0 deletions bauble/plugins/plants/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#
# Copyright 2008-2010 Brett Adams
# Copyright 2015 Mario Frasca <[email protected]>.
# Copyright 2017 Jardín Botánico de Quito
#
# This file is part of ghini.desktop.
#
Expand Down
1 change: 1 addition & 0 deletions bauble/plugins/report/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#
# Copyright 2008-2010 Brett Adams
# Copyright 2012-2017 Mario Frasca <[email protected]>.
# Copyright 2017 Jardín Botánico de Quito
# Copyright 2017 Ross Demuth
#
# This file is part of ghini.desktop.
Expand Down
1 change: 1 addition & 0 deletions bauble/plugins/report/mako/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#
# Copyright 2008-2010 Brett Adams
# Copyright 2012-2016 Mario Frasca <[email protected]>.
# Copyright 2017 Jardín Botánico de Quito
#
# This file is part of ghini.desktop.
#
Expand Down
Binary file modified bauble/plugins/report/mako/templates/accession-label-qr.ps
Binary file not shown.
1 change: 1 addition & 0 deletions bauble/plugins/report/mako/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#
# Copyright (c) 2005,2006,2007,2008,2009 Brett Adams <[email protected]>
# Copyright (c) 2012-2015 Mario Frasca <[email protected]>
# Copyright 2017 Jardín Botánico de Quito
#
# This file is part of ghini.desktop.
#
Expand Down
1 change: 1 addition & 0 deletions bauble/plugins/report/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#
# Copyright (c) 2005,2006,2007,2008,2009 Brett Adams <[email protected]>
# Copyright (c) 2012-2017 Mario Frasca <[email protected]>
# Copyright 2017 Jardín Botánico de Quito
# Copyright (c) 2017 Ross Demuth <[email protected]>
#
# This file is part of ghini.desktop.
Expand Down
1 change: 1 addition & 0 deletions bauble/plugins/users/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#
# Copyright (c) 2005,2006,2007,2008,2009 Brett Adams <[email protected]>
# Copyright (c) 2012-2017 Mario Frasca <[email protected]>
# Copyright 2017 Jardín Botánico de Quito
#
# This file is part of ghini.desktop.
#
Expand Down
Loading

0 comments on commit b375520

Please sign in to comment.