diff options
author | Walther Neuper <neuper@neuper.(none)> | 2009-12-13 12:18:32 (GMT) |
---|---|---|
committer | Walther Neuper <neuper@neuper.(none)> | 2009-12-13 12:18:32 (GMT) |
commit | 1ed0ccb13bbbaa37a1251651f46c1ae2d19370da (patch) | |
tree | 44255b5ec17683d5f11ecfe29826d6bb9435856d | |
parent | ea0babcbe86de7052f138829462a7f92d72ce449 (diff) |
cp offer_coll_to_learner+callback display--> collection
-rwxr-xr-x | ReckonPrimer.activity/coach.py | 2 | ||||
-rw-r--r-- | ReckonPrimer.activity/collection.py | 45 | ||||
-rwxr-xr-x | ReckonPrimer.activity/display.py | 2 | ||||
-rwxr-xr-x | ReckonPrimer.activity/exaddsimp.py | 4 | ||||
-rwxr-xr-x | ReckonPrimer.activity/exercise.py | 2 |
5 files changed, 47 insertions, 8 deletions
diff --git a/ReckonPrimer.activity/coach.py b/ReckonPrimer.activity/coach.py index 26ee671..dd6f2dc 100755 --- a/ReckonPrimer.activity/coach.py +++ b/ReckonPrimer.activity/coach.py @@ -60,7 +60,7 @@ class Coach: def request_exercise(self): """ This preliminary version just lets the Learner select. """ - #print("in Coach.request_exercise") + #print("in coach.request_exercise") self._dis.offer_coll_to_learner([t.get_topic() for t in self._exs]) # calls back with notify('setting-done'... diff --git a/ReckonPrimer.activity/collection.py b/ReckonPrimer.activity/collection.py index 56a0a5f..787fc4b 100644 --- a/ReckonPrimer.activity/collection.py +++ b/ReckonPrimer.activity/collection.py @@ -12,6 +12,47 @@ class Collection: self._sett.get_setting('times_div')] self._display = display - def define_coll_gui(): + def define_coll_gui(self): """ Define gui-elements for presenting the collcetion. """ - + self.topic_box = gtk.HBox(True, 0) + self.topic_table.attach(self.topic_box, 0, 6, 0, 1) + _i = 0 + for _t in topics: + _i = _i + 1 + self.button = gtk.Button() + self.image = gtk.Image() + + if(_t == 'addsub_simp'): + self.image.set_from_file("img/addsub_simp.jpg") + elif(_t == 'passten'): + self.image.set_from_file("img/passten.jpg") + elif(_t == 'times_div'): + self.image.set_from_file("img/times_div.jpg") + + self.button.set_image(self.image) + self.button.connect("clicked", self.new_topic, _t) + self.topic_box.pack_start(self.button) + self.button.show() + self.topic_box.show() + + def new_topic(self, widget, topic): + """callback: get the users choice from buttons above the settings""" + if(self.active_topic == None): + self.active_topic = topic + print('in Display.new_topic, 422 self._sett=', self._sett) + self._co.notify(('new-topic', topic)) + elif(self.active_topic == topic): + pass + elif(self.active_topic != topic): + self.active_topic = topic + self.settings_table.destroy() + self.settings_table = gtk.Table(15, 6, True) + self.table.attach(self.settings_table, 1, 2, 0, 5) + self.settings_table.show() + + self.table_with_start.destroy() + self.table_with_start = gtk.Table(15, 6, True) + self.table.attach(self.table_with_start, 1, 2, 0, 5) + self.table_with_start.show() + self._co.notify(('new-topic', topic)) + diff --git a/ReckonPrimer.activity/display.py b/ReckonPrimer.activity/display.py index 78e2900..4f1f215 100755 --- a/ReckonPrimer.activity/display.py +++ b/ReckonPrimer.activity/display.py @@ -394,7 +394,6 @@ class Display: """TODO: get the users choice from buttons above the settings""" self.topic_box = gtk.HBox(True, 0) self.topic_table.attach(self.topic_box, 0, 6, 0, 1) - _i = 0 for _t in topics: _i = _i + 1 @@ -412,7 +411,6 @@ class Display: self.button.connect("clicked", self.new_topic, _t) self.topic_box.pack_start(self.button) self.button.show() - self.topic_box.show() diff --git a/ReckonPrimer.activity/exaddsimp.py b/ReckonPrimer.activity/exaddsimp.py index 3d9df51..6df7c87 100755 --- a/ReckonPrimer.activity/exaddsimp.py +++ b/ReckonPrimer.activity/exaddsimp.py @@ -86,9 +86,9 @@ class ExAddSimp(Exercise): #[' ', '1', '0', ' ', '-', ' ', '7', ' ', '=', ' ', '3', ' '])]) def define_buttons(self): - """ See comment in Exercies.define_buttons. """ + """ See comment in exercise.define_buttons. """ - print('in ExAddSimp.define_buttons, 86 self._sett=', self._sett) + print('in exaddsimp.define_buttons, 86 self._sett=', self._sett) #self.label_count = gtk.Label(str(self.count())) #self.label6.modify_font(pango.FontDescription("sans 12")) #self._display.settings_table.attach(self.label6, 0, 1, 1, 2 ) diff --git a/ReckonPrimer.activity/exercise.py b/ReckonPrimer.activity/exercise.py index 0b826a6..5d03401 100755 --- a/ReckonPrimer.activity/exercise.py +++ b/ReckonPrimer.activity/exercise.py @@ -73,7 +73,7 @@ class Exercise: pass def define_buttons(self): - """ Define buttons for update settings. """ + """ Define buttons for update settings including callbacks. """ pass def set_buttons(self, sett): |