~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to services/python-console

  • Committer: William Grant
  • Date: 2010-02-26 06:33:35 UTC
  • Revision ID: grantw@unimelb.edu.au-20100226063335-25ka31up8cegwaiz
ivle.interpret.execute_raw now sets a clean environment, in particular with HOME set correctly.

Show diffs side-by-side

added added

removed removed

Lines of Context:
181
181
 
182
182
        # Handlers for each action
183
183
        actions = {
 
184
            'splash': self.handle_splash,
184
185
            'chat': self.handle_chat,
185
186
            'block': self.handle_block,
186
187
            'globals': self.handle_globals,
198
199
                response = {'error': repr(e)}
199
200
            finally:
200
201
                self.cmdQ.put(response)
201
 
                   
 
202
 
 
203
    def handle_splash(self, params):
 
204
        # Initial console splash screen
 
205
        python_version = '.'.join(str(v) for v in sys.version_info[:3])
 
206
        splash_text = ("""IVLE %s Python Console (Python %s)
 
207
Type "help", "copyright", "credits" or "license" for more information.
 
208
""" % (ivle.__version__, python_version))
 
209
        return {'output': splash_text}
 
210
 
202
211
    def handle_chat(self, params):
203
212
        # Set up the partial cmd buffer
204
213
        if self.curr_cmd == '':
369
378
    """Handles response from signals"""
370
379
    global terminate
371
380
    if signum == signal.SIGXCPU:
372
 
        terminate = "CPU Time Limit Exceeded"
 
381
        terminate = "CPU time limit exceeded"
373
382
 
374
383
def dispatch_msg(msg):
375
384
    global terminate
376
385
    if msg['cmd'] == 'terminate':
377
 
        terminate = "User requested console be terminated"
 
386
        terminate = "User requested restart"
378
387
    if terminate:
379
388
        raise ivle.chat.Terminate({"terminate":terminate})
380
389
    expiry.ping()