[*@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 */usr/lib/python3.4/idlelib/OutputWindow.pyrszOutputWindow.__init__cCsdS)Nrr )r filenamer r r ispythonsourceszOutputWindow.ispythonsourcecCsdS)NZOutputr )r r r r short_titleszOutputWindow.short_titlecCs|jrdSdSdS)NZyesZno)Z get_saved)r r r r maybesaves zOutputWindow.maybesaveinsertcCsjt|ttfr-|jtjd}n|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|jdkrQg}x-|jD]"}|jtj|tjqW||_n|jjdd}|j|}|s|jjdd}|j|}|st j ddd|jdSn|\}}|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.Zmaster)file_line_progsfile_line_patsappendrecompile IGNORECASErget_file_line_helper tkMessageBoxZ showerrorflistopenZgotoline) r ZeventlZpatrresultr linenoZeditr r r rIs(      zOutputWindow.goto_file_linec Csx{|jD]l}|j|}|r |jdd\}}yt|d}|jPWqvtk rrw YqvXq q WdSy|t|fSWntk rdSYnXdS)Nr)r,searchgroupr6closeOSErrorint TypeError)r rprogmatchr r9fr r r r3ds   zOutputWindow._file_line_helper)r!r"r#)r$r%r&)r'r(r))NNN)r*r+N)__name__ __module__ __qualname____doc__rrrrrrr Z rmenu_specsr-r,rr3r r r r rs*         rc@sVeZdZiidd6d6idd6d6ZddZdd Zd d Zd S) OnDemandOutputWindowZblueZ foregroundstdoutz#007700stderrcCs||_d|_dS)N)r5owin)r r5r r r rs zOnDemandOutputWindow.__init__cCs0|js|jn|jj|||dS)N)rMsetupr)r rrrr r r rs  zOnDemandOutputWindow.writecCsxt|j|_}|j}x6|jjD]%\}}|r/|j||q/q/W|jd|jj|_dS)NZsel) rr5rMrtagdefsitemsZ tag_configureZ tag_raiser)r rMrtagZcnfr r r rNs  zOnDemandOutputWindow.setupN)rFrGrHrOrrrNr r r r rJxs   rJ) ZtkinterZidlelib.EditorWindowrr/Ztkinter.messageboxZ messageboxr4ZidlelibrrrJr r r r s  q