a Z^k@spdZddlZddlZddlZGdddeZGdddZddZd d Ze d krldd l m Z e d ddddS)z Zoom a window to maximum height.Nc@s eZdZdS)WmInfoGatheringErrorN)__name__ __module__ __qualname__rr*/usr/lib64/python3.9/idlelib/zoomheight.pyrsrc@s2eZdZiZddZd ddZddZdd ZdS) ZoomHeightcCs||_|jj|_dS)N)editwintop)selfr rrr__init__szZoomHeight.__init__NcCsD|}|dur|jn$|r$dnd}|jjdd|dddS)NZRestoreZZoomoptionsz* Heightz Height)ZmenuindexZlabelbreak) zoom_heightr Zbellr Zupdate_menu_label)r eventzoomedZ menu_statusrrrzoom_height_events   zZoomHeight.zoom_height_eventcCs||j}t|\}}}}|dkr&dSz|\}}WntyJYdS0||krjt|||||fdS|ddSdS)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}||jvr|}z|dWntjyRtdYn0|t |\}}}}t j dkrzd}| }|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.win32rr)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_coord)N)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# ExceptionrrrrrZunittestr0rrrrsb