diff options
author | Daniel Francis <francis@sugarlabs.org> | 2012-12-24 14:33:08 (GMT) |
---|---|---|
committer | Daniel Francis <francis@sugarlabs.org> | 2012-12-24 14:33:08 (GMT) |
commit | cf73790f9807ed58997138b01f7400e654ca8988 (patch) | |
tree | 9d53b6d621ab700c4714797676d587c3b879c8f4 | |
parent | 0f48cba633f9205a5218065140370bca78a58c35 (diff) |
Add tree view
Signed-off-by: Daniel Francis <francis@sugarlabs.org>
-rw-r--r-- | activity.py | 67 |
1 files changed, 64 insertions, 3 deletions
diff --git a/activity.py b/activity.py index 0770346..2ba7f21 100644 --- a/activity.py +++ b/activity.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- +# # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or @@ -22,8 +24,41 @@ from sugar3.graphics.toolbarbox import ToolbarBox ACTIVITIES_URL = 'http://www.honduras-tests.com.ar/lesson.html?name=' +grades = [('Tercer grado', + [('unidad2', 'Perpendicularidad'), + ('unidad3', 'Adición'), + ('unidad4', 'Sustracción'), + ('unidad11', 'Longitud'), + ('unidad12', 'Operaciones combinadas'), + ('unidad13', 'Peso'), + ('unidad14', 'Simetría'), + ('tiempo', 'Tiempo')]), + ('Cuarto grado', + [('cuadrilateros', 'Cuadriláteros'), + ('M020407longitud_4grado', 'Longitud'), + ('4_moneda', 'Moneda'), + ('Hora_y_tiempo', 'Hora y tiempo'), + ('M010408capacidad', 'La ruleta del saber')]), + ('Quinto Grado', + [('5u1', 'Potencias'), + ('5u2', 'Ángulos'), + ('5u3', 'Múltiplos'), + ('5u4', 'Superficies'), + ('5u6', 'Sólidos geométricos'), + ('5u10', 'Círculos y circunferencias')]), + ('Sexto grado', + [('U5', 'Fracciones'), + ('U6', 'Sólidos geométricos'), + ('U7', 'Multiplicación y división de fracciones'), + ('M080407elementos', 'Sólidos geométricos'), + ('U10', 'Calendario Maya')]) + ] + + class HNDViewer(activity.Activity): + buffers = [] + def __init__(self, handle): activity.Activity.__init__(self, handle, True) @@ -44,12 +79,31 @@ class HNDViewer(activity.Activity): toolbarbox.toolbar.insert(stopbtn, -1) self.set_toolbar_box(toolbarbox) - + # Canvas - self._notebook = Gtk.Notebook() + paned = Gtk.Paned() + paned.set_orientation(Gtk.Orientation.HORIZONTAL) + + self._treeview = Gtk.TreeView() + column = Gtk.TreeViewColumn('Unidades') + cellrenderer = Gtk.CellRendererText() + column.pack_start(cellrenderer, True) + self._treeview.append_column(column) + column.add_attribute(cellrenderer, 'text', 1) + self.load_buffers() + self._treeview.set_model(self.buffers[0][1]) + self._treeview.show() + paned.pack1(self._treeview) + + self._notebook = Gtk.Notebook() + # Comment this line to debug + self._notebook.set_show_tabs(False) self._browser = WebKit.WebView() self._notebook.append_page(self._browser, None) - self.set_canvas(self._notebook) + paned.pack2(self._notebook) + + paned.show() + self.set_canvas(paned) # TODO: Create a IconView # iconview = Gtk.IconView() @@ -68,3 +122,10 @@ class HNDViewer(activity.Activity): def write_file(self, file_path): return + + def load_buffers(self): + for i in grades: + grade_buffer = Gtk.ListStore(str, str) + for lesson in i[1]: + grade_buffer.append(lesson) + self.buffers.append((i[0], grade_buffer)) |