diff options
Diffstat (limited to 'tutorius/engine.py')
-rw-r--r-- | tutorius/engine.py | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/tutorius/engine.py b/tutorius/engine.py index ec281b3..e102406 100644 --- a/tutorius/engine.py +++ b/tutorius/engine.py @@ -1,3 +1,18 @@ +# Copyright (C) 2009, Tutorius.org +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA import logging import dbus.mainloop.glib from jarabe.model import shell @@ -10,6 +25,8 @@ from .tutorial import Tutorial, AutomaticTransitionEvent from .translator import ResourceTranslator +LOGGER = logging.getLogger("TutorialRunner") + class TutorialRunner(object): """ Driver for the execution of one tutorial @@ -37,13 +54,16 @@ class TutorialRunner(object): def start(self): self.setCurrentActivity() #Temp Hack until activity in events/actions + LOGGER.debug("Starting tutorial : %s"%self._tutorial.name) self.enterState(self._tutorial.INIT) def stop(self): self.setCurrentActivity() #Temp Hack until activity in events/actions + LOGGER.debug("Stopping tutorial execution for tutorial : %s"%self._tutorial.name) self.enterState(self._tutorial.END) self._teardownState() self._state = None + LOGGER.debug("Teardown complete for tutorial : %s"%self._tutorial.name) def _handleEvent(self, next_state, event): #FIXME sanity check, log event that was not installed and ignore @@ -87,7 +107,7 @@ class TutorialRunner(object): # Install all the actions first for (action_name, action) in actions.items(): - self._pM.install(action, save_args(self.__save_address, action_name), block=True) + self._pM.install(action, save_args(self.__save_address, action_name)) # Install the event filters for (event, next_state) in transitions.values(): @@ -107,11 +127,13 @@ class TutorialRunner(object): @param state_name The name of the state to enter in """ + LOGGER.debug("Tutorial %s moving into state : %s"%(self._tutorial.name, state_name)) self.setCurrentActivity() #Temp Hack until activity in events/actions # Recursive base case if state_name == self._state: #Nothing to do + LOGGER.debug("Installation of state %s completed"%state_name) return self._teardownState() @@ -142,8 +164,10 @@ class Engine: @param tutorialID unique tutorial identifier used to retrieve it from the disk """ if self._tutorial: + LOGGER.debug("Stopping old tutorial : %s"%self._tutorial.name) self.stop() + LOGGER.debug("Starting new tutorial with ID : %s"%str(tutorialID)) # Insert the resource translation layer into the translator_layer = ResourceTranslator(self._probeManager, tutorialID) self._tutorial = TutorialRunner(Vault.loadTutorial(tutorialID), translator_layer) |