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

« back to all changes in this revision

Viewing changes to scripts/python-console

  • Committer: dcoles
  • Date: 2008-08-07 07:32:36 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:991
Console: Some improvements to the python console code - most notably the 
addition of a reset button (which causes the console to restarted to a new 
python-console process). It won't work against everything (ie. if the console 
is so tied up it doesn't even respond, but should be good enough for 'I just 
want to clear everything' situations.

Show diffs side-by-side

added added

removed removed

Lines of Context:
50
50
            return ln['chat']
51
51
        if 'interrupt' in ln:
52
52
            raise Interrupt()
53
 
        if 'terminate' in ln:
54
 
            sys.exit(0)
55
53
 
56
54
class StdoutToWeb(object):
57
55
    def __init__(self, cmdQ, lineQ):
236
234
        terminate = "CPU Time Limit Exceeded"
237
235
 
238
236
def dispatch_msg(msg):
 
237
    global terminate
 
238
    if msg['cmd'] == 'restart':
 
239
        terminate = "User requested console be reset"
 
240
    if terminate:
 
241
        raise common.chat.Terminate({"restart":terminate})
239
242
    expiry.ping()
240
243
    lineQ.put({msg['cmd']:msg['text']})
241
244
    if terminate: