Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWalther Neuper <neuper@neuper.(none)>2009-12-14 11:34:31 (GMT)
committer Walther Neuper <neuper@neuper.(none)>2009-12-14 11:34:31 (GMT)
commite71797b073e2c2ba40256557d3e8f933e28aa231 (patch)
treec3c3fb5b4c16264a51e21f3d0e1cb83d93d4cf9c
parent3fc089e3ffcad3f207c9623a380d4638d26a85f6 (diff)
shifted code from Collection to Display.switch_exercise
-rwxr-xr-xReckonPrimer.activity/coach.py9
-rw-r--r--ReckonPrimer.activity/collection.py20
-rwxr-xr-xReckonPrimer.activity/display.py21
-rwxr-xr-xReckonPrimer.activity/exaddsimp.py4
-rwxr-xr-xReckonPrimer.activity/extimesdiv.py2
-rw-r--r--ReckonPrimer.activity/learner.py2
-rwxr-xr-xReckonPrimer.activity/settings.py6
7 files changed, 32 insertions, 32 deletions
diff --git a/ReckonPrimer.activity/coach.py b/ReckonPrimer.activity/coach.py
index 83d3623..1cb4234 100755
--- a/ReckonPrimer.activity/coach.py
+++ b/ReckonPrimer.activity/coach.py
@@ -7,10 +7,10 @@ from display import Display
class Coach:
""" The coach supervises the selection of exercises. """
- #print('in coach, class definition')
+ print('in coach, class definition')
def __init__(self):
- print("DEL do Coach.__init__")
+ #print("in coach.__init__")
self._ex = None # the learner can change the settings of _this_ exerc
def register(self, sess, dis, collect, learner):
@@ -27,13 +27,12 @@ class Coach:
def notify(self, (msg, data)):
"""called by the observed objects"""
- print("in coach.notify: msg=, data=", (msg, data))
+ #print("in coach.notify: msg=, data=", (msg, data))
if msg == 'setting-done': # from display
self._ex.update_setting(data)
self._learner.notify((msg, self._ex))
elif msg == 'exerc-selected': # from collection
self._ex = self._collect.select(data)
- print('in coach.notify(exerc-selected), 93 self._ex._sett=',
- self._ex._sett)
+ #print('in coach.notify(exerc-selected), self._ex._sett=',self._ex._sett)
self._dis.offer_setting(self._ex)
diff --git a/ReckonPrimer.activity/collection.py b/ReckonPrimer.activity/collection.py
index 504b867..fd2298d 100644
--- a/ReckonPrimer.activity/collection.py
+++ b/ReckonPrimer.activity/collection.py
@@ -81,27 +81,15 @@ class Collection:
def select_exerc_callback(self, widget, exerc):
""" Callback telling the item from the collection selected. """
if(self._active_exerc == None):
+ # at startup
self._active_exerc = exerc
- print('in collection.select_exerc_callback, 422 self._sett=',
- self._sett)
self._coach.notify(('exerc-selected', exerc))
elif(self._active_exerc == exerc):
+ # hit the same button once more
pass
elif(self._active_exerc != exerc):
+ # switched to another exercise
self._active_exerc = exerc
- #self._display.switch_exercise()
- #WN.LV the code below should go into display
- self._display.settings_table.destroy()
- self._display.settings_table = gtk.Table(15, 6, True)
- self._display.table.attach(self._display.
- settings_table, 1, 2, 0, 5)
- self._display.settings_table.show()
-
- self._display.table_with_start.destroy()
- self._display.table_with_start = gtk.Table(15, 6, True)
- self._display.table.attach(self._display.
- table_with_start, 1, 2, 0, 5)
- self._display.table_with_start.show()
-
+ self._display.switch_exercise()
self._coach.notify(('exerc-selected', exerc))
diff --git a/ReckonPrimer.activity/display.py b/ReckonPrimer.activity/display.py
index beb4c67..ba6ebf7 100755
--- a/ReckonPrimer.activity/display.py
+++ b/ReckonPrimer.activity/display.py
@@ -21,7 +21,7 @@ class Display:
Definition and manipulation of all GUI-elemts.
Exception (redesign?): def define_buttons in classes derived from Exercise.
"""
- print("DEL import Display")
+ print("in display, class definition")
def __init__(self, window):
self.errors = 0
@@ -238,7 +238,7 @@ class Display:
### START BUTTON END ###
self.current_exercise = ex #WN.LV either drop this or self._ex
- print('in display.offer_setting, 241 self._sett=', self._sett)
+ #print('in display.offer_setting, self._sett=', self._sett)
self.current_exercise.define_buttons()
self.current_exercise.set_buttons(self._sett)
@@ -272,7 +272,7 @@ class Display:
prepares for calculations from 1 setting.
for instance, a calculation might be on 1 ore more lines.
"""
- print("DEL do Display.init_calc")
+ print("in display.init_calc")
# make empty lines such that all calcs are entered at bottom
for i in range(1,21):
end_iterator = self.log_buffer.get_end_iter()
@@ -337,7 +337,7 @@ class Display:
"""display the lines of a calc with _ at all input positions"""
lino = 0
for li in lines:
- print('in Display.display_calc, line=', li)
+ #print('in Display.display_calc, line=', li)
self.create_entryline((lino, -1, 'dummy-dig', 'dummy-proterr', 'dummy-protok', li))
lino = lino + 1
@@ -393,3 +393,16 @@ class Display:
"""TODO: get the users choice from buttons above the settings"""
collect.define_coll_gui()
collect.set_coll_gui()
+
+ def switch_exercise(self):
+ """ Another exercise has been selected. """
+ 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()
+
diff --git a/ReckonPrimer.activity/exaddsimp.py b/ReckonPrimer.activity/exaddsimp.py
index 947bf29..a774436 100755
--- a/ReckonPrimer.activity/exaddsimp.py
+++ b/ReckonPrimer.activity/exaddsimp.py
@@ -78,7 +78,7 @@ class ExAddSimp(Exercise):
"""format the calc for display, prepare overlays for input"""
#@print('in Display.format_addsub_simp: calc=', (calc, linepos))#@
_ccs = collect_digits(calc)
- print('in Display.format_addsub_simp: _ccs=',_ccs )
+ #print('in Display.format_addsub_simp: _ccs=',_ccs )
_l0 = make_line(_ccs, linepos)
_ip = make_input(_ccs, linepos)
#@print('in Display.format_addsub_simp: return=', ([_l0], _ip)) #@
@@ -90,7 +90,7 @@ class ExAddSimp(Exercise):
def define_buttons(self):
""" See comment in exercise.define_buttons. """
- print('in exaddsimp.define_buttons, 86 self._sett=', self._sett)
+ #print('in exaddsimp.define_buttons, 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/extimesdiv.py b/ReckonPrimer.activity/extimesdiv.py
index 9c997f3..8d63ce2 100755
--- a/ReckonPrimer.activity/extimesdiv.py
+++ b/ReckonPrimer.activity/extimesdiv.py
@@ -397,7 +397,7 @@ class ExTimesDiv(Exercise):
_calcs.append((_c, 5))
else:
for _i in range(1,11):
- print('in Generate.tim_div, (j,i)=',(_j, _i))
+ #print('in Generate.tim_div, (j,i)=',(_j, _i))
if dic == '*':
#_c = [to_str_99(_i),'*',str(_j*10),'=',to_str_99(_i*_j*10)]
_c = [to_str_99(_i),'*',str(_j),'=',to_str_99(_i*_j)]
diff --git a/ReckonPrimer.activity/learner.py b/ReckonPrimer.activity/learner.py
index bbb831e..f296983 100644
--- a/ReckonPrimer.activity/learner.py
+++ b/ReckonPrimer.activity/learner.py
@@ -40,7 +40,7 @@ class Learner:
self._display.show_progress()
try: # get_next_calc
_calc = self._ex.get_next_calc()
- print('in Session.notify: calc=', _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
diff --git a/ReckonPrimer.activity/settings.py b/ReckonPrimer.activity/settings.py
index 39b8ec1..b91e927 100755
--- a/ReckonPrimer.activity/settings.py
+++ b/ReckonPrimer.activity/settings.py
@@ -5,10 +5,10 @@ import pickle
import os
class Settings:
""" A setting is a dictionary, the settings are a dict of dicts. """
- print('in settings, begin class definition')
+ print('in settings, class definition')
def __init__(self):
- print("DEL do Settings.__init__")
+ #print("in settings.__init__")
#+ and - between min and max, max <= 10
self._default_addsub_simp = \
{'topic' : 'addsub_simp', #for programmers only
@@ -95,7 +95,7 @@ class Settings:
}
def get_setting(self, key):
- print("in settings.get_setting, key=" + key)
+ #print("in settings.get_setting, key=" + key)
return self._setts[key]
# def load_last_sett(self, key):