f f*@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/python34/lib64/python3.4/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.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.parent)file_line_progsfile_line_patsappendrecompile IGNORECASErget_file_line_helper tkMessageBoxZ showerrorflistopenZgotoline) r ZeventlZpatr resultr 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/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@sVeZdZiidd6d6idd6d6ZddZdd Zd d Zd S) OnDemandOutputWindowZblueZ foregroundstdoutz#007700stderrcCs||_d|_dS)N)r8owin)r r8r r r rs zOnDemandOutputWindow.__init__cCs0|js|jn|jj|||dS)N)rPsetupr)r rrrr r r rs  zOnDemandOutputWindow.writecCsxt|j|_}|j}x6|jjD]%\}}|r/|j||q/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