a Z^8c@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 inversedictZvars)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)canonizeospathZisdir tkMessageBox showerrorrnormcaserZtopZwakeuprZ good_loadZ_close)r filenameZactionkeyeditr r r opens*      z FileList.opencCs(||}|dur$|dur$||dSr)rZgotoline)r rZlinenorr r r gotofileline,s zFileList.gotofilelinecCs |||Srr)r rr r r new1sz FileList.newcOs(t|jD]}|}|dkr q$q dS)NZcancelZbreak)ZlistrZclose)r ZargsZkwdsrZreplyr 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))rKeyErrorprintrrZquit)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_hookrrrZiorrrrrrrrr)r rrrZnewkeyZconflictr r r filename_changed_editGs>           zFileList.filename_changed_editcCsFtj|s:z t}Wnty*Yn0tj||}tj|Sr)rrZisabsZgetcwdZOSErrorZjoinZnormpath)r rZpwdr r r rgs   zFileList.canonizerrr) __name__Z __module__Z __qualname__idlelib.editorrr rrrrrrrr r r r rs      rcCsdddlm}ddlm}ddlm}|}|||||t|}||j r`| dS)Nr)Tk) fixwordbreaks) fix_scaling) tkinterr!r r"Z idlelib.runr#ZwithdrawrrrZmainloop)r!r"r#rZflistr r r _testrs   r%Z__main__)mainzidlelib.idle_test.test_filelisti)Z verbosity) Z__doc__rr$rrrr%rZunittestr&r r r r Zs k