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 02:58:20 (GMT)
committer mike <michael.jmontcalm@gmail.com>2009-12-12 02:28:05 (GMT)
commitc4d00bf355a4a33d645fd4fa968a7dc203f93397 (patch)
tree1bb6904c43e8f473f9d975d40ac27f4281ea8b13
parentcfe99ec84472d0da26a6efabe4a6ca7a95cb9e60 (diff)
Integration with Sugar : Exposing set_current_act on Service
Correcting two interface mismatches (install error on translator, subscribe error on creator) Changing MessageButtonNext to ButtonNext
-rw-r--r--addons/messagebuttonnext.py4
-rwxr-xr-xsrc/extensions/tutoriusremote.py2
-rw-r--r--tutorius/TProbe.py30
-rw-r--r--tutorius/creator.py11
-rw-r--r--tutorius/engine.py2
-rw-r--r--tutorius/propwidgets.py4
-rw-r--r--tutorius/translator.py5
7 files changed, 48 insertions, 10 deletions
diff --git a/addons/messagebuttonnext.py b/addons/messagebuttonnext.py
index 40e55c2..37d86b4 100644
--- a/addons/messagebuttonnext.py
+++ b/addons/messagebuttonnext.py
@@ -29,7 +29,7 @@ class MessageButtonNext(EventFilter):
MessageButtonNext
"""
# set message
- message = TStringProperty("Message")
+ message = TStringProperty("Click next to continue")
# create the position as an array of fixed-size 2
position = TArrayProperty((0,0), 2, 2)
@@ -95,7 +95,7 @@ __event__ = {
"display_name" : "Message button next",
"icon" : "message-bubble",
"class" : MessageButtonNext,
- "mandatory_props" : ["message"]
+ "mandatory_props" : []
}
class MsgNext(gtk.EventBox):
diff --git a/src/extensions/tutoriusremote.py b/src/extensions/tutoriusremote.py
index c7687ee..498c606 100755
--- a/src/extensions/tutoriusremote.py
+++ b/src/extensions/tutoriusremote.py
@@ -119,6 +119,8 @@ class TPalette(Palette):
elif activity.is_journal():
act_name = "org.laptop.JournalActivity"
+ LOGGER.debug("Remote :: Listing tutorial for activity %s", act_name)
+
tutorial_dict = Vault.list_available_tutorials(act_name)
# Build the combo box
diff --git a/tutorius/TProbe.py b/tutorius/TProbe.py
index 65454ca..69a2656 100644
--- a/tutorius/TProbe.py
+++ b/tutorius/TProbe.py
@@ -673,15 +673,24 @@ class ProbeProxy:
else:
LOGGER.debug("ProbeProxy :: unsubsribe address %s inconsistency : not registered", address)
- def create_event(self, addon_name):
+ def create_event(self, addon_name, event_created_cb):
"""
Create an event on the app side and request the user to fill the
properties before returning it.
@param addon_name: the add-on name of the event
+ @param event_created_cb The notification to trigger once the event has
+ been instantiated
@returns: an eventfilter instance
"""
- return pickle.loads(str(self._probe.create_event(addon_name)))
+ self._probe.create_event(addon_name,
+ reply_handler=save_args(self._event_created_cb, event_created_cb),
+ error_handler=ignore)
+
+ def _event_created_cb(self, event_created_cb, event):
+ LOGGER.debug("ProbeProxy :: _event_created_cb, calling upper layer")
+ event = pickle.loads(str(event))
+ event_created_cb(event)
def subscribe(self, event, notification_cb, event_subscribed_cb, error_cb):
@@ -754,8 +763,16 @@ class ProbeManager(object):
ProbeManager._LOGGER.debug("__init__()")
def setCurrentActivity(self, activity_id):
+ # HACK : Disabling check for now, since it prevents usage of probes
+ # in activities that have yet to register their probes... We might
+ # set the current activity before having to execute anything inside it
+ # e.g. A new source is crawling in and we need to start the activity
+ #
+ # This should be removed once the Home Window probes are installed.
+
#if not activity_id in self._probes:
# raise RuntimeError("Activity not attached, id : %s"%activity_id)
+ LOGGER.debug("ProbeManager :: New activity set as current = %s", str(activity_id))
self._current_activity = activity_id
def getCurrentActivity(self):
@@ -860,16 +877,17 @@ class ProbeManager(object):
else:
raise RuntimeWarning("No activity attached")
- def create_event(self, addon_name):
+ def create_event(self, addon_name, event_created_cb):
"""
Create an event on the app side and request the user to fill the
properties before returning it.
@param addon_name: the add-on name of the event
+ @param event_created_cb The notification to send once the event was created
@returns: an eventfilter instance
"""
if self.currentActivity:
- return self._first_proxy(self.currentActivity).create_event(addon_name)
+ return self._first_proxy(self.currentActivity).create_event(addon_name, event_created_cb)
else:
raise RuntimeWarning("No activity attached")
@@ -930,6 +948,10 @@ class ProbeManager(object):
self._probes[process_name] = [(unique_id,self._ProxyClass(process_name, unique_id))]
else:
self._probes[process_name].append((unique_id,self._ProxyClass(process_name, unique_id)))
+ # Register the probe that was just installed as the current activity
+ # (this will be true by default since we probably were waiting for it
+ # to open up)
+ self.currentActivity = process_name
def unregister_probe(self, unique_id):
diff --git a/tutorius/creator.py b/tutorius/creator.py
index 6ba7011..7d9153b 100644
--- a/tutorius/creator.py
+++ b/tutorius/creator.py
@@ -306,8 +306,17 @@ class Creator(Object):
"""
event_type = self._propedit.events_list[path][ToolBox.ICON_NAME]
- event = self._probe_mgr.create_event(event_type)
+ event = self._probe_mgr.create_event(event_type,
+ event_created_cb=partial(self._event_created, event_type))
+ def _event_created(self, event_type, event):
+ """
+ Callback to execute when the creation of a new event is complete.
+
+ @param event_type The type of event that was created
+ @param event The event that was instanciated
+ """
+ LOGGER.debug("Creator :: _event_created, now setting source and adding inside tutorial")
# Configure the event prior to installing it
# Currently, this consists of writing its source
event.source = self._probe_mgr.currentActivity
diff --git a/tutorius/engine.py b/tutorius/engine.py
index 2c10c80..97e28ca 100644
--- a/tutorius/engine.py
+++ b/tutorius/engine.py
@@ -112,7 +112,7 @@ class TutorialRunner(object):
# Verify if we just completed the subscription of all the events for this state
self._verify_event_install_state()
- def subscribe_error(self, event_name, exception):
+ def subscribe_error(self, event_name, event, exception):
# TODO : Do correct error handling here
LOGGER.debug("TutorialRunner :: Could not subscribe to event %s, got exception : %s"%(event_name, str(exception)))
self._subscription_errors[event_name] = exception
diff --git a/tutorius/propwidgets.py b/tutorius/propwidgets.py
index dfc6ac0..09d53c5 100644
--- a/tutorius/propwidgets.py
+++ b/tutorius/propwidgets.py
@@ -21,6 +21,9 @@ Allows displaying properties cleanly.
import gtk
import gobject
+import logging
+LOGGER = logging.getLogger("sugar.tutorius.propwidgets")
+
from . import gtkutils, overlayer
###########################################################################
# Dialog classes
@@ -94,6 +97,7 @@ class SignalInputDialog(gtk.MessageDialog):
iter = self.entry.get_active_iter()
if iter:
text = self.model.get_value(iter, 0)
+ LOGGER.debug("SignalInputDialog :: Got signal name %s", text)
return text
return None
diff --git a/tutorius/translator.py b/tutorius/translator.py
index 6b5e5c4..d5e99c0 100644
--- a/tutorius/translator.py
+++ b/tutorius/translator.py
@@ -221,7 +221,7 @@ class ResourceTranslator(object):
# was installed
action_installed_cb(address)
- def action_install_error(self, install_error_cb, old_action, exception):
+ def action_install_error(self, install_error_cb, old_action, new_action, exception):
# Warn the upper layer that the installation failed
install_error_cb(old_action, exception)
@@ -235,7 +235,8 @@ class ResourceTranslator(object):
self.translate(new_action)
# Send the new action to the probe manager
- self._probe_manager.install(new_action, save_args(self.action_installed, action_installed_cb),
+ self._probe_manager.install(new_action,
+ save_args(self.action_installed, action_installed_cb),
save_args(self.action_install_error, error_cb, new_action),
is_editing=is_editing,
editing_cb=editing_cb)