Sindbad~EG File Manager

Current Path : /usr/local/lib/python3.12/site-packages/pygetwindow/__pycache__/
Upload File :
Current File : //usr/local/lib/python3.12/site-packages/pygetwindow/__pycache__/_pygetwindow_win.cpython-312.pyc

�

&ٜg�3���ddlZddlmZddlmZmZmZmZmZmZdZ	dZ
dZdZdZ
dZdZd	Zd
ZdZdZGd�d
ej(�Zej,j.j0Zej4ej6ej8ej:ej8��Zej,j.j>Z ej,j.jBZ"ej,j.jFZ$Gd�dej(�Z%d�Z&d�Z'd�Z(d�Z)d�Z*d�Z+d�Z,d�Z-d�Z.Gd�de�Z/d�Z0d�Z1y)�N)�wintypes)�PyGetWindowException�pointInRect�
BaseWindow�Rect�Point�Size�ii����	�c�D�eZdZdejfdejfgZy)�POINT�x�yN)�__name__�
__module__�__qualname__�ctypes�c_long�_fields_���G/usr/local/lib/python3.12/site-packages/pygetwindow/_pygetwindow_win.pyrr s!���f�m�m�$��f�m�m�$�&�Hrrc�|�eZdZdZdej
fdej
fdej
fdej
fgZy)�RECTz�A nice wrapper of the RECT structure.

    Microsoft Documentation:
    https://msdn.microsoft.com/en-us/library/windows/desktop/dd162897(v=vs.85).aspx
    �left�top�right�bottomN)rrr�__doc__rrrrrrrr+s@���
����'���
�
�&��&�-�-�(��6�=�=�)�+�Hrrc�@��g��fd�}tt|�d��S)Nc���t|�rPt|�}tj|dz�}t	|||dz��j||jf�y�N�T)�isWindowVisible�getWindowTextLengthr�create_unicode_buffer�
getWindowText�append�value)�hWnd�lParam�length�buff�titless    �r�foreach_windowz%_getAllTitles.<locals>.foreach_window;sQ����4� �(��.�F��/�/���
�;�D��$��f�q�j�1��M�M�4����,�-�rr��enumWindows�enumWindowsProc)r3r2s @r�
_getAllTitlesr77s%����F�����/��3��Mrc��tj�}tjjjttztzt|dtjtj|�tj�dt�|jj�}tjjj|�|S)asA nice wrapper for FormatMessageW(). TODO

    Microsoft Documentation:
    https://docs.microsoft.com/en-us/windows/desktop/api/winbase/nf-winbase-formatmessagew

    Additional information:
    https://stackoverflow.com/questions/18905702/python-ctypes-and-mutable-buffers
    https://stackoverflow.com/questions/455434/how-should-i-use-formatmessage-properly-in-c
    r)r�LPWSTRr�windll�kernel32�FormatMessageW�FORMAT_MESSAGE_FROM_SYSTEM�FORMAT_MESSAGE_ALLOCATE_BUFFER�FORMAT_MESSAGE_IGNORE_INSERTS�NULL�cast�byrefr-�rstrip�	LocalFree)�	errorCode�lpBuffer�msgs   r�_formatMessagerHGs������ �H�
�M�M���)�)�*D�Ge�*e�iF�+F�*.�*3�*+�*0�+�+�f�l�l�8�6L�h�o�o�*^�*+�*.�
0��.�.�
�
�
!�C�
�M�M���$�$�X�.��Jrc��tjjj�}t	d|�dt|�����)z{A helper function that raises PyGetWindowException using the error
    information from GetLastError() and FormatMessage().zError code from Windows: z - )rr:r;�GetLastErrorrrH)rEs r�_raiseWithLastErrorrK_s3���
�
�&�&�3�3�5�I�
�Y�P^�_h�Pi�j�
k�krc�t�tjjj�}|dk(ryt	|�S)zAReturns a Window object of the currently active (focused) Window.rN)rr:�user32�GetForegroundWindow�Win32Window)r.s r�getActiveWindowrPfs/���=�=���3�3�5�D��q�y���4� � rc���tjjj���dk(ry�fd�}t	t|�d�tS)zLReturns a string of the title text of the currently active (focused) Window.rNc���|�k(r?t|�}tj|dz�}t|||dz�|jayr&)r)rr*r+r-�activeWindowTitle)r.r/r0r1�activeWindowHwnds    �rr3z,getActiveWindowTitle.<locals>.foreach_windowzsG����#�#�(��.�F��/�/���
�;�D��$��f�q�j�1�!%����r)rr:rMrNr5r6rS)r3rTs @r�getActiveWindowTitlerUpsE���
�}�}�+�+�?�?�A���1�������/��3��rc	��g}t�D]L}t|||j|j|j|j
�s�<|j
|��N|S)z�Returns a list of Window objects whose windows contain the point ``(x, y)``.

    * ``x`` (int, optional): The x position of the window(s).
    * ``y`` (int, optional): The y position of the window(s).)�
getAllWindowsrrr �width�heightr,)rr�windowsAtXY�windows    r�getWindowsAtr\�sM��
�K��/���q�!�V�[�[�&�*�*�f�l�l�F�M�M�R����v�&�"��rc��t�}g}|D]@\}}|j�|j�vs�'|jt|���B|S)zTReturns a list of Window objects that substring match ``title`` in their title text.)r7�upperr,rO)�title�hWndsAndTitles�
windowObjsr.�winTitles     r�getWindowsWithTitlerc�sL��"�_�N��J�(���h��;�;�=�H�N�N�,�,����k�$�/�0�)��rc�P�t�D�cgc]}|j��c}Scc}w)zHReturns a list of strings of window titles for all visible windows.
    )rWr_)r[s r�getAllTitlesre�s"��(5��7��V�F�L�L��7�7��7s�#c�@��g��fd�}tt|�d��S)z>Returns a list of Window objects for all visible windows.
    c���tjjj|�dk7r�j	t|��y)NrT)rr:rM�IsWindowVisibler,rO)r.r/ras  �rr3z%getAllWindows.<locals>.foreach_window�s6����=�=���/�/��5��:����k�$�/�0�rrr4)r3ras @rrWrW�s&����J�����/��3��rc��eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�ZeZd
�Zd�ZeZd�Zed��Zed��Zed��Zed��Zed��Zy)rOc�2�||_|j�y�N)�_hWnd�_setupRectProperties)�selfr.s  r�__init__zWin32Window.__init__�s����
��!�!�#rc�0�t�}tjjj	|j
tj|��}|dk7r6t|j|j|j|j�St�y)aA nice wrapper for GetWindowRect(). TODO

        Syntax:
        BOOL GetWindowRect(
          HWND   hWnd,
          LPRECT lpRect
        );

        Microsoft Documentation:
        https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-getwindowrect
        rN)
rrr:rM�
GetWindowRectrlrBrrr r!r"rK)rn�rect�results   r�_getWindowRectzWin32Window._getWindowRect�sb���v�����%�%�3�3�D�J�J����T�@R�S���Q�;���	�	�4�8�8�T�Z�Z����E�E��!rc�N�|jj�d|j�d�S)Nz(hWnd=�))�	__class__rrl�rns r�__repr__zWin32Window.__repr__�s�� $��� 7� 7����D�Drc�X�t|t�xr|j|jk(Srk)�
isinstancerOrl)rn�others  r�__eq__zWin32Window.__eq__�s!���%��-�K�$�*�*����2K�Krc��tjjj|jt
dd�}|dk(rt
�yy)z�Closes this window. This may trigger "Are you sure you want to
        quit?" dialogs or other actions that prevent the window from
        actually closing. This is identical to clicking the X button on the
        window.rN)rr:rM�PostMessageArl�WM_CLOSErK�rnrss  r�closezWin32Window.close�s:��
���%�%�2�2�4�:�:�x��A�N���Q�;��!�rc�t�tjjj|jt
�y)zMinimizes this window.N)rr:rM�
ShowWindowrl�SW_MINIMIZErxs r�minimizezWin32Window.minimize�� ���
�
���'�'��
�
�K�@rc�t�tjjj|jt
�y)zMaximizes this window.N)rr:rMr�rl�SW_MAXIMIZErxs r�maximizezWin32Window.maximize�r�rc�t�tjjj|jt
�y)zCIf maximized or minimized, restores the window to it's normal size.N)rr:rMr�rl�
SW_RESTORErxs r�restorezWin32Window.restore�s ���
�
���'�'��
�
�J�?rc�t�tjjj|jt
�y)zBIf hidden or showing, shows the window on screen and in title bar.N)rr:rMr�rl�SW_SHOWrxs r�showzWin32Window.show�� ���
�
���'�'��
�
�7�;rc�t�tjjj|jt
�y)zAIf hidden or showing, hides the window from screen and title bar.N)rr:rMr�rl�SW_HIDErxs r�hidezWin32Window.hide�r�rc��tjjj|j�}|dk(rt�yy)zAActivate this window and make it the foreground (focused) window.rN)rr:rM�SetForegroundWindowrlrKr�s  r�activatezWin32Window.activate�s2�����%�%�9�9�$�*�*�E���Q�;��!�rc	��tjjj|jt
|j|j|j|z|j|zd�}|dk(rt�yy)z0Resizes the window relative to its current size.rN�rr:rM�SetWindowPosrl�HWND_TOPrr rXrYrK)rn�widthOffset�heightOffsetrss    r�resizezWin32Window.resize�s{�����%�%�2�2�4�:�:�x����TX�T\�T\�^b�^h�^h�kv�^v�x|�yD�yD�GS�yS�UV�W���Q�;��!�rc	���tjjj|jt
|j|j||d�}|dk(rt�yy)z-Resizes the window to a new width and height.rN)	rr:rMr�rlr�rr rK)rn�newWidth�	newHeightrss    r�resizeTozWin32Window.resizeTosL�����%�%�2�2�4�:�:�x����TX�T\�T\�^f�hq�st�u���Q�;��!�rc	��tjjj|jt
|j|z|j|z|j|jd�}|dk(rt�yy)z2Moves the window relative to its current position.rNr�)rn�xOffset�yOffsetrss    r�movezWin32Window.movesw�����%�%�2�2�4�:�:�x����U\�I\�^b�^f�^f�ip�^p�rv�r|�r|�C�J�J�LM�N���Q�;��!�rc	���tjjj|jt
|||j|jd�}|dk(rt�yy)z2Moves the window to new coordinates on the screen.rN)	rr:rMr�rlr�rXrYrK)rn�newLeft�newToprss    r�moveTozWin32Window.moveTosN�����%�%�2�2�4�:�:�x��RX�Z^�Zd�Zd�fj�fq�fq�st�u���Q�;��!�rc�n�tjjj|j�dk7S)z6Returns ``True`` if the window is currently minimized.r)rr:rM�IsIconicrlrxs r�isMinimizedzWin32Window.isMinimized�(���}�}�#�#�,�,�T�Z�Z�8�A�=�=rc�n�tjjj|j�dk7S)z6Returns ``True`` if the window is currently maximized.r)rr:rM�IsZoomedrlrxs r�isMaximizedzWin32Window.isMaximizedr�rc��t�|k(S)zJReturns ``True`` if the window is currently the active, foreground window.)rPrxs r�isActivezWin32Window.isActives��� �D�(�(rc� �tjjj|j�}tj
|dz�}tjjj
|j||dz�|jS)z%Returns the window title as a string.r')rr:rM�GetWindowTextLengthWrlr*�GetWindowTextWr-)rn�textLenInCharacters�stringBuffers   rr_zWin32Window.title$sn��%�m�m�2�2�G�G��
�
�S���3�3�4G�!�4K�L���
�
���+�+�D�J�J��FY�\]�F]�^��!�!�!rc�,�t|j�S)z3Return ``True`` if the window is currently visible.)r(rlrxs r�visiblezWin32Window.visible.s���t�z�z�*�*rN)rrrrortryr}r�r�r�r�r�r�r�r��	resizeRelr�r��moveRelr��propertyr�r�r�r_r�rrrrOrO�s���$�
"�(E�L�"�A�
A�
@�<�<�"�"�
�I�"�"�
�G�"��>��>��>��>��)��)��"��"��+��+rrOc���t�}tjjj	tj
|��t
|j|j��S)z�Returns the current xy coordinates of the mouse cursor as a two-integer
    tuple by calling the GetCursorPos() win32 function.

    Returns:
      (x, y) tuple of the current xy coordinates of the mouse cursor.
    )rr)	rrr:rM�GetCursorPosrBrrr)�cursors rr�r�4sA���W�F�
�M�M���%�%�f�l�l�6�&:�;��6�8�8�v�x�x�(�(rc��ttjjj	d�tjjj	d���S)z�Returns the width and height of the screen as a two-integer tuple.

    Returns:
      (width, height) tuple of the screen size, in pixels.
    rr')rXrY)r	rr:rM�GetSystemMetricsrrr�
resolutionr�As<���f�m�m�*�*�;�;�A�>�v�}�}�G[�G[�Gl�Gl�mn�Go�p�pr)2rr�pygetwindowrrrrrr	r@r>r=r?r�r�r�r�r�r�r��	Structurerr:rM�EnumWindowsr5�WINFUNCTYPE�c_bool�c_int�POINTERr6r�r+r�r)rhr(rr7rHrKrPrUr\rcrerWrOr�r�rrr�<module>r�sM��
��X�X�	��",��'�� *������
��
��
�
�
����
&�F���&��m�m�"�"�.�.��$�&�$�$�V�]�]�F�L�L�.�&�.�.�QW�Q]�Q]�B^�_���
�
�$�$�3�3�
��m�m�*�*�?�?���-�-�&�&�6�6��	+�6���	+�
� �0l�!��.	��8�
�A+�*�A+�H
)�q�r

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists