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-12 02:22:00 (GMT)
committer mike <michael.jmontcalm@gmail.com>2009-12-12 02:22:00 (GMT)
commitc959c8d96fb37e7ee00b965e0b9cad579f491df8 (patch)
treefcf05720386819153163030c4a3e3d6fe461a983
parenta6f01575d19ffaae326b10b1752a04b427901f13 (diff)
Shell Integration : Working out process detection in Engine and Remotedesktop_probes
-rwxr-xr-xsrc/extensions/tutoriusremote.py13
-rw-r--r--tutorius/TProbe.py30
-rw-r--r--tutorius/engine.py23
-rw-r--r--tutorius/overlayer.py1
-rw-r--r--tutorius/properties.py5
-rw-r--r--tutorius/service.py14
6 files changed, 74 insertions, 12 deletions
diff --git a/src/extensions/tutoriusremote.py b/src/extensions/tutoriusremote.py
index 129b7b3..c7687ee 100755
--- a/src/extensions/tutoriusremote.py
+++ b/src/extensions/tutoriusremote.py
@@ -105,6 +105,19 @@ class TPalette(Palette):
activity = get_model().get_active_activity()
act_name = activity.get_type()
+
+ if not act_name:
+ # If the activity name is null, then we are looking at a zoom level window
+ shell_model = get_model()
+ zoom_level = shell_model.zoom_level
+ if zoom_level == shell_model.ZOOM_MESH:
+ act_name = "org.sugar.desktop.mesh"
+ elif zoom_level == shell_model.ZOOM_GROUP:
+ act_name = "org.sugar.desktop.group"
+ elif zoom_level == shell_model.ZOOM_HOME:
+ act_name = "org.sugar.desktop.home"
+ elif activity.is_journal():
+ act_name = "org.laptop.JournalActivity"
tutorial_dict = Vault.list_available_tutorials(act_name)
diff --git a/tutorius/TProbe.py b/tutorius/TProbe.py
index 7da777f..d5ce713 100644
--- a/tutorius/TProbe.py
+++ b/tutorius/TProbe.py
@@ -678,17 +678,35 @@ class ProbeManager(object):
ProbeManager._LOGGER.debug("__init__()")
def setCurrentActivity(self, activity_id):
- if not activity_id in self._probes:
- raise RuntimeError("Activity not attached, id : %s"%activity_id)
+ #if not activity_id in self._probes:
+ # raise RuntimeError("Activity not attached, id : %s"%activity_id)
self._current_activity = activity_id
def getCurrentActivity(self):
# TODO : Insert the correct call to remember the current activity,
# taking the views and frame into account
- current_act = get_model().get_active_activity()
- current_act_bundle = ActivityBundle(current_act.get_bundle_path())
- current_act_id = current_act_bundle.get_bundle_id()
- self._current_activity = current_act_id
+ #shell_model = get_model()
+ #current_act = shell_model.get_active_activity()
+ #if current_act is None:
+ # zoom_level = shell_model.get_zoom_level()
+ # LOGGER.debug("ProbeManager :: Current activity is None, zoom_level is %d", zoom_level)
+ # if zoom_level == shell_model.ZOOM_HOME:
+ # self._current_activity = "org.sugar.dekstop.home"
+ # elif zoom_level == shell_model.ZOOM_GROUP:
+ # self._current_activity = "org.sugar.desktop.group"
+ # elif zoom_level == shell_model.ZOOM_MESH:
+ # self._current_activity = "org.sugar.desktop.mesh"
+ # else:
+ # current_act_bundle = ActivityBundle(current_act.get_bundle_path())
+ # current_act_id = current_act_bundle.get_bundle_id()
+ # self._current_activity = current_act_id
+ #elif current_act.is_journal():
+ # self._current_activity = "org.laptop.JournalActivity"
+ #else:
+ # current_act_bundle = ActivityBundle(current_act.get_bundle_path())
+ # current_act_id = current_act_bundle.get_bundle_id()
+ # self._current_activity = current_act_id
+ #LOGGER.debug("ProbeManager :: Current activity is %s"%(self._current_activity))
return self._current_activity
currentActivity = property(fget=getCurrentActivity, fset=setCurrentActivity)
diff --git a/tutorius/engine.py b/tutorius/engine.py
index 39cfeeb..2c10c80 100644
--- a/tutorius/engine.py
+++ b/tutorius/engine.py
@@ -38,6 +38,10 @@ RUNNER_STATE_AWAITING_NOTIFICATIONS = "awaiting_notification"
RUNNER_STATE_UNINSTALLING_ACTIONS = "uninstalling_actions"
RUNNER_STATE_UNSUBSCRIBING_EVENTS = "unsubscribing_events"
+SUGAR_HOME = "org.sugar.desktop.home"
+SUGAR_MESH = "org.sugar.desktop.mesh"
+SUGAR_GROUP = "org.sugar.desktop.group"
+
LOGGER = logging.getLogger("sugar.tutorius.engine")
class TutorialRunner(object):
@@ -317,10 +321,21 @@ class Engine:
#Get the active activity from the shell
activity = self._shell.get_active_activity()
- #TProbes automatically use the bundle id, available from the ActivityBundle
- bundle = ActivityBundle(activity.get_bundle_path())
-
- self._tutorial._activity_id = bundle.get_bundle_id() #HACK until we have activity id's in action/events
+ if activity and activity.get_bundle_path():
+ #TProbes automatically use the bundle id, available from the ActivityBundle
+ bundle = ActivityBundle(activity.get_bundle_path())
+
+ self._tutorial._activity_id = bundle.get_bundle_id() #HACK until we have activity id's in action/events
+ else:
+ zoom_level = self._shell.zoom_level
+ if zoom_level == self._shell.ZOOM_MESH:
+ self._tutorial._activity_id = SUGAR_MESH
+ elif zoom_level == self._shell.ZOOM_GROUP:
+ self._tutorial._activity_id = SUGAR_GROUP
+ elif zoom_level == self._shell.ZOOM_HOME:
+ self._tutorial._activity_id = SUGAR_HOME
+ else:
+ self._tutorial._activity_id = "org.laptop.JournalActivity"
self._tutorial.start()
diff --git a/tutorius/overlayer.py b/tutorius/overlayer.py
index 6b75e8a..d59fda5 100644
--- a/tutorius/overlayer.py
+++ b/tutorius/overlayer.py
@@ -187,6 +187,7 @@ class FrameOverlayer(gtk.Window):
self.set_keep_above(True) # Always on top
self.fullscreen() # Cover the entire screen
self.expose = self.connect("expose-event", self.apply_mask)
+ self.set_accept_focus(False)
def _child_map_event(self, widget):
LOGGER.debug("map %s", str(widget))
diff --git a/tutorius/properties.py b/tutorius/properties.py
index a0d63bb..63bdee5 100644
--- a/tutorius/properties.py
+++ b/tutorius/properties.py
@@ -28,7 +28,8 @@ from .constraints import Constraint, \
ColorConstraint, FileConstraint, BooleanConstraint, EnumConstraint, \
ResourceConstraint, IntTypeConstraint, FloatTypeConstraint, \
StringTypeConstraint, ArrayTypeConstraint, BoolTypeConstraint, \
- SequenceTypeConstraint, TypeConstraint, TypeConstraintError
+ SequenceTypeConstraint, TypeConstraint, TypeConstraintError, \
+ MultiTypeConstraint
from .propwidgets import PropWidget, \
StringPropWidget, \
@@ -266,7 +267,7 @@ class TStringProperty(TutoriusProperty):
if size_limit:
self.size_limit = MaxSizeConstraint(size_limit)
if null:
- self.string_type = TypeConstraint((str, type(None)))
+ self.string_type = MultiTypeConstraint((str, type(None)))
else:
self.string_type = StringTypeConstraint()
diff --git a/tutorius/service.py b/tutorius/service.py
index 1564339..704bfcd 100644
--- a/tutorius/service.py
+++ b/tutorius/service.py
@@ -87,6 +87,18 @@ class Service(dbus.service.Object):
LOGGER.debug("Service.unregister_probe(%s)", unique_id)
self._probeMgr.unregister_probe(unique_id)
+ @dbus.service.method(_DBUS_SERVICE_IFACE,
+ in_signature='s', out_signature='')
+ def set_current_act(self, new_act_id):
+ """
+ Sets the new current activity. Must be called by Sugar when the activity
+ or window focus changes.
+
+ @param new_act_id The bundle id of the new current activity/window.
+ """
+ new_act_id = str(new_act_id)
+ self._probeMgr.currentActivity = new_act_id
+
class ServiceProxy:
""" Proxy to connect to the Service object, abstracting the DBus interface"""
@@ -137,6 +149,8 @@ class ServiceProxy:
# asynchronous call to be completed
self._service.unregister_probe(unique_id)
+ def set_current_act(self, new_act_id):
+ remote_call(self._service.set_current_act, (new_act_id,), block=False)
if __name__ == "__main__":
import dbus.mainloop.glib