[t5@sddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl m Z ddl m Z ddl mZddl mZddl mZddl mZddl mZdd l mZddlZd ZddlZddd d Zdad dZede jZeddZdadadadddZ ddZ!ddZ"ddZ#ddZ$ddZ%dd Z&Gd!d"d"ej'Z(Gd#d$d$ej)Z*Gd%d&d&e+Z,eddS)'N)CallTips) AutoComplete)RemoteDebugger)RemoteObjectBrowser) StackViewer)rpc)PyShell) IOBindingz 127.0.0.1c CsW|dkrtj}ny&|jtj|||||Wntk rRYnXdS)zuShow Idle-format warning after replacing warnings.showwarning. The only difference is the formatter called. N)sysstderrwriterZidle_formatwarningIOError)messagecategoryfilenamelinenofileliner!/usr/lib/python3.4/idlelib/run.pyidle_showwarning_subprocs    rcCsL|r*tdkrHtjatt_qHntdk rHtt_dandS)zFReplace warning.showwarning with idle_showwarning_subproc, or reverse.N)_warnings_showwarningwarnings showwarningr)Zcapturerrrcapture_warnings,s    rTcCs|jddS)zProcess any tk events that are ready to be dispatched if tkinter has been imported, a tcl interpreter has been created and tk has been loaded.updateN)eval)tclrrrhandle_tk_events<srFc Cs|ay2ttjdks$tttjd}WntddtjdSYnXtddgtjdd.print_exc) linecache checkcache flush_stdoutr r r8 last_type last_valuelast_tracebackset)rlrcvalrAZexcinfor)rirjrkrr9s    r9c Cs}|dd}x>|rPx*|D]!}|ddj|r Pq q WP|d=qWx>|rx*|D]!}|d dj|raPqaqaWP|d =qTWt|dkr|dd|ddoverride SocketIO method - wait for MainThread to shut us down N)rErF)rrrrexithookBszMyHandler.exithookcCsdatjdS)zEOverride SocketIO method - terminate wait on callback and exit threadTN)r6rr)rrrrEOFhookFszMyHandler.EOFhookcCsdatjdS)zinterrupt awakened threadTN)r6rr)rrrrdecode_interrupthookLszMyHandler.decode_interrupthookN)rrrrrrrrrrrrH(s    rHc@sseZdZddZddZddZddZd d Zd d Zd dZ dddZ dS)rcCs7||_tj|_tj|_tj|_dS)N)rx__main____dict__localsrcalltipr autocomplete)rrxrrr__init__Us  zExecutive.__init__cCsy1d|_dazt||jWddaXWnmtk rEYnctj|_trgtnt |j j j d}|r|j j jnYnXtdS)NTFz<>) usr_exc_info interruptablertrr7r r8r6r2r9rxrZgetvarrZopen_remote_stack_viewerrn)rcodeZjitrrrruncode[s"    zExecutive.runcodecCstrtjndS)N)rrr)rrrrinterrupt_the_servertszExecutive.interrupt_the_servercCstj|j|S)N)rZstart_debuggerrx)rZ gui_adap_oidrrrstart_the_debuggerxszExecutive.start_the_debuggercCs|jj|dS)zDUnregister the Idb Adapter. Link objects and Idb then subject to GCN)rxZ unregister)rZ idb_adap_oidrrrstop_the_debugger{szExecutive.stop_the_debuggercCs|jj|S)N)rZ fetch_tip)rr"rrrget_the_calltipszExecutive.get_the_calltipcCs|jj||S)N)rZfetch_completions)rZwhatmoderrrget_the_completion_listsz!Executive.get_the_completion_listNcCs|jr|j\}}}ndSd}|dk rI|jj|}nx)|rt|jjddkrt|j}qLW|t_|t_t j ||}t j |S)Nrrrun)zrpcr) rrxrtb_frame f_globalstb_nextr rorprZ StackTreeItemrZremote_object_tree_item)rZ flist_oidrcrsrAZflistitemrrr stackviewers     zExecutive.stackviewer) rrrrrrrrrrrrrrrrSs        r)-r iorlrEZsocketr:_threadrr-r5rPZidlelibrrrrrrrr rr/rrrrZTclrrr1r6rrBr.rJr9r`rnr2Z RPCServerrGrrHobjectrrrrrsP                I   $   +A