B /g^8 c@srddlmZmZddlZGdddZeZejZejZejZGdddeZ e dkrnddl m Z e d d d dS) i)ToplevelTclErrorNc@sDeZdZddZddZddZddZd d Zd d Zd dZ dS) WindowListcCsi|_g|_dSN)dict callbacksselfr&/usr/lib64/python3.7/idlelib/window.py__init__szWindowList.__init__cCs||j||jt|<dSr)Z after_idlecall_callbacksrstrrwindowrrr add s zWindowList.addcCs2y|jt|=Wntk r$YnX|dSr)rr ZKeyErrorr r rrr deletes zWindowList.deletec Csg}xL|jD]B}|j|}y |}Wntk r<w YnX||||fq W|x"|D]\}}}|j||jdq`WdS)N)ZlabelZcommand)r get_titlerappendZsortZ add_commandwakeup)rZmenuZlistZkeyrZtitlerrr add_windows_to_menus   zWindowList.add_windows_to_menucCs|j|dSr)rrrcallbackrrr register_callback$zWindowList.register_callbackcCs*y|j|Wntk r$YnXdSr)rZremoveZ ValueErrorrrrr unregister_callback'szWindowList.unregister_callbackc CsHxB|jD]8}y |Wqt\}}}td|d|YqXqWdS)Nz&warning: callback failed in WindowListz:)rsysZexc_infoZprint)rrZtZvZtbrrr r -s   zWindowList.call_callbacksN) __name__ __module__ __qualname__r rrrrrr rrrr rs rc@s4eZdZddZddZddZddZd d Zd S) ListedToplevelcKs"t|||t|||_dSr)rr registryrfocused_widget)rZmasterZkwrrr r ?s zListedToplevel.__init__cCs&t|t|tjs"|dSr)rrrdestroyrZquitrrrr r!Ds  zListedToplevel.destroycCs tdSr)rr r rrr update_windowlist_registryLrz)ListedToplevel.update_windowlist_registrycCs|Sr)Zwm_titlerrrr rOszListedToplevel.get_titlecCsLy2|dkr||||jWntk rFYnXdS)NZiconic)Zwm_stateZ wm_withdrawZ wm_deiconifyZtkraiser Z focus_setrrrrr rSs zListedToplevel.wakeupN)rrrr r!r"rrrrrr r=s rZ__main__)mainzidlelib.idle_test.test_windowi)Z verbosity) ZtkinterrrrrrrrrrrZunittestr#rrrr Zs1#