diff options
Diffstat (limited to 'tutorialtoolbar.py')
-rw-r--r-- | tutorialtoolbar.py | 81 |
1 files changed, 78 insertions, 3 deletions
diff --git a/tutorialtoolbar.py b/tutorialtoolbar.py index 8e41a2d..5d154bd 100644 --- a/tutorialtoolbar.py +++ b/tutorialtoolbar.py @@ -33,13 +33,16 @@ class TutorialToolbar(gtk.Toolbar): 'begin': (SIGNAL_RUN_FIRST, TYPE_NONE, []), 'previous': (SIGNAL_RUN_FIRST, TYPE_NONE, []), 'next': (SIGNAL_RUN_FIRST, TYPE_NONE, []), - 'change-category': (SIGNAL_RUN_FIRST, TYPE_NONE, [TYPE_STRING]), + 'change-category': (SIGNAL_RUN_FIRST, TYPE_NONE, [TYPE_INT]), } + + def __init__(self, activity): gtk.Toolbar.__init__(self) self.activity = activity - + self._current_category = 0 + self._script_indicies = [0,1,3,6,8,11,15,18,21,25,29,33,38,41,48] # Begin Button @@ -102,6 +105,10 @@ class TutorialToolbar(gtk.Toolbar): self._begin_button.set_sensitive(False) self.emit('begin') + def reset_cb(self): + self._current_category = 0 + self._category_combo.combo.set_active(0) + def grey_out_previous(self): self._previous_button.set_sensitive(False) @@ -110,6 +117,40 @@ class TutorialToolbar(gtk.Toolbar): def _previous_cb(self, widget): self._previous_button.set_sensitive(True) + if self._current_category != 0: + self._current_category -= 1 + + if self._current_category == 0: + self._category_combo.combo.set_active(0) + elif self._current_category == 2: + self._category_combo.combo.set_active(1) + elif self._current_category == 5: + self._category_combo.combo.set_active(2) + elif self._current_category == 7: + self._category_combo.combo.set_active(3) + elif self._current_category == 10: + self._category_combo.combo.set_active(4) + elif self._current_category == 14: + self._category_combo.combo.set_active(5) + elif self._current_category == 17: + self._category_combo.combo.set_active(6) + elif self._current_category == 20: + self._category_combo.combo.set_active(7) + elif self._current_category == 24: + self._category_combo.combo.set_active(8) + elif self._current_category == 28: + self._category_combo.combo.set_active(9) + elif self._current_category == 32: + self._category_combo.combo.set_active(10) + elif self._current_category == 37: + self._category_combo.combo.set_active(11) + elif self._current_category == 40: + self._category_combo.combo.set_active(12) + elif self._current_category == 47: + self._category_combo.combo.set_active(13) + else: + self._category_combo.combo.set_active(int(self._category_combo.combo.get_active()) - 1) + self.emit('previous') def grey_out_next(self): @@ -120,7 +161,40 @@ class TutorialToolbar(gtk.Toolbar): def _next_cb(self, widget): self._next_button.set_sensitive(True) + if self._current_category != 53: + self._current_category += 1 self.emit('next') + if self._current_category == 1: + self._category_combo.combo.set_active(1) + elif self._current_category == 3: + self._category_combo.combo.set_active(2) + elif self._current_category == 6: + self._category_combo.combo.set_active(3) + elif self._current_category == 8: + self._category_combo.combo.set_active(4) + elif self._current_category == 11: + self._category_combo.combo.set_active(5) + elif self._current_category == 15: + self._category_combo.combo.set_active(6) + elif self._current_category == 18: + self._category_combo.combo.set_active(7) + elif self._current_category == 21: + self._category_combo.combo.set_active(8) + elif self._current_category == 25: + self._category_combo.combo.set_active(9) + elif self._current_category == 29: + self._category_combo.combo.set_active(10) + elif self._current_category == 33: + self._category_combo.combo.set_active(11) + elif self._current_category == 38: + self._category_combo.combo.set_active(12) + elif self._current_category == 41: + self._category_combo.combo.set_active(13) + elif self._current_category == 48: + self._category_combo.combo.set_active(14) + else: + self._category_combo.combo.set_active(int(self._category_combo.combo.get_active())) + def grey_out_category(self): self._category_combo.set_sensitive(False) @@ -129,6 +203,7 @@ class TutorialToolbar(gtk.Toolbar): self._category_combo.set_sensitive(True) def _category_cb(self, widget): - self.category = int(self._categories[self._category_combo.combo.get_active()]) + self._current_category = int(self._script_indicies[int(self._category_combo.combo.get_active())]) + self.category = int(self._category_combo.combo.get_active()) self.emit('change-category', self.category) |