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

« back to all changes in this revision

Viewing changes to services/python-console

  • Committer: William Grant
  • Date: 2009-06-24 10:47:04 UTC
  • Revision ID: grantw@unimelb.edu.au-20090624104704-614jru0retkt5h5q
Kill Request.unmake_path.

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,
185
184
            'chat': self.handle_chat,
186
185
            'block': self.handle_block,
187
186
            'globals': self.handle_globals,
199
198
                response = {'error': repr(e)}
200
199
            finally:
201
200
                self.cmdQ.put(response)
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
 
 
 
201
                   
211
202
    def handle_chat(self, params):
212
203
        # Set up the partial cmd buffer
213
204
        if self.curr_cmd == '':
378
369
    """Handles response from signals"""
379
370
    global terminate
380
371
    if signum == signal.SIGXCPU:
381
 
        terminate = "CPU time limit exceeded"
 
372
        terminate = "CPU Time Limit Exceeded"
382
373
 
383
374
def dispatch_msg(msg):
384
375
    global terminate
385
376
    if msg['cmd'] == 'terminate':
386
 
        terminate = "User requested restart"
 
377
        terminate = "User requested console be terminated"
387
378
    if terminate:
388
379
        raise ivle.chat.Terminate({"terminate":terminate})
389
380
    expiry.ping()
408
399
    for o in object:
409
400
        try:
410
401
            flat[o] = cPickle.dumps(object[o], PICKLEVERSION)
411
 
        except (TypeError, cPickle.PicklingError):
 
402
        except TypeError:
412
403
            try:
413
404
                o_type = type(object[o]).__name__
414
405
                o_name = object[o].__name__