
    af                         d dl Z d dlZd dlmZ d dlmZ d dlmZ dZ	 	 	 dd	ed
e	de	de
def
dZedk    rd dlmZ d Z ee           dS dS )    N)Deferred)IReactorProcess)getProcessOutput)get_input_from_dialog
Unlock key%Please enter passphrase to unlock keyTreactortitletext	hide_textreturnc                     t          j        d          }|st          d          dd|d|g}|r|                    d           t	          ||t
          j        |           }d }|                    |           |S )	a  
    Show a Gnome/GTK desktop dialog asking for a passphrase.

    This is using zenity, the GNOME port of dialog which allows you to display dialog boxes
    from the commandline and shell scripts. To install (on Linux):

    .. code:: console

        sudo apt update
        sudo install zenity

    See also:

    - https://gitlab.gnome.org/GNOME/zenity
    - https://wiki.ubuntuusers.de/Zenity/
    - https://bash.cyberciti.biz/guide/Zenity:_Shell_Scripting_with_Gnome

    :param reactor: Twisted reactor to use.
    :param title: Dialog window title to show.
    :param text: Dialog text to show above text entry field.
    :param hide_text: Hide entry field text.

    :return: A deferred that resolves with the string the user entered.
    zenityzRget_input_from_dialog(): could not find zenity (install with "apt install zenity")z--entryz--titlez--textz--hide-text)argsenvr	   c                 T    |                      d                                          }|S )Nutf8)decodestrip)output
passphrases     F/var/www/html/env/lib/python3.11/site-packages/autobahn/xbr/_dialog.py_consumez'get_input_from_dialog.<locals>._consumeH   s%    ]]6**0022
    )shutilwhichRuntimeErrorappendr   osenvironaddCallback)r	   r
   r   r   exer   dr   s           r   r   r   %   s    6 ,x
 
 C qopppy%48D #M"""4RZIIIA   MM(Hr   __main__)reactc                    K   t          |            d {V }t          t          |          t          |          d                    |                     d S )Nz"{}")r   printtypelenformat)r	   r   s     r   mainr+   S   sW      099999999
d:Jz1J1JKKKKKr   )r   r   T)r   r   twisted.internet.deferr   twisted.internet.interfacesr   twisted.internet.utilsr   __all__strboolr   __name__twisted.internet.taskr%   r+    r   r   <module>r5      s   6 
			  + + + + + + 7 7 7 7 7 7 3 3 3 3 3 3
$ BN&M,0( (? (3 ( #(%)(5=( ( ( (V z++++++L L L 
E$KKKKK r   