3 Õì2a°ã@s’ddlZddlmZddlmZddlmZddddd gZdad d „Z d d „Z Gdd„deƒZ Gdd„dƒZ e dkrŽddlmZedddd�dS)éN)Ú messagebox)Ú EditorWindow)Úiomenuzfile "([^"]*)", line (\d+)z([^\s]+)\((\d+)\)z^(\s*\S.*?):\s*(\d+):z([^\s]+):\s*(\d+):z^\s*(\S.*?):\s*(\d+):cCsdd„tDƒadS)NcSsg|]}tj|tjƒ‘qS©)ÚreÚcompileÚ IGNORECASE)Ú.0Zpatrrú+/opt/alt/python36/lib64/python3.6/outwin.pyú sz!compile_progs..)Úfile_line_patsÚfile_line_progsrrrr Ú compile_progssrc Cs�ts tƒx^tD]R}|j|ƒ}|r|jddƒ\}}yt|dƒ}|jƒPWqtk r`wYqXqWdSy |t|ƒfStk rŠdSXdS)NééÚr) r rÚsearchÚgroupÚopenÚcloseÚOSErrorÚintÚ TypeError)ÚlineÚprogÚmatchÚfilenameÚlinenoÚfrrr Úfile_line_helpers"     rc@sjeZdZd d!d"d#d$gZd d„Zdd„Zdd„Zdd„Zfdfdd„Zdd„Z dd„Z dd„Z d%dd„Z d S)&Ú OutputWindowÚCutú<>Úrmenu_check_cutÚCopyú<>Úrmenu_check_copyÚPasteú <>Úrmenu_check_pasteNúGo to file/lineú<>cGs0tj|f|žŽ|jjd|jƒ|jjdƒdS)Nz<>z<>)rÚ__init__ÚtextZbindÚgoto_file_lineZunbind)ÚselfÚargsrrr r,MszOutputWindow.__init__cCsdS)NFr)r/rrrr ÚispythonsourceSszOutputWindow.ispythonsourcecCsdS)NZOutputr)r/rrr Ú short_titleWszOutputWindow.short_titlecCs|jƒr dSdS)NÚyesÚno)Z get_saved)r/rrr Ú maybesave[szOutputWindow.maybesaveÚinsertcCsFt|tƒr|jtjdƒ}|jj|||ƒ|jj|ƒ|jjƒt |ƒS)NÚreplace) Ú isinstanceÚbytesÚdecoderÚencodingr-r6ZseeÚupdateÚlen)r/ÚsÚtagsÚmarkrrr Úwrite`s    zOutputWindow.writecCsx|D]}|j|ƒqWdS)N)rA)r/Úlinesrrrr Ú writelinesws zOutputWindow.writelinescCsdS)Nr)r/rrr Úflush|szOutputWindow.flushcOstj||ŽdS)N)rÚ showerror)r/r0Úkwargsrrr rE€szOutputWindow.showerrorcCsd|jjddƒ}t|ƒ}|sJ|jjddƒ}t|ƒ}|sJ|jdd|jd�dS|\}}|jj||ƒ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-ÚgetrrEÚflistZ gotofileline)r/ZeventrÚresultrrrrr r.ƒs  zOutputWindow.goto_file_line)r!r"r#)r$r%r&)r'r(r))NNN)r*r+N)N) Ú__name__Ú __module__Ú __qualname__Z rmenu_specsr,r1r2r5rArCrDrEr.rrrr r ;s r c@s6eZdZddiddidœZdd„Zdd„Zd d „Zd S) ÚOnDemandOutputWindowZ foregroundZbluez#007700)ÚstdoutÚstderrcCs||_d|_dS)N)rIÚowin)r/rIrrr r,¨szOnDemandOutputWindow.__init__cCs"|js|jƒ|jj|||ƒdS)N)rQÚsetuprA)r/r>r?r@rrr rA¬szOnDemandOutputWindow.writecCsXt|jƒ|_}|j}x(|jjƒD]\}}|r"|j|f|Žq"W|jdƒ|jj|_dS)NZsel) r rIrQr-ÚtagdefsÚitemsZ tag_configureZ tag_raiserA)r/rQr-ÚtagZcnfrrr rR±s zOnDemandOutputWindow.setupN)rKrLrMrSr,rArRrrrr rN s  rNÚ__main__)Úmainzidlelib.idle_test.test_outwinrF)Ú verbosityÚexit)rZtkinterrZidlelib.editorrZidlelibrr r rrr rNrKZunittestrWrrrr Ús    e