diff options
Diffstat (limited to 'ReckonPrimer.activity/exercises/extimesdiv.py')
-rwxr-xr-x | ReckonPrimer.activity/exercises/extimesdiv.py | 236 |
1 files changed, 116 insertions, 120 deletions
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) |