o
    ¯bþ  ã                   @   s:   d Z ddlZddlZddlmZ dd„ ZG dd„ dƒZdS )z5
Creation of  Windows shortcuts.

Requires win32all.
é    N)Úshellc                 C   s   t ƒ }| | ¡ |S )zg
    Open an existing shortcut for reading.

    @return: The shortcut object
    @rtype: Shortcut
    )ÚShortcutÚload)ÚfilenameÚsc© r   ú9/usr/lib/python3/dist-packages/twisted/python/shortcut.pyÚopen   s   
r	   c                   @   s>   e Zd ZdZ						ddd„Zdd„ Zdd	„ Zd
d„ ZdS )r   z
    A shortcut on Win32.
    Nr   c                 C   s”   t  tjdt jtj¡| _|dur|  tj	 
|¡¡ |dur"|  |¡ |dur+|  |¡ |dur8|  tj	 
|¡¡ |durH|  tj	 
|¡|¡ dS dS )a½  
        @param path: Location of the target
        @param arguments: If path points to an executable, optional arguments
                      to pass
        @param description: Human-readable description of target
        @param workingdir: Directory from which target is launched
        @param iconpath: Filename that contains an icon for the shortcut
        @param iconidx: If iconpath is set, optional index of the icon desired
        N)Ú	pythoncomÚCoCreateInstancer   ÚCLSID_ShellLinkÚCLSCTX_INPROC_SERVERÚIID_IShellLinkÚ_baseÚSetPathÚosÚpathÚabspathÚSetArgumentsÚSetDescriptionÚSetWorkingDirectoryÚSetIconLocation)Úselfr   Ú	argumentsÚdescriptionÚ
workingdirÚiconpathÚiconidxr   r   r   Ú__init__"   s"   ü

ÿzShortcut.__init__c                 C   s    | j  tj¡ tj |¡¡ dS )z1
        Read a shortcut file from disk.
        N)r   ÚQueryInterfacer
   ÚIID_IPersistFileÚLoadr   r   r   ©r   r   r   r   r   r   E   s   
ÿzShortcut.loadc                 C   s"   | j  tj¡ tj |¡d¡ dS )z^
        Write the shortcut to disk.

        The file should be named something.lnk.
        r   N)r   r   r
   r    ÚSaver   r   r   r"   r   r   r   ÚsaveM   s   ÿzShortcut.savec                 C   s   t | j|ƒS )N)Úgetattrr   )r   Únamer   r   r   Ú__getattr__W   s   zShortcut.__getattr__)NNNNNr   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r$   r'   r   r   r   r   r      s    
ù#
r   )r+   r   r
   Úwin32com.shellr   r	   r   r   r   r   r   Ú<module>   s   