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-13 14:53:49 (GMT)
committer Walther Neuper <neuper@neuper.(none)>2009-12-13 14:53:49 (GMT)
commitececf7d3de1752a80317c8a6b8beb304138e4112 (patch)
tree6ec60efa42ef27ba17af118695d9620628ef1893
parent77aee633c3eef95e760599b45352382aece04709 (diff)
display.offer_topic --> collection.offer_coll_to_learner OK
-rw-r--r--ReckonPrimer.activity/collection.py56
-rwxr-xr-xReckonPrimer.activity/display.py51
-rwxr-xr-xReckonPrimer.activity/session.py2
3 files changed, 38 insertions, 71 deletions
diff --git a/ReckonPrimer.activity/collection.py b/ReckonPrimer.activity/collection.py
index 0356f5a..e9a1d69 100644
--- a/ReckonPrimer.activity/collection.py
+++ b/ReckonPrimer.activity/collection.py
@@ -1,16 +1,25 @@
# -*- coding: utf-8 -*-
+import gtk
+import pygtk
+import pango
+import random
+import copy
+from sugar.graphics import style
from settings import Settings
+from coach import Coach
class Collection:
- def __init__(self, display):
+ def __init__(self, display, coach):
self._sett = Settings()
# these data should come from pickle (see code in Settings)
self._data = [self._sett.get_setting('addsub_simp'),
self._sett.get_setting('passten'),
self._sett.get_setting('times_div')]
self._display = display
+ self._coach = coach
+ self._active_topic = None
def define_coll_gui(self):
""" Define gui-elements for presenting the collcetion. """
@@ -18,11 +27,11 @@ class Collection:
self.topic_box = gtk.HBox(True, 0)
self._display.topic_table.attach(self.topic_box, 0, 6, 0, 1)
- def set_coll_gui(self, data):
+ def set_coll_gui(self):
""" Set gui-elements according to Collection.data. """
#WN.LV diesen Code ersetzen !!!!!
_i = 0
- for _t in ['addsub_simp', 'passten', 'times_div']:
+ for _t in ['addsub_simp','passten','times_div']:
_i = _i + 1
self.button = gtk.Button()
self.image = gtk.Image()
@@ -35,29 +44,34 @@ class Collection:
self.image.set_from_file("img/times_div.jpg")
self.button.set_image(self.image)
- self.button.connect("clicked", self.new_topic, _t)
+ self.button.connect("clicked", self.topic_select_callback, _t)
self.topic_box.pack_start(self.button)
self.button.show()
self.topic_box.show()
+
- def new_topic(self, widget, topic):
+ def topic_select_callback(self, widget, topic):
"""callback: get the users choice from buttons above the settings"""
- if(self.active_topic == None):
- self.active_topic = topic
- print('in Display.new_topic, 422 self._sett=', self._sett)
- self._co.notify(('new-topic', topic))
- elif(self.active_topic == topic):
+ if(self._active_topic == None):
+ self._active_topic = topic
+ print('in collection.topic_select_callback, 422 self._sett=',
+ self._sett)
+ self._coach.notify(('new-topic', topic))
+ elif(self._active_topic == topic):
pass
- elif(self.active_topic != topic):
- self.active_topic = topic
- self.settings_table.destroy()
- self.settings_table = gtk.Table(15, 6, True)
- self.table.attach(self.settings_table, 1, 2, 0, 5)
- self.settings_table.show()
+ elif(self._active_topic != topic):
+ self._active_topic = topic
+ #WN.LV the code below should go into display
+ self._display.settings_table.destroy()
+ self._display.settings_table = gtk.Table(15, 6, True)
+ self._display.table.attach(self._display.
+ settings_table, 1, 2, 0, 5)
+ self._display.settings_table.show()
- self.table_with_start.destroy()
- self.table_with_start = gtk.Table(15, 6, True)
- self.table.attach(self.table_with_start, 1, 2, 0, 5)
- self.table_with_start.show()
- self._co.notify(('new-topic', topic))
+ self._display.table_with_start.destroy()
+ self._display.table_with_start = gtk.Table(15, 6, True)
+ self._display.table.attach(self._display.
+ table_with_start, 1, 2, 0, 5)
+ self._display.table_with_start.show()
+ self._coach.notify(('new-topic', topic))
diff --git a/ReckonPrimer.activity/display.py b/ReckonPrimer.activity/display.py
index 5861a77..beb4c67 100755
--- a/ReckonPrimer.activity/display.py
+++ b/ReckonPrimer.activity/display.py
@@ -391,52 +391,5 @@ class Display:
def offer_coll_to_learner(self, collect):
"""TODO: get the users choice from buttons above the settings"""
-# define_coll_gui()
-# set_coll_gui()
- self.topic_box = gtk.HBox(True, 0)
- self.topic_table.attach(self.topic_box, 0, 6, 0, 1)
- _i = 0
- for _t in ['addsub_simp','passten','times_div']:
- _i = _i + 1
- self.button = gtk.Button()
- self.image = gtk.Image()
-
- if(_t == 'addsub_simp'):
- self.image.set_from_file("img/addsub_simp.jpg")
- elif(_t == 'passten'):
- self.image.set_from_file("img/passten.jpg")
- elif(_t == 'times_div'):
- self.image.set_from_file("img/times_div.jpg")
-
- self.button.set_image(self.image)
- self.button.connect("clicked", self.new_topic, _t)
- self.topic_box.pack_start(self.button)
- self.button.show()
- self.topic_box.show()
-
-
- def new_topic(self, widget, topic):
- """callback: get the users choice from buttons above the settings"""
- if(self.active_topic == None):
- self.active_topic = topic
- print('in Display.new_topic, 422 self._sett=', self._sett)
- self._co.notify(('new-topic', topic))
- elif(self.active_topic == topic):
- pass
- elif(self.active_topic != topic):
- self.active_topic = topic
- self.settings_table.destroy()
- self.settings_table = gtk.Table(15, 6, True)
- self.table.attach(self.settings_table, 1, 2, 0, 5)
- self.settings_table.show()
-
- self.table_with_start.destroy()
- self.table_with_start = gtk.Table(15, 6, True)
- self.table.attach(self.table_with_start, 1, 2, 0, 5)
- self.table_with_start.show()
- self._co.notify(('new-topic', topic))
-
-
-
-
-
+ collect.define_coll_gui()
+ collect.set_coll_gui()
diff --git a/ReckonPrimer.activity/session.py b/ReckonPrimer.activity/session.py
index 5bdb5f0..f583d47 100755
--- a/ReckonPrimer.activity/session.py
+++ b/ReckonPrimer.activity/session.py
@@ -19,7 +19,7 @@ class Session:
self._co = Coach()
self._learner = Learner(self._dis, self._co)
self._author = Author()
- self._collect = Collection(self._dis)
+ self._collect = Collection(self._dis, self._co)
self._co.register(self, self._dis, self._collect, self._learner)
self._dis.register(self, self._co, self._learner)
self._co.create_exercises() #TODO.WN091101 replace by storing Exerc.s