a Z^@sddlZddlmZddlmZddlmZgdZdaddZ dd Z Gd d d eZ Gd d d Z e dkrddlmZedddddS)N) messagebox) EditorWindow)iomenu)zfile "([^"]*)", line (\d+)z([^\s]+)\((\d+)\)z^(\s*\S.*?):\s*(\d+):z([^\s]+):\s*(\d+):z^\s*(\S.*?):\s*(\d+):cCsddtDadS)NcSsg|]}t|tjqS)recompile IGNORECASE).0patrr&/usr/lib64/python3.9/idlelib/outwin.py sz!compile_progs..)file_line_patsfile_line_progsrrrr compile_progssrc Csts ttD]V}||}|r|dd\}}zt|d}|WqjWqtybYqYq0qdSz|t|fWStyYdS0dS)Nr) rrsearchgroupopencloseOSErrorint TypeError)lineprogmatchfilenamelinenofrrr file_line_helpers"      r c@sdeZdZgdZdZddZddZddZd d Zdd dZ ddZ ddZ ddZ dddZ dS) OutputWindow))ZCutz<>Zrmenu_check_cut)ZCopyz<>Zrmenu_check_copy)ZPastez <>Zrmenu_check_paste)NNN)zGo to file/line<>NFcGs&tj|g|R|jd|jdS)Nr")r__init__textbindgoto_file_line)selfargsrrr r#OszOutputWindow.__init__cCsdS)NFr)r'rrrr ispythonsourceTszOutputWindow.ispythonsourcecCsdS)NZOutputrr'rrr short_titleXszOutputWindow.short_titlecCs|r dSdS)NZyesno)Z get_savedr*rrr maybesave\szOutputWindow.maybesaverinsertcCsFt|tr|tjd}|j||||j||jt |S)Nreplace) isinstancebytesdecoderencodingr$r.Zseeupdatelenr'stagsZmarkrrr writeas    zOutputWindow.writecCs|D]}||qdSN)r9)r'linesrrrr writelinesxszOutputWindow.writelinescCsdSr:rr*rrr flush}szOutputWindow.flushcOstj|i|dSr:)r showerror)r'r(kwargsrrr r>szOutputWindow.showerrorNcCsd|jdd}t|}|sJ|jdd}t|}|sJ|jdd|jddS|\}}|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)r$getr r>flistZ gotofileline)r'eventrresultrrrrr r&s zOutputWindow.goto_file_line)rr.)N)__name__ __module__ __qualname__Z rmenu_specsZallow_code_contextr#r)r+r-r9r<r=r>r&rrrr r!;s  r!c@s6eZdZddiddidZddZddZd d Zd S) OnDemandOutputWindowZ foregroundZbluez#007700)stdoutstderrcCs||_d|_dSr:)rBowin)r'rBrrr r#szOnDemandOutputWindow.__init__cCs"|js||j|||dSr:)rKsetupr9r6rrr r9szOnDemandOutputWindow.writecCsXt|j|_}|j}|jD]\}}|r |j|fi|q |d|jj|_dS)NZsel) r!rBrKr$tagdefsitemsZ tag_configureZ tag_raiser9)r'rKr$tagZcnfrrr rLs zOnDemandOutputWindow.setupN)rErFrGrMr#r9rLrrrr rHs rH__main__)mainzidlelib.idle_test.test_outwinrF) verbosityexit)rtkinterrZidlelib.editorrZidlelibrr rrr r!rHrEZunittestrQrrrr s    f