From a08cff1ddb144cee268395111bbe6acb4f9c1674 Mon Sep 17 00:00:00 2001 From: Walther Neuper Date: Tue, 12 Jan 2010 17:06:43 +0000 Subject: comments for W.Wintersteller --- diff --git a/ReckonPrimer.activity/collection.py b/ReckonPrimer.activity/collection.py index b94ca3a..fddada6 100644 --- a/ReckonPrimer.activity/collection.py +++ b/ReckonPrimer.activity/collection.py @@ -11,7 +11,11 @@ import os class Collection: - __data = None + """ The root and the non-leaf nodes of the ExStore._data. + The leafs are of type Task. + """ + __data = None # TODO transfer from here to Display.treestore and back. + # Transfer is presently done via pickle -- REPLACE this?!? __title = None __description = None __pic = None diff --git a/ReckonPrimer.activity/data/Collection.data b/ReckonPrimer.activity/data/Collection.data new file mode 100644 index 0000000..ff8f3a7 --- /dev/null +++ b/ReckonPrimer.activity/data/Collection.data @@ -0,0 +1,134 @@ +(icollection +Collection +p0 +(dp1 +S'_Collection__description' +p2 +S"hier sind alle 1x1-Reihen mit 'in'" +p3 +sS'_Collection__pic' +p4 +NsS'_Collection__data' +p5 +(lp6 +(icollection +Collection +p7 +(dp8 +g2 +g3 +sg4 +Nsg5 +(lp9 +(itask +Task +p10 +(dp11 +S'_eval' +p12 +(lp13 +sS'_sett' +p14 +(dp15 +S'min' +p16 +I2 +sS'max' +p17 +I2 +sS'*' +p18 +I01 +sS'title' +p19 +S'template extimesdiv' +p20 +sS'shuffle_all' +p21 +I00 +sS'MAX' +p22 +I100 +sS'*commute' +p23 +I01 +sS'MIN' +p24 +I10 +sS'descript' +p25 +S'multiplication, division and "in" from 2 to 19 and 20 to 190. ' +p26 +sS'cut-max' +p27 +I01 +sS'topic' +p28 +S'times_div' +p29 +sS'shuffle_inner' +p30 +I01 +sS'calclines' +p31 +I1 +sS'in' +p32 +I01 +sS':' +p33 +I00 +sS'remainder' +p34 +I00 +sS'icon' +p35 +Nssba(itask +Task +p36 +(dp37 +g12 +(lp38 +sg14 +(dp39 +g16 +I3 +sg17 +I3 +sg18 +I01 +sg19 +g20 +sg21 +I00 +sg22 +I100 +sg23 +I01 +sg24 +I10 +sg25 +g26 +sg27 +I01 +sg28 +g29 +sg30 +I01 +sg31 +I1 +sg32 +I01 +sg33 +I00 +sg34 +I00 +sg35 +NssbasS'_Collection__title' +p40 +S'einzeln * in' +p41 +sbasg40 +S"'*' und 'in' Reihen" +p42 +sb. \ No newline at end of file diff --git a/ReckonPrimer.activity/display.py b/ReckonPrimer.activity/display.py index 05173ed..a5390b4 100755 --- a/ReckonPrimer.activity/display.py +++ b/ReckonPrimer.activity/display.py @@ -99,6 +99,7 @@ class Display: self.exstore_table = gtk.Table(14, 9, True) self.gtk_tree() #-->self.treeview #@# self.exstore_table.attach(self.treeview, 0, 9, 0, 13) + #@# self.treeview.show() self.feedback_table = gtk.Table (14, 9, True) # Insert the 3 tables into the right half of the screen @@ -503,7 +504,8 @@ class Display: self.drag_data_received_data) self.treeview.expand_all() - def drag_data_get_data(self, treeview, context, selection, target_id, etime): + def drag_data_get_data(self, treeview, context, + selection, target_id, etime): # selection erfassen und pixbuf in string umwandeln treeselection = treeview.get_selection() model, iter = treeselection.get_selected() @@ -524,7 +526,8 @@ class Display: return - def drag_data_received_data(self, treeview, context, x, y, selection, info, etime): + def drag_data_received_data(self, treeview, context, x, y, + selection, info, etime): treeselection = treeview.get_selection() model, from_parent = treeselection.get_selected() model = treeview.get_model() @@ -532,7 +535,8 @@ class Display: data = selection.data # aus pixel-string wieder pixbuf objekt erstellen iconpixtemp, sep, title = data.partition(sep) - iconpix = gtk.gdk.pixbuf_new_from_data(iconpixtemp, gtk.gdk.COLORSPACE_RGB, True, 8, 10, 10, 40) + iconpix = gtk.gdk.pixbuf_new_from_data( + iconpixtemp, gtk.gdk.COLORSPACE_RGB, True, 8, 10, 10, 40) data = [iconpix, title] c = Collection(None,None,None,None) diff --git a/ReckonPrimer.activity/exstore.py b/ReckonPrimer.activity/exstore.py index 562ce65..412c9d3 100644 --- a/ReckonPrimer.activity/exstore.py +++ b/ReckonPrimer.activity/exstore.py @@ -7,7 +7,7 @@ import random import copy from sugar.graphics import style -from settings import Settings +from settings import Settings #WN.100112 remove with "treeView-Kollektion" from coach import Coach from collection import Collection from task import Task @@ -18,14 +18,22 @@ from exercises.exercise import Exercise class ExStore: - + """ Holds all exercises avaiable in RP in a tree and stores them on disk. + The tree ist presented looking like a filebrowser, see Display.treeview. + The Learner starts an Exercise by selecting an item of the tree. + The Author creates new Exercises copying certain Exercises by + drag-and-drop and then editing the title, the description and the settings. + + """ + _data = None #hold the tree with root of Collection and leafs of Task def __init__(self, display, coach): self._sett = Settings() - #WN.LV diese Daten via pickle.load(...) holen ############ + #Provisorium für die "3-Button-Version" vvvvvvvvvvvvvvvvvvvvvvvvv self._data = [(self._sett.get_setting('addsub_simp'), []), (self._sett.get_setting('passten'), []), (self._sett.get_setting('times_div'), [])] - #WN.LV [] ist die vorlaeufige Liste der errors ########### + #Provisorium für die "3-Button-Version" ^^^^^^^^^^^^^^^^^^^^^^^^^ + #Provisorium für impl. "treeView-Kollektion" vvvvvvvvvvvvvvvvvvvv _ex000 = Task({'topic' : 'times_div', #for programmers only 'title' : 'template extimesdiv', 'descript': 'multiplication, division and "in" \ @@ -76,9 +84,10 @@ class ExStore: _coll0 = Collection("'*' und 'in' Reihen", "hier sind alle 1x1-Reihen mit 'in'", None, [_coll00]) - _coll0.set_data_in_pickle(_coll0) + _coll0.set_data_in_pickle(_coll0) #WN.100112 remove asap + #self._data = _coll0 + #Provisorium für impl. "treeView-Kollektion" ^^^^^^^^^^^^^^^^^^^^ - #xxxxxxxxxxxxxxxxxxxxxxxx self._display = display self._coach = coach self._active_exerc = None diff --git a/ReckonPrimer.activity/task.py b/ReckonPrimer.activity/task.py index c704be9..b29d244 100644 --- a/ReckonPrimer.activity/task.py +++ b/ReckonPrimer.activity/task.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + ''' author: Bernhard Ruttinger date: 02.12.2009 @@ -5,6 +7,9 @@ description: test class "task" to test our new idea for saving all tasks ''' class Task: + """ The leaf-type of the ExStore._data. The root and the non-leaf nodes + are of type Collection. + """ _sett = None _eval = None diff --git a/ReckonPrimer.activity/treeview_icon.py b/ReckonPrimer.activity/treeview_icon.py index 9b45c25..0d79ab1 100644 --- a/ReckonPrimer.activity/treeview_icon.py +++ b/ReckonPrimer.activity/treeview_icon.py @@ -6,6 +6,7 @@ date: 07.01.2010 treeview_icon Version 0.3 (first test with drag and drop) description: it's the first attempt for drag and drop on display layer. problem with icons is fixed print with Drag and with Drop positions +WN.100112 unused but kept with some code snippets """ import gtk -- cgit v0.9.1