Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWalther Neuper <neuper@neuper.(none)>2009-12-17 13:08:57 (GMT)
committer Walther Neuper <neuper@neuper.(none)>2009-12-17 13:08:57 (GMT)
commit150ed6044e91a183aafec30fd5a8b090db9ba6a5 (patch)
tree9ace5d7a01ff68f48881a10515892aee945f37b3
parent7bb8d6219f7b38aad7516fd581981c73f803b1a9 (diff)
parent8edcc2f175f3aa4574479e41f7fc834a218586f3 (diff)
debug settings_table, middle of a conflicted merge 2
-rwxr-xr-xReckonPrimer.activity/coach.py19
-rw-r--r--ReckonPrimer.activity/collection.py15
-rwxr-xr-xReckonPrimer.activity/display.py191
-rwxr-xr-xReckonPrimer.activity/exercise.py12
-rwxr-xr-xReckonPrimer.activity/extimesdiv.py3
-rw-r--r--ReckonPrimer.activity/learner.py3
-rw-r--r--ReckonPrimer.tests/collection/test_collection_WW091215.py197
-rw-r--r--ReckonPrimer.tests/collection/test_perfect_minimum.py5
8 files changed, 360 insertions, 85 deletions
diff --git a/ReckonPrimer.activity/coach.py b/ReckonPrimer.activity/coach.py
index 1cb4234..3406c08 100755
--- a/ReckonPrimer.activity/coach.py
+++ b/ReckonPrimer.activity/coach.py
@@ -18,21 +18,32 @@ class Coach:
self._dis = dis
self._collect = collect
self._learner = learner
+ print('in coach.register, exaddsimp =', self._collect.select(0))
+ print('in coach.register, exaddsimp._display =', self._collect.select(0)._display._testvar)
+ print('in coach.register, expassten =', self._collect.select(1))
+ print('in coach.register, expassten._display =', self._collect.select(1)._display._testvar)
+ print('in coach.register, extimesdiv=', self._collect.select(2))
+ print('in coach.register, extimesdiv._display=', self._collect.select(2)._display._testvar)
def request_exercise(self):
""" This preliminary version just lets the Learner select. """
#print("in coach.request_exercise")
self._dis.offer_coll_to_learner(self._collect)
- # calls back with notify('exerc-selected'...
+ # calls back with notify('exerc-selected'... OR 'switch-to-setts'
def notify(self, (msg, data)):
"""called by the observed objects"""
- #print("in coach.notify: msg=, data=", (msg, data))
+ print("in coach.notify: msg=, data=", (msg, data))
if msg == 'setting-done': # from display
self._ex.update_setting(data)
- self._learner.notify((msg, self._ex))
+ self._learner.notify(('start-calcs', self._ex))
elif msg == 'exerc-selected': # from collection
self._ex = self._collect.select(data)
- #print('in coach.notify(exerc-selected), self._ex._sett=',self._ex._sett)
+ print('in coach.notify(exerc-selected), _sett=',self._ex._sett)
+ self._learner.notify(('start-calcs', self._ex))
+ elif msg == 'switch-to-setts': # from display
+ self._ex = self._collect.select(data)
self._dis.offer_setting(self._ex)
+ else:
+ raise Error()
diff --git a/ReckonPrimer.activity/collection.py b/ReckonPrimer.activity/collection.py
index 63b08f2..53ababe 100644
--- a/ReckonPrimer.activity/collection.py
+++ b/ReckonPrimer.activity/collection.py
@@ -55,10 +55,10 @@ class Collection:
TODO: define once at startup of RP ?"""
#WN.LV diesen Code ersetzen: collection_table.attach(self.colldata,...
self.topic_box = gtk.HBox(True, 0)
- self._display.collection_table.attach(self.topic_box, 0, 6, 0, 1)
- #self._display.collection_table.attach(self.topic_box, 0, 6, 5, 6)
+ #self._display.collection_table.attach(self.topic_box, 0, 6, 0, 1)
+ self._display.collection_table.attach(self.topic_box, 0, 9, 5, 6)
- def set_coll_gui(self):
+ def set_coll_gui(self, coll_data):
""" Set gui-elements according to Collection.data. """
#WN.LV diesen Code ersetzen !!!!!
_i = 0
@@ -83,16 +83,19 @@ class Collection:
def select_exerc_callback(self, widget, coll_key):
""" Callback telling the item from the collection selected. """
#WN.LV diesen Code ersetzen> statt 1..n fuer Listen kommt coll_key
+ print('in Collection.select_exerc_callback')
if(self._active_exerc == None):
# at startup
self._active_exerc = coll_key
- self._coach.notify(('exerc-selected', coll_key))
+ self._display.set_select_exerc_semaphore(coll_key)
+ #self._coach.notify(('exerc-selected', coll_key))
elif(self._active_exerc == coll_key):
# hit the same button once more
pass
elif(self._active_exerc != coll_key):
# switched to another exercise
self._active_exerc = coll_key
- self._display.switch_exercise()
- self._coach.notify(('exerc-selected', coll_key))
+ self._display.switch_exercise() # TODO rename
+ self._display.set_select_exerc_semaphore(coll_key)
+ #self._coach.notify(('exerc-selected', coll_key))
diff --git a/ReckonPrimer.activity/display.py b/ReckonPrimer.activity/display.py
index ac0381e..4e93400 100755
--- a/ReckonPrimer.activity/display.py
+++ b/ReckonPrimer.activity/display.py
@@ -21,10 +21,13 @@ class Display:
def __init__(self, window):
self._permanent_gui_elements(window)
self.errors = 0
- self._ex = None # WN091214 ???
- self._ex_key = None #
+ self._ex = None # needed for feedback_table etc
+ # TODO: imprive information hiding
self._sett = None # setting updated by callbacks during input
- self.running = False # first round of calculations WN091214 ???
+ self.running = False # switch settings_/feedback_table TODO rename
+ self._coll_key = None # semaphore for self.finish_collect_callback
+ # and Collection.select_exerc_callback
+ self._testvar = 'FOUND'
def register(self, sess, co, learner):
"""register _after_ Session and Coach have been instantiated"""
@@ -85,9 +88,9 @@ class Display:
self.scrolled_window.show()
# 3 tables as overlays with same 15 lines and 6 columns
- self.settings_table = gtk.Table(15, 6, True)
- self.collection_table = gtk.Table(15, 6, True)
- self.feedback_table = gtk.Table(15, 6, True)
+ self.settings_table = gtk.Table (14, 9, True)
+ self.collection_table = gtk.Table(14, 9, True)
+ self.feedback_table = gtk.Table (14, 9, True)
# Insert the 3 tables into the right half of the screen
self.table.attach(self.settings_table, 1, 2, 0, 5)
@@ -95,9 +98,9 @@ class Display:
self.table.attach(self.feedback_table, 1, 2, 0, 5)
# show all tables, scrolled_window already shown above
- self.settings_table.show()
- self.collection_table.show()
- self.feedback_table.show()
+ self.settings_table_show() # treat uniformly <>!
+ self.collection_table.show() # treat uniformly !
+ self.feedback_table.show() # treat uniformly !
self.table.show() # since all other tables have been inserted
def update_time(self):
@@ -114,19 +117,46 @@ class Display:
self.stopwatch_label.queue_draw()
return True
+ def settings_table_show(self): # rename to .._permanent
+ """ Initialize all permanent gui-elements in settings_table. """
+ # button releasing settings_table and coach.notify('setting-done',..)
+ self.see_butt = gtk.Button(None, gtk.STOCK_GO_FORWARD)
+ self.see_butt.connect("clicked", self.release_sett_callback)
+ #self.settings_table.attach(self.see_butt, 0, 5, 14, 15)
+ self.settings_table.attach(self.see_butt, 0, 8, 13, 14)
+ self.see_alignment = self.see_butt.get_children()[0]
+ self.see_hbox = self.see_alignment.get_children()[0]
+ self.see_image, self.see_label = self.see_hbox.get_children()
+ self.see_label.set_label("settings_table")
+ self.see_butt.show()
+ # button switching from settings_table to collect_table
+ self.sec_butt = gtk.Button("")
+ self.sec_butt.connect("clicked", self.switch_setts_to_coll_callback)
+ #self.settings_table.attach(self.sec_butt, 5, 6, 14, 15)
+ self.settings_table.attach(self.sec_butt, 8, 9, 13, 14)
+ self.sec_alignment = self.sec_butt.get_children()[0]
+ self.sec_butt.show()
+
+ def switch_setts_to_coll_callback(self, widget):
+ """ Switch from settings_table to collection_table. """
+ self.settings_table.hide()
+ self.collection_table.show()
+
def feedback_table_show(self):
"""RENAME to draw_feedback_screen"""
# Section for stopwatch
self.stopwatch = Timer()
self.stopwatch_label = gtk.Label("00:00")
self.stopwatch_label.modify_font(pango.FontDescription("sans 16"))
- self.feedback_table.attach(self.stopwatch_label, 3, 5, 12, 13)
+ #self.feedback_table.attach(self.stopwatch_label, 3, 5, 12, 13)
+ self.feedback_table.attach(self.stopwatch_label, 4, 6, 12, 13)
# Section for nickname
self.name = profile.get_nick_name()
self.name_label = gtk.Label(self.name)
self.name_label.modify_font(pango.FontDescription("sans 16"))
- self.feedback_table.attach(self.name_label, 0, 6, 13, 14)
+ #self.feedback_table.attach(self.name_label, 0, 6, 13, 14)
+ self.feedback_table.attach(self.name_label, 0, 9, 13, 14)
# Section for progress bar
self.progressbar = gtk.ProgressBar(adjustment=None)
@@ -136,7 +166,7 @@ class Display:
style.bg[gtk.STATE_PRELIGHT] = gtk.gdk.color_parse("green")
self.progressbar.set_style (style)
self.progressbar.set_fraction(0)
- self.feedback_table.attach(self.progressbar, 0, 6, 8, 9)
+ self.feedback_table.attach(self.progressbar, 0, 9, 8, 9)
# Labels for progress bar
self.progress0 = gtk.Label("0")
@@ -154,7 +184,8 @@ class Display:
attr.insert(fg_color)
self.correct_counter.set_attributes(attr)
- self.feedback_table.attach(self.correct_counter, 2, 4, 9, 10 )
+ #self.feedback_table.attach(self.correct_counter, 2, 4, 9, 10 )
+ self.feedback_table.attach(self.correct_counter, 3, 5, 9, 10 )
self.false_count = 0
self.false_counter = gtk.Label(str(self.false_count))
@@ -166,7 +197,8 @@ class Display:
attr.insert(fg_color)
self.false_counter.set_attributes(attr)
- self.feedback_table.attach(self.false_counter, 2, 4, 10, 11 )
+ #self.feedback_table.attach(self.false_counter, 2, 4, 10, 11 )
+ self.feedback_table.attach(self.false_counter, 3, 5, 10, 11 )
self.stopwatch_label.show()
gobject.timeout_add(1000, self.update_time)
@@ -179,9 +211,19 @@ class Display:
self.total_calcs = self._ex.count()
self.progress_total = gtk.Label(str(self.total_calcs))
self.progress_total.modify_font(pango.FontDescription("sans 16"))
- self.feedback_table.attach(self.progress_total, 5, 6, 9, 10 )
+ #self.feedback_table.attach(self.progress_total, 5, 6, 9, 10 )
+ self.feedback_table.attach(self.progress_total, 8, 9, 9, 10 )
self.progress_total.show()
+ self.sfb_butt = gtk.Button(None, gtk.STOCK_STOP)
+ self.sfb_butt.connect("clicked", self.release_feedb_callback)
+ self.feedback_table.attach(self.sfb_butt, 0, 9, 13, 14)
+ self.sfb_alignment = self.sfb_butt.get_children()[0]
+ self.sfb_hbox = self.sfb_alignment.get_children()[0]
+ self.sfb_image, self.sfb_label = self.sfb_hbox.get_children()
+ self.sfb_label.set_label("feedback_table")
+ self.sfb_butt.show()
+
def feedback_table_hide(self):
self.progressbar.set_fraction(0)
self.stopwatch_label.hide()
@@ -191,56 +233,35 @@ class Display:
self.correct_counter.hide()
self.false_counter.hide()
self.progress_total.hide()
+ self.sfb_butt.hide()
def offer_setting(self,ex):
""" Prepare display for update of settings. """
self._ex = ex #WN.LV either drop this or self.current_exercise
self._sett = self._ex.get_setting() #WN.LV make _sett local
- ### START BUTTON BEGIN ###
- self.start_button = gtk.Button(None, gtk.STOCK_GO_FORWARD)
- self.start_button.connect("clicked", self.clicked_start_callback)
- self.feedback_table.attach(self.start_button, 0, 6, 14, 15)
- self.start_alignment = self.start_button.get_children()[0]
- self.start_hbox = self.start_alignment.get_children()[0]
- self.start_image, self.start_label = self.start_hbox.get_children()
- self.start_label.set_label("")
- self.start_button.show()
- ### START BUTTON END ###
-
self.current_exercise = ex #WN.LV either drop this or self._ex
- #print('in display.offer_setting, self._sett=', self._sett)
+ print('in display.offer_setting, topic=', self._sett['topic'])
self.current_exercise.define_buttons()
self.current_exercise.set_buttons(self._sett)
+ self.settings_table.show()
+
+ def release_feedb_callback(self, widget):
+ """ """
+ self.protocol('----------------------------------------', 0, 'OK')
+ print('in display.release_feedb_callback')
+ self.calc_table.destroy()
+ self.feedback_table_hide()
+ self.collection_table.show() # from here the next user-interactions
+
+ def release_sett_callback(self, widget):
+ """ Start calcs with these settings (probably updated). """
+ print('in display.release_sett_callback')
+ self._co.notify(('setting-done', self._ex._sett))
+ self.settings_table.hide()
+ #self.collection_table.hide()
+ self.feedback_table_show()
- def clicked_start_callback(self, widget):
- """ Finish offer_setting, deliver settings (possibly updated)
- and tell the coach to start the calculations of the exercise
- ELIF
- """
- if self.running == False:
- self.running = True
- self.start_button.set_label(gtk.STOCK_STOP) #stop-button
- self.start_alignment = self.start_button.get_children()[0]
- self.start_hbox = self.start_alignment.get_children()[0]
- self.start_image, self.start_label = self.start_hbox.get_children()
- self.start_label.set_label("")
- self._co.notify(('setting-done', self._sett))# difference from here
- self.settings_table.hide()
- self.collection_table.hide()
- self.feedback_table_show()
- elif self.running == True:
- self.protocol('----------------------------------------', 0, 'OK')
- self.running = False
- self.start_button.set_label(gtk.STOCK_GO_FORWARD)# >-button
- self.start_alignment = self.start_button.get_children()[0]
- self.start_hbox = self.start_alignment.get_children()[0]
- self.start_image, self.start_label = self.start_hbox.get_children()
- self.start_label.set_label("")
- self.calc_table.destroy() # difference from here
- self.feedback_table_hide()
- self.settings_table.show()
- self.collection_table.show()
def init_calc(self):
"""
@@ -268,16 +289,6 @@ class Display:
mark = self.log_buffer.create_mark(None, end_iterator, True)
self.log_view.scroll_mark_onscreen(mark)
-# def dis_calc(self, clist, cursor, errs):
-# _i, _calc = 0, ''
-# for _c in clist:
-# _i = _i + 1
-# if (_i == cursor) & (errs > 0):
-# _calc = _calc + '_'
-# else:
-# _calc = _calc + _c
-# return _calc + ' ' + errs * '/'
-
def input_digit(self, widget, dig, proterr, protok):
"""callback: input a digit and give feedback.
The _only_ other active widget is the <stop>-button on the right"""
@@ -364,17 +375,61 @@ class Display:
def offer_coll_to_learner(self, collect):
"""TODO: get the users choice from buttons above the settings"""
collect.define_coll_gui()
- collect.set_coll_gui() # sets callbacks
+ collect.set_coll_gui(collect) # sets callbacks
+ self.set_coll_to_learner() # set finish_learner_coll_butt + callb
def switch_exercise(self):
""" Another exercise has been selected. """
+ #WN091215 DAS IST AB JETZT FALSCH: ex<->sett + ex<->coll moeglich
self.settings_table.destroy()
- self.settings_table = gtk.Table(15, 6, True)
+ self.settings_table = gtk.Table(14, 9, True)
self.table.attach(self.settings_table, 1, 2, 0, 5)
self.settings_table.show()
self.feedback_table.destroy()
- self.feedback_table = gtk.Table(15, 6, True)
+ self.feedback_table = gtk.Table(14, 9, True)
self.table.attach(self.feedback_table, 1, 2, 0, 5)
self.feedback_table.show()
+ def set_select_exerc_semaphore(self, coll_key):
+ """ Sets a semaphore for finish_collect_callback. """
+ print('in display.set_select_exerc_semaphore, coll_key', self._coll_key)
+ self._coll_key = coll_key
+
+ def set_coll_to_learner(self):
+ """ Set the permanent gui-elements for collection_table. """
+ print('in display.set_coll_to_learner')
+ # button switching from collect_table to calcs
+ self.flc_butt = gtk.Button(None, gtk.STOCK_GO_FORWARD)
+ self.flc_butt.connect("clicked", self.finish_learner_coll_callback)
+ self.collection_table.attach(self.flc_butt, 0, 8, 13, 14)
+ self.flc_alignment = self.flc_butt.get_children()[0]
+ self.flc_hbox = self.flc_alignment.get_children()[0]
+ self.flc_image, self.flc_label = self.flc_hbox.get_children()
+ self.flc_label.set_label("to calcs")
+ self.flc_butt.show()
+
+ # button switching from collect_table to settings_table
+ self.sts_butt = gtk.Button("")
+ self.sts_butt.connect("clicked", self.switch_learner_to_setts)
+ self.collection_table.attach(self.sts_butt, 8, 9, 13, 14)
+ self.sts_alignment = self.sts_butt.get_children()[0]
+ self.sts_butt.show()
+
+ def finish_learner_coll_callback(self, widget):
+ """ Callback on flc_butt; uses self._coll_key as semaphore
+ from Collection.select_exerc_callback. """
+ print('in display.finish_learner_coll_callback, _coll_key=', self._coll_key)
+ if not(self._coll_key is None):
+ self._co.notify(('exerc-selected', self._coll_key))
+ self.collection_table.hide()
+ self.feedback_table_show()
+
+ def switch_learner_to_setts(self, widget):
+ """ Callback on sts_butt. asks the Coach if allowed. """
+ self._co.notify(('switch-to-setts', self._coll_key))
+ self.collection_table.hide()
+
+ def set_curr_exerc(self, exerc):
+ """ self._ex is needed for feedback_table etc. """
+ self._ex = exerc
diff --git a/ReckonPrimer.activity/exercise.py b/ReckonPrimer.activity/exercise.py
index 69ceeac..c824214 100755
--- a/ReckonPrimer.activity/exercise.py
+++ b/ReckonPrimer.activity/exercise.py
@@ -63,11 +63,19 @@ class Exercise:
pass
def define_buttons(self):
- """ Define buttons for update settings including callbacks. """
+ """ Define buttons for update settings including callbacks.
+ The widgets are local to exerc-instances and attached to the display:
+ # self.butt.connect('toggled',self.butt_callback)
+ # self._display.settings_table.attach(self.butt, 1,2,3,4)
+ And the callbacks run locally, but read and write in the display:
+ # def butt_callback(self, widget)
+ # if widget.get_active():
+ # self._display._sett['+'] = True
+ """
pass
def set_buttons(self, sett):
- """ Display buttons according to the current setting. """
+ """ Display buttons according to the current setting sett. """
pass
#===== methods is used by more than one subclass
diff --git a/ReckonPrimer.activity/extimesdiv.py b/ReckonPrimer.activity/extimesdiv.py
index 8d63ce2..3383810 100755
--- a/ReckonPrimer.activity/extimesdiv.py
+++ b/ReckonPrimer.activity/extimesdiv.py
@@ -201,7 +201,8 @@ class ExTimesDiv(Exercise):
self.toggle_times = gtk.ToggleButton("<")
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_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.toggle_times.show()
diff --git a/ReckonPrimer.activity/learner.py b/ReckonPrimer.activity/learner.py
index f296983..fcbaf85 100644
--- a/ReckonPrimer.activity/learner.py
+++ b/ReckonPrimer.activity/learner.py
@@ -21,8 +21,9 @@ class Learner:
def notify(self, (msg, data)):
'''called by the observed objects'''
#print('in learner.notify: msg=,data=', msg, data)
- if msg == 'setting-done': # from Coach
+ if msg == 'start-calcs': # from Coach
self._ex = data
+ self._display.set_curr_exerc(data)
_calc = self._ex.get_next_calc()
_lines, self._input = data.format(_calc)
self._display.display_calc(_lines)
diff --git a/ReckonPrimer.tests/collection/test_collection_WW091215.py b/ReckonPrimer.tests/collection/test_collection_WW091215.py
new file mode 100644
index 0000000..b8008c8
--- /dev/null
+++ b/ReckonPrimer.tests/collection/test_collection_WW091215.py
@@ -0,0 +1,197 @@
+# -*- coding: utf-8 -*-
+"""tests on collection class"""
+
+
+
+class Task(object):
+
+ # constructor
+ def __init__(self, name):
+ self.name = name
+ self.obj = object
+ # destructor
+ #def __del__(self):
+ # print "in destructor"
+
+ # methods
+
+ # returns string representation of object
+ def __str__(self):
+ return "task: { name: ", self._name , " }"
+
+
+
+class Collection(object):
+
+ # constructor
+ def __init__(self, name):
+ self.name = name
+ self.pic = object
+ self._coll = []
+ self._tasks = []
+ # destructor
+ #def __del__(self):
+ # print "in destructor"
+
+ # methods
+
+ # adds collection or task to collection
+ def add(self, obj):
+ # if obj.instanceOf(Collection)
+ self._coll.append(obj)
+ #else
+ #self._tasks.append(obj)
+
+ # deletes collection or task from collection
+ def delete(self,sel):
+ # if obj.instanceOf(Collection) ?????
+ # find object
+ # if obj empty: delete
+ print "collection deleted"
+ # else error: collection not empty
+ # error: collection not found
+ # else # =task
+ # find object
+ print "task deletet"
+ # error: task not found
+
+ # returns string representation of object
+ def __str__(self): #mit for schleife definieren!!!
+ return 'collection: { name: ' , self.name , ', tasks: [' , self._tasks.__str__ , '], collections: [' , self._coll.__str__ , '] }'
+
+################################
+ def delete(self, n):
+ del self._data[n]
+
+ def pick(self, coords):
+ """ coords is a list of numbers (n-tupel), wich tells, which element
+ of the collection to select. The selected element will be returned """
+ if len(coords) == 0:
+ return self # emty coordinates: return this element
+ elif len(coords) == 1:
+ return self._data[coords[0]] # end of recursion
+ # go to next level
+ #self._data[coords[0]].show()
+ self._data[coords[0]].pick(coords[1:])
+
+ def show(self, top):
+ """ prints recursively all elements of this collection """
+ print("**********")
+ print "collection: ", self._name
+ print "elements:"
+ for el in self._data:
+ el.show(False)
+ print "---- end of ", self._name
+ if top:
+ print # print an empty line after the last element
+##################################
+
+
+
+class Data(object): # inherit from gtk tree???
+
+ # constructor
+ def __init__(self):
+ self._collRoot = Collection("")
+ self._co=[0,2] # selction coordiantes: testing only ???
+ # destructor
+ #def __del__(self):
+ # print "in destructor"
+
+ # methods
+
+ # adds collection to selected collection or root
+ def addCollection(self, obj):
+ # if selection = null
+ self._collRoot.add(obj)
+ # else
+ # selCollection.add(obj)
+
+ # adds task to selected collection
+ def addTask(self, obj):
+ print "add task" #avoid syntax error
+ # if selection = null
+ # Error: please selct a collection to add a new task
+ # else
+ # selCollection.add(obj)
+
+ # edit selected object: task or collection
+ def edit(self):
+ # if selection = null
+ # Error: please select a task or collection
+ # find object
+ # if sel obj instance of task
+ # loadTask.. ???
+ # else
+ # loadCollection.. ???
+ print "edit object"
+
+ # deletes selected collection or task
+ def delete(self):
+ print "delete" #avoid syntax error
+ #if self._co = [0,2] and self._collRoot = []
+ # del self._collRoot
+ #else
+ self._collRoot.delete(sel)
+
+
+ # saves _collRoot to file
+ def _saveToFile(self):
+ print "save"
+
+ # loads _collRoot from file
+ def _loadFromFile(self):
+ print "load"
+
+ # update treeView
+ def _updateTree(self):
+ print "update treeView"
+
+ # returns string representation of object
+ def __str__(self):
+ return self._collRoot.__str__()
+
+
+
+
+
+
+# test
+
+fs = Data()
+
+c1 = Collection("c1")
+c2 = Collection("c2")
+t1 = Task("t1")
+t2 = Task("t2")
+c1.add(t1)
+c1.add(t2)
+c3 = Collection("c3")
+c3.add(t2)
+c3.add(t1)
+c1.add(c2.add(c3))
+fs.addCollection(c1)
+
+# created: [[t1, t2, [t2, t1]]]
+print fs.__str__()
+#print fs.__dict__
+#print fs.collRoot.__dict__
+
+
+# Versuch in einer Schleife dynamisch auf ein mit Koordinaten spezifiertes Object zuzugreifen
+#co=[0,2] # Koordinaten
+#print "pick element ", co
+#el = root
+#for n in co:
+# el = el._data[n]
+#el.show(True)
+
+#p1=task("res")
+#p1.show(True)
+#p1=root.pick([0,1])
+#p1.show(True)
+
+#root.pick([0,2,1]).show(True)
+#print "should be t1"
+
+
diff --git a/ReckonPrimer.tests/collection/test_perfect_minimum.py b/ReckonPrimer.tests/collection/test_perfect_minimum.py
index 671072a..8e1134b 100644
--- a/ReckonPrimer.tests/collection/test_perfect_minimum.py
+++ b/ReckonPrimer.tests/collection/test_perfect_minimum.py
@@ -1,5 +1,4 @@
-# -*- coding: utf-8 -*-
-# (c) Michael Matschir 2009
+# -*- coding: UTF8 -*-
"""tests on collection class"""
class collection:
@@ -55,7 +54,7 @@ el = root
for n in co:
el = el._data[n]
-el.show(True) # gewähltes Element anzeigen
+el.show(True) # gewähltes Element anzeigen
# funktioniert!