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-11 14:06:27 (GMT)
committer Christian Mayer <christian.mayer@student.tugraz.at>2010-01-11 14:06:27 (GMT)
commitb6729cb64cc1856067efd14ef54e5b52682b1d2a (patch)
treedd524c3c2905e455168c5a7c5636bb406ddf84c8
parenta5e771edeb19a13c1ffeb20d504e4440c3d1854e (diff)
parent1fd6f43d88c760f1253d96dd21bbd763386f7745 (diff)
Merge branch 'master' into devel
-rwxr-xr-xReckonPrimer.activity/coach.py3
-rwxr-xr-xReckonPrimer.activity/display.py23
-rwxr-xr-xReckonPrimer.activity/exercises/exaddsimp.py47
-rwxr-xr-xReckonPrimer.activity/exercises/extimesdiv.py236
-rwxr-xr-xReckonPrimer.activity/session.py2
5 files changed, 187 insertions, 124 deletions
diff --git a/ReckonPrimer.activity/coach.py b/ReckonPrimer.activity/coach.py
index 57f95bd..310538d 100755
--- a/ReckonPrimer.activity/coach.py
+++ b/ReckonPrimer.activity/coach.py
@@ -32,13 +32,16 @@ class Coach:
# calls back with notify('exerc-selected'... OR 'switch-to-setts'
def exercise_selected(self, key):
+ self._dis.init_calc()
self._ex = self._collect.select(key)
self._learner.start_calcs(self._ex)
def switch_to_settings(self, key):
self._ex = self._collect.select(key)
+ self._dis.init_calc()
self._dis.offer_setting(self._ex)
def settings_done(self, settings):
self._ex.update_setting(settings)
+ self._dis.init_calc()
self._learner.start_calcs(self._ex)
diff --git a/ReckonPrimer.activity/display.py b/ReckonPrimer.activity/display.py
index 022e5c0..de5a2ac 100755
--- a/ReckonPrimer.activity/display.py
+++ b/ReckonPrimer.activity/display.py
@@ -44,11 +44,11 @@ class Display:
#0+-------------------------+------------------------+
# | | |
#1| | OVERLAYS OF |
- # | scrolled_window | collection_table |
+ # | scrolled_window | collection_table |
#2| | OR |
# | | settings_table |
#3+-------------------------+ OR |
- # | | feedback_table |
+ # | | feedback_table |
#4| empty for calcs etc | |
# | | |
#5+-------------------------+------------------------+
@@ -194,6 +194,25 @@ class Display:
end_iterator = self.log_buffer.get_end_iter()
mark = self.log_buffer.create_mark(None, end_iterator, True)
self.log_view.scroll_mark_onscreen(mark)
+
+ def protocol_generated_calcs(self, calculations, change):
+ print("DEBUG: in display.protocol_generated_calcs")
+ end_iterator = self.log_buffer.get_end_iter()
+ self.log_buffer.insert_with_tags_by_name(end_iterator, "\n---------- " + change + " ----------" , "fixxxme!" )
+ for c in calculations:
+ end_iterator = self.log_buffer.get_end_iter()
+
+ #['1', '-', '1', '=', '0']
+ to_format = c[0]
+ printable_calc = to_format[0] + " " + \
+ to_format[1] + " " + \
+ to_format[2] + " " + \
+ to_format[3] + " " + \
+ to_format[4]
+ self.log_buffer.insert_with_tags_by_name(end_iterator, "\n" + printable_calc, "fixxxme!" )
+
+ mark = self.log_buffer.create_mark(None, end_iterator, True)
+ self.log_view.scroll_mark_onscreen(mark)
def input_digit(self, widget, dig, proterr, protok):
"""callback: input a digit and give feedback.
diff --git a/ReckonPrimer.activity/exercises/exaddsimp.py b/ReckonPrimer.activity/exercises/exaddsimp.py
index a774436..d4dc222 100755
--- a/ReckonPrimer.activity/exercises/exaddsimp.py
+++ b/ReckonPrimer.activity/exercises/exaddsimp.py
@@ -311,37 +311,62 @@ class ExAddSimp(Exercise):
else:
widget.set_active(True)
-
+ #BEGIN LPCHANGE
+ self._display_generated_calcs('digit '+ str(i))
+ #END LPCHANGE
+
# callbacks updating the settings
def toggle_max_callback(self, widget):
if widget.get_active():
self._display._sett['cut-max'] = True
+ #BEGIN LPCHANGE
+ self._display_generated_calcs('max')
+ #END LPCHANGE
else:
self._display._sett['cut-max'] = False
+ #BEGIN LPCHANGE
+ self._display_generated_calcs('no max')
+ #END LPCHANGE
def toggle_plus_callback(self, widget):
if widget.get_active():
self._display._sett['+'] = True
+ #BEGIN LPCHANGE
+ self._display_generated_calcs('plus')
+ #END LPCHANGE
else:
if( self.toggle_minus.get_active() ):
self._display._sett['+'] = False
+ #BEGIN LPCHANGE
+ self._display_generated_calcs('no plus')
+ #END LPCHANGE
+
else:
widget.set_active(True)
+
def toggle_minus_callback(self, widget):
if widget.get_active():
self._display._sett['-'] = True
+ #BEGIN LPCHANGE
+ self._display_generated_calcs('minus')
+ #END LPCHANGE
else:
if( self.toggle_plus.get_active() ):
self._display._sett['-'] = False
+ #BEGIN LPCHANGE
+ self._display_generated_calcs('no minus')
+ #END LPCHANGE
else:
widget.set_active(True)
+
def toggle_shuffle_callback(self, widget):
if widget.get_active():
self._display._sett['shuffle'] = True
else:
self._display._sett['shuffle'] = False
+
def toggle_equal_fixed_right_callback(self, widget):
if widget.get_active():
@@ -349,14 +374,21 @@ class ExAddSimp(Exercise):
self.toggle_pos1.set_active(True)
self.toggle_pos3.set_active(True)
self.toggle_pos5.set_active(True)
+ #BEGIN LPCHANGE
+ self._display_generated_calcs('fixed right')
+ #END LPCHANGE
else:
if( self.toggle_equal_fixed_left.get_active() ):
self._display._sett['_+_=_'] = False
self.toggle_pos1.set_active(False)
self.toggle_pos3.set_active(False)
self.toggle_pos5.set_active(False)
+ #BEGIN LPCHANGE
+ self._display_generated_calcs('unfixed right')
+ #END LPCHANGE
else:
widget.set_active(True)
+
def toggle_equal_fixed_left_callback(self, widget):
if widget.get_active():
@@ -364,14 +396,21 @@ class ExAddSimp(Exercise):
self.toggle_pos1_lower.set_active(True)
self.toggle_pos3_lower.set_active(True)
self.toggle_pos5_lower.set_active(True)
+ #BEGIN LPCHANGE
+ self._display_generated_calcs('fixed left')
+ #END LPCHANGE
else:
if( self.toggle_equal_fixed_right.get_active() ):
self._display._sett['_=_+_'] = False
self.toggle_pos1_lower.set_active(False)
self.toggle_pos3_lower.set_active(False)
self.toggle_pos5_lower.set_active(False)
+ #BEGIN LPCHANGE
+ self._display_generated_calcs('unfixed left')
+ #END LPCHANGE
else:
widget.set_active(True)
+
def toggle_pos1_callback(self, widget):
@@ -491,3 +530,9 @@ class ExAddSimp(Exercise):
_subs.append(_c)
return _subs
+#BEGIN LPCHANGE
+ def _display_generated_calcs(self, change):
+ print("DEBUG: in exaddsubsimp._display_generated_calcs()")
+ self._display.protocol_generated_calcs(self._generate_calcs(), change)
+#END LPCHANGE
+
diff --git a/ReckonPrimer.activity/exercises/extimesdiv.py b/ReckonPrimer.activity/exercises/extimesdiv.py
index 3383810..d1fe8a0 100755
--- a/ReckonPrimer.activity/exercises/extimesdiv.py
+++ b/ReckonPrimer.activity/exercises/extimesdiv.py
@@ -81,162 +81,163 @@ class ExTimesDiv(Exercise):
def define_buttons(self):
"""buttons for this setting, which is specific for TimesDiv"""
- self.label = gtk.Label("2")
- self.label.modify_font(pango.FontDescription("sans 12"))
- self._display.settings_table.attach(self.label, 0, 1, 13, 14 )
+ self.label = gtk.Label("2")
+ self.label.modify_font(pango.FontDescription("sans 12"))
+ self._display.settings_table.attach(self.label, 0, 1, 13, 14 )
self.label.show()
- self.label = gtk.Label("in")
- self.label.modify_font(pango.FontDescription("sans 12"))
- self._display.settings_table.attach(self.label, 1, 2, 13, 14 )
+ self.label = gtk.Label("in")
+ self.label.modify_font(pango.FontDescription("sans 12"))
+ self._display.settings_table.attach(self.label, 1, 2, 13, 14 )
self.label.show()
- self.label = gtk.Label("2")
- self.label.modify_font(pango.FontDescription("sans 12"))
- self._display.settings_table.attach(self.label, 2, 3, 13, 14 )
+ self.label = gtk.Label("2")
+ self.label.modify_font(pango.FontDescription("sans 12"))
+ self._display.settings_table.attach(self.label, 2, 3, 13, 14 )
self.label.show()
- self.label = gtk.Label("=")
- self.label.modify_font(pango.FontDescription("sans 12"))
- self._display.settings_table.attach(self.label, 3, 4, 13, 14 )
+ self.label = gtk.Label("=")
+ self.label.modify_font(pango.FontDescription("sans 12"))
+ self._display.settings_table.attach(self.label, 3, 4, 13, 14 )
self.label.show()
- self.label = gtk.Label("1")
- self.label.modify_font(pango.FontDescription("sans 12"))
- self._display.settings_table.attach(self.label, 4, 5, 13, 14 )
+ self.label = gtk.Label("1")
+ self.label.modify_font(pango.FontDescription("sans 12"))
+ self._display.settings_table.attach(self.label, 4, 5, 13, 14 )
self.label.show()
- self.label = gtk.Label("|")
- self.label.modify_font(pango.FontDescription("sans 12"))
- self._display.settings_table.attach(self.label, 5, 6, 13, 14 )
+ self.label = gtk.Label("|")
+ self.label.modify_font(pango.FontDescription("sans 12"))
+ self._display.settings_table.attach(self.label, 5, 6, 13, 14 )
self.label.show()
self._display.settings_table.resize(15, 8)
- self.label = gtk.Label("0")
- self.label.modify_font(pango.FontDescription("sans 12"))
- self._display.settings_table.attach(self.label, 6, 7, 13, 14 )
+ self.label = gtk.Label("0")
+ self.label.modify_font(pango.FontDescription("sans 12"))
+ self._display.settings_table.attach(self.label, 6, 7, 13, 14 )
self.label.show()
- self.label = gtk.Label("2")
- self.label.modify_font(pango.FontDescription("sans 12"))
- self._display.settings_table.attach(self.label, 0, 1, 12, 13 )
+ self.label = gtk.Label("2")
+ self.label.modify_font(pango.FontDescription("sans 12"))
+ self._display.settings_table.attach(self.label, 0, 1, 12, 13 )
self.label.show()
- self.label = gtk.Label(":")
- self.label.modify_font(pango.FontDescription("sans 12"))
- self._display.settings_table.attach(self.label, 1, 2, 12, 13 )
+ self.label = gtk.Label(":")
+ self.label.modify_font(pango.FontDescription("sans 12"))
+ self._display.settings_table.attach(self.label, 1, 2, 12, 13 )
self.label.show()
- self.label = gtk.Label("2")
- self.label.modify_font(pango.FontDescription("sans 12"))
- self._display.settings_table.attach(self.label, 2, 3, 12, 13 )
+ self.label = gtk.Label("2")
+ self.label.modify_font(pango.FontDescription("sans 12"))
+ self._display.settings_table.attach(self.label, 2, 3, 12, 13 )
self.label.show()
- self.label = gtk.Label("=")
- self.label.modify_font(pango.FontDescription("sans 12"))
- self._display.settings_table.attach(self.label, 3, 4, 12, 13 )
+ self.label = gtk.Label("=")
+ self.label.modify_font(pango.FontDescription("sans 12"))
+ self._display.settings_table.attach(self.label, 3, 4, 12, 13 )
self.label.show()
- self.label = gtk.Label("1")
- self.label.modify_font(pango.FontDescription("sans 12"))
- self._display.settings_table.attach(self.label, 4, 5, 12, 13 )
+ self.label = gtk.Label("1")
+ self.label.modify_font(pango.FontDescription("sans 12"))
+ self._display.settings_table.attach(self.label, 4, 5, 12, 13 )
self.label.show()
- self.label = gtk.Label("|")
- self.label.modify_font(pango.FontDescription("sans 12"))
- self._display.settings_table.attach(self.label, 5, 6, 12, 13 )
+ self.label = gtk.Label("|")
+ self.label.modify_font(pango.FontDescription("sans 12"))
+ self._display.settings_table.attach(self.label, 5, 6, 12, 13 )
self.label.show()
- self.label = gtk.Label("0")
- self.label.modify_font(pango.FontDescription("sans 12"))
- self._display.settings_table.attach(self.label, 6, 7, 12, 13 )
+ self.label = gtk.Label("0")
+ self.label.modify_font(pango.FontDescription("sans 12"))
+ self._display.settings_table.attach(self.label, 6, 7, 12, 13 )
self.label.show()
- self.label = gtk.Label("1")
- self.label.modify_font(pango.FontDescription("sans 12"))
- self._display.settings_table.attach(self.label, 0, 1, 9, 10 )
+ self.label = gtk.Label("1")
+ self.label.modify_font(pango.FontDescription("sans 12"))
+ self._display.settings_table.attach(self.label, 0, 1, 9, 10 )
self.label.show()
- self.label = gtk.Label("*")
- self.label.modify_font(pango.FontDescription("sans 12"))
- self._display.settings_table.attach(self.label, 1, 2, 9, 10 )
+ self.label = gtk.Label("*")
+ self.label.modify_font(pango.FontDescription("sans 12"))
+ self._display.settings_table.attach(self.label, 1, 2, 9, 10 )
self.label.show()
- self.label = gtk.Label("=")
- self.label.modify_font(pango.FontDescription("sans 12"))
- self._display.settings_table.attach(self.label, 3, 4, 9, 10 )
+ self.label = gtk.Label("=")
+ self.label.modify_font(pango.FontDescription("sans 12"))
+ self._display.settings_table.attach(self.label, 3, 4, 9, 10 )
self.label.show()
- self.label = gtk.Label("2")
- self.label.modify_font(pango.FontDescription("sans 12"))
- self._display.settings_table.attach(self.label, 4, 5, 9, 10 )
+ self.label = gtk.Label("2")
+ self.label.modify_font(pango.FontDescription("sans 12"))
+ self._display.settings_table.attach(self.label, 4, 5, 9, 10 )
self.label.show()
- self.toggle_shuffle_all = gtk.ToggleButton("@")
- self.toggle_shuffle_all_label = self.toggle_shuffle_all.get_child()
- self.toggle_shuffle_all_label.modify_font(pango.FontDescription("sans %d" % style.zoom(12)))
- self.toggle_shuffle_all.connect("toggled", self.toggle_shuffle_all_callback)
- self._display.settings_table.attach(self.toggle_shuffle_all, 2, 3, 11, 12 )
+ self.toggle_shuffle_all = gtk.ToggleButton("@")
+ self.toggle_shuffle_all_label = self.toggle_shuffle_all.get_child()
+ self.toggle_shuffle_all_label.modify_font(pango.FontDescription("sans %d" % style.zoom(12)))
+ self.toggle_shuffle_all.connect("toggled", self.toggle_shuffle_all_callback)
+ self._display.settings_table.attach(self.toggle_shuffle_all, 2, 3, 11, 12 )
self.toggle_shuffle_all.show()
- self.toggle_shuffle_inner = gtk.ToggleButton("@")
- self.toggle_shuffle_inner_label = self.toggle_shuffle_inner.get_child()
- self.toggle_shuffle_inner_label.modify_font(pango.FontDescription("sans %d" % style.zoom(12)))
- self.toggle_shuffle_inner.connect("toggled", self.toggle_shuffle_inner_callback)
- self._display.settings_table.attach(self.toggle_shuffle_inner, 0, 1, 11, 12 )
+ self.toggle_shuffle_inner = gtk.ToggleButton("@")
+ self.toggle_shuffle_inner_label = self.toggle_shuffle_inner.get_child()
+ self.toggle_shuffle_inner_label.modify_font(pango.FontDescription("sans %d" % style.zoom(12)))
+ self.toggle_shuffle_inner.connect("toggled", self.toggle_shuffle_inner_callback)
+ self._display.settings_table.attach(self.toggle_shuffle_inner, 0, 1, 11, 12 )
self.toggle_shuffle_inner.show()
- self.toggle_remainder = gtk.ToggleButton("V")
- self.toggle_remainder_label = self.toggle_remainder.get_child()
- self.toggle_remainder_label.modify_font(pango.FontDescription("sans %d" % style.zoom(12)))
- self.toggle_remainder.connect("toggled", self.toggle_remainder_callback)
- self._display.settings_table.attach(self.toggle_remainder, 5, 7, 11, 12 )
+ self.toggle_remainder = gtk.ToggleButton("V")
+ self.toggle_remainder_label = self.toggle_remainder.get_child()
+ self.toggle_remainder_label.modify_font(pango.FontDescription("sans %d" % style.zoom(12)))
+ self.toggle_remainder.connect("toggled", self.toggle_remainder_callback)
+ self._display.settings_table.attach(self.toggle_remainder, 5, 7, 11, 12 )
self.toggle_remainder.show()
- self.label = gtk.Label("< - >")
- self.label.modify_font(pango.FontDescription("sans 12"))
- self._display.settings_table.attach(self.label, 0, 3, 10, 11)
+ self.label = gtk.Label("< - >")
+ self.label.modify_font(pango.FontDescription("sans 12"))
+ self._display.settings_table.attach(self.label, 0, 3, 10, 11)
self.label.show()
self.toggle_times = gtk.ToggleButton("<")
- self.toggle_times_label = self.toggle_times.get_child()
+ self.toggle_times_label = self.toggle_times.get_child()
self.toggle_times_label.modify_font(pango.FontDescription(
"sans %d" % style.zoom(12)))
self.toggle_times.connect("toggled", self.toggle_times_callback)
- self._display.settings_table.attach(self.toggle_times, 7, 8, 9, 10 )
+ self._display.settings_table.attach(self.toggle_times, 7, 8, 9, 10 )
self.toggle_times.show()
self.toggle_commute = gtk.ToggleButton("<")
- self.toggle_commute_label = self.toggle_commute.get_child()
+ self.toggle_commute_label = self.toggle_commute.get_child()
self.toggle_commute_label.modify_font(pango.FontDescription("sans %d" % style.zoom(12)))
self.toggle_commute.connect("toggled", self.toggle_commute_callback)
- self._display.settings_table.attach(self.toggle_commute, 7, 8, 10, 11 )
+ self._display.settings_table.attach(self.toggle_commute, 7, 8, 10, 11 )
self.toggle_commute.show()
self.toggle_div = gtk.ToggleButton("<")
- self.toggle_div_label = self.toggle_div.get_child()
+ self.toggle_div_label = self.toggle_div.get_child()
self.toggle_div_label.modify_font(pango.FontDescription("sans %d" % style.zoom(12)))
self.toggle_div.connect("toggled", self.toggle_div_callback)
- self._display.settings_table.attach(self.toggle_div, 7, 8, 12, 13 )
+ self._display.settings_table.attach(self.toggle_div, 7, 8, 12, 13 )
self.toggle_div.show()
self.toggle_in = gtk.ToggleButton("<")
- self.toggle_in_label = self.toggle_in.get_child()
+ self.toggle_in_label = self.toggle_in.get_child()
self.toggle_in_label.modify_font(pango.FontDescription("sans %d" % style.zoom(12)))
self.toggle_in.connect("toggled", self.toggle_in_callback)
- self._display.settings_table.attach(self.toggle_in, 7, 8, 13, 14 )
+ self._display.settings_table.attach(self.toggle_in, 7, 8, 13, 14 )
self.toggle_in.show()
- self.number_butts = []
-
- for i in range(2 ,9 + 1):
- self.toggle = gtk.ToggleButton(str(i))
- self.toggle_label = self.toggle.get_child()
- self.toggle_label.modify_font(pango.FontDescription("sans %d" % style.zoom(12)))
- self.toggle.connect("toggled", self.toggle_number_callback, i)
- self._display.settings_table.attach(self.toggle, 2, 3, 11-i, 12-i)
- self.toggle.show()
+ self.number_butts = []
+
+ for i in range(2 ,9 + 1):
+ self.toggle = gtk.ToggleButton(str(i))
+ self.toggle_label = self.toggle.get_child()
+ self.toggle_label.modify_font(pango.FontDescription(
+ "sans %d" % style.zoom(12)))
+ self.toggle.connect("toggled", self.toggle_number_callback, i)
+ self._display.settings_table.attach(self.toggle, 2, 3, 11-i, 12-i)
+ self.toggle.show()
self.number_butts.append(self.toggle)
def set_buttons(self, sett):
@@ -282,14 +283,14 @@ class ExTimesDiv(Exercise):
#**** callbacks ********************************************************
def toggle_shuffle_all_callback(self, widget):
- if widget.get_active():
+ if widget.get_active():
self._display._sett['shuffle_all'] = True
self.toggle_shuffle_inner.set_active(True)
else:
self._display._sett['shuffle_all'] = False
def toggle_shuffle_inner_callback(self, widget):
- if widget.get_active():
+ if widget.get_active():
self._display._sett['shuffle_inner'] = True
else:
if(self.toggle_shuffle_all.get_active()):
@@ -297,35 +298,30 @@ class ExTimesDiv(Exercise):
else:
self._display._sett['shuffle_inner'] = False
- def toggle_number_callback(self, widget, i):
-
- if widget.get_active():
- if(i < self._display._sett['min']):
- self._display._sett['min'] = i
- self.set_buttons(self._display._sett)
-
- elif( i > self._display._sett['max'] ):
- self._display._sett['max'] = i
- self.set_buttons(self._display._sett)
-
- else:
- if( i == self._display._sett['min'] ):
- if( self._display._sett['min'] == self._display._sett['max'] ):
- widget.set_active(True)
- else:
- self._display._sett['min'] = i+1
- self.set_buttons(self._display._sett)
-
- elif( i == self._display._sett['max'] ):
- if( self._display._sett['min'] == self._display._sett['max'] ):
- widget.set_active(True)
- else:
- self._display._sett['max'] = i-1
-
-
- self.set_buttons(self._display._sett)
-
- else:
+ def toggle_number_callback(self, widget, i):
+ if widget.get_active():
+ pass
+# if(i < self._display._sett['min']):
+# self._display._sett['min'] = i
+# self.set_buttons(self._display._sett)
+#
+# elif( i > self._display._sett['max'] ):
+# self._display._sett['max'] = i
+# self.set_buttons(self._display._sett)
+ else:
+ if( i == self._display._sett['min'] ):
+ if( self._display._sett['min'] == self._display._sett['max'] ):
+ widget.set_active(True)
+# else:
+# self._display._sett['min'] = i+1
+# self.set_buttons(self._display._sett)
+ elif( i == self._display._sett['max'] ):
+ if( self._display._sett['min'] == self._display._sett['max'] ):
+ widget.set_active(True)
+# else:
+# self._display._sett['max'] = i-1
+ self.set_buttons(self._display._sett)
+ else:
widget.set_active(True)
diff --git a/ReckonPrimer.activity/session.py b/ReckonPrimer.activity/session.py
index bb6f073..a399c73 100755
--- a/ReckonPrimer.activity/session.py
+++ b/ReckonPrimer.activity/session.py
@@ -32,7 +32,7 @@ class Session:
"""
#print("in Session.run")
if False: # TODO choice according to menu CM
- pass # start Author
+ pass # self._author.run()
else:
self._learner.run()
#self._co.request_exercise()