Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/editlessonlistscreen.py
diff options
context:
space:
mode:
authorWade Brainerd <wadetb@gmail.com>2009-09-11 00:00:12 (GMT)
committer Wade Brainerd <wadetb@gmail.com>2009-09-11 00:00:12 (GMT)
commit05cb5364230d2d9ab65ac3a77a4a7dec29b8748b (patch)
tree157236d0157b34331de3a965f4304e230547abf8 /editlessonlistscreen.py
parent9ffd0d146b25b5430bdf18ac44c552d0d8a53454 (diff)
Lesson editing bug fixes.
Diffstat (limited to 'editlessonlistscreen.py')
-rw-r--r--editlessonlistscreen.py23
1 files changed, 11 insertions, 12 deletions
diff --git a/editlessonlistscreen.py b/editlessonlistscreen.py
index d1ed405..29d76d7 100644
--- a/editlessonlistscreen.py
+++ b/editlessonlistscreen.py
@@ -51,20 +51,13 @@ class EditLessonListScreen(gtk.VBox):
titlebox.pack_start(stopbtn, False, False, 10)
titlebox.pack_end(title, False, False, 10)
- help = gtk.Label()
- help.set_padding(10, 0)
- help.set_alignment(1.0, 0.5)
- help.set_markup(
- _("Choose the lesson that you wish to modify. If you wish to add a new lesson, ") +
- _("or delete an existing lesson, use the buttons at the bottom.")
- )
-
# Add the lesson list.
self.treeview = gtk.TreeView()
self.treeview.set_rules_hint(True)
self.treeview.set_enable_search(False)
self.treeview.connect('cursor-changed', self.lesson_selected_cb)
+ self.treeview.connect('row-activated', self.lesson_activated_cb)
# Note that the only thing we store in our liststore is the lesson id.
# All the actual data is in the lessons list.
@@ -113,7 +106,6 @@ class EditLessonListScreen(gtk.VBox):
buttonbox.pack_start(self.dellessonbtn, True, False, 10)
self.pack_start(titlebox, False, False, 10)
- self.pack_start(help, False, False, 10)
self.pack_start(gtk.HSeparator(), False, False, 0)
self.pack_start(scroll, True, True, 10)
self.pack_start(buttonbox, False, False, 10)
@@ -124,6 +116,7 @@ class EditLessonListScreen(gtk.VBox):
def build(self):
# Fill the lesson list.
+ self.liststore.clear()
for t in range(0, len(self.lessons)-1):
self.liststore.append((t,))
@@ -138,11 +131,16 @@ class EditLessonListScreen(gtk.VBox):
cell_renderer.set_property('text', t['description'])
def stop_clicked_cb(self, btn):
+ # Refresh the main screen given the new lesson data.
+ self.activity.mainscreen.show_lesson(self.activity.mainscreen.lesson_index)
+
self.activity.pop_screen()
def add_lesson_clicked_cb(self, btn):
- lesson = {}
+ lesson = { 'name':'', 'description':'', 'type':'normal', 'steps':[ { 'instructions':'', 'text':'' } ] }
+ self.lessons.append(lesson)
self.activity.push_screen(editlessonscreen.EditLessonScreen(self.activity, lesson))
+ self.build()
def del_lesson_clicked_cb(self, btn):
path = self.treeview.get_cursor()[0]
@@ -150,8 +148,8 @@ class EditLessonListScreen(gtk.VBox):
model = self.liststore
iter = model.get_iter(path)
id = model.get_value(iter, 0)
- self.lessons = self.lessons[id:] + self.lessons[id:]
- self.liststore.remove(iter)
+ self.lessons.pop(id)
+ self.build()
def edit_lesson_clicked_cb(self, btn):
path = self.treeview.get_cursor()[0]
@@ -177,3 +175,4 @@ class EditLessonListScreen(gtk.VBox):
lesson = self.lessons[id]
self.activity.push_screen(editlessonscreen.EditLessonScreen(self.activity, lesson))
+