Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/mindmapactivity.py
diff options
context:
space:
mode:
authorTomeu Vizoso <tomeu@sugarlabs.org>2009-01-24 14:52:05 (GMT)
committer Tomeu Vizoso <tomeu@sugarlabs.org>2009-01-24 14:52:05 (GMT)
commitdbb1e04ee6f544d9b18f2b78633138602dab0d4b (patch)
tree2ed8f0876f1fbd545afd2ed0e653883bd75ebbaa /mindmapactivity.py
parent852766ad7192a6b53eea8127643e8a81ecf49efa (diff)
Place a first thought in new modelsmodel-as-a-tree
Diffstat (limited to 'mindmapactivity.py')
-rwxr-xr-xmindmapactivity.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/mindmapactivity.py b/mindmapactivity.py
index e972f79..4a5e2b2 100755
--- a/mindmapactivity.py
+++ b/mindmapactivity.py
@@ -17,6 +17,7 @@
import logging
from gettext import gettext as _
+import gobject
import gtk
from sugar.activity import activity
@@ -27,6 +28,9 @@ from view import MindMapView
from treeview import TreeView
class MindMapActivity(activity.Activity):
+
+ __gtype_name__ = 'MindMapActivity'
+
def __init__(self, handle):
activity.Activity.__init__(self, handle)
@@ -54,6 +58,18 @@ class MindMapActivity(activity.Activity):
pane.pack2(self._view)
self._view.show()
+ if handle.object_id is None:
+ gobject.idle_add(self.__add_first_thought_cb)
+
+ def __add_first_thought_cb(self):
+ x, y, width, height = self._view.get_allocation()
+ #TODO: place better the first thought
+ thought_id = self._model.create_new_thought(name=_('Initial thought'),
+ color='#999900',
+ x=width / 2,
+ y=height / 2)
+ return False
+
def __new_thought_button_cb(self, button):
self._model.create_new_thought()