a Z^8@sRdZddlZddlmZGdddZddZedkrNdd lm Z e d d d dS) zidlelib.filelistN) messageboxc@s^eZdZddlmZddZdddZddd Zdd d Zd d Z ddZ ddZ ddZ dS)FileListr EditorWindowcCs||_i|_i|_i|_dSN)rootdict inversedictvars)selfrr (/usr/lib64/python3.9/idlelib/filelist.py__init__ szFileList.__init__NcCs|sJ||}tj|r:tjdd|f|jddStj|}||jvrh|j|}|j |S|rt||S| |||}|j r|S| dSdS)Nz File Errorz%r is a directory.Zmaster)canonizeospathisdir tkMessageBox showerrorrnormcasertopwakeuprZ good_load_close)r filenameactionkeyeditr r r opens*      z FileList.opencCs(||}|dur$|dur$||dSr)rZgotoline)r rlinenorr r r gotofileline,s zFileList.gotofilelinecCs |||Srr)r rr r r new1sz FileList.newcOs(t|jD]}|}|dkr q$q dS)Ncancelbreak)listr close)r argskwdsrZreplyr r r close_all_callback4s zFileList.close_all_callbackcCsTz|j|}Wnty*tdYdS0|r8|j|=|j|=|jsP|jdS)Nz-Don't know this EditorWindow object. (close))r KeyErrorprintrrquit)r rrr r r unregister_maybe_terminate;s z#FileList.unregister_maybe_terminatecCs|z|j|}Wnty2tdYdS0|jj}|sZ|rL|j|=d|j|<dS||}tj |}||kr|dS||jvr|j|}d|j|<t j dd|f|j d||j|<||j|<|rz |j|=WntyYn0dS)Nz.Don't know this EditorWindow object. (rename)z Name Conflictz.You now have multiple edit windows open for %rr)Zsaved_change_hookr r)r*iorrrrrrrrr)r rrrZnewkeyZconflictr r r filename_changed_editGs>           zFileList.filename_changed_editcCsFtj|s:z t}Wnty*Yn0tj||}tj|Sr)rrisabsgetcwdOSErrorjoinnormpath)r rpwdr r r rgs   zFileList.canonize)N)N)N) __name__ __module__ __qualname__idlelib.editorrrrr r!r(r,r.rr r r r rs      rcCsdddlm}ddlm}ddlm}|}|||||t|}||j r`| dS)Nr)Tk) fixwordbreaks) fix_scaling) tkinterr9r8r:Z idlelib.runr;Zwithdrawrr!r Zmainloop)r9r:r;rflistr r r _testrs   r>__main__)mainzidlelib.idle_test.test_filelist) verbosity) __doc__rr<rrrr>r5Zunittestr@r r r r s k