Yf*@srddlTddlmZddlZddljZddlmZGdddeZ GdddZ dS) )*) EditorWindowN) IOBindingc@seZdZdZddZddZddZdd Zfd d d Zd dZ ddZ d&d'd(d)d*gZ dddd d!gZ dZ dd"d#Zd$d%ZdS)+ OutputWindowzAn editor window that can serve as an output file. Also the future base class for the Python shell window. This class has no input facilities. cGs*tj|||jjd|jdS)Nz<>)r__init__textZbindgoto_file_line)selfargsr 9/opt/alt/python35/lib64/python3.5/idlelib/OutputWindow.pyrszOutputWindow.__init__cCsdS)Nrr )r filenamer r r ispythonsourceszOutputWindow.ispythonsourcecCsdS)NZOutputr )r r r r short_titleszOutputWindow.short_titlecCs|jrdSdSdS)Nyesno)Z get_saved)r r r r maybesaves zOutputWindow.maybesaveinsertcCsgt|ttfr*|jtjd}|jj||||jj||jjt |S)Nreplace) isinstancebytesdecoderencodingrrZseeupdatelen)r stagsmarkr r r write%s  zOutputWindow.writecCs"x|D]}|j|qWdS)N)r)r linesliner r r writelines-s zOutputWindow.writelinescCsdS)Nr )r r r r flush1szOutputWindow.flushCut<>rmenu_check_cutCopy<>rmenu_check_copyPaste <>rmenu_check_pasteNGo to file/line<>zfile "([^"]*)", line (\d+)z([^\s]+)\((\d+)\)z^(\s*\S.*?):\s*(\d+):z([^\s]+):\s*(\d+):z^\s*(\S.*?):\s*(\d+):c Cs|jdkrNg}x-|jD]"}|jtj|tjqW||_|jjdd}|j|}|s|jjdd}|j|}|st j ddd|jdS|\}}|j j |}|j |dS)Nzinsert linestartzinsert lineendzinsert -1line linestartzinsert -1line lineendzNo special linezTThe line you point at doesn't look like a valid file name followed by a line number.parent)file_line_progsfile_line_patsappendrecompile IGNORECASErget_file_line_helper tkMessageBoxZ showerrorflistopenZgotoline) r ZeventlZpatr resultr linenoZeditr r r rIs(      zOutputWindow.goto_file_linec Csxx|jD]i}|j|}|r |jdd\}}yt|d}|jPWq tk rrw Yq Xq WdSy|t|fSWntk rdSYnXdS)Nr)r/searchgroupr9closeOSErrorint TypeError)r r progmatchr r<fr r r r6ds    zOutputWindow._file_line_helper)r#r$r%)r&r'r()r)r*r+)NNN)r,r-N)__name__ __module__ __qualname____doc__rrrrrr!r"Z rmenu_specsr0r/rr6r r r r rs*         rc@sReZdZdddidddiiZddZdd Zd d Zd S) OnDemandOutputWindowstdoutZ foregroundZbluestderrz#007700cCs||_d|_dS)N)r8owin)r r8r r r rs zOnDemandOutputWindow.__init__cCs-|js|j|jj|||dS)N)rPsetupr)r rrrr r r rs  zOnDemandOutputWindow.writecCsut|j|_}|j}x3|jjD]"\}}|r/|j||q/W|jd|jj|_dS)NZsel) rr8rPrtagdefsitemsZ tag_configureZ tag_raiser)r rPrtagZcnfr r r rQs  zOnDemandOutputWindow.setupN)rIrJrKrRrrrQr r r r rMxs    rM) ZtkinterZidlelib.EditorWindowrr2Ztkinter.messageboxZ messageboxr7ZidlelibrrrMr r r r s  q