From 410da49824e3a310829a1d02e8f8b488b227d702 Mon Sep 17 00:00:00 2001 From: Charlie Date: Mon, 07 Dec 2009 14:20:08 +0000 Subject: remove the Calc hack --- diff --git a/src/extensions/tutoriusremote.py b/src/extensions/tutoriusremote.py index d795141..129b7b3 100755 --- a/src/extensions/tutoriusremote.py +++ b/src/extensions/tutoriusremote.py @@ -104,8 +104,8 @@ class TPalette(Palette): dlg.vbox.pack_start(gtk.Label(_('Which tutorial do you want to run?\n'))) activity = get_model().get_active_activity() + act_name = activity.get_type() - act_name = activity.get_activity_name() tutorial_dict = Vault.list_available_tutorials(act_name) # Build the combo box diff --git a/tutorius/creator.py b/tutorius/creator.py index 9b1b9bf..6ba7011 100644 --- a/tutorius/creator.py +++ b/tutorius/creator.py @@ -44,6 +44,8 @@ from dbus import SessionBus from dbus.service import method, Object, BusName from .dbustools import ignore +from jarabe.model import bundleregistry + import logging LOGGER = logging.getLogger("creator") @@ -410,14 +412,24 @@ class Creator(Object): vault.INI_NAME_PROPERTY: tutorial_name, vault.INI_VERSION_PROPERTY: '1', } - # FIXME : The environment does not dispose of the appropriate - # variables to inform the creator at this point. We will - # need to iterate inside all the actions and remember - # their sources. - - # FIXME : I insist. This is a hack. - related_activities_dict = {} - related_activities_dict['calculate'] = '27' + + related_activities_dict ={} + activity_set = set() + + for state_name in self._tutorial.get_state_dict().keys(): + for action in self._tutorial.get_action_dict(state_name).values(): + if action.source is not None: + activity_set.add(action.source) + + for event,next_state in self._tutorial.get_transition_dict(state_name).values(): + if event.source is not None: + activity_set.add(event.source) + + reg = bundleregistry.get_registry() + for activity_name in activity_set: + bundle = reg.get_bundle(activity_name) + if bundle is not None: + related_activities_dict[activity_name] = str(bundle.get_activity_version()) self._metadata['activities'] = dict(related_activities_dict) diff --git a/tutorius/tutorial.py b/tutorius/tutorial.py index b45363f..efcc0dc 100644 --- a/tutorius/tutorial.py +++ b/tutorius/tutorial.py @@ -18,6 +18,7 @@ #TODO: For notification of modifications on the Tutorial check for GObject and PyDispatcher for inspiration from .constraints import ConstraintException +from . import properties from .properties import TPropContainer _NAME_SEPARATOR = "/" @@ -802,6 +803,7 @@ class State(object): #TODO: Define the automatic transition in the same way as # other events class AutomaticTransitionEvent(TPropContainer): + source = properties.TStringProperty(None, null=True) def __repr__(self): return str(self.__class__.__name__) -- cgit v0.9.1