B  }/@sddlZddlmZddlmZddlmZddddd gZdad d Z d d Z GdddeZ GdddZ e dkrddlmZedddddS)N) messagebox) EditorWindow)iomenuzfile "([^"]*)", 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).0Zpatrr1/opt/alt/python37/lib/python3.7/idlelib/outwin.py sz!compile_progs..)file_line_patsfile_line_progsrrrr compile_progssrc Csts tx^tD]R}||}|r|dd\}}yt|d}|PWqtk r`wYqXqWdSy |t|fStk rdSXdS)Nr) r rsearchgroupopencloseOSErrorint TypeError)lineprogmatchfilenamelinenofrrr file_line_helpers"     rc@sjeZdZdddddgZdZddZd d Zd d Zd dZdddZ ddZ ddZ ddZ dddZ dS) OutputWindow)ZCutz<>Zrmenu_check_cut)ZCopyz<>Zrmenu_check_copy)ZPastez <>Zrmenu_check_paste)NNN)zGo to file/linez<>NFcGs$tj|f||jd|jdS)Nz<>)r__init__textZbindgoto_file_line)selfargsrrr r!OszOutputWindow.__init__cCsdS)NFr)r$rrrr ispythonsourceTszOutputWindow.ispythonsourcecCsdS)NZOutputr)r$rrr short_titleXszOutputWindow.short_titlecCs|r dSdS)NZyesno)Z get_saved)r$rrr maybesave\szOutputWindow.maybesaverinsertcCsFt|tr|tjd}|j||||j||jt |S)Nreplace) isinstancebytesdecoderencodingr"r*Zseeupdatelen)r$stagsmarkrrr writeas    zOutputWindow.writecCsx|D]}||qWdS)N)r5)r$linesrrrr writelinesxs zOutputWindow.writelinescCsdS)Nr)r$rrr flush}szOutputWindow.flushcOstj||dS)N)r showerror)r$r%kwargsrrr r9szOutputWindow.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"getrr9flistZ gotofileline)r$Zeventrresultrrrrr r#s  zOutputWindow.goto_file_line)rr*)N)__name__ __module__ __qualname__Z rmenu_specsZallow_code_contextr!r&r'r)r5r7r8r9r#rrrr r ;s  r c@s6eZdZddiddidZddZddZd d Zd S) OnDemandOutputWindowZ foregroundZbluez#007700)stdoutstderrcCs||_d|_dS)N)r=owin)r$r=rrr r!szOnDemandOutputWindow.__init__cCs"|js||j|||dS)N)rEsetupr5)r$r2r3r4rrr r5szOnDemandOutputWindow.writecCsXt|j|_}|j}x(|jD]\}}|r"|j|f|q"W|d|jj|_dS)NZsel) r r=rEr"tagdefsitemsZ tag_configureZ tag_raiser5)r$rEr"tagZcnfrrr rFs zOnDemandOutputWindow.setupN)r?r@rArGr!r5rFrrrr rBs  rB__main__)mainzidlelib.idle_test.test_outwinrF) verbosityexit)rZtkinterrZidlelib.editorrZidlelibrr r rrr rBr?ZunittestrKrrrr s    f