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

Commit

Permalink
since most of the housekeeping is done in the AskTPL class, the clien…
Browse files Browse the repository at this point in the history
…t needs doing really little.

this is part of the solution to #221
  • Loading branch information
mfrasca committed Dec 22, 2015
1 parent b152dfb commit c37c7e5
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
4 changes: 2 additions & 2 deletions bauble/plugins/plants/species_editor.glade
Original file line number Diff line number Diff line change
Expand Up @@ -309,13 +309,13 @@
</packing>
</child>
<child>
<object class="GtkButton" id="button1">
<object class="GtkButton" id="sp_species_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_action_appearance">False</property>
<child>
<object class="GtkImage" id="sp_species_check">
<object class="GtkImage" id="sp_species_image">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="stock">gtk-yes</property>
Expand Down
15 changes: 15 additions & 0 deletions bauble/plugins/plants/species_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,21 @@ def gen_get_completions(text):
return self.session.query(Genus).filter(clause).\
order_by(Genus.genus)

def on_sp_species_button_clicked(widget, event=None):
# this activity runs in a thread
# return False
from ask_tpl import AskTPL, what_to_do_with_it

binomial = '%s %s' % (self.model.genus, self.model.sp)
AskTPL(binomial, what_to_do_with_it, timeout=2).start()
if event is not None:
return False

self.view.connect('sp_species_button', "clicked",
on_sp_species_button_clicked)
self.view.connect('sp_species_entry', "focus-out-event",
on_sp_species_button_clicked)

# called when a genus is selected from the genus completions
def on_select(value):
logger.debug('on select: %s' % value)
Expand Down

0 comments on commit c37c7e5

Please sign in to comment.