Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Mayer <christian.mayer@student.tugraz.at>2010-01-06 18:08:47 (GMT)
committer Christian Mayer <christian.mayer@student.tugraz.at>2010-01-06 18:08:47 (GMT)
commit6c3542948f4556f20773623568c0dec78f496d85 (patch)
tree75164b8514f9ddda9edb20e4fee96cfafa428f16
parentf2bfbd8ed15cc43f7160b48afdaec2b3e923f879 (diff)
* moved Learner#notify('digit-done') into separate method
* call Learner#digit_done directly * remove Display#notify()
-rwxr-xr-xReckonPrimer.activity/display.py8
-rw-r--r--ReckonPrimer.activity/learner.py38
2 files changed, 19 insertions, 27 deletions
diff --git a/ReckonPrimer.activity/display.py b/ReckonPrimer.activity/display.py
index 3d9b992..f68494a 100755
--- a/ReckonPrimer.activity/display.py
+++ b/ReckonPrimer.activity/display.py
@@ -299,7 +299,7 @@ class Display:
self.errors = 0 #WN090518 ???
self.protocol(protok, self.errors, 'OK')
self.destroy_box()
- self.notify(('digit-done', None))
+ self._learner.digit_done()
elif(entry_text == ""):
pass #otherwise feedback in protocol written twice: see entry.set_text("") below
else:
@@ -360,12 +360,6 @@ class Display:
def finish_calc(self):
self.stopwatch.stop()
-
- def notify(self, msg):
- """only used by gtk"""
- if msg[0] == 'digit-done':
- self._learner.notify(('digit-done', None))
-
def show_progress(self):
self.progressbar.set_fraction(self.progressbar.get_fraction()+(float(1)/float(self.total_calcs)))
self.correct_count = self.correct_count + 1
diff --git a/ReckonPrimer.activity/learner.py b/ReckonPrimer.activity/learner.py
index 01e9562..5df67e2 100644
--- a/ReckonPrimer.activity/learner.py
+++ b/ReckonPrimer.activity/learner.py
@@ -27,24 +27,22 @@ class Learner:
self._curr_in = self._input.pop() #need _curr_in in notify
self._display.create_entryline(self._curr_in)
- def notify(self, (msg, data)):
- '''called by the observed objects'''
- if msg == 'digit-done': # from Display
- #print('in learner.notify, digit-done: _input=', self._input)
- (lino, pos, dig, proterr, protok, li) = self._curr_in
- self._display.create_entryline((lino, -1, dig, proterr, protok, li))
- try: # _input.pop()
- self._curr_in = self._input.pop()
+ def digit_done(self):
+ (lino, pos, dig, proterr, protok, li) = self._curr_in
+ self._display.create_entryline((lino, -1, dig, proterr, protok, li))
+ try: # _input.pop()
+ self._curr_in = self._input.pop()
+ self._display.create_entryline(self._curr_in)
+ except IndexError: # start new calc
+ self._display.show_progress()
+ try: # get_next_calc
+ _calc = self._ex.get_next_calc()
+ print('in learner.notify: calc=', _calc)
+ _lines, self._input = self._ex.format(_calc)
+ self._display.display_calc(_lines)
+ self._curr_in = self._input.pop() #need _curr_in in notify
self._display.create_entryline(self._curr_in)
- except IndexError: # start new calc
- self._display.show_progress()
- try: # get_next_calc
- _calc = self._ex.get_next_calc()
- print('in learner.notify: calc=', _calc)
- _lines, self._input = self._ex.format(_calc)
- self._display.display_calc(_lines)
- self._curr_in = self._input.pop() #need _curr_in in notify
- self._display.create_entryline(self._curr_in)
- # create_entryline sets the callback from gtk to Display
- except IndexError:
- self._display.finish_calc()
+ # create_entryline sets the callback from gtk to Display
+ except IndexError:
+ self._display.finish_calc()
+ \ No newline at end of file