diff options
author | Walther Neuper <wneuper@localhost.(none)> | 2010-06-08 09:56:13 (GMT) |
---|---|---|
committer | Walther Neuper <wneuper@localhost.(none)> | 2010-06-08 09:56:13 (GMT) |
commit | a95dd5a31df562ba0c755ef857aecd52c10d24bf (patch) | |
tree | 78a74a02e20058ccb3e853e7455115c1dc8ed2b8 /ReckonPrimer.activity | |
parent | f87aa26674efced594809ae825b592944390080a (diff) |
exaddsimp.py: Extimesdiv._dis._sett --> Extimesdiv._sett WORKS OK, old setts again
Diffstat (limited to 'ReckonPrimer.activity')
-rw-r--r-- | ReckonPrimer.activity/exercises/exaddsimp.py | 163 |
1 files changed, 82 insertions, 81 deletions
diff --git a/ReckonPrimer.activity/exercises/exaddsimp.py b/ReckonPrimer.activity/exercises/exaddsimp.py index af939eb..f252b87 100644 --- a/ReckonPrimer.activity/exercises/exaddsimp.py +++ b/ReckonPrimer.activity/exercises/exaddsimp.py @@ -14,7 +14,7 @@ from functions import * class ExAddSimp(Exercise): def __init__(self, dis, (sett, errors)): - self._display = dis + self._dis = dis self._sett = sett self._errors = errors # {'topic' : 'addsub_simp', @@ -93,136 +93,136 @@ class ExAddSimp(Exercise): #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 ) + #self._dis.settings_table.attach(self.label6, 0, 1, 1, 2 ) #self.label6.show() self.label_to = gtk.Label('-->') self.label_to.modify_font(pango.FontDescription("sans 12")) - self._display.settings_table.attach(self.label_to, 1, 2, 1, 2 ) + self._dis.settings_table.attach(self.label_to, 1, 2, 1, 2 ) self.label_to.show() -# self.toggle_max = gtk.ToggleButton(str(self._display._sett['MAX'])) -# self.toggle_label = self.toggle_max.get_child() -# self.toggle_label.modify_font(pango.FontDescription("sans %d" % style.zoom(12))) -# self.toggle_max.connect("toggled", self.toggle_max_callback) -# self._display.settings_table.attach(self.toggle_max, 2, 3, 1, 2) -# self.toggle_max.show() + self.toggle_max = gtk.ToggleButton(str(self._sett['MAX'])) + self.toggle_label = self.toggle_max.get_child() + self.toggle_label.modify_font(pango.FontDescription("sans %d" % style.zoom(12))) + self.toggle_max.connect("toggled", self.toggle_max_callback) + self._dis.settings_table.attach(self.toggle_max, 2, 3, 1, 2) + self.toggle_max.show() self.toggle_shuffle = gtk.ToggleButton("@") self.toggle_label = self.toggle_shuffle.get_child() self.toggle_label.modify_font(pango.FontDescription("sans %d" % style.zoom(12))) self.toggle_shuffle.connect("toggled", self.toggle_shuffle_callback) - self._display.settings_table.attach(self.toggle_shuffle, 5, 6, 13, 14 ) + self._dis.settings_table.attach(self.toggle_shuffle, 5, 6, 13, 14 ) self.toggle_shuffle.show() self.toggle_equal_fixed_right = gtk.ToggleButton("<<") self.toggle_label = self.toggle_equal_fixed_right.get_child() self.toggle_label.modify_font(pango.FontDescription("sans %d" % style.zoom(12))) self.toggle_equal_fixed_right.connect("toggled", self.toggle_equal_fixed_right_callback) - self._display.settings_table.attach(self.toggle_equal_fixed_right, 5, 6, 10, 11 ) + self._dis.settings_table.attach(self.toggle_equal_fixed_right, 5, 6, 10, 11 ) self.toggle_equal_fixed_right.show() self.toggle_equal_fixed_left = gtk.ToggleButton("<<") self.toggle_label = self.toggle_equal_fixed_left.get_child() self.toggle_label.modify_font(pango.FontDescription("sans %d" % style.zoom(12))) self.toggle_equal_fixed_left.connect("toggled", self.toggle_equal_fixed_left_callback) - self._display.settings_table.attach(self.toggle_equal_fixed_left, 5, 6, 12, 13 ) + self._dis.settings_table.attach(self.toggle_equal_fixed_left, 5, 6, 12, 13 ) self.toggle_equal_fixed_left.show() self.toggle_pos1 = gtk.ToggleButton("--") self.toggle_label = self.toggle_pos1.get_child() self.toggle_label.modify_font(pango.FontDescription("sans %d" % style.zoom(12))) self.toggle_pos1.connect("toggled", self.toggle_pos1_callback) - self._display.settings_table.attach(self.toggle_pos1, 0, 1, 11, 12 ) + self._dis.settings_table.attach(self.toggle_pos1, 0, 1, 11, 12 ) self.toggle_pos1.show() self.toggle_pos3 = gtk.ToggleButton("--") self.toggle_label = self.toggle_pos3.get_child() self.toggle_label.modify_font(pango.FontDescription("sans %d" % style.zoom(12))) self.toggle_pos3.connect("toggled", self.toggle_pos3_callback) - self._display.settings_table.attach(self.toggle_pos3, 2, 3, 11, 12 ) + self._dis.settings_table.attach(self.toggle_pos3, 2, 3, 11, 12 ) self.toggle_pos3.show() self.toggle_pos5 = gtk.ToggleButton("--") self.toggle_label = self.toggle_pos5.get_child() self.toggle_label.modify_font(pango.FontDescription("sans %d" % style.zoom(12))) self.toggle_pos5.connect("toggled", self.toggle_pos5_callback) - self._display.settings_table.attach(self.toggle_pos5, 4, 5, 11, 12 ) + self._dis.settings_table.attach(self.toggle_pos5, 4, 5, 11, 12 ) self.toggle_pos5.show() self.toggle_pos1_lower = gtk.ToggleButton("--") self.toggle_label = self.toggle_pos1_lower.get_child() self.toggle_label.modify_font(pango.FontDescription("sans %d" % style.zoom(12))) self.toggle_pos1_lower.connect("toggled", self.toggle_pos1_lower_callback) - self._display.settings_table.attach(self.toggle_pos1_lower, 0, 1, 13, 14 ) + self._dis.settings_table.attach(self.toggle_pos1_lower, 0, 1, 13, 14 ) self.toggle_pos1_lower.show() self.toggle_pos3_lower = gtk.ToggleButton("--") self.toggle_label = self.toggle_pos3_lower.get_child() self.toggle_label.modify_font(pango.FontDescription("sans %d" % style.zoom(12))) self.toggle_pos3_lower.connect("toggled", self.toggle_pos3_lower_callback) - self._display.settings_table.attach(self.toggle_pos3_lower, 2, 3, 13, 14 ) + self._dis.settings_table.attach(self.toggle_pos3_lower, 2, 3, 13, 14 ) self.toggle_pos3_lower.show() self.toggle_pos5_lower = gtk.ToggleButton("--") self.toggle_label = self.toggle_pos5_lower.get_child() self.toggle_label.modify_font(pango.FontDescription("sans %d" % style.zoom(12))) self.toggle_pos5_lower.connect("toggled", self.toggle_pos5_lower_callback) - self._display.settings_table.attach(self.toggle_pos5_lower, 4, 5, 13, 14 ) + self._dis.settings_table.attach(self.toggle_pos5_lower, 4, 5, 13, 14 ) self.toggle_pos5_lower.show() self.label0 = gtk.Label("0") self.label0.modify_font(pango.FontDescription("sans 12")) - self._display.settings_table.attach(self.label0, 0, 1, 10, 11 ) + self._dis.settings_table.attach(self.label0, 0, 1, 10, 11 ) self.label0.show() self.toggle_plus = gtk.ToggleButton("+") self.toggle_label = self.toggle_plus.get_child() self.toggle_label.modify_font(pango.FontDescription("sans %d" % style.zoom(12))) self.toggle_plus.connect("toggled", self.toggle_plus_callback) - self._display.settings_table.attach(self.toggle_plus, 1, 2, 10, 11 ) + self._dis.settings_table.attach(self.toggle_plus, 1, 2, 10, 11 ) self.toggle_plus.show() self.toggle_minus = gtk.ToggleButton("-") self.toggle_label = self.toggle_minus.get_child() self.toggle_label.modify_font(pango.FontDescription("sans %d" % style.zoom(12))) self.toggle_minus.connect("toggled", self.toggle_minus_callback) - self._display.settings_table.attach(self.toggle_minus, 1, 2, 9, 10 ) + self._dis.settings_table.attach(self.toggle_minus, 1, 2, 9, 10 ) self.toggle_minus.show() self.label02 = gtk.Label("0") self.label02.modify_font(pango.FontDescription("sans 12")) - self._display.settings_table.attach(self.label02, 2, 3, 10, 11 ) + self._dis.settings_table.attach(self.label02, 2, 3, 10, 11 ) self.label02.show() self.label_equal = gtk.Label("=") self.label_equal.modify_font(pango.FontDescription("sans 12")) - self._display.settings_table.attach(self.label_equal, 3, 4, 10, 11 ) + self._dis.settings_table.attach(self.label_equal, 3, 4, 10, 11 ) self.label_equal.show() self.label0_lower = gtk.Label("0") self.label0_lower.modify_font(pango.FontDescription("sans 12")) - self._display.settings_table.attach(self.label0_lower, 0, 1, 12, 13 ) + self._dis.settings_table.attach(self.label0_lower, 0, 1, 12, 13 ) self.label0_lower.show() self.label_equal_lower = gtk.Label("=") self.label_equal_lower.modify_font(pango.FontDescription("sans 12")) - self._display.settings_table.attach(self.label_equal_lower, 1, 2, 12, 13 ) + self._dis.settings_table.attach(self.label_equal_lower, 1, 2, 12, 13 ) self.label_equal_lower.show() self.label02_lower = gtk.Label("0") self.label02_lower.modify_font(pango.FontDescription("sans 12")) - self._display.settings_table.attach(self.label02_lower, 2, 3, 12, 13 ) + self._dis.settings_table.attach(self.label02_lower, 2, 3, 12, 13 ) self.label02_lower.show() self.label_plus_minus_lower = gtk.Label("+") self.label_plus_minus_lower.modify_font(pango.FontDescription("sans 12")) - self._display.settings_table.attach(self.label_plus_minus_lower, 3, 4, 12, 13 ) + self._dis.settings_table.attach(self.label_plus_minus_lower, 3, 4, 12, 13 ) self.label_plus_minus_lower.show() self.label03_lower = gtk.Label("0") self.label03_lower.modify_font(pango.FontDescription("sans 12")) - self._display.settings_table.attach(self.label03_lower, 4, 5, 12, 13 ) + self._dis.settings_table.attach(self.label03_lower, 4, 5, 12, 13 ) self.label03_lower.show() # Buttons 9 .. 0 @@ -232,7 +232,7 @@ class ExAddSimp(Exercise): 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, 4, 5, 10-i, 11-i) + self._dis.settings_table.attach(self.toggle, 4, 5, 10-i, 11-i) self.toggle.show() self.number_butts.append(self.toggle) @@ -287,58 +287,58 @@ class ExAddSimp(Exercise): 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) + if(i < self._sett['min']): + self._sett['min'] = i + self.set_buttons(self._sett) + elif( i > self._sett['max'] ): + self._sett['max'] = i + self.set_buttons(self._sett) else: - if( i == self._display._sett['min'] ): - if( self._display._sett['min'] == self._display._sett['max'] ): + if( i == self._sett['min'] ): + if( self._sett['min'] == self._sett['max'] ): widget.set_active(True) else: - self._display._sett['min'] = i+1 - self.set_buttons(self._display._sett) + self._sett['min'] = i+1 + self.set_buttons(self._sett) - elif( i == self._display._sett['max'] ): - if( self._display._sett['min'] == self._display._sett['max'] ): + elif( i == self._sett['max'] ): + if( self._sett['min'] == self._sett['max'] ): widget.set_active(True) else: - self._display._sett['max'] = i-1 - self.set_buttons(self._display._sett) + self._sett['max'] = i-1 + self.set_buttons(self._sett) else: widget.set_active(True) #BEGIN LPCHANGE - self._display_generated_calcs('digit '+ str(i)) + self._dis_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 + self._sett['cut-max'] = True #BEGIN LPCHANGE - self._display_generated_calcs('max') + self._dis_generated_calcs('max') #END LPCHANGE else: - self._display._sett['cut-max'] = False + self._sett['cut-max'] = False #BEGIN LPCHANGE - self._display_generated_calcs('no max') + self._dis_generated_calcs('no max') #END LPCHANGE def toggle_plus_callback(self, widget): if widget.get_active(): - self._display._sett['+'] = True + self._sett['+'] = True #BEGIN LPCHANGE - self._display_generated_calcs('plus') + self._dis_generated_calcs('plus') #END LPCHANGE else: if( self.toggle_minus.get_active() ): - self._display._sett['+'] = False + self._sett['+'] = False #BEGIN LPCHANGE - self._display_generated_calcs('no plus') + self._dis_generated_calcs('no plus') #END LPCHANGE else: @@ -347,15 +347,15 @@ class ExAddSimp(Exercise): def toggle_minus_callback(self, widget): if widget.get_active(): - self._display._sett['-'] = True + self._sett['-'] = True #BEGIN LPCHANGE - self._display_generated_calcs('minus') + self._dis_generated_calcs('minus') #END LPCHANGE else: if( self.toggle_plus.get_active() ): - self._display._sett['-'] = False + self._sett['-'] = False #BEGIN LPCHANGE - self._display_generated_calcs('no minus') + self._dis_generated_calcs('no minus') #END LPCHANGE else: widget.set_active(True) @@ -363,28 +363,28 @@ class ExAddSimp(Exercise): def toggle_shuffle_callback(self, widget): if widget.get_active(): - self._display._sett['shuffle'] = True + self._sett['shuffle'] = True else: - self._display._sett['shuffle'] = False + self._sett['shuffle'] = False def toggle_equal_fixed_right_callback(self, widget): if widget.get_active(): - self._display._sett['_+_=_'] = True + self._sett['_+_=_'] = True 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') + self._dis_generated_calcs('fixed right') #END LPCHANGE else: if( self.toggle_equal_fixed_left.get_active() ): - self._display._sett['_+_=_'] = False + self._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') + self._dis_generated_calcs('unfixed right') #END LPCHANGE else: widget.set_active(True) @@ -392,21 +392,21 @@ class ExAddSimp(Exercise): def toggle_equal_fixed_left_callback(self, widget): if widget.get_active(): - self._display._sett['_=_+_'] = True + self._sett['_=_+_'] = True 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') + self._dis_generated_calcs('fixed left') #END LPCHANGE else: if( self.toggle_equal_fixed_right.get_active() ): - self._display._sett['_=_+_'] = False + self._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') + self._dis_generated_calcs('unfixed left') #END LPCHANGE else: widget.set_active(True) @@ -420,13 +420,13 @@ class ExAddSimp(Exercise): self.toggle_pos1.set_active(False) if( self.toggle_pos1.get_active() ): - self._display._sett['input='] = list(set(self._display._sett['input=']) | set([1])) + self._sett['input='] = list(set(self._sett['input=']) | set([1])) else: if( self.toggle_equal_fixed_right.get_active() ): if( not self.toggle_pos3.get_active() and not self.toggle_pos5.get_active() ): self.toggle_pos1.set_active(True) else: - self._display._sett['input='] = list(set(self._display._sett['input=']) - set([1])) + self._sett['input='] = list(set(self._sett['input=']) - set([1])) def toggle_pos3_callback(self, widget): if( self.toggle_equal_fixed_right.get_active() ): @@ -435,13 +435,13 @@ class ExAddSimp(Exercise): self.toggle_pos3.set_active(False) if( self.toggle_pos3.get_active() ): - self._display._sett['input='] = list(set(self._display._sett['input=']) | set([3])) + self._sett['input='] = list(set(self._sett['input=']) | set([3])) else: if( self.toggle_equal_fixed_right.get_active() ): if( not self.toggle_pos1.get_active() and not self.toggle_pos5.get_active() ): self.toggle_pos3.set_active(True) else: - self._display._sett['input='] = list(set(self._display._sett['input=']) - set([3])) + self._sett['input='] = list(set(self._sett['input=']) - set([3])) def toggle_pos5_callback(self, widget): if( self.toggle_equal_fixed_right.get_active() ): @@ -450,13 +450,13 @@ class ExAddSimp(Exercise): self.toggle_pos5.set_active(False) if( self.toggle_pos5.get_active() ): - self._display._sett['input='] = list(set(self._display._sett['input=']) | set([5])) + self._sett['input='] = list(set(self._sett['input=']) | set([5])) else: if( self.toggle_equal_fixed_right.get_active() ): if( not self.toggle_pos1.get_active() and not self.toggle_pos3.get_active() ): self.toggle_pos5.set_active(True) else: - self._display._sett['input='] = list(set(self._display._sett['input=']) - set([5])) + self._sett['input='] = list(set(self._sett['input=']) - set([5])) def toggle_pos1_lower_callback(self, widget): @@ -466,13 +466,13 @@ class ExAddSimp(Exercise): self.toggle_pos1_lower.set_active(False) if( self.toggle_pos1_lower.get_active() ): - self._display._sett['=input'] = list(set(self._display._sett['=input']) | set([1])) + self._sett['=input'] = list(set(self._sett['=input']) | set([1])) else: if( self.toggle_equal_fixed_left.get_active() ): if( not self.toggle_pos3_lower.get_active() and not self.toggle_pos5_lower.get_active() ): self.toggle_pos1_lower.set_active(True) else: - self._display._sett['=input'] = list(set(self._display._sett['=input']) - set([1])) + self._sett['=input'] = list(set(self._sett['=input']) - set([1])) def toggle_pos3_lower_callback(self, widget): if( self.toggle_equal_fixed_left.get_active() ): @@ -481,16 +481,16 @@ class ExAddSimp(Exercise): self.toggle_pos3_lower.set_active(False) if( self.toggle_pos3_lower.get_active() ): - self._display._sett['=input'] = list( - set(self._display._sett['=input']) | set([3])) + self._sett['=input'] = list( + set(self._sett['=input']) | set([3])) else: if(self.toggle_equal_fixed_left.get_active()): if(not self.toggle_pos1_lower.get_active() and not self.toggle_pos5_lower.get_active()): self.toggle_pos3_lower.set_active(True) else: - self._display._sett['=input'] = list( - set(self._display._sett['=input']) - set([3])) + self._sett['=input'] = list( + set(self._sett['=input']) - set([3])) def toggle_pos5_lower_callback(self, widget): if( self.toggle_equal_fixed_left.get_active() ): @@ -499,13 +499,13 @@ class ExAddSimp(Exercise): self.toggle_pos5_lower.set_active(False) if( self.toggle_pos5_lower.get_active() ): - self._display._sett['=input'] = list(set(self._display._sett['=input']) | set([5])) + self._sett['=input'] = list(set(self._sett['=input']) | set([5])) else: if( self.toggle_equal_fixed_left.get_active() ): if( not self.toggle_pos1_lower.get_active() and not self.toggle_pos3_lower.get_active()): self.toggle_pos5_lower.set_active(True) else: - self._display._sett['=input'] = list(set(self._display._sett['=input']) - set([5])) + self._sett['=input'] = list(set(self._sett['=input']) - set([5])) ##### end of public methods ############################################ def _alladd(self, min, max): @@ -536,6 +536,7 @@ class ExAddSimp(Exercise): #BEGIN LPCHANGE def _display_generated_calcs(self, change): print("DEBUG: in exaddsubsimp._display_generated_calcs()") - self._display.protocol_generated_calcs(self._generate_calcs(), change) + self._dis.protocol_generated_calcs(self._generate_calcs(), change) + #END LPCHANGE |