%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/share/hplip/ui5/__pycache__/
Upload File :
Create Path :
Current File : //usr/share/hplip/ui5/__pycache__/devmgr5.cpython-312.pyc

�

=	fQ���ddlZddlZddlZddlZddlZddlZddlZddlmZddl	�ddl
mZmZm
Z
mZmZmZmZddlmZddlmZddl�ddl�ddl�ddl�ddl�ddl�ddlZ	ej:Zej@d�Z!	ddl"Z"dd	l#m$Z$dd
l"m%Z%ddl*Z*e*jVd
e,�ddl-m.Z.ddl/m0Z0ddl1m2Z2ddl3m4Z4ddl5m6Z6ddl7m8Z8ddl9m:Z:ddl;m<Z<ddl=m>Z>ddl?m@Z@ddlAmBZBddlCmDZDddlEmFZFddlGmHZHddlImJZJddlKmLZLddlMmNZNddlOmPZPdd lQmRZRdd!lSmTZTdd"lUmVZVdd#l
mZd$ZWd%ZXd&ZYiZZej��Z\Gd'�d(e]�Z^Gd)�d*e]�Z_Gd+�d,e`�Za	Gd-�d.e0e.eb�ZcGd/�d0ed�Zed1�Zfd2�Zgy#e$reZY��"wxYw#e&$r:e'jQd�ere'jQd�ejRd�Y��AwxYw)3�N)�configparser)�*)�device�utils�pml�maint�models�pkit�os_utils)�cups)�PY3��hpmudext)�
DBusGMainLoop)�lowlevelzLUnable to load DBus libraries. Please check your installation and try again.zHPlease upgrade your python installation to the latest available version.�ignore)�
Ui_MainWindow)�Ui_MainWindow_Derived)�FaxSetupDialog)�PluginDialog)�FirmwareDialog)�AlignDialog)�PrintDialog)�MakeCopiesDialog)�
SendFaxDialog)�	FABWindow)�DeviceSetupDialog)�PrintTestPageDialog)�
InfoDialog)�CleanDialog)�ColorCalDialog)�LineFeedCalDialog)�PQDiagDialog)�NoDevicesDialog)�AboutDialog)�SettingsDialog)�PrintSettingsToolbox)r��<�c��eZdZd�Zy)�FuncViewItemc�b�tj|t|�||�||_||_y�N)�QListWidgetItem�__init__�QIcon�tooltip_text�cmd)�self�parent�text�pixmapr2r3s      �/usr/share/hplip/ui5/devmgr5.pyr0zFuncViewItem.__init__us)��� � ��u�V�}�d�F�C�(������N��__name__�
__module__�__qualname__r0�r9r8r,r,ts��r9r,c��eZdZdd�Zy)�DeviceViewItemc��tj|t|�||�||_||_|jtj�yr.)r/r0r1�
device_uri�is_avail�setTextAlignment�Qt�AlignHCenter)r4r5r6r7rBrCs      r8r0zDeviceViewItem.__init__}s:��� � ��u�V�}�d�F�C�$��� ��
����b�o�o�.r9N)Tr:r>r9r8r@r@|s��/r9r@c� �eZdZd�Zd�Zdd�Zy)�
PluginInstallc�.�||_||_||_yr.)r5�plugin_type�plugin_installed)r4r5rJrKs    r8r0zPluginInstall.__init__�s�����&��� 0��r9c��d}|jr�tj|j|jj	�|jd�tjtjztj�tjk(}|r�tj|jtk(|jjjd�\}}|sxtj|j|jj	�|jd�tj tjztj�yyy)NTzZ<b>The HPLIP plugin is already installed.</b><p>Do you want to continue and re-install it?z
plugin-reasonzm<b>Unable to find an appropriate su/sudo utility to run hp-plugin.</b><p>Install kdesu, gnomesu, or gksu.</p>)rK�QMessageBox�warningr5�windowTitle�_PluginInstall__tr�Yes�No�NoButtonr
�run_plugin_commandrJ�PLUGIN_REQUIRED�
cur_device�mq�critical�Ok)r4�install_plugin�ok�sudo_oks    r8�exec_zPluginInstall.exec_�s����� � �(�0�0���� $��� 7� 7� 9� $�	�	�+G�!H� +���+�.�.� @� +� 4� 4�	6�:E���	I�N���1�1�$�2B�2B�o�2U�W[�Wb�Wb�Wm�Wm�Wp�Wp�rA�XB�C�K�B����$�$�T�[�[��K�K�+�+�-��I�I�N�O��N�N�[�%9�%9�9��(�(�	*��r9Nc�0�tjd||�S�N�DevMgr5��qApp�	translate�r4�s�cs   r8�__trzPluginInstall.__tr�����~�~�i��!�,�,r9r.)r;r<r=r0r]rPr>r9r8rHrH�s��1�*�(-r9rHc�4��eZdZ		dT�fd�	Zd�Zd�Zd�Zd�Zd�Zd�Z	d	�Z
d
�Zd�ZdUd�Z
d
�Zd�Zej"ddfd�Zd�ZdVd�Zd�Zd�Zd�Zd�Zd�ZdUd�Zd�Zd�Zd�ZdWd�Zd�Zd�Z d�Z!d �Z"dXd!�Z#d"�Z$d#�Z%d$�Z&d%�Z'd&�Z(d'�Z)d(�Z*d)�Z+d*�Z,d+�Z-d,�Z.d-�Z/d.�Z0d/�Z1d0�Z2dYd1�Z3d2�Z4d3�Z5d4�Z6d5�Z7dZd6�Z8d7�Z9d8�Z:d9�Z;d:�Z<d;�Z=d<�Z>d=�Z?d>�Z@d?�ZAd@�ZBdA�ZCdB�ZDdC�ZEdD�ZFdE�ZGdF�ZHdG�ZIdH�ZJdI�ZKdJ�ZLdVdK�ZMdL�ZNdM�ZOdN�ZPdO�ZQd[dP�ZRdQ�ZSdR�ZTdUdS�ZU�xZVS)\r`rc���tt|�|�tj	d�tj	dt
jz�||_||_i|_	d|_
d|_d|_d|_
d|_d|_d|_t#t$�}|j'�|_t)�|_|j*j-�|j*j	�|j*j.|_t2j5dd�}t7j8||j*j:�s|j=|d|j �n1|j=||j*j:|j �|j?�|jA�|jC�|jE�tGjHtJ�t
jLs|jNjQd�d|_)tTjWd|jX�y)	Nz Initializing toolbox UI (Qt5)...zHPLIP Version: %srF�hplip�version�T)-�superr`r0�log�debug�prop�installed_version�toolbox_version�initial_device_uri�device_vars�num_devicesrV�cur_printer�updating�init_failed�service�Is_autoInstaller_distro�CoreInstall�
MODE_CHECK�is_auto_installer_support�UserSettings�
user_settings�load�last_used_device_uri�cur_device_uri�sys_conf�getr�Is_HPLIP_older_version�latest_available_version�setupUi�initDBus�initPixmaps�initMisc�initUIr�setPasswordCallback�showPasswordUI�	doc_build�ContentsAction�
setEnabled�allow_auto_refresh�QTimer�
singleShot�initalUpdate)
r4rsrt�	dbus_loopr5�name�fl�corerr�	__class__s
         �r8r0zDevMgr5.__init__�s����	�g�t�%�f�-��	�	�4�5��	�	�%��(>�(>�>�?� /���"4�����������������
� ������',��$��J�'��'+�'E�'E�'G��$�)�^��������!���� � �"�"�0�0�E�E���"�,�,�w�y�9���+�+�->��AS�AS�Al�Al�m��L�L��b��!=�!=�>��L�L��t�1�1�J�J�4�Kg�Kg�h�	
�
�
�������
�
�����
�� � ��0��~�~����*�*�5�1�"&������!�T�.�.�/r9c�2�td��|_tj|j�\|_|_|_|jstjd�d|_	y|jj|jddddd�	�y)
NT)�set_as_defaultz#dBus initialization error. Exiting.�sender�dest�	interface�member�path)�sender_keyword�destination_keyword�interface_keyword�member_keyword�path_keyword)rr�r�	init_dbus�
dbus_availrz�session_busro�errorry�add_signal_receiver�handleSessionSignal�r4s r8r�zDevMgr5.initDBuss��&�d�;���:@�:J�:J�4�>�>�:Z�7�����t�'7�����I�I�;�<�#�D���	
���,�,�T�-E�-E�V^� &�+�#�&�	-�	:r9c��d|_i|_i|_|jt	tdd���tdd�|_y)NF�hp_logo�128x128�fax2�other)�func_icons_cached�
func_icons�device_icons�
setWindowIconr1�load_pixmap�fax_iconr�s r8r�zDevMgr5.initPixmaps!sC��!&���������	
���5��Y�	�!B�C�D�#�F�G�4��
r9c�d
���jjd��jjtj��jtj��jjj�fd���jjj�fd���jjdj�j��jjt!t#dd����jjj�j$��j&jt!t#dd����j&jj�j(��j*jt!t#dd����j*jj�j,��j.jt!t#d	d����j.jj�j0��j2jt!t#d
d����j2jj�j4��j6jt!t#dd����j6jj�j8��j:jt!t#dd����j:jj�j<��j>jj�j@��jBjDd
j�jF��jHjDd
j�jJ�tMjLtLjNtLjP��jS��jU��jW��jY��j[��j\j^t`j�jb��jdjgddg��jjitkdd���jjldj�jn�y)NTc�B���jtj�Sr.��setDeviceListViewMode�	QListView�IconModer�s�r8�<lambda>z DevMgr5.initUI.<locals>.<lambda>2s����9S�9S�T]�Tf�Tf�9g�r9c�B���jtj�Sr.�r�r��ListModer�s�r8r�z DevMgr5.initUI.<locals>.<lambda>3s����8R�8R�S\�Se�Se�8f�r9zconst QPoint &�refresh1�16x16�refresh�list_add�list_remove�settings�help�quitzconst QString &�PiXr))�QListWidgetItem *r�)8�
DeviceList�setSortingEnabled�setContextMenuPolicyrE�CustomContextMenur�r�r��ViewAsIconsAction�	triggered�connect�ViewAsListAction�customContextMenuRequested�%DeviceList_customContextMenuRequested�DeviceRefreshAction�setIconr1r��DeviceRefreshAction_activated�RefreshAllAction�RefreshAllAction_activated�SetupDeviceAction�SetupDeviceAction_activated�RemoveDeviceAction�RemoveDeviceAction_activated�PreferencesAction�PreferencesAction_activatedr��helpContents�
QuitActionr��AboutAction�	helpAbout�PrintControlPrinterNameCombo�	activated�&PrintControlPrinterNameCombo_activated�PrintSettingsPrinterNameCombo�'PrintSettingsPrinterNameCombo_activated�signal�SIGINT�SIG_IGN�initActionsTab�
initStatusTab�initSuppliesTab�initPrintSettingsTab�initPrintControlTab�Tabs�currentChanged�int�Tabs_currentChanged�splitter�setSizes�setIconSize�QSize�currentItemChanged�DeviceList_currentChangedr�s`r8r�zDevMgr5.initUI,s�������)�)�$�/����,�,�R�-A�-A�B��"�"�9�#5�#5�6����(�(�0�0�1g�h����'�'�/�/�0f�g����2�2�3C�D�L�L�T�Mw�Mw�x�	
� � �(�(��{�:�w�/O�)P�Q�� � �*�*�2�2�4�3U�3U�V����%�%�e�K�	�7�,K�&L�M����'�'�/�/��0O�0O�P����&�&�u�[��W�-M�'N�O����(�(�0�0��1Q�1Q�R����'�'��k�-��.Q�(R�S����)�)�1�1�$�2S�2S�T����&�&�u�[��W�-M�'N�O����(�(�0�0��1Q�1Q�R�	
���#�#�E�+�f�g�*F�$G�H����%�%�-�-�d�.?�.?�@�������k�&�'�&B� C�D����!�!�)�)�$�)�)�4����"�"�*�*�4�>�>�:��)�)�3�3�4E�F�N�N�t�Oz�Oz�{��*�*�4�4�5F�G�O�O�PT�P|�P|�}��
�
�f�m�m�V�^�^�4�	
�������������!�!�#�� � �"�	
�	�	� � ��%�-�-�d�.F�.F�G�	
�
�
����C�y�)�	
���#�#�E�"�b�M�2����*�*�+S�T�\�\�]a�]{�]{�|r9c��|j|j|j|j|j|j
d�|_d|_tjr]tjjtjdd�d�}tjj|�r
d|z|_d|_y)N)rr���r(zhttp://hplip.sf.net�dirs�docz
index.htmlz	file://%szhttps://launchpad.net/hplip)�updateActionsTab�updateStatusTab�updateSuppliesTab�updatePrintSettingsTab�updatePrintControlTab�updateHPLIPupgrade�TabIndex�docsrqr��osr��joinr�r��exists�support)r4�gs  r8r�zDevMgr5.initMiscls���!�2�2�!�1�1�!�3�3�!�8�8�!�7�7� �3�3���
�*��	��>�>������X�\�\�&�%�8�,�G�A��w�w�~�~�a� �'�!�O��	�5��r9c�.�|jr|j�y|j�d}|j�?|j	|j�s$t
j
d|jz�d}|jr�|j�|jtjk(r*|jjt|j�|js+|jjt |j�yyy)NTzDevice %s not foundF)ry�close�
rescanDevicesrt�activateDeviceror�rw�getPrinterState�
printer_stater�IPP_PRINTER_STATE_STOPPEDrV�	sendEvent�EVENT_PRINTER_QUEUE_STOPPED�printer_accepting�"EVENT_PRINTER_QUEUE_REJECTING_JOBS)r4�conts  r8r�zDevMgr5.initalUpdate�s�������J�J�L���������"�"�.��&�&�t�'>�'>�?��	�	�/�$�2I�2I�I�J������� � �"��!�!�T�%C�%C�C����)�)�*E�t�GW�GW�X��)�)����)�)�*L�d�N^�N^�_�*�
r9c
��tjtjdd�d|�dd����d}|jj	|�}d}|�n|j
|k(r<d}|jj
|d�|jj|�	|S|dz
}|jj	|�}|��n|S)Nz
Activate: �********************� rFTr)rorp�boldr��itemrB�setSelected�setCurrentItem)r4rB�index�d�founds     r8rzDevMgr5.activateDevice�s����	�	�#�(�(�6�:�v�N�O�P����O�O� � ��'�����m��|�|�z�)������+�+�A�t�4����.�.�q�1��
��
�Q�J�E����$�$�U�+�A��m��r9c��|ddk(�r�|ddk(�r�tjd�tj|dd�}|j�|jt
kry|jtk(r~tjd|jz�|j|j�}|�>	|jj|j|j|j��yy|jt"k(r0tjd
�|j$j'�y|jt(k(rRtjd|jz�|j|j�}|�|j+|�yy|jt,k(rOtjd�tj/d
�t1j2�|j5�y|jt6k(rxtjd�|j9�|j;|j=�t>j@zt>jBz�|jE�y|jtFtHtJfvrytj!d|jz�yyy#tjj$r}tj!d	�Yd}~yd}~wwxYw)Nr�zcom.hplip.Toolboxr��EventzHandling event...�zEVENT_DEVICE_UPDATE_REPLY (%s)��
reply_handler�
error_handlerz dbus call to GetStatus() failed.� EVENT_USER_CONFIGURATION_CHANGEDzEVENT_HISTORY_UPDATE (%s)�EVENT_SYSTEMTRAY_EXITzDHPLIP Status Service was closed. HPLIP Device Manager will now exit.�EVENT_RAISE_DEVICE_MANAGERzUnhandled event: %d)&rorprr'�
event_code�EVENT_MIN_USER_EVENT�EVENT_DEVICE_UPDATE_REPLYrB�findDeviceByURIrz�	GetStatus�handleStatusReply�handleStatusError�dbus�
exceptions�
DBusExceptionr�r,r�r��EVENT_HISTORY_UPDATE�
updateHistoryr-�warnr�releaseCupsInstancerr.�
showNormal�setWindowState�windowStaterE�WindowMinimized�WindowActive�raise_�EVENT_DEVICE_START_POLLING�EVENT_DEVICE_STOP_POLLING�EVENT_POLLING_REQUEST)r4�args�kwds�event�dev�es      r8r�zDevMgr5.handleSessionSignal�sl����� 3�3���N�g�%��I�I�)�*��L�L�$�r��(�+�E��K�K�M����"6�6���!�!�%>�>��	�	�:�U�=M�=M�M�N��*�*�5�+;�+;�<���?�F����.�.�u�/?�/?�t�Oe�Oe�*.�*@�*@�/�B�#��!�!�%E�E��	�	�<�=��"�"�'�'�)��!�!�%9�9��	�	�5��8H�8H�H�I��*�*�5�+;�+;�<���?��&�&�s�+�#��!�!�%:�:��	�	�1�2����_�`��(�(�*��
�
���!�!�%?�?��	�	�6�7����!��#�#�D�$4�$4�$6�"�:L�:L�9L�$L�r���$^�_����
��!�!�&@�&?�&;�&=�=���	�	�/�%�2B�2B�B�C�c
&�4��& �?�?�8�8�F��	�	�"D�E�E��F�s�4<K
�
L�'L�Lc�~�|j|�}|��i}|D]?}tjt|�t||��}|j	||��A|j�|_|jD].}|j||j|jdd�<�0|j|�yy)N�-�_)
r2�	model_obj�convert_data�str�
setdefault�copy�dq�__dict__�replace�updateDevice)r4rB�datarI�t�key�valuer$s        r8r4zDevMgr5.handleStatusReply�s����"�"�:�.���?��A��
)��!�.�.�s�3�x��T�#�Y��H�����S�%�(�
)��V�V�X�C�F��V�V�
=��36�6�6�!�9����Q�Y�Y�s�3�/�0�
=�
���c�"�r9c�@�tjt|��yr.�ror�rP�r4rJs  r8r5zDevMgr5.handleStatusError�����	�	�#�a�&�r9c��|�|j}	|jj|j|j|j
��y#tjj$r}tjd�Yd}~yd}~wwxYw)Nr)z!dbus call to GetHistory() failed.)rVrz�
GetHistoryrB�handleHistoryReply�handleHistoryErrorr6r7r8ror�)r4rIrJs   r8r:zDevMgr5.updateHistory�sn���;��/�/�C�	;��L�L�#�#�C�N�N�$�BY�BY�26�2I�2I�
$�
K�����,�,�	;��I�I�9�:�:��	;�s�<A
�
B	�*B�B	c��|j|�}|��g}|j�|D],}|jtjt|����.	|dj|_tj|jt�|_
||_|j|�yy#t$rt|_Y�YwxYw�Nr)r2�reverse�appendrr'�tupler/�
error_code�
IndexError�STATUS_UNKNOWN�STATUS_TO_ERROR_STATE_MAPr��ERROR_STATE_CLEAR�error_state�histrV)r4rB�historyrI�result�hs      r8razDevMgr5.handleHistoryReplys����"�"�:�.���?��F��O�O���
7���
�
�f�l�l�E�!�H�5�6�
7�
1�"(��)�"6�"6���8�;�;�D�O�O�M^�_�C�O��C�H����c�"����
1�"0���
1�s�B/�/C�Cc�@�tjt|��yr.r\r]s  r8rbzDevMgr5.handleHistoryErrorr^r9rmc�j�tj||||||�j|j�yr.)rr'�
send_via_dbusr�)r4rB�printer_namer/�username�job_id�titles       r8�sendMessagezDevMgr5.sendMessages-��	���Z��z�8��E�	#�#0�=��1A�1A�#Br9c�$�|js�|jjrm|jr`tjd�|j
�|jjdk(r|j�y|j�yyyy)NzRefresh timer...r)
rxr��auto_refreshr�rorp�cleanupChildren�auto_refresh_type�requestDeviceUpdaterr�s r8�timedRefreshzDevMgr5.timedRefresh&sp���}�}��!3�!3�!@�!@�T�E\�E\��I�I�(�)�� � �"��!�!�3�3�q�8��(�(�*��"�"�$�F]�!@�}r9c�F�|j�|j|�yy)zU Called when the active tab changes.
            Update newly displayed tab.
        N)rVr	�r4�tabs  r8r�zDevMgr5.Tabs_currentChanged7s$���?�?�&��D�M�M�#�� �'r9c�N�|jD]}|j|��yr.)r	r�s  r8�
updateAllTabszDevMgr5.updateAllTabs>s&���=�=�	!�C��D�M�M�#�� �	!r9c��tjd�|j|jj	��y)NzupdateCurrentTab())rorpr	r��currentIndexr�s r8�updateCurrentTabzDevMgr5.updateCurrentTabCs-���	�	�&�'�/��
�
�d�i�i�,�,�.�/�1r9c��|jjd�|j�|jjd�y�NFT)r�r�r~r�s r8r�z%DevMgr5.DeviceRefreshAction_activatedPs6��� � �+�+�E�2�� � �"�� � �+�+�D�1r9c�$�|j�yr.)rr�s r8r�z"DevMgr5.RefreshAllAction_activatedVs�����r9c��|tjk(r`|jjtj�|jjd�|jjd�y|jjtj�|jjd�|jjd�yr�)r�r�r��setViewModer�r�r�r�)r4�modes  r8r�zDevMgr5.setDeviceListViewModeZs����9�%�%�%��O�O�'�'�	�(:�(:�;��!�!�,�,�U�3��"�"�-�-�d�3��O�O�'�'�	�(:�(:�;��!�!�,�,�T�2��"�"�-�-�e�4r9c���|�|j}	|j	|j|j|j|j}|j�|j
�}}|j}t||�}t|�}|jdd|j�|j
��|jdd|�	|j}|jtk(r8|j||j j�z
d|j �|t"k7r@|t$t&fvrt)|�d}	nt)|�d}	|	�|jdd|	�|j+�|S#t$rd|_Y��wxYw#t	|jd�|j|j<Y���xYw#t$r
t}Y��wxYw)N�default_printer�devicesrr)rV�icon�AttributeErrorr�r��width�heightrm�QPixmap�QPainter�	eraseRect�
drawPixmap�	tech_type�TECH_TYPE_NONE�device_type�DEVICE_TYPE_FAXr�rl�TECH_TYPE_COLOR_INK�TECH_TYPE_MONO_INK�getStatusOverlayIcon�end)
r4rI�pix�wrqrmr��pr��status_icons
          r8�createDeviceIconzDevMgr5.createDeviceIcones����;��/�/�C�	)��H�H�	K����c�h�h�'�������)���y�y�{�C�J�J�L�1���o�o���q�!�}���T�N��	���A�q�$�*�*�,����
�6�	���Q��3��	'��
�
�I��?�?�o�-�
�L�L��T�]�]�0�0�2�2�A�t�}�}�E��+�+��0�2D�E�E�2�;�?��B��2�;�?��B���&����Q��;�/�	�������G�	)�(�C�H�	)��
	K�*5�c�h�h�	�*J�D���c�h�h�'���	'�&�I�	'�s.�F�F�G�F�F�/G�G'�&G'c��tjd�	t�d|_|j	|jd��|j
�j|jd��tjddg�|_
d}	g}|jD]}|tvs�|j|��tjdd	j|�z�g}tD]"}||jvs�|j|��$tjd
d	j|�z�g}tD]}||vs�||vs�
|j|��tjdd	j|�z�|D�]5}tjd|z�tj||jd
��}|j s'tjd�|j|��q|j#|�}|j$t&k(r5t)|j*|jd|j,z�||�nc|j.r5t)|j*|jd|j,z�||�n"t)|j*|j,||�|t|<��8tjdd	j|�z�d}|D]�}|}|j*j1�dz
}	|j*j3|	�}
tjd|z�	t|=|	dk\rU|
�S|
j6|k(r|j*j9|	�n(|	dz}	|j*j3|	�}
|	dk\r|
��St:j=���|j*j?�t:j=�tAt��r�|jBD]}|jDjG|d�� |jHr�d}	|j*j3|	�x}
}|
�|t:j=�|
j6|jHk(r,|
}|j
�j|jH�n1|	dz
}	|j*j3|	�}
|
��|d|_%d|_$|jJ�H|j*j3d�}
|
�+|
j6|_$t|jH|_%|
}|jM�|jHr5|jH|jN_(|jNjS�||zD]}||vs�|jUt|��!n�d|_%|jVjYd
�|jZjYd
�d
|_|j
�j|jd��|jBD]}|jDjG|d
�� t]�t_|�}|ja�d
|_t]�|�|j*jc|�|jVjYd�|jJ�U|jZjYd�|j
�j|jH�|je�yy#t4$rY���wxYw#d
|_t]�wxYw)NzRescanning device list...rTz*Refreshing Device List - HP Device ManagerzRefreshing device list...�hp�hpfaxzAdds: %s�,zRemovals (1): %szUpdates: %sz
adding: %sF)rz�disable_dbusz$Unsupported model - removing device.z%s (Fax)z%s (Printer)zRemovals (2): %szremoving: %srrmzPress F6 to refresh.)3rorp�beginWaitCursorrx�setWindowTitle�_DevMgr5__tr�	statusBar�showMessager�getSupportedCUPSDevices�cups_devices�device_listrfr�Devicerz�	supportedr�r�r�r@r��model_ui�fax_type�countr �KeyErrorrB�takeItemrb�
processEvents�updateGeometry�lenr	r��
setTabEnabledr�rV�updatePrinterCombosr�r��saver~r�r�r��
endWaitCursorr$r]r"�updateWindowTitle)r4�current�addsr$�removals�updatesrIr��removed_devicer#r r��
first_item�i�dlgs               r8�refreshDeviceListzDevMgr5.refreshDeviceList�s���	�	�-�.���� �D�M�����	�	�*V� W�X��N�N��(�(����3N�)O�P� &� >� >��g�� O�D���G�C
 ����*�*�'�A���+����A��'��	�	�*�s�x�x��~�5�6���$�+�A��� 1� 1�1� ����*�+��	�	�,�s�x�x��/A�A�B���$�*�A���}��(�):����q�)�*��	�	�-�#�(�(�7�*;�;�<��)�A��I�I�l�Q�.�/� �-�-��4�<�<�e�T�C��=�=��	�	�"H�I� ����*� ��0�0��5�D����/�9�&�t������:�c�l�l�CZ�9[� �!�%��<�<�*�4�?�?�D�I�I�n�UX�Ua�Ua�Fa�<b� $�a�)�+�4�?�?�C�L�L� $�a�)�&)�K��N�/)�2�	�	�,�s�x�x��/A�A�B�#��!�)�A�%&�N� �O�O�1�1�3�A�5�E��?�?�/�/��6�D��I�I�n�q�0�1��'��N� �1�*��)9��?�?�a�/� �O�O�4�4�U�;�!���
��#���3�3�E�:��
 �1�*��)9��&�&�(�')�*���.�.�0��"�"�$��{�#�#�}�}�;���	�	�/�/��T�:�;��*�*� !��,0�O�O�,@�,@��,G�G��z�"�.� �.�.�0�#���$�2E�2E�E�*.�� $��� 0� <� <�T�=P�=P� Q� %�!�Q�J�E�#'�?�?�#7�#7��#>�D�#�.�/3�D�O�24�D�/����.� �O�O�0�0��3���=�23�,�,�D�/�.9�$�:M�:M�.N�D�O�&'�G��,�,�.��*�*�BF�BU�BU��*�*�?��*�*�/�/�1�$�t�^�E���H�,� �4�4�[��^�D�E�
'+�D�O��,�,�7�7��>��+�+�6�6�u�=�$)�D�M��N�N�$�0�0����;Q�1R�S�#�}�}�<���	�	�/�/��U�;�<�"�O�)�$�/�C��I�I�K�!&��
����"����.�.�w�7��$�$�/�/��5����*��'�'�2�2�4�8���� �,�,�T�-@�-@�A��&�&�(�+��c$�����R!&��
���sa�\-�/A\-�A	\-�
\-�G5\-�\�A\-�)D)\-�B?\-�C\-�	\*�&\-�)\*�*\-�-]c�
�|jjtk(r8|j|j	d|jj
z��n�|jjr8|j|j	d|jj
z��n7|j|j	d|jj
z��|j�j|j�y)NzHP Device Manager - %s (Fax)z HP Device Manager - %s (Printer)zHP Device Manager - %s)
rVr�r�r�r�r�r�r�r�r�r�s r8r�zDevMgr5.updateWindowTitle2s����?�?�&�&�/�9��#�#�D�I�I�.L�T�_�_�Me�Me�.e�$f�g����'�'��#�#�D�I�I�.P�QU�Q`�Q`�Qi�Qi�.i�$j�k��#�#�D�I�I�.F�t���G_�G_�._�$`�a�����$�$�T�%8�%8�9r9c�B�|j|j|��Sr.)rVr2�r4rBs  r8�updateDeviceByURIzDevMgr5.updateDeviceByURI>s��� � ��!5�!5�j�!A�B�Br9c�r�|�|j}tjd|jz�|j	|�}|�)|jt
|j|���||ju�r�|�r�|j�|j�|j�j|j�|jjtk(r�|jj!|jj#|j$�t&j)ddd��|jj!|jj#|j*�t&j)ddd��y|jj!|jj#|j$�t&j)ddd��|jj!|jj#|j*�t&j)ddd��yyy)z= Update the device icon and currently displayed tab.
        NzupdateDevice(%s)�
MainWindowzPrint SettingszPrinter ControlzFax SettingszFax Control)rVrorprB�findItemr�r1r�r�r�r�r�r�r��DEVICE_TYPE_PRINTERr��
setTabText�indexOf�Settings�QApplicationrc�Control)r4rI�
update_tabr s    r8rVzDevMgr5.updateDeviceBs����;��/�/�C��	�	�$�s�~�~�5�6��}�}�S�!�����L�L��t�4�4�S�9�:�;��$�/�/�!�j��$�$�&��!�!�#��N�N��(�(��)<�)<�=����*�*�.A�A��	�	�$�$�T�Y�Y�%6�%6�t�}�}�%E�|�G]�G]�^j�l|�C�HD�E��	�	�$�$�T�Y�Y�%6�%6�t�|�|�%D�l�F\�F\�]i�k|�C�GD�E��	�	�$�$�T�Y�Y�%6�%6�t�}�}�%E�|�G]�G]�^j�lz�}A�HB�C��	�	�$�$�T�Y�Y�%6�%6�t�|�|�%D�l�F\�F\�]i�kx�z~�F�A�'1�!r9c�P�|��|js�|jj�j|_t
|j|_|j|j_|jj�|j�|j�yyyr.)rxr��currentItemrBr�r�rVr�r�r�rVr�)r4r��js   r8r�z!DevMgr5.DeviceList_currentChanged\s���=����"&�/�/�"=�"=�"?�"J�"J�D��)�$�*=�*=�>�D�O�6:�6I�6I�D���3����#�#�%������"�"�$�"/�=r9c�T�|�|j}|j|j�Sr.)rV�
findItemByURIrB)r4rIs  r8r�zDevMgr5.findItemhs%���;��/�/�C��!�!�#�.�.�1�1r9c��d}|jj|�}|�5|j|k(r|S|dz
}|jj|�}|��4yy)Nrr)r�r rB)r4rBr#r s    r8r�zDevMgr5.findItemByURIosW�������#�#�E�*�������*�,����Q�J�E��?�?�'�'��.�D��r9c�$�	t|S#YyxYwr.)r�r�s  r8r2zDevMgr5.findDeviceByURI{s��	��z�*�*��	��s��c��|�|j}|�@t|_|j|d��|j	|j
dt�yy)z0 Submit device update request to update thread. NF)r�rm)rV�ERROR_STATE_REFRESHINGrmrVryrB�EVENT_DEVICE_UPDATE_REQUESTED)r4rIr s   r8r~zDevMgr5.requestDeviceUpdate�sM���;��/�/�C��?�4�C�O����c�e��4����S�^�^�R�1N�O�	r9c���|jsH|jjd�	|j�|jjd�yy#|jjd�wxYw)z  Rescan and update all devices. FTN)rxr�r�r�r�s r8rzDevMgr5.rescanDevices�s_���}�}��!�!�,�,�U�3�
7��&�&�(��%�%�0�0��6���
�%�%�0�0��6�s�A�A3c�,�tj�yr.)rbr�r�s r8�callbackzDevMgr5.callback�s�����r9c����j}|���|jtk7xr|j}|jt
k(xr|}|jtkDxr>tjxr,|jtk(xrtjdk\xr|}|jtkDxr,tjxr|xr�j j"}|j$t&kDxr|}t)��}�j*j-�}	|	���jj.t0k7r�|rq|j3�j5d��fd��|r$|j3�j5d��fd��|rK|j3�j5d��fd��n&|r$|j3�j5d��fd	��|j7��j8s+|j3�j5d
��j:��j8s+|j3�j5d��j<�|j7��j*j?�t@jBk(r%|j3�j5d��fd
��n$|j3�j5d��fd��|jE�j*jG|��yy)N��zPrint...c�N���jt��j��Sr.)�contextMenuFuncrrwr�s�r8r�z?DevMgr5.DeviceList_customContextMenuRequested.<locals>.<lambda>�s&���t�G[�G[�\g�hl�nr�n~�n~�\�HA�r9zScan...c�N���j�jj�Sr.)r�r��cmd_scanr�s�r8r�z?DevMgr5.DeviceList_customContextMenuRequested.<locals>.<lambda>�s���4�K_�K_�`d�`r�`r�`{�`{�K|�r9zMake Copies...c�0��t��j�Sr.�rr�r�s�r8r�z?DevMgr5.DeviceList_customContextMenuRequested.<locals>.<lambda>�s���Rb�cg�im�i|�i|�R}�r9zSend Fax...c�d���jt��j�j��Sr.)r�rrwr�r�s�r8r�z?DevMgr5.DeviceList_customContextMenuRequested.<locals>.<lambda>�sG���t�Oc�Oc�dq�rv�x|�yI�yI�KO�K^�K^�e_�P`�r9zRefresh DevicezRefresh AllzView as Listc�B���jtj�Sr.r�r�s�r8r�z?DevMgr5.DeviceList_customContextMenuRequested.<locals>.<lambda>�s���4�C]�C]�^g�^p�^p�Cq�r9z
View as Iconsc�B���jtj�Sr.r�r�s�r8r�z?DevMgr5.DeviceList_customContextMenuRequested.<locals>.<lambda>�s���D�D^�D^�_h�_q�_q�Dr�r9)$rV�device_state�DEVICE_STATE_NOT_FOUNDr�r�r�r��
FAX_TYPE_NONErq�	fax_buildr��sys�
hexversion�	scan_type�SCAN_TYPE_NONE�
scan_buildr�r��	copy_type�COPY_TYPE_NONE�QMenur�r�rm�ERROR_STATE_ERROR�	addActionr��addSeparatorrxr~r�viewModer�r�r]�mapToGlobal)
r4r�r$�avail�printer�fax�scan�cpy�popupr s
`         r8r�z-DevMgr5.DeviceList_customContextMenuRequested�sS����O�O���=��N�N�&<�<�L����E��m�m�':�:�D�u�G��*�*�}�,�7����7�A�M�M�Ud�Dd�7����*�,�7�16�
��;�;��/�D�D�O�O�D�#�D�(,�(:�(:�(C�(C�
��+�+��.�:�7�C��$�K�E��?�?�.�.�0�D����?�?�.�.�2C�C������	�	�*�(=�@A�B��!�O�O�D�I�I�i�,@�C|�}��!�O�O�D�I�I�6F�,G�J}�~��!�O�O�D�I�I�m�,D�H`�a��&�&�(��}�}��O�O�D�I�I�.>�$?�$�BZ�BZ�[��=�=�����	�	�-� 8�4�;M�;M�N���� ����'�'�)�Y�-?�-?�?�����	�	�.� 9�;q�r�����	�	�/� :�<r�s��K�K����3�3�A�6�7�[r9c���|jddt�		|j�|jddt�y#t$r�t	�|jd�ddvr.tjd|z�tj|�n|j|�tjd|j�Y��wxYw#|jddt�wxYw�Nrm�:r)�http�https�filezOpening browser to: %s��)ryrDr]r�r��splitrorpr�openURL�runExternalCommandr�r��unlockClickrC)r4�fs  r8r�zDevMgr5.contextMenuFunc�s�������R�!:�;�	A�
:����	�
���R��%?�@��"�	
:��!��7�7�3�<��?�&?�?��I�I�6��:�;��M�M�!�$��+�+�A�.��!�!�$��(8�(8�9�	
:��
���R��%?�@�s$�A�BC
�
C�C
�
C�C)c���|jj�|jj�|j��|jjr�|jj�|jjD]:}|jjd|�|jjd|��<t|jj��|_
yyyrd)r��clearr�rVr��updateCUPSPrinters�
cups_printers�
insertItem�
to_unicode�currentTextrw)r4rfs  r8r�zDevMgr5.updatePrinterCombos�s����*�*�0�0�2��)�)�/�/�1��?�?�&��O�O�%�%��O�O�.�.�0��_�_�2�2�
C���2�2�=�=�a��C��1�1�<�<�Q��B�
C� *�$�*L�*L�*X�*X�*Z�[�D��
&�'r9c�D�t|�|_|j�yr.�rrwr��r4res  r8r�z/DevMgr5.PrintSettingsPrinterNameCombo_activated���%�a�=������r9c�D�t|�|_|j�yr.rrs  r8r�z.DevMgr5.PrintControlPrinterNameCombo_activatedrr9c�$�d|_|jjtdd��|jjdj|j�|jjdj|j�y)N� r�)�
click_lock�ActionsListr�r��itemClickedr��ActionsList_clicked�itemDoubleClickedr�s r8r�zDevMgr5.initActionsTabso��������$�$�U�2�r�]�3����$�$�%8�9�A�A�$�BZ�BZ�[����*�*�+>�?�G�G��H`�H`�ar9c��
������������t�	�jj��j����d�jt
k7xr�j��jtkDxr>tjxr,�jtk(xrtjdk\xr���jtk(xr���j t"kDxr,tj$xr�xr�j&j(��j*t,kDxr���j.t0k(��j.t2k(�	t5j6�j8�\	}}�}}}}}}t?j@�}	tCdd�}
|	jE|
�|
jG�	tIjJ|	jMdd����j.tPk7rX�r�r�jSd�}nD�r�s�jSd�}n.�r�r�jSd	�}n�r�s�jSd
�}nd}�fd��jSd
�d�jSd��fd�f�fd��jSd�d�jSd��j&j(f�fd��jSd�d�jSd��fd�f�fd��jSd�d�jSd��fd�f�fd��jSd �d!�jSd"��fd#�f��fd$��jSd%�d&�jSd'��j&jTf��fd(��jSd)�d*�jSd+��fd,�f�fd-��jSd.�d/�jSd0��fd1�fd2��jSd3�d4�jSd5��fd6�f��fd7��jSd8�d9�jSd:��fd;�f��fd<��jSd=�d>�jSd?��fd@�f��fdA��jSdB�dC�jSdD��fdE�f��fdF��jSdB�dC�jSdG��fdH�f��fdI��jSdJ�dK�jSdL��fdM�f��fdN��jSdO�dP�jSdQ��fdR�f���fdS��jSdT�dU�jSdV�dW�j8zf��fdX��jSdY�dZ�jSd[��fd\�f��fd]��jSd^�d���fd_�f��fd`��jSda�d|���fdb�f���fdc��jSdd�de�jSdf�tW||�fdg��jSdh�di�jSdj��jXfdk��jSdl�dm�jSdn��jZfg�_.�j^s7�j\D]!\}}
}}}ta|do��jb|<�#dp�_/�j\D]8\}}
}}}|�|�s�te�j|
�jb|||��:t=�y#t:$r
Yt=�ywxYw#t>jN$rd�Y��wxYw#t=�wxYw)qNr�z/etc/hp/hplip.conf�rrk�pluginFz<Download and install<br>required plugin (already installed).z=Download and install<br>required plugin (needs installation).z<Download and install<br>optional plugin (already installed).z=Download and install<br>optional plugin (needs installation).rmc����Sr.r>�rs�r8r�z*DevMgr5.updateActionsTab.<locals>.<lambda>T����g�r9�Print�printzPrint documents or files.c�0��t��j�Sr.)rrwr�s�r8r�z*DevMgr5.updateActionsTab.<locals>.<lambda>Xs���[��t�/?�/?�@�r9c����Sr.r>)rs�r8r�z*DevMgr5.updateActionsTab.<locals>.<lambda>Zs���T�r9�Scanrz*Scan a document, image, or photograph.<br>c����Sr.r>)rs�r8r�z*DevMgr5.updateActionsTab.<locals>.<lambda>`s���c�r9zMake Copies�
makecopiesz3Make copies on the device controlled by the PC.<br>c�0��t��j�Sr.r�r�s�r8r�z*DevMgr5.updateActionsTab.<locals>.<lambda>ds���-�d�D�4G�4G�H�r9c����Sr.r>�rs�r8r�z*DevMgr5.updateActionsTab.<locals>.<lambda>h����S�r9zSend FaxrzSend a fax from the PC.c�F��t��j�j�Sr.)rrwr�r�s�r8r�z*DevMgr5.updateActionsTab.<locals>.<lambda>ls���]�4��1A�1A�4�CV�CV�W�r9c����Sr.r>r6s�r8r�z*DevMgr5.updateActionsTab.<locals>.<lambda>nr7r9z	Fax Setup�	fax_setupz4Fax support must be setup before you can send faxes.c�0��t��j�Sr.)rr�r�s�r8r�z*DevMgr5.updateActionsTab.<locals>.<lambda>r����^�D�$�2E�2E�F�r9c�8���xr�jjSr.)r��cmd_fab)rr4s��r8r�z*DevMgr5.updateActionsTab.<locals>.<lambda>ts���S�?�T�%7�%7�%?�%?�r9zFax Address Book�fabz>Setup fax phone numbers to use when sending faxes from the PC.c�2���jtk7xr�Sr.)�power_settings�POWER_SETTINGS_NONE)rr$s��r8r�z*DevMgr5.updateActionsTab.<locals>.<lambda>|s���a�.�.�2E�E�O�%�r9zDevice Settingsr�zNYour device has special device settings.<br>You may alter these settings here.c�0��t��j�Sr.)rr�r�s�r8r�z*DevMgr5.updateActionsTab.<locals>.<lambda>�����.�t�T�5H�5H�I�r9c����Sr.r>r+s�r8r�z*DevMgr5.updateActionsTab.<locals>.<lambda>�r,r9zPrint Test Page�testpagez4Print a test page to test the setup of your printer.c�0��t��j�Sr.)rrwr�s�r8r�z*DevMgr5.updateActionsTab.<locals>.<lambda>�s���0��t�7G�7G�H�r9c��y�NTr>r>r9r8r�z*DevMgr5.updateActionsTab.<locals>.<lambda>���r9z#View Printer and Device Informationrz:View information about the device and all its CUPS queues.c�0��t��j�Sr.)rr�r�s�r8r�z*DevMgr5.updateActionsTab.<locals>.<lambda>�s���Z��d�.A�.A�B�r9c�2���xr�jtk7Sr.)�
align_type�ALIGN_TYPE_NONE�r$rs��r8r�z*DevMgr5.updateActionsTab.<locals>.<lambda>�����W�H�����)H�r9zAlign Cartridges (Print Heads)�alignzJThis will improve the quality of output when a new cartridge is installed.c�0��t��j�Sr.)rr�r�s�r8r�z*DevMgr5.updateActionsTab.<locals>.<lambda>�����[��t�/B�/B�C�r9c�2���xr�jtk7Sr.)�
clean_type�CLEAN_TYPE_NONErOs��r8r�z*DevMgr5.updateActionsTab.<locals>.<lambda>�rPr9zClean Printheads�cleanzyYou only need to perform this action if you are<br>having problems with poor printout quality due to clogged ink nozzles.c�0��t��j�Sr.)r r�r�s�r8r�z*DevMgr5.updateActionsTab.<locals>.<lambda>�rSr9c�\���xr(�jtk7xr�jtk(Sr.��color_cal_type�COLOR_CAL_TYPE_NONE�COLOR_CAL_TYPE_TYPHOONrOs��r8r�z*DevMgr5.updateActionsTab.<locals>.<lambda>��*���W���)9�)9�=P�)P��UV�Ue�Ue�i�U�r9zColor Calibration�colorcalz^Use this procedure to optimimize your printer's color output<br>(requires glossy photo paper).c�0��t��j�Sr.�r!r�r�s�r8r�z*DevMgr5.updateActionsTab.<locals>.<lambda>�r<r9c�\���xr(�jtk7xr�jtk7Sr.rZrOs��r8r�z*DevMgr5.updateActionsTab.<locals>.<lambda>�r^r9z=Use this procedure to optimimize your printer's color output.c�0��t��j�Sr.rar�s�r8r�z*DevMgr5.updateActionsTab.<locals>.<lambda>�r<r9c�2���xr�jtk7Sr.)�linefeed_cal_type�LINEFEED_CAL_TYPE_NONErOs��r8r�z*DevMgr5.updateActionsTab.<locals>.<lambda>�s���W�V��)<�)<�@V�)V�r9zLine Feed Calibration�linefeed_calz^Use line feed calibration to optimize print quality<br>(to remove gaps in the printed output).c�0��t��j�Sr.)r"r�r�s�r8r�z*DevMgr5.updateActionsTab.<locals>.<lambda>�rDr9c�2���xr�jtk7Sr.)�pq_diag_type�PQ_DIAG_TYPE_NONErOs��r8r�z*DevMgr5.updateActionsTab.<locals>.<lambda>�s���W�L����;L�)L�r9zPrint Diagnostic Page�pq_diagzOYour printer can print a test page <br>to help diagnose print quality problems.c�0��t��j�Sr.)r#r�r�s�r8r�z*DevMgr5.updateActionsTab.<locals>.<lambda>�s���\�$��0C�0C�D�r9c�@���xr�jtk\xr�dk(S)N�usb)�wifi_config�WIFI_CONFIG_USB_XML��busr$rs���r8r�z*DevMgr5.updateActionsTab.<locals>.<lambda>�s"���W�^����:M�)M�^�RU�Y^�R^�r9zWireless/wifi setup using USB�wirelesszIConfigure your wireless capable printer using a temporary USB connection.zhp-wificonfig -d %sc�$���xr�jSr.)�fw_downloadrOs��r8r�z*DevMgr5.updateActionsTab.<locals>.<lambda>�s���g�7�!�-�-�r9zDownload Firmware�firmwarezUDownload firmware to your printer <br>(required on some devices after each power-up).c�0��t��j�Sr.)rr�r�s�r8r�z*DevMgr5.updateActionsTab.<locals>.<lambda>�r<r9c����xr�Sr.r>)r�
req_plugins��r8r�z*DevMgr5.updateActionsTab.<locals>.<lambda>�����g�4�*�r9zInstall Required Pluginc�2��t��j��Sr.�rHr)�r$rKr4s���r8r�z*DevMgr5.updateActionsTab.<locals>.<lambda>�����]�4����;K�L�r9c����xr�Sr.r>)�
opt_pluginrs��r8r�z*DevMgr5.updateActionsTab.<locals>.<lambda>�r{r9zInstall Optional Pluginc�2��t��j��Sr.r}r~s���r8r�z*DevMgr5.updateActionsTab.<locals>.<lambda>�rr9c�@���xr�jtkDxr�dk(S)N�net)�embedded_server_type�EWS_NONErrs���r8r�z*DevMgr5.updateActionsTab.<locals>.<lambda>�s#���g�\�!�*@�*@�8�*K�\�PS�W\�P\�r9z$Open printer's web page in a browser�ewszAThe printer's web page has supply, status, and other information.c��yrIr>r>r9r8r�z*DevMgr5.updateActionsTab.<locals>.<lambda>�rJr9zVisit HPLIP Support Websiter�zVisit HPLIP Support Website.c��yrIr>r>r9r8r�z*DevMgr5.updateActionsTab.<locals>.<lambda>�rJr9�Helpr�zView HPLIP help.�32x32T)3r�r#rrVr�r�r�r�r�rqr�r�r�r�r�r�r�r�r�r�r�r�r�r)rU�PLUGIN_OPTIONALr�parseDeviceURIr��Errorr�r�ConfigParser�open�	read_filerr�to_boolr��
NoOptionError�PLUGIN_NONEr�r>�openEWSrr
�ICONSr�r�r�r,)r4�back_end�is_hp�model�serial�dev_file�host�zc�port�
hplip_conf�fp�x�filter6r��tooltipr3�fltrrrsrr$rr�rKrrzrs`                 @@@@@@@@@@r8rzDevMgr5.updateActionsTabs�������Z	����"�"�$����A��}����*@�@�P�Q�[�[���j�j�=�0�;�T�^�^�;��
�
�Yh�Hh�;��N�N�j�0�;�5:���-�-�+>�>�H�5���{�{�^�3�@����@��@�$(�$6�$6�$?�$?���k�k�N�2�>�w���X�X��8�
��X�X��8�
���-�-�d�.A�.A�B�R�H�e�S�%���4��T�
*�6�6�8�
��.��4���$�$�R�(����
�-�',�}�}�Z�^�^�G�X�5V�'W�$��8�8�{�*�!�&6� �I�I�&d�e��#�,<� �I�I�&e�f��#�(8� �I�I�&d�e��#�,<� �I�I�&e�f���A�&��I�I�g�&���I�I�9�:�@�	B�"��I�I�f�%���I�I�J�K��&�&�/�/�	1�"��I�I�m�,� ��I�I�S�T�H�	J�!��I�I�j�)���I�I�7�8�W�	Y�!��I�I�k�*���I�I�T�U�F�	H�@��I�I�0�1���I�I�^�_��&�&�.�.�	0�P��I�I�/�0���I�I�n�o�I�	K�&��I�I�/�0���I�I�T�U�H�	J�$��I�I�C�D���I�I�Z�[�B�	D�I��I�I�>�?���I�I�j�k�C�	E�I��I�I�0�1���I�I�Z�[�C�	E�@��I�I�1�2���I�I�~��F�	H�@��I�I�1�2���I�I�]�^�F�	H�W��I�I�5�6�"��I�I�~��I�	K�M��I�I�5�6���I�I�o�p�D�	F�_��Y�Y�>�?���Y�Y�j�k�*�T�-@�-@�@�	B�8��I�I�1�2���I�I�u�v�F�	H�5��I�I�7�8���L�	N�5��I�I�7�8���L�	N�]��Y�Y�E�F���Y�Y�b�c��T�2�&�	(�#��I�I�;�<���I�I�<�=��L�L�	"�#��I�I�f�%���I�I�0�1��I�I�	�]T��
�l�-�-�;?�:�:�K�7��t�T�7�C�0;�D�'�0J�����-�K�-1�D�*�6:�j�j��2�D�$��g�s��'�#�v�$� ��!1�!1�4�����-�����
�O��O���L
�O�O��$�1�1�-�',�$�-��z
�O�sV�D2[$�
)Z/�3A[$�5%[�S
[$�/	[�8[$�[�[$�[!�[$� [!�![$�$[0c���|��H|j|u�r8||_|jrtt|jtj�rP|j�}|jddt�	|j�|jddt�n�t�|jjd�ddvrBtjd|jz�tj|j�n$|jt!|j��t"j%d|j&�yyy#|jddt�wxYwr	)r"r3�
isinstance�collectionsAbc�CallableryrDr]rCr�rrorprrrrPr�r�r)r4r r�s   r8r%zDevMgr5.ActionsList_clicked�s�������t� ;�"�D�O��x�x�J�t�x�x��1H�1H�I��h�h�j��� � ��R�)B�C�I��I�I�K��$�$�R��-G�H� �!��8�8�>�>�#�&�q�)�-F�F��I�I�6����A�B��M�M�$�(�(�+��+�+�C����M�:����d�D�$4�$4�5�%!<����$�$�R��-G�H�s�2E
�
E&c�&�d|_t�yr.)r"r�r�s r8rzDevMgr5.unlockClicks������r9c��t|�yr.)r.)r4r�s  r8�&ActionsList_customContextMenuRequestedz.DevMgr5.ActionsList_customContextMenuRequesteds	��
�a�r9c��|jjd�|jd�|jd�|jd�|jd�|jd�|jd�g|_y)Nrrm�Statusz
Date and Time�Code�Job ID�Description)�StatusTable�setColumnCountr��status_headersr�s r8r�zDevMgr5.initStatusTabse�����'�'��*�#�y�y��}�d�i�i��.A�4�9�9�_�C]�#�y�y��0�$�)�)�H�2E�t�y�y�Q^�G_�a��r9c�D�|j�|j�yr.)�updateStatusLCD�updateStatusTabler�s r8rzDevMgr5.updateStatusTab$s��������� r9c�r�|j��|jjr�|jjr�|jj}|j	dd�dk(r%|j	dd�}|j	dd�}n9	tj|jjdj�}d}|j||�y|jjtk(r1|j|jd�|jd��y|jjs!|j|jd	��y|jjs!|j|jd
��y|j�y#ttf$rd}Y��wxYw)N�panelrrzpanel-line1rmzpanel-line2zStatus information notzavailable for this device.zDevice not supported.zNo status history available.)rVrnr�rSr�r�queryStringr/r��	TypeError�
drawStatusLCD�status_type�STATUS_TYPE_NONEr�)r4rS�line1�line2s    r8r�zDevMgr5.updateStatusLCD)sU���?�?�&��O�O� � ��O�O�%�%����#�#�B��v�v�g�q�!�Q�&����}�b�1�����}�b�1���"�.�.�t���/C�/C�A�/F�/Q�/Q�R�E������u�e�,����*�*�.>�>��"�"�4�9�9�-E�#F��	�	�Rn�Ho�p��_�_�.�.��"�"�4�9�9�-D�#E�F��_�_�)�)��"�"�4�9�9�-K�#L�M��"�"�$��%'�	�2���E��s�
6F"�"F6�5F6c�~�tdd�}t�}|j|�|jt	ddd��|j|j
��d\}}}|r|j|||�|r|j|||�|j�|jj|�y)N�	panel_lcdr�r)�
��!)r�r��begin�setPen�QColor�setFont�font�drawTextr��LCD�	setPixmap)r4r�r��pmr�r��y_line1�y_line2s        r8r�zDevMgr5.drawStatusLCDKs���
��g�
.���J��	�����	�����1�a��!�	�	�	�$�)�)�+��(���7�G��
�J�J�q�'�5�)��
�J�J�q�'�5�)�	���������2�r9c�R
�|jj�tjtjz}d}|j
jdd}|�r9|jjt|��|jjt|j��|jj|j�|jj�j�|jj�j�|j!�t|�dz
}|D�]}|��t#j$|j&d�}t#j$|j&d�}|dk(r|j)d�}nt+|j,�}t/�}|j1t3|j,��t5|j7��d|���}	|j8rt;|j8�}
nt;d�}
t<j?|j&t@�}|j
jB}|tDtFfvrtI|�d}
ntI|�d}
t;|j&�}tKtM|
�|j)d��}|jO|�|jjQ|d|�d|fd|	fd|fd|
fd	|ffD]G\}}tKt5|��}|jO|�|jjQ|||��I|dz}��|jjS�|jjUdd
�y|jjd�|jjd�|jjddg�|jj�j�|jj�j�tj}tItV�d}tKtM|�|j)d��}|jO|�|jjQ|d|�tK|j)d��}|jO|�|jjQdd|�|jjS�|jjUdd
�y)Nrrz
(most recent)rrmr�r�rr(�z1Status information not available for this device.),r�rrE�ItemIsSelectable�
ItemIsEnabledrVrn�setRowCountr�r�r��setHorizontalHeaderLabels�verticalHeader�hide�horizontalHeader�showrerr�r/r��getTimeDeltaDesc�timedate�	QDateTime�	setTime_tr�rP�toStringrwrrkr�rlr�r�r��getStatusListIcon�QTableWidgetItemr1�setFlags�setItem�resizeColumnsToContents�setColumnWidthr�)r4�flags�rowrnrJ�ess�esl�desc�dt�ttrwrmr��
status_pixr/r��colrXr7s                   r8r�zDevMgr5.updateStatusTablebs������� ��#�#�b�&6�&6�6�������#�#�A�&������(�(��T��3����+�+�C��0C�0C�,D�E����6�6�t�7J�7J�K����+�+�-�2�2�4����-�-�/�4�4�6��L�L�N��d�)�A�+�C��,
���9���(�(����q�9���(�(����q�9���!�8��9�9�_�5�D�,�A�J�J�7�D��[�����S����_�-��"�+�+�-��5�6���8�8�'����1�F�'��^�F�7�;�;�A�L�L�J[�\�� �O�O�5�5�	��!4�6H� I�I�!2�;�!?��!B�J�!2�;�!?��!B�J�'����5�
�$�U�:�%6��	�	�"�
�F���
�
�5�!�� � �(�(��a��3� !�3�x�!�R��1�j�/�A�v�;�QR�TW�PX�Y�:�F�C��(��Q��0�A��J�J�u�%��$�$�,�,�S�#�q�9�	:��q���Y,
�\
���4�4�6����+�+�A�r�2�
���(�(��+����+�+�A�.����6�6��B�x�@����+�+�-�2�2�4����-�-�/�4�4�6��$�$�E�&�'8�9�!�<�F� ��v���	�	�"�
�>�A�
�J�J�u�����$�$�S�!�Q�/� ����+^�!_�`�A�
�J�J�u�����$�$�Q��1�-����4�4�6����+�+�A�r�2r9c�^�tdd�|_d}d}d}d}d}d}d	}d
}d}	d}
d
}d}it|g�t|g�t|g�t
|
g�t|g�t|||g�t|||g�t|
g�t|g�t|g�t|g�t|g�t|g�t|g�t |g�t"|||g�t$||g�t&||
gt(|gt*|	gt,|
gt.|gt0||gt2||gt4|gt6|gi	�|_|j;d�|j;d�|j;d�|j;d�|j;d�g|_|j>dk7r	|j>j@dyy#tB$r|j>jE�YywxYw)N�batteryr�z#ffff00z#ffffccz#00ffffz#ccffffz#ff00ffz#ffccffz#000000z#0000ffz#808080z#a9a9a9z#c0c0c0z#ff0000rmr�zHP Part No.z
Approx. Levelr�zagent1-type)#r��pix_battery�AGENT_TYPE_UNSPECIFIED�AGENT_TYPE_BLACK�AGENT_TYPE_MATTE_BLACK�AGENT_TYPE_PHOTO_BLACK�AGENT_TYPE_BLACK_B8800�AGENT_TYPE_CMY�AGENT_TYPE_KCM�AGENT_TYPE_GGK�AGENT_TYPE_YELLOW�AGENT_TYPE_MAGENTA�AGENT_TYPE_CYAN�AGENT_TYPE_CYAN_LOW�AGENT_TYPE_YELLOW_LOW�AGENT_TYPE_MAGENTA_LOW�AGENT_TYPE_BLUE�AGENT_TYPE_KCMY_CM�AGENT_TYPE_LC_LM�AGENT_TYPE_LG_PK�
AGENT_TYPE_LG�AGENT_TYPE_G�
AGENT_TYPE_DG�
AGENT_TYPE_PG�AGENT_TYPE_C_M�AGENT_TYPE_K_Y�
AGENT_TYPE_LC�AGENT_TYPE_RED�TYPE_TO_PIX_MAPr��supplies_headersrVrSr��queryDevice)
r4�yellow�light_yellow�cyan�
light_cyan�magenta�
light_magenta�black�blue�gray�	dark_gray�
light_gray�reds
             r8r�zDevMgr5.initSuppliesTab�s0��&�y�'�:����� �����
���!�
��������	��
��� !�5��� !�/�%�� !� 6��� !� 6���	 !�
 6��w� !� .��g�v�/F�
 !� .�
�M�<�/X� !� .�	�{� !� 1�6�(� !� 2�G�9� !� /�$�� !� 3�Z�L� !� 5�|�n� !� 6�
�� !� /��� !�  2�F�D�'�3J�! !�" 0�*�m�1L�# !�( 0�*�i�1H�,�z�l�+�d�V�,�y�k�,�z�l�-��g��-��v��,�z�l�-���9 !���>"&���2���	�	�-�0H�!%���=�!9�4�9�9�_�;U�!%���8�!4�!6����?�?�d�"�
.����"�"�=�1�#���
.����+�+�-�
.�s�+F�#F,�+F,c	�>�t�tjtjz}	|jj�|jj
d�|jjd�|j��|jjr�|jjtk7r�|jjtk7r�g|j_d}		t|jj d|z�}t|jj d|z�}|jj d|z}|jjj#||||f�|dz
}��thjkd�tj}|jj
d�|jjd
�|jj5ddg�|jj7�j9�|jj;�j9�tY|j]d��}
|
j_|�|jjadd|
�tmtn�d}tYt[|�|j]d��}
|
j_|�|jjadd|
�|jje�|jjgdd�tq�y#t$$r&|dk(r|jj'�nYnY���wxYw|jjj)t+j,t*j.���|jj
t1|jj��|jjt1|j2��|jj5|j2�|jj7�j9�|jj;�j=�|jj?tAdd��tC|jj�D�]�\}}|\}}}}	t|jj d	|z�}|jj d
|z}	|jj d|z}
n#t$$rY�nrwxYwd}|tDtFtHtJtLtNtPfvr|jS||�}d}|tDtTtFtHtNfvr|jW||�}|�RtYt[|�|j]d��}
|
j_|�|jja|d|
�d|	fd
|fd|
ffD]G\}}tYtc|��}
|
j_|�|jja|||
��I|����tYt[|�|j]d��}
|
j_|�|jja|d|
����|jje�|jjgdd�|jjgdd����#tq�wxYw)Nrrzagent%d-typezagent%d-kindzagent%d-sku)rY�d�z
agent%d-levelzagent%d-desczagent%d-health-descrmr�rr�r��xz3Supplies information not available for this device.)9r�rEr�r��
SuppliesTablerr�r�rVr�r�r�r�r��sorted_suppliesr�rSrfr�r
�sortr�
cmp_to_key�	levelsCmpr�rr�r�r�r�r�r�r��	enumerate�AGENT_KIND_SUPPLY�AGENT_KIND_HEAD_AND_SUPPLY�AGENT_KIND_TONER_CARTRIDGE�AGENT_KIND_MAINT_KIT�AGENT_KIND_ADF_KIT�AGENT_KIND_INT_BATTERY�AGENT_KIND_DRUM_KIT�createStatusLevelGraphic�AGENT_KIND_HEAD�
getStatusIconr�r1r�r�r�rPr�r�rorNr�r�r�)r4r��a�
agent_type�
agent_kind�	agent_skur�r��agent_level�
agent_desc�agent_health_desc�level_pixmapr7r�r�rXs                r8rzDevMgr5.updateSuppliesTab�s������#�#�b�&6�&6�6��p	����$�$�&����*�*�1�-����-�-�a�0����*����)�)����+�+�/?�?����,�,�0F�F�24����/����
g�%(����);�);�N�Q�<N�)O�%P�
�%(����);�);�N�Q�<N�)O�%P�
�$(�O�O�$6�$6�}�q�7H�$I�	����7�7�>�>��:�z�[d�?e�f���F�A��`���Q�R��(�(���"�"�.�.�q�1��"�"�1�1�!�4��"�"�<�<�b�"�X�F��"�"�1�1�3�8�8�:��"�"�3�3�5�:�:�<�$�T�Y�Y�/d�%e�f���
�
�5�!��"�"�*�*�1�a��3�*�+<�=�a�@��$�U�6�]�D�I�I�b�M�B���
�
�5�!��"�"�*�*�1�a��3��"�"�:�:�<��"�"�1�1�!�R�8�
�O��A$�"���6� �O�O�7�7�9�!�:�"�����/�/�4�4��9I�9I�%�/�/�9Z�4�[��"�"�.�.�s�4�?�?�3R�3R�/S�T��"�"�1�1�#�d�6K�6K�2L�M��"�"�<�<�T�=R�=R�S��"�"�1�1�3�8�8�:��"�"�3�3�5�:�:�<��"�"�.�.�u�S�"�~�>�'����(G�(G�H�1>�F�C��;<�8�A�z�:�y��&)�$�/�/�*<�*<�_�q�=P�*Q�&R��%)�_�_�%7�%7���8J�%K�
�,0�O�O�,>�,>�?T�WX�?X�,Y�)��#�����$(�L�!�&7�&@�&@�&:�&8�&<�&9�&(�(�(,�'D�'D�[�R\�']��"�F�!�&7�&5�&@�&@�'=�
&(�(�"&�!3�!3�J�
�!K���)�,�U�6�]�D�I�I�b�M�J���
�
�5�)��*�*�2�2�3��1�=�$%�z�?�Q�	�N�Q�HY�DZ�"[�@���Q�,�S��V�4���
�
�5�)��*�*�2�2�3��Q�?�@�
$�/�,�U�<�-@�$�)�)�B�-�P���
�
�5�)��*�*�2�2�3��1�=�c1>�f�"�"�:�:�<��"�"�1�1�!�R�8��"�"�1�1�!�S�9��0
�O�s`�C\�.A&L8�G\�8)M'�!\�&M'�'E7\�AT=�<\�=	U�\�
U�D\�'B)\�\c��|ttttfv�r&|j|}t|t��rt|�}tdd�}|jtdddd��t�}|j|�|jtj�|dk(rj|jt|d��|j!t#t|d�t$j&��|j)dddddd��n|dk(r�|jt|d��|j!t#t|d�t$j&��|j)dddddd�|jt|d��|j!t#t|d�t$j&��|j)d	ddddd��n>|d
k(�r8|jt|d��|j!t#t|d�t$j&��|j)d	d	dddd�|jt|d��|j!t#t|d�t$j&��|j)dd	dddd�|jt|d��|j!t#t|d�t$j&��|j)dddddd�|j+�|S|S|t,k(r|j.Sy)N�rrr�r�i�r�r(r�)r$r,r%r&rr��listr�r��fillr�r�r��
setRenderHint�Antialiasingr��setBrush�QBrushrE�SolidPattern�drawPier�r)r�)r4r0r/�map�map_lenr�r�s       r8r-zDevMgr5.getStatusIconps����+�)�4�4�6�6�
�&�&�z�2�C��#�t�$��c�(���b�"�o�������1�a��+�,��J����������� 5� 5�6��a�<��H�H�V�C��F�^�,��J�J�v�f�S��V�n�b�o�o�F�G��I�I�a��B��A�t�4���\��H�H�V�C��F�^�,��J�J�v�f�S��V�n�b�o�o�F�G��I�I�a��A�q�!�T�2��H�H�V�C��F�^�,��J�J�v�f�S��V�n�b�o�o�F�G��I�I�a��A�q�!�T�2���\��H�H�V�C��F�^�,��J�J�v�f�S��V�n�b�o�o�F�G��I�I�a��A�q�!�T�2��H�H�V�C��F�^�,��J�J�v�f�S��V�n�b�o�o�F�G��I�I�a��A�q�!�T�2��H�H�V�C��F�^�,��J�J�v�f�S��V�n�b�o�o�F�G��I�I�a��A�q�!�T�2������
��
�
�1�
1��'�'�'�2r9c�
�|rt|dz|z�}nd}t||�}|jtdddd��t	�}|j|�|j
tj�|jtj�|j|}t|�}	|	dk(s|	dkDr,|jdd||tt|d����n|	dk(rct|dz�}
|jdd||
tt|d���|jd|
||tt|d���n�|	dk(r�t|dz�}td|z�}|jdd||tt|d���|jd|||tt|d���|jd|||tt|d���|jdd||�|dkDr2|t t"t$fvr|jtj&�td|zdz�}
t|dz�}|j)|
d|
|�|j)|
||
||z
�|d	kDr2|t t"t$fvr|jtj&�t|dz�}t|dz�}|j)|d||�|j)|||||z
�|d
kDr2|t t"t$fvr|jtj&�t|dz�}|j)|d||�|j)|||||z
�|j+�|S)Nrrrr�r��Krr(�2�)r�r�r:r�r�r�r;r<r�rErrr��fillRectr>�drawRectr�r�r��white�drawLiner�)r4�percentr/r�rq�fw�px�pprArB�h2�h3�h23�w1�h6�w2�h4�w4s                  r8r+z DevMgr5.createStatusLevelGraphic�s�����Q�s�U�7�]�#�B��B�
�Q��]��
����q�!�Q��"�#�
�Z��
�����
����.�.�/�
�	�	�"�(�(���"�"�:�.���c�(���a�<�7�Q�;��K�K��1�b�!�V�F�3�q�6�N�%;�<�
��\��Q��U��B��K�K��1�b�"�f�V�C��F�^�&<�=��K�K��2�r�1�f�V�C��F�^�&<�=�
��\��Q��U��B��a�"�f�+�C��K�K��1�b�"�f�V�C��F�^�&<�=��K�K��2�r�3��v�c�!�f�~�(>�?��K�K��3��A�v�f�S��V�n�'=�>�	���A�q�!�Q���R�<�J��3�_�
E�F��I�I�b�h�h����Q����^��
��Q��Z��
���B��2�r�"�
���B��2�q��t�$��R�<�J��3�_�
E�F��I�I�b�h�h����Q��Z��
��Q��Z��
���B��2�r�"�
���B��2�q��t�$��R�<�J��3�_�
E�F��I�I�b�h�h����Q��Z��
���B��2�r�"�
���B��2�q��t�$�
�����	r9c��yr.r>r�s r8r�zDevMgr5.initPrintSettingsTab�s��r9c��t�	|jjtk(r+|jj|j
d��n*|jj|j
d��|jj|j|j�t�y#t�wxYw)N�
Printer Name:�	Fax Name:)r�rVr�r��PrintSettingsPrinterNameLabel�setTextr�r'�updateUirwr�r�s r8rzDevMgr5.updatePrintSettingsTab�s�����	����*�*�.A�A��2�2�:�:�4�9�9�_�;U�V��2�2�:�:�4�9�9�[�;Q�R��%�%�.�.�t����@P�@P�Q��O��M�O�s�B"B9�9Cc��tj|jd�tj|jd�tj|jd�tj
|jd�tj|jd�tj|jd�tj|jd�i|_	|jjttdd	���|jjttd
d	���tjttdd	��tjttdd	��tjttdd	��tj
ttd
d	��tjttd
d	��tjttdd	��tjttdd	��i|_|j j"j%|j&�|j(j"j%|j*�|j,j"j%|j.�|jj"j%|j0�|jj"j%|j2�|jd�|jd�|jd�g|_y)N�PendingzOn hold�Printing�Stopped�Canceled�Aborted�	Completed�cancelr�r��busyr.rNr�r[r�zTitle/Descriptionr�)r�IPP_JOB_PENDINGr��IPP_JOB_HELD�IPP_JOB_PROCESSING�IPP_JOB_STOPPED�IPP_JOB_CANCELLED�IPP_JOB_ABORTED�IPP_JOB_COMPLETED�
JOB_STATES�CancelJobButtonr�r1r��
RefreshButton�JOB_STATE_ICONS�StartStopButton�clickedr��StartStopButton_clicked�AcceptRejectButton�AcceptRejectButton_clicked�SetDefaultButton�SetDefaultButton_clicked�CancelJobButton_clicked�RefreshButton_clicked�job_headersr�s r8r�zDevMgr5.initPrintControlTabs[�� �0�0�4�9�9�Y�3G� �-�-��	�	�)�0D� �3�3�d�i�i�
�6K� �0�0�4�9�9�Y�3G� �2�2�T�Y�Y�z�5J� �0�0�4�9�9�Y�3G� �2�2�T�Y�Y�{�5K�
���	
���$�$�U�;�x��+I�%J�K����"�"�5��Y��)H�#I�J�!%�!5�!5�u�[��QX�=Y�7Z�!%�!2�!2�U�;�v�w�;W�5X�!%�!8�!8�5��W�V]�A^�;_�!%�!5�!5��k�)�U\�>]�8^�!%�!7�!7�%��I�W^�@_�:`�!%�!5�!5��k�'�SZ�>[�8\�!%�!7�!7�%��D�RY�@Z�:[�
 "���	
���$�$�,�,�T�-I�-I�J����'�'�/�/��0O�0O�P����%�%�-�-�d�.K�.K�L����$�$�,�,�T�-I�-I�J����"�"�*�*�4�+E�+E�F� �I�I�h�/����;N�1O�QU�QZ�QZ�[c�Qd�e��r9c�p�|jjj|j�d|_y�NF)�InstallLatestButtonrsr��InstallLatestButton_clicked�InstallLatestButton_lockr�s r8�initUpgradeTabzDevMgr5.initUpgradeTab)s*��� � �(�(�0�0��1Q�1Q�R�(-��%r9c���|jdury|jr�|jjd�t	j
�}|�0t	jd�r|dz}tj|�ntjd|z�|jjd�yd|_t	jd�tjd|j�y)NTFz
hp-upgradez 'hp-upgrade -w'z3Failed to run hp-upgrade command from terminal =%s z>http://hplipopensource.com/hplip-web/install/manual/index.htmlr)r�r{r~r�r�get_terminal�whichr�executeror�rr�r��InstallLatestButton_unlock)r4�terminal_cmdr3s   r8rz#DevMgr5.InstallLatestButton_clicked.s����(�(�D�0���'�'��$�$�/�/��6� �-�-�/�L��'�E�K�K��,E�"�%7�7��� � ��%��	�	�O�P\�\�]��$�$�/�/��5�,0�D�)��M�M�Z�[����d�D�$C�$C�Dr9c��d|_yr})r�r�s r8r�z"DevMgr5.InstallLatestButton_unlock@s
��(-��%r9c��|jj�}|�mt|jtj
��\}}|r?|r<|jj|�tjd|j�yyyy)Nr)�JobTabler��	value_intrWrE�UserRolerV�	cancelJobr�r�r)r4r rwr[s    r8ryzDevMgr5.CancelJobButton_clickedDsn���}�}�(�(�*����"�4�9�9�R�[�[�#9�:�J�F�B��f����(�(��0�� � ��t�'A�'A�B��r�r9c�$�|j�yr.)rr�s r8rzzDevMgr5.RefreshButton_clickedNs���"�"�$r9c�$�|j�yr.)r�r�s r8rzDevMgr5.updateHPLIPupgradeQs�����r9c�~�|jjtk(r[|jj	|jd��|jjtjddd��nZ|jj	|jd��|jjtjddd��|jj�|jjd�|jjd�|j�tj tj"z}t%j&�}d}|D]!}|j(|j*k(s�|dz
}�#|�r|j,j/d�|jj|�|jjt1|j2��|jj5|j2�t7|�D�]A\}}|j(|j*k(s�!t9|j:|j<|j>|j<�}|jAtjB|jD�|jG|�|jjI|d|�t9|jJ�}|jG|�|jjI|d|�t9tM|jD��}|jG|�|jjI|d	|���D|jjOdd�|jjQ�y|j,j/d
�y)NrYr�zPrinter Queue ControlrZzFax Queue ControlrrTr�F))rVr�r��PrintControlPrinterNameLabelr\r��groupBox�setTitler�rcr�rr�r��updatePrintControllerrEr�r�r�getJobsr�rwror�r�r{r�r#r�rq�statern�setDatar��idr�r�rxr�setCurrentCellr�)r4r��jobs�num_jobsr�r�r�s       r8rzDevMgr5.updatePrintControlTabWs����?�?�&�&�*=�=��-�-�5�5�d�i�i��6P�Q��M�M�"�"�<�#9�#9�,�H_�ae�#f�g��-�-�5�5�d�i�i��6L�M��M�M�"�"�<�#9�#9�,�H[�]a�#b�c��
�
�����
�
�!�!�!�$��
�
�$�$�Q�'��"�"�$��#�#�b�&6�&6�6���|�|�~�����	�A��v�v��)�)�)��A�
��	��� � �+�+�D�1��M�M�%�%�h�/��M�M�(�(��T�-=�-=�)>�?��M�M�3�3�D�4D�4D�E�#�D�/�

5���Q��6�6�T�-�-�-�(��)=�)=�a�g�g�)F����XY�X_�X_�H`�a�A��I�I�b�k�k�1�4�4�0��J�J�u�%��M�M�)�)�#�q�!�4�(����1�A��J�J�u�%��M�M�)�)�#�q�!�4�(��A�D�D�)9�:�A��J�J�u�%��M�M�)�)�#�q�!�4�

5� 
�M�M�(�(��A�.��M�M�1�1�3�
� � �+�+�E�2r9c���tj|_d|_tj�}|D]?}|j
|jk(s�|j|_|j|_yyrI)	r�IPP_PRINTER_STATE_IDLErr�getPrintersr�rwr��	accepting)r4rr�s   r8rzDevMgr5.getPrinterState�sb��!�8�8���!%����(�(�*�
��	�A��v�v��)�)�)�%&�W�W��"�)*����&��		r9c��|jj|jd��tj�}|j
jtk(rd}nd}||jk(rn|jj|jd|z��|jjtdd��|jjd�nm|jj|jd|z��|jjtd	d��|jjd
�|j�|jtj k(r~|j"j|jd��|j$jtdd��|j&j|jd
|z���n|jtj(k(r}|j"j|jd��|j$jtdd��|j&j|jd
|z��n||j"j|jd��|j$jtdd��|j&j|jd|z��|j*rz|j,j|jd��|j.jtdd��|j0j|jd��y|j,j|jd��|j.jtdd��|j0j|jd��y)NzSet as Default�Printer�Faxz
Default %sr[r�FzNot Default %s�infoTzStarted/Idle�idlezStop %szStarted/ProcessingrfrarNzStart %szAccepting JobszReject JobszRejecting JobszAccept Jobs)rwr\r�r�getDefaultPrinterrVr�r�rw�SetDefaultLabel�SetDefaultIconr�r�r�rrr��StartStopLabel�
StartStopIconrr�IPP_PRINTER_STATE_PROCESSINGr�AcceptRejectLabel�AcceptRejectIconru)r4r��
device_strings   r8r�zDevMgr5.updatePrintController�s�����%�%�d�i�i�0@�&A�B��0�0�2���?�?�&�&�*=�=�%�M�!�M��d�.�.�.�� � �(�(����<�
�3M�)N�O����)�)�+�d�G�*D�E��!�!�,�,�U�3�
� � �(�(����3C�M�3Q�)R�S����)�)�+�f�g�*F�G��!�!�,�,�T�2���������!<�!<�<����'�'��	�	�.�(A�B����(�(��V�W�)E�F�� � �(�(����9�]�3J�)K�L��
�
�4�#D�#D�
D����'�'��	�	�2F�(G�H����(�(��V�W�)E�F�� � �(�(����9�]�3J�)K�L�
���'�'��	�	�)�(<�=����(�(��Y��)H�I�� � �(�(����:�m�3K�)L�M��!�!��"�"�*�*�4�9�9�5E�+F�G��!�!�+�+�K���,H�I��#�#�+�+�D�I�I�m�,D�E�
�"�"�*�*�4�9�9�5E�+F�G��!�!�+�+�K�	�7�,K�L��#�#�+�+�D�I�I�m�,D�Er9c�r�t�	|jtjtjfvrvtj
tjtd||j�\}}|tjk(r�|jjtk(rt}n|t}nutj
tjtd||j�\}}|tjk(r*|jjtk(rt }nt"}|tjk(r7|j%�|jj'|j�n2t)||j+d|z��tj,�t/�y#t/�wxYw)N�qt4z><b>Start/Stop printer queue operation fails. </b><p>Error : %s)r�rrr�r��cups_operation�stop�GUI_MODErw�IPP_OKrVr�r�r�EVENT_FAX_QUEUE_STOPPED�start�EVENT_PRINTER_QUEUE_STARTED�EVENT_FAX_QUEUE_STARTEDr�r�	FailureUIr�r<r��r4rp�
result_strrJs    r8rtzDevMgr5.StartStopButton_clicked�s7����	��!�!�d�&A�&A�4�Cd�Cd�%e�e�%)�%8�%8����H�e�UY�[_�[k�[k�%l�"��
��T�[�[�(����2�2�6I�I�7��3��&*�%8�%8����X�u�VZ�\`�\l�\l�%m�"��
��T�[�[�(����2�2�6I�I�7��3������$��*�*�,����)�)�!�T�-=�-=�>��$��	�	�*j�ku�*u� v�w��(�(�*�
�O��M�O�s�FF*�*F6c�2�t�	|jrvtjtjt
d||j�\}}|tjk(r�|jjtk(rt}n|t}nutjtjt
d||j�\}}|tjk(r*|jjtk(rt}nt}|tjk(r7|j!�|jj#|j�n2t%||j'd|z��tj(�t+�y#t+�wxYw)Nr�z@<b>Accept/Reject printer queue operation fails.</b><p>Error : %s)r�rrr��rejectr�rwr�rVr�r�r�EVENT_FAX_QUEUE_REJECTING_JOBS�accept�"EVENT_PRINTER_QUEUE_ACCEPTING_JOBS�EVENT_FAX_QUEUE_ACCEPTING_JOBSr�rr�r�r<r�r�s    r8rvz"DevMgr5.AcceptRejectButton_clicked�s#����	��%�%�%)�%8�%8����h�PU�W[�]a�]m�]m�%n�"��
��T�[�[�(����2�2�6I�I�>��:��&*�%8�%8����h�PU�W[�]a�]m�]m�%n�"��
��T�[�[�(����2�2�6I�I�>��:������$��*�*�,����)�)�!�T�-=�-=�>��$��	�	�*l�mw�*w� x�y��(�(�*�
�O��M�O�s�E3F
�
Fc	�&�t�	tjtjtd||j
j
d��\}}|tjk7r3t||jd|z��tj�n`|j�|jjtk(rt}nt }|jj#||j
�t%�y#t%�wxYw)Nr��utf8zB<b>Set printer queue as default operation fails. </b><p>Error : %s)r�rr��setDefaultPrinterr�rw�encoder�r�r�r<r�rVr�r��"EVENT_PRINTER_QUEUE_SET_AS_DEFAULT�EVENT_FAX_QUEUE_SET_AS_DEFAULTrr�r�s    r8rxz DevMgr5.SetDefaultButton_clickeds�����	�!%�!4�!4�T�5K�5K�X�W\�^b�dh�dt�dt�d{�d{�}C�eD�"E��F�J�����$��$��	�	�*n�oy�*y� z�{��(�(�*��*�*�,��?�?�.�.�2E�E�:�A�6�A����)�)�!�T�-=�-=�>�
�O��M�O�s�C-D�Dc�4�t�	|jj�}|�H|j�r%|jj|j�|j�}|��Ht�|j�y#t�wxYwr.)
r�r��
firstChild�isOnrVr�rw�nextSiblingr�r)r4r s  r8�cancelCheckedJobszDevMgr5.cancelCheckedJobssx����		��=�=�+�+�-�D��"��9�9�;��O�O�-�-�d�k�k�:��'�'�)��	�"�
�O�	
�"�"�$��
�O�s�A#B�Bc�D�|j�|j�yr.)�cleanupr�)r4rHs  r8�
closeEventzDevMgr5.closeEvent4s������
���r9c�$�|j�yr.)r|r�s r8r�zDevMgr5.cleanup9s�����r9c��tjd�	tjdtj�y#t
$rYywxYw)NzCleaning up child processes.���)rorpr�waitpid�WNOHANG�OSErrorr�s r8r|zDevMgr5.cleanupChildren=s8���	�	�0�1�	��J�J�r�2�:�:�&���	��	�s�$<�	A�Ac�l�|j�tj�|j�yr.)r|rr<rr�s r8r�zDevMgr5.quitEs#������� � �"��
�
�r9c�6�t|�}|jj|�|j�tj
k(rR|jj�|j�+|jjt|j�yyyr.)r&�	TabWidget�setCurrentIndexr]�QDialog�Acceptedr�r�rVrr,rw)r4�tab_to_showr�s   r8r�z#DevMgr5.PreferencesAction_activatedXss���T�"���
�
�%�%�k�2��9�9�;�'�*�*�*����#�#�%����*����)�)�*J�D�L\�L\�]�+�+r9c���tjd�rd}nd}tj|�tj|�|j�|j
�y)N�hp-setupzhp-setup --guizpython ./setup.py --gui)rr�rorp�runrr��r4r3s  r8r�z#DevMgr5.SetupDeviceAction_activatedisF���;�;�z�"�"�C�+�C��	�	�#��
�	�	�#������� � �"r9c��tjd�rd}nd}|j�|d|jzz
}tj	|�tj
|�|j
�|j�y)Nr�zhp-setup --gui --removez python ./setup.py --gui --removez --device=%s)rr�r�rorpr�rr�r�s  r8r�z$DevMgr5.RemoveDeviceAction_activatedusg���;�;�z�"�+�C�4�C����*��>�D�$7�$7�7�7�C��	�	�#��
�	�	�#������� � �"r9c��tjd�rd}nd}tj|�t	j
|�y)Nzhp-diagnose_queueszhp-diagnose_queues --guiz!python ./diagnose_queues.py --gui)rr�rorprr�r�s  r8�DiagnoseQueueAction_activatedz%DevMgr5.DiagnoseQueueAction_activated�s2���;�;�+�,�+�C�4�C��	�	�#������r9c��tjd�rd}nd}tj�}|r|d|zz}tj|�yy)Nz	hp-doctorzhp-doctor -i -wzpython ./doctor.py -i -wz '%s')rr�r�rr�)r4r3r�s   r8�DiagnoseHPLIP_activatedzDevMgr5.DiagnoseHPLIP_activated�sJ���;�;�{�#�#�C�,�C��)�)�+�������,�C����S�!�r9c
�p�t�	t|�dk(r2t||jd��tjd��n>tj
dd�d|�d|j�dd���tj
|�	d	j|j|�D�cgc](}|jjj||���*c}�}tj
|�|j�d}|j�}tj
|�tj
|�|j�tj tj"||�t$j'�t)�ycc}w#t$rY��wxYw#t)�wxYw)
Nrzq<p><b>Unable to run command. No command specified.</b><p>Use <pre>Configure...</pre> to specify a command to run.z9No command specified. Use settings to configure commands.zRun: rrz (z) rm)r�r�r�r�ror�rpr�rrrVrur�r�r|r�spawnvp�P_NOWAITrbr�r�)r4r3�
macro_charr�r�rFs      r8rzDevMgr5.runExternalCommand�sA����	��3�x�1�}��$�t�y�y�*]� ^�_��	�	�U�V��	�	�&�#�t�?R�?R�TZ�[�\��	�	�#����'�'��I�I�j�)�#+��$(�?�?�#>�#>�#B�#B�1�a�#H�#+�,�C�
�	�	�#���y�y�{�1�~���y�y�{���	�	�$���	�	�$���$�$�&��
�
�2�;�;��d�3��"�"�$�
�O��%#+��%����� 
�O�sC�BF)�
F�+-F�F�B+F)�F�	F&�#F)�%F&�&F)�)F5c�B�tj|j�yr.)rrr
r�s r8r�zDevMgr5.helpContents�s��
�
�
�d�i�i� r9c�t�t|tj|jdz�}|j	�y)Nz (Qt4))r%rqrlrsr])r4r�s  r8r�zDevMgr5.helpAbout�s(���$����d�.B�.B�X�.M�N���	�	�r9c�0�tjd||�Sr_rards   r8rgzDevMgr5.__tr�rhr9)NNNNrr.)rrI)NN�rmrm)rr)�%)Wr;r<r=r0r�r�r�r�r�rr�r4r5r:rarbrqrvryrr�r�r�r�r�r�r�r�r�r�rVr�r�r�r2r~rr�r�r�r�r�r�r�rr%rr�r�rr�r�r�r�rr-r+r�rr�r�rr�ryrzrrrr�rtrvrxr�r�r�r|r�r�r�r�r�r�rr�r�r��
__classcell__)r�s@r8r`r`�s����<@�<=�00�t:�5�=}�@5�,`�.�43D�l#��;�#�(�JN����B�C�%�"!�!�
2�2��5�)�X^)�B	:�C�A�4	%�2�	/��
P�7��08�fA�6
\�  �
 �b�\�~6�,�
�a�!�
%�D�.U3�|6.�rt�n3(�lA�V
�
�&f�B.�
E�$.�C�%��-3�`	�1F�j�>�>�*%�2�
���&^�"	#�#��	"�&�B!��
-r9r`c�.�eZdZdd�Zd�Zd�Zd�Zdd�Zy)	�PasswordDialogNc��tj||�||_t|�}|j	dddd�|jd�t
|�|_|j|jdddd�t
|�|_	|j|jdd�t|�|_|jjtj�|j|jdddd�t
|�|_|j|jdd�t|�|_|jjtj �|j|jdddd�t#|�|_|j|j$dd�|j'�|j)t+dd�j-|j/���|j$j0j3|j4�|jj6j3|j4�y)	Nr�r(rrr�r�i��)r�r0�prompt�QGridLayout�setContentsMargins�
setSpacing�QLabel�PromptTextLabel�	addWidget�UsernameTextLabel�	QLineEdit�UsernameLineEdit�setEchoMode�Normal�PasswordTextLabel�PasswordLineEdit�Password�QPushButton�OkPushButton�languageChange�resizer��
expandedTo�minimumSizeHintrsr�r��
returnPressed)r4r�r5r��modalr��Layouts       r8r0zPasswordDialog.__init__�s�������v�&�����D�!���!�!�"�R��2�.����!��%�d�|�������-�-�a��!�A�6�!'���������/�/��!�4� )�$�������)�)�)�*:�*:�;�����.�.�q��1�Q�7�!'���������/�/��!�4� )�$�������)�)�)�*<�*<�=�����.�.�q��1�Q�7�'��-�������*�*�1�Q�/��������E�#�c�N�-�-�d�.B�.B�.D�E�F����!�!�)�)�$�+�+�6����+�+�3�3�D�K�K�@r9c�H�t|jj��Sr.)rr�r6r�s r8�getUsernamezPasswordDialog.getUsername�����$�/�/�4�4�6�7�7r9c�H�t|jj��Sr.)rrr6r�s r8�getPasswordzPasswordDialog.getPassword�r
r9c��|j|jd��|jj|j|j��|j
j|jd��|jj|jd��|jj|jd��y)Nz+HP Device Manager - Enter Username/Passwordz	Username:z	Password:�OK)r��_PasswordDialog__trr�r\r�r�r�rr�s r8rzPasswordDialog.languageChange�s������D�I�I�&S�T�U����$�$�T�Y�Y�t�{�{�%;�<����&�&�t�y�y��'=�>����&�&�t�y�y��'=�>����!�!�$�)�)�D�/�2r9c�0�tjd||�Sr_rards   r8rgzPasswordDialog.__tr	rhr9)NNrrr.)r;r<r=r0rrrrr>r9r8r�r��s��!A�H8�8�3�-r9r�c��	t|d�}|j�tjk(r |j	�|j�fS		y#wxYw)Nr�)r�r]r�r�rr)r�r�s  r8r�r�	sV��
��V�T�*���9�9�;�'�*�*�*��O�O�%�s���'8�9�	
�	+�	
���	
�s�AA�Ac�x�|r2tj|�\}}|tjk7rd}d|zS|}d|zS)Nzhplipopensource.comz	http://%s)r�get_zc_ip_address�
HPMUD_R_OK)r�r��status�ips    r8r�r�	sK��	��/�/��3�
����X�(�(�(�&�B����������r9)hr��timer�gzip�select�structr��base.sixext.movesr�base.g�baserrrrr	r
r�prntr�base.sixextr
�
base.codes�ui_utils�installer.core_install�PyQt5.QtCore�PyQt5.QtGui�PyQt5.QtWidgets�collections�abcr�r��
import_extrr6�dbus.mainloop.glibrr�ImportErrorror��exit�warnings�simplefilter�DeprecationWarning�devmgr5_baser�
devmgr_extr�faxsetupdialogr�plugindialogr�firmwaredialogr�aligndialogr�printdialogr�makecopiesdialogr�
sendfaxdialogr�	fabwindowr�devicesetupdialogr�printtestpagedialogr�
infodialogr�cleandialogr �colorcaldialogr!�linefeedcaldialogr"�pqdiagdialogr#�nodevicesdialogr$�aboutdialogr%�settingsdialogr&�printsettingstoolboxr'�MIN_AUTO_REFRESH_RATE�MAX_AUTO_REFRESH_RATE�DEF_AUTO_REFRESH_RATEr��	ModelDatarNr/r,r@�QObjectrH�QMainWindowr`r�r�r�r�r>r9r8�<module>rMs���2��	��
�
�
�*��B�B�B�����$�����!� �_�_�N��5���J�'����0�������h� 2�3�(�-�*�&�*�$�$�.�(� �0�4�"�$�*�0�&�,�$�+�6�����������F����	��?��/�_�/�-�G�-�L*�Xu-�#�]�K�u-�t?6-�W�6-�t
���OG�!� �N�!�����I�I�\�]�
��	�	�\�]��C�H�H�Q�K�	�s$�)F
�F�
F�F�;G�G

Zerion Mini Shell 1.0