
    dk                         d Z ddlZddlZddlZ G d de          Z G d d          Zd Zd Ze	d	k    rdd
l
mZ  eddd           dS dS )z Zoom a window to maximum height.    Nc                       e Zd ZdS )WmInfoGatheringErrorN)__name__
__module____qualname__     $  /croot/python-split_1694437901252/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_plac/lib/python3.11/idlelib/zoomheight.pyr   r      s        Dr	   r   c                   ,    e Zd Zi Zd ZddZd Zd ZdS )
ZoomHeightc                 6    || _         | j         j        | _        d S N)editwintop)selfr   s     r
   __init__zZoomHeight.__init__   s    <#r	   Nc                     |                                  }|| j                                         n&|rdnd}| j                            dd| d           dS )NRestoreZoomoptionsz* Heightz Height)menuindexlabelbreak)zoom_heightr   bellr   update_menu_label)r   eventzoomedmenu_statuss       r
   zoom_height_eventzZoomHeight.zoom_height_event   sp    !!##>HMMOOOO'-9))6KL**	4?1H1H1H + J J J wr	   c                 &   | j         }t          |          \  }}}}|                                dk    rd S 	 |                                 \  }}n# t          $ r Y d S w xY w||k    rt          |||||f           dS |                    d           dS )NnormalT F)r   get_window_geometrywm_stateget_max_height_and_y_coordr   set_window_geometrywm_geometry)r   r   widthheightxy	maxheightmaxys           r
   r   zZoomHeight.zoom_height!   s    h1#66vq!<<>>X%% 4	"==??OItt# 	 	 	44	 YeY4%@AAA4 OOB5s   A 
AAc                 2   | j         }|                                |                                f}|| j        vrR|                                }	 |                    d           n"# t
          j        $ r t          d          w xY w|                                 t          |          \  }}}}t          j        dk    rd}|                                }|                    d           |                                 t          |          }	|	d d         |fz   }
t          ||
           |                                 |                                }|||z
  z  }||f| j        |<   t          ||	           |                    |           | j        |         S )Nr   z_Failed getting geometry of maximized windows, because the "zoomed" window state is unavailable.win32r   r#      )r   winfo_screenwidthwinfo_screenheight_max_height_and_y_coordsr&   tkinterTclErrorr   updater%   sysplatformwinfo_rootyr(   )r   r   screen_dimensions
orig_statemaxwidthr.   maxxr/   maxrooty	orig_geom
max_y_geommax_y_geom_rootys               r
   r'   z%ZoomHeight.get_max_height_and_y_coord<   s   h 2244 33557D$AAAJAX&&&&# A A A +@A A AA JJLLL.A#.F.F+Hit|w&& ((H LL"""JJLLL+C00I"2A2$0JZ000JJLLL"00 $444I?H$D)*;<Y///LL$$$,->??s   A% %Br   )r   r   r   r5   r   r!   r   r'   r   r	   r
   r   r      sb          "$ $ $
 
 
 
  6/@ /@ /@ /@ /@r	   r   c                     |                                  }t          j        d|          }t          t	          t
          |                                                    S )Nz(\d+)x(\d+)\+(-?\d+)\+(-?\d+))r)   rematchtuplemapintgroups)r   geomms      r
   r%   r%   n   sC    ??D
1488AS!((**%%&&&r	   c                 @    |                       dj        |            d S )Nz{:d}x{:d}+{:d}+{:d})r)   format)r   geometrys     r
   r(   r(   t   s&    OO0)0(;<<<<<r	   __main__)mainz!idlelib.idle_test.test_zoomheight   F)	verbosityexit)__doc__rE   r9   r6   	Exceptionr   r   r%   r(   r   unittestrQ   r   r	   r
   <module>rX      s    " " 				 



 	 	 	 	 	9 	 	 	_@ _@ _@ _@ _@ _@ _@ _@D' ' '= = = zD	,FFFFFF r	   