Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormike <michael.jmontcalm@gmail.com>2009-12-09 03:00:32 (GMT)
committer mike <michael.jmontcalm@gmail.com>2009-12-09 03:00:32 (GMT)
commit6d7315d644e776566f5bc833c3fa17f6f6bfdff8 (patch)
tree654c668659f4adada192b8e6d06ad0f4402a4854
parent4a0bde4a5b6570aa40505e32e17c04787c2951d6 (diff)
Integration with Tutorius : Emitting set_current_act calls on Frame's Home and Activities TraysHEADmaster
-rw-r--r--src/jarabe/frame/activitiestray.py13
-rw-r--r--src/jarabe/frame/zoomtoolbar.py31
-rw-r--r--src/jarabe/journal/journalactivity.py27
-rw-r--r--src/jarabe/model/shell.py2
4 files changed, 69 insertions, 4 deletions
diff --git a/src/jarabe/frame/activitiestray.py b/src/jarabe/frame/activitiestray.py
index d6831b2..3c44bda 100644
--- a/src/jarabe/frame/activitiestray.py
+++ b/src/jarabe/frame/activitiestray.py
@@ -367,6 +367,19 @@ class ActivitiesTray(HTray):
def __activity_changed_cb(self, home_model, home_activity):
logging.debug('__activity_changed_cb: %r', home_activity)
+ logging.debug('__activity_changed_cb: Activity name is %s', home_activity.get_activity_name())
+ from sugar.tutorius.service import ServiceProxy
+ service = ServiceProxy()
+ if home_activity.is_journal():
+ service.set_current_act("org.laptop.JournalActivity")
+ else:
+ # Import the activity bundle in order to get the right
+ # name for the current activity
+ from sugar.bundle.activitybundle import ActivityBundle
+ # Send the activity id to the Tutorius service to inform
+ # it of the current activity
+ bundle = ActivityBundle(home_activity.get_bundle_path())
+ service.set_current_act(bundle.get_bundle_id())
# Only select the new activity, if there is no tabbing activity.
if home_model.get_tabbing_activity() is None:
diff --git a/src/jarabe/frame/zoomtoolbar.py b/src/jarabe/frame/zoomtoolbar.py
index c168e97..2fcc7a6 100644
--- a/src/jarabe/frame/zoomtoolbar.py
+++ b/src/jarabe/frame/zoomtoolbar.py
@@ -69,7 +69,36 @@ class ZoomToolbar(gtk.Toolbar):
if not button.get_active():
return
- shell.get_model().zoom_level = level
+ shell_model = shell.get_model()
+ shell_model.zoom_level = level
+
+ from sugar.tutorius.service import ServiceProxy
+ service = ServiceProxy()
+ view_name = ""
+ if level == shell.ShellModel.ZOOM_MESH:
+ view_name = "org.sugar.desktop.mesh"
+ elif level == shell.ShellModel.ZOOM_GROUP:
+ view_name = "org.sugar.desktop.group"
+ elif level == shell.ShellModel.ZOOM_HOME:
+ #view_name = "org.sugar.desktop.home"
+ # HACK : because the home gets to be the
+ # current activity when selecting something in the Creator
+ pass
+ elif level == shell.ShellModel.ZOOM_ACTIVITY:
+ current_act = shell_model.get_active_activity()
+
+ logging.debug("__level_clicked_cb :: %r", current_act)
+ if current_act.is_journal():
+ view_name = "org.laptop.JournalActivity"
+ else:
+ bundle_path = current_act.get_bundle_path()
+ logging.debug("__level_clicked_cb :: %s", bundle_path)
+ from sugar.bundle.activitybundle import ActivityBundle
+ bundle = ActivityBundle(bundle_path)
+ view_name = bundle.get_bundle_id()
+ logging.debug("ZoomToolbar :: Tray view clicked, new view is %s", view_name)
+ if view_name != "":
+ service.set_current_act(view_name)
def __zoom_level_changed_cb(self, **kwargs):
self._set_zoom_level(kwargs['new_level'])
diff --git a/src/jarabe/journal/journalactivity.py b/src/jarabe/journal/journalactivity.py
index 0d6d09d..71eba9b 100644
--- a/src/jarabe/journal/journalactivity.py
+++ b/src/jarabe/journal/journalactivity.py
@@ -32,6 +32,8 @@ from sugar import env
from sugar.activity import activityfactory
from sugar import wm
+import sugar.tutorius.TProbe as TProbe
+
from jarabe.model import bundleregistry
from jarabe.journal.journaltoolbox import MainToolbox, DetailToolbox
from jarabe.journal.listview import ListView
@@ -138,10 +140,23 @@ class JournalActivity(Window):
self._critical_space_alert = None
self._check_available_space()
+ # Add the Tutorius Probe to allow interaction with engine and creator
+ self._probe = TProbe.TProbe(self, "org.laptop.JournalActivity", self.get_id())
+
+ # DEBUG functions -- get this away as soon as the flexible probes are
+ # introduced
+ def get_bundle_id(self):
+ return _BUNDLE_ID
+ def get_id(self):
+ self._activity_id = activityfactory.create_activity_id()
+ return self._activity_id
+ def get_bundle_path(self):
+ return ""
+
def __realize_cb(self, window):
wm.set_bundle_id(window.window, _BUNDLE_ID)
- activity_id = activityfactory.create_activity_id()
- wm.set_activity_id(window.window, str(activity_id))
+ #self._activity_id = activityfactory.create_activity_id()
+ wm.set_activity_id(window.window, str(self._activity_id))
self.disconnect(self._realized_sid)
self._realized_sid = None
@@ -295,6 +310,10 @@ class JournalActivity(Window):
def __window_state_event_cb(self, window, event):
logging.debug('window_state_event_cb %r', self)
+
+ #from sugar.tutorius.service import ServiceProxy
+ #prox = ServiceProxy()
+ #prox.set_current_act("org.laptop.JournalActivity")
if event.changed_mask & gtk.gdk.WINDOW_STATE_ICONIFIED:
state = event.new_window_state
visible = not state & gtk.gdk.WINDOW_STATE_ICONIFIED
@@ -304,6 +323,10 @@ class JournalActivity(Window):
logging.debug('visibility_notify_event_cb %r', self)
visible = event.state != gtk.gdk.VISIBILITY_FULLY_OBSCURED
self._list_view.set_is_visible(visible)
+ if visible:
+ from sugar.tutorius.service import ServiceProxy
+ prox = ServiceProxy()
+ prox.set_current_act("org.laptop.JournalActivity")
def _check_available_space(self):
''' Check available space on device
diff --git a/src/jarabe/model/shell.py b/src/jarabe/model/shell.py
index ef2268d..e256770 100644
--- a/src/jarabe/model/shell.py
+++ b/src/jarabe/model/shell.py
@@ -265,6 +265,7 @@ class Activity(gobject.GObject):
error_handler=self._set_active_error)
def _set_active_success(self):
+ logging.debug("Activity %s is now active"%(self.get_activity_name()))
pass
def _set_active_error(self, err):
@@ -515,7 +516,6 @@ class ShellModel(gobject.GObject):
act = self._get_activity_by_xid(window.get_xid())
if act is not None:
self._set_active_activity(act)
-
self._update_zoom_level(window)
def _add_activity(self, home_activity):