From 9a5fdf65b7b2932f7b581ac60c6767c0b15e645a Mon Sep 17 00:00:00 2001 From: Tim McNamara Date: Sat, 14 Aug 2010 23:26:48 +0000 Subject: Removed right-hand whitespace Removed trailing whitespace. --- diff --git a/Experior.Activity/sbexecutionengine.py b/Experior.Activity/sbexecutionengine.py index 228f0e1..cb0b361 100755 --- a/Experior.Activity/sbexecutionengine.py +++ b/Experior.Activity/sbexecutionengine.py @@ -33,80 +33,80 @@ import gtk from sbpython import * class sbExecutionEngine: - """ - Responsible for communications with the XML-RPC server regarding command - retrieval, as well as parsing and execution of those commands. - """ - def __init__(self, sbGUI, xmlRpcServer): - self.sbgui = sbGUI - self.rpc = xmlRpcServer - self.widgets = sbwidgets - - self.delayedExecution = False - self.executionComplete = False - self.lastCommand = None - - self.log = logging.getLogger("ExecutionEngine") - - try: - self.id = os.environ['SUGARBOT_ID'] - except KeyError: - self.log.error("Sugarbot ID is not set. Using default 0. ") - self.id = 0 - - def killSugarbot(self): - """ - Kills the sugarbot activity. - """ - self.log.info("Attempting to kill sugarbot") - sys.exit(0) - - def executePy(self): - """ - Executes the Sugarbot p◊ython script. - - Executes the Sugarbot python script provided by the XML-RPC server. - Regards any unhandled exceptions as fatal errors, and reports them - to the server. Also handles the termination of Sugarbot if the - auto-restart flag has been set by the XML-RPC server. - """ - self.script = self.rpc.getScript(self.id) - self.log.info("Executing Script:\n%s" % self.script) - - self.widgets.gui = self.sbgui - - # Execute the actual python script. - try: - exec self.script - - # t = threading.Thread(args=(self.widgets,)) - # t.run = sugarbot_main - # t.start() - - sugarbot_main(self.widgets) - self.rpc.success(self.id) - - # Something bad happened. Report it, and log it. - except: - text = "Execution failed:\n%s" % traceback.format_exc() - text = self.rpc.fail(text, self.id) - self.log.error( text ) - - # Regarless of the success status, check to see if we need to restart - # sugarbot or not. - finally: - restart = self.rpc.getRestartFlag() - self.log.info("Got restart flag: " + str(restart)) - - if restart: - self.killSugarbot() - - - def isComplete(self): - """ - Returns true if execution is complete. - - Returns true if execution is complete, i.e. there are no more - commands that can be executed. - """ - return self.executionComplete + """ + Responsible for communications with the XML-RPC server regarding command + retrieval, as well as parsing and execution of those commands. + """ + def __init__(self, sbGUI, xmlRpcServer): + self.sbgui = sbGUI + self.rpc = xmlRpcServer + self.widgets = sbwidgets + + self.delayedExecution = False + self.executionComplete = False + self.lastCommand = None + + self.log = logging.getLogger("ExecutionEngine") + + try: + self.id = os.environ['SUGARBOT_ID'] + except KeyError: + self.log.error("Sugarbot ID is not set. Using default 0. ") + self.id = 0 + + def killSugarbot(self): + """ + Kills the sugarbot activity. + """ + self.log.info("Attempting to kill sugarbot") + sys.exit(0) + + def executePy(self): + """ + Executes the Sugarbot p◊ython script. + + Executes the Sugarbot python script provided by the XML-RPC server. + Regards any unhandled exceptions as fatal errors, and reports them + to the server. Also handles the termination of Sugarbot if the + auto-restart flag has been set by the XML-RPC server. + """ + self.script = self.rpc.getScript(self.id) + self.log.info("Executing Script:\n%s" % self.script) + + self.widgets.gui = self.sbgui + + # Execute the actual python script. + try: + exec self.script + + # t = threading.Thread(args=(self.widgets,)) + # t.run = sugarbot_main + # t.start() + + sugarbot_main(self.widgets) + self.rpc.success(self.id) + + # Something bad happened. Report it, and log it. + except: + text = "Execution failed:\n%s" % traceback.format_exc() + text = self.rpc.fail(text, self.id) + self.log.error( text ) + + # Regarless of the success status, check to see if we need to restart + # sugarbot or not. + finally: + restart = self.rpc.getRestartFlag() + self.log.info("Got restart flag: " + str(restart)) + + if restart: + self.killSugarbot() + + + def isComplete(self): + """ + Returns true if execution is complete. + + Returns true if execution is complete, i.e. there are no more + commands that can be executed. + """ + return self.executionComplete -- cgit v0.9.1