a  zeM@sddlZddlmZddlmZgdZdaddZddZGd d d eZ Gd d d Z e d kr|ddl m Z e dddddS)N) messagebox) EditorWindow)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).0patrrB/opt/bitninja-python-dojo/embedded/lib/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) r rsearchgroupopencloseOSErrorint TypeError)lineprogmatchfilenamelinenofrrr file_line_helpers"      rc@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"NszOutputWindow.__init__cCsdS)NFr)r&rrrr ispythonsourceSszOutputWindow.ispythonsourcecCsdS)NZOutputrr&rrr short_titleWszOutputWindow.short_titlecCs|r dSdS)NZyesno)Z get_savedr)rrr maybesave[szOutputWindow.maybesaverinsertcCs.|j||||j||jt|SN)r#r-Zseeupdatelenr&stagsZmarkrrr write`s  zOutputWindow.writecCs|D]}||qdSr.)r4)r&linesrrrr writelinesvszOutputWindow.writelinescCsdSr.rr)rrr flush{szOutputWindow.flushcOstj|i|dSr.)r showerror)r&r'kwargsrrr r8szOutputWindow.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#getrr8flistZ gotofileline)r&eventrresultrrrrr r%s zOutputWindow.goto_file_line)rr-)N)__name__ __module__ __qualname__Z rmenu_specsZallow_code_contextr"r(r*r,r4r6r7r8r%rrrr r :s  r c@s6eZdZddiddidZddZddZd d Zd S) OnDemandOutputWindowZ foregroundZbluez#007700)stdoutstderrcCs||_d|_dSr.)r<owin)r&r<rrr r"szOnDemandOutputWindow.__init__cCs"|js||j|||dSr.)rEsetupr4r1rrr r4szOnDemandOutputWindow.writecCsXt|j|_}|j}|jD]\}}|r |j|fi|q |d|jj|_dS)NZsel) r r<rEr#tagdefsitemsZ tag_configureZ tag_raiser4)r&rEr#tagZcnfrrr rFs zOnDemandOutputWindow.setupN)r?r@rArGr"r4rFrrrr rBs rB__main__)mainzidlelib.idle_test.test_outwinrF) verbosityexit)rtkinterrZidlelib.editorrr r rrr rBr?ZunittestrKrrrr s   e