Fa*@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.5/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.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 ZeventlZpatrresultr 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-searchgroupr7closeOSErrorint TypeError)r rprogmatchr r:fr r r r4ds    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-rr4r r r r rs*         rc@sReZdZdddidddiiZddZdd Zd d Zd S) OnDemandOutputWindowstdoutZ foregroundZbluestderrz#007700cCs||_d|_dS)N)r6owin)r r6r r r rs zOnDemandOutputWindow.__init__cCs-|js|j|jj|||dS)N)rNsetupr)r rrrr r r rs  zOnDemandOutputWindow.writecCsut|j|_}|j}x3|jjD]"\}}|r/|j||q/W|jd|jj|_dS)NZsel) rr6rNrtagdefsitemsZ tag_configureZ tag_raiser)r rNrtagZcnfr r r rOs  zOnDemandOutputWindow.setupN)rGrHrIrPrrrOr r r r rKxs    rK) ZtkinterZidlelib.EditorWindowrr0Ztkinter.messageboxZ messageboxr5ZidlelibrrrKr r r r s  q