o =?hk@stdZddlZddlZddlZGdddeZGdddZddZd d Ze d kr8dd l m Z e d ddddSdS)z Zoom a window to maximum height.Nc@s eZdZdS)WmInfoGatheringErrorN)__name__ __module__ __qualname__rr9/opt/alt/python310/lib64/python3.10/idlelib/zoomheight.pyrsrc@s2eZdZiZddZd ddZddZdd ZdS) ZoomHeightcCs||_|jj|_dSN)editwintop)selfr rrr__init__szZoomHeight.__init__NcCsF|}|dur|jdS|rdnd}|jjdd|dddS)NZRestoreZZoomZoptionsz* Heightz Height)ZmenuindexZlabelbreak) zoom_heightr Zbellr Zupdate_menu_label)r ZeventzoomedZ menu_statusrrrzoom_height_events  zZoomHeight.zoom_height_eventcCsx|j}t|\}}}}|dkrdSz|\}}Wn ty%YdSw||kr5t|||||fdS|ddS)NnormalTF)r get_window_geometrywm_stateget_max_height_and_y_coordrset_window_geometry wm_geometry)r r widthZheightxy maxheightmaxyrrrr!s   zZoomHeight.zoom_heightc Cs|j}||f}||jvry|}z|dWn tjy'tdw|t |\}}}}t j dkr;d}| }|d|t |} | dd|f} t || || } ||| 7}||f|j|<t || |||j|S)Nrz_Failed getting geometry of maximized windows, because the "zoomed" window state is unavailable.Zwin32rr)r Zwinfo_screenwidthZwinfo_screenheight_max_height_and_y_coordsrtkinterZTclErrorrupdatersysplatformZ winfo_rootyr) r r Zscreen_dimensionsZ orig_stateZmaxwidthrZmaxxrZmaxrootyZ orig_geomZ max_y_geomZmax_y_geom_rootyrrrr<s<        z%ZoomHeight.get_max_height_and_y_coordr )rrrr r rrrrrrrr s   rcCs&|}td|}ttt|S)Nz(\d+)x(\d+)\+(-?\d+)\+(-?\d+))rrematchtuplemapintgroups)r Zgeommrrrrns rcCs|dj|dS)Nz{:d}x{:d}+{:d}+{:d})rformat)r Zgeometryrrrrtsr__main__)mainz!idlelib.idle_test.test_zoomheightF) verbosityexit) __doc__r%r#r! ExceptionrrrrrZunittestr.rrrrsb