diff options
Diffstat (limited to 'ReckonPrimer.activity/display.py')
-rwxr-xr-x | ReckonPrimer.activity/display.py | 70 |
1 files changed, 45 insertions, 25 deletions
diff --git a/ReckonPrimer.activity/display.py b/ReckonPrimer.activity/display.py index 008d076..659036b 100755 --- a/ReckonPrimer.activity/display.py +++ b/ReckonPrimer.activity/display.py @@ -21,7 +21,8 @@ class Display: def __init__(self, window): self._permanent_gui_elements(window) self.errors = 0 - self._ex = None # WN091214 ??? + self._ex = None # needed for feedback_table etc + # TODO: imprive information hiding self._sett = None # setting updated by callbacks during input self.running = False # switch settings_/feedback_table TODO rename self._coll_key = None # semaphore for self.finish_collect_callback @@ -183,6 +184,18 @@ class Display: self.feedback_table.attach(self.progress_total, 5, 6, 9, 10 ) self.progress_total.show() + ### START BUTTON BEGIN ### + # works on feedback_+ settings_table: beware of show/hide/destroy them + self.start_button = gtk.Button(None, gtk.STOCK_GO_FORWARD) + self.start_button.connect("clicked", self.clicked_start_callback) + self.feedback_table.attach(self.start_button, 0, 6, 14, 15) + self.start_alignment = self.start_button.get_children()[0] + self.start_hbox = self.start_alignment.get_children()[0] + self.start_image, self.start_label = self.start_hbox.get_children() + self.start_label.set_label("") + self.start_button.show() + ### START BUTTON END ### + def feedback_table_hide(self): self.progressbar.set_fraction(0) self.stopwatch_label.hide() @@ -198,27 +211,13 @@ class Display: self._ex = ex #WN.LV either drop this or self.current_exercise self._sett = self._ex.get_setting() #WN.LV make _sett local - ### START BUTTON BEGIN ### - self.start_button = gtk.Button(None, gtk.STOCK_GO_FORWARD) - self.start_button.connect("clicked", self.clicked_start_callback) - self.feedback_table.attach(self.start_button, 0, 6, 14, 15) - self.start_alignment = self.start_button.get_children()[0] - self.start_hbox = self.start_alignment.get_children()[0] - self.start_image, self.start_label = self.start_hbox.get_children() - self.start_label.set_label("") - self.start_button.show() - ### START BUTTON END ### - self.current_exercise = ex #WN.LV either drop this or self._ex #print('in display.offer_setting, self._sett=', self._sett) self.current_exercise.define_buttons() self.current_exercise.set_buttons(self._sett) def clicked_start_callback(self, widget): - """ Finish offer_setting, deliver settings (possibly updated) - and tell the coach to start the calculations of the exercise - ELIF - """ + """ .start_button switches settings_ / feedback_table. """ if self.running == False: self.running = True self.start_button.set_label(gtk.STOCK_STOP) #stop-button @@ -382,16 +381,37 @@ class Display: def set_select_exerc_semaphore(self, coll_key): """ Sets a semaphore for finish_collect_callback. """ + print('in display.set_select_exerc_semaphore, coll_key', self._coll_key) self._coll_key = coll_key def set_finish_learner_coll(self): - """ """ -# self.start_button = gtk.Button(None, gtk.STOCK_GO_FORWARD) -# self.start_button.connect("clicked", self.clicked_start_callback) -# self.feedback_table.attach(self.start_button, 0, 6, 14, 15) -# self.start_alignment = self.start_button.get_children()[0] -# self.start_hbox = self.start_alignment.get_children()[0] -# self.start_image, self.start_label = self.start_hbox.get_children() -# self.start_label.set_label("") -# self.start_button.show() + """ Set the button switching from collect_table to calcs""" + print('in display.set_finish_learner_coll') + self.flc_butt = gtk.Button(None, gtk.STOCK_GO_FORWARD) + self.flc_butt.connect("clicked", self.finish_learner_coll_callback) + self.collection_table.attach(self.flc_butt, 0, 5, 14, 15) + self.flc_alignment = self.flc_butt.get_children()[0] + self.flc_hbox = self.flc_alignment.get_children()[0] + self.flc_image, self.flc_label = self.flc_hbox.get_children() + self.flc_label.set_label("") + self.flc_butt.show() pass + + def finish_learner_coll_callback(self, widget): + """ Callback on flc_butt; uses self._coll_key as semaphore + from Collection.select_exerc_callback. """ + #self.flc_butt.set_label(gtk.STOCK_STOP) #stop-button + #self.start_alignment = self.flc_butt.get_children()[0] + #self.start_hbox = self.start_alignment.get_children()[0] + #self.start_image, self.start_label = self.start_hbox.get_children() + #self.start_label.set_label("") + print('in display.finish_learner_coll_callback, _coll_key=', self._coll_key) + if not(self._coll_key is None): + self._co.notify(('exerc-selected', self._coll_key)) + #self.settings_table.hide() + self.collection_table.hide() + self.feedback_table_show() + + def set_curr_exerc(self, exerc): + """ self._ex is needed for feedback_table etc. """ + self._ex = exerc |