%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/rhythmbox/plugins/alternative-toolbar/__pycache__/
Upload File :
Create Path :
Current File : //lib/rhythmbox/plugins/alternative-toolbar/__pycache__/alttoolbar_rb3compat.cpython-312.pyc

�

 ]e�p���ddlZddlmcmZddlZddlmZddlmZddlm	Z	ddlm
Z
ddlmZd�Zd�Z
d	�ZejdZed
k\r
ddlZddlZddlZn
ddlZddlmZed
k\rddlZd�ZnddlZd
�Zd�Zd�Zd�Zd�Zd�Zd�Z d�Z!d�Z"d!d�Z#d�Z$d�Z%Gd�dejL�Z'Gd�de(�Z)Gd�de(�Z*Gd�d e(�Z+y)"�N)�GLib)�GObject)�Gio)�Gtk)�RBc��tttj��dzttj��z�S)zc
    returns float of the major and minor parts of the GTK version
    e.g. return float(3.10)
    �.)�float�strr�get_major_version�get_minor_version���F/usr/lib/rhythmbox/plugins/alternative-toolbar/alttoolbar_rb3compat.py�gtk_versionr#s<����S�*�*�,�-��3��S�*�*�,�-�.�/�/rc�p�d�}|tj�}t|jdd�d�S)zx
    returns float of the major and minor parts of a pygobject version
    e.g. version (3, 9, 5) return float(3.9)
    c�2�djd�|D��S)Nr	c3�2K�|]}t|����y�w�N�r��.0�vs  r�	<genexpr>z6pygobject_version.<locals>.<lambda>.<locals>.<genexpr>2�����"5�a�3�q�6�"5�����join��ts r�<lambda>z#pygobject_version.<locals>.<lambda>2���#�(�(�"5�1�"5�5�rr	�r)r�pygobject_versionr
�rsplit)�	to_number�str_versions  rr$r$-s6��
6�I��G�5�5�6�K���#�#�C��+�A�.�/�/rc��d�}|tj�}|jdd�}|jdd�}t|d�t|d�kryt|d�t|d�kryy)zS
    return True if version is less than pygobject_version
    i.e. 3.9 < 3.11
    c�2�djd�|D��S)Nr	c3�2K�|]}t|����y�wrrrs  rrz>compare_pygobject_version.<locals>.<lambda>.<locals>.<genexpr>>rrrrs rr!z+compare_pygobject_version.<locals>.<lambda>>r"rr	�rTr#F)rr$r%�int)�versionr&r'�split�
split_compares     r�compare_pygobject_versionr09sx��
6�I��G�5�5�6�K����s�A�&�E��N�N�3��*�M�
�=����s�5��8�}�,��
�=����s�5��8�}�,��r�)�urlparsec�
�||fSrr)�a�bs  r�unicoder6^s���1�v�
rc�h�tdk\rtjjStjS�Nr1)�PYVER�http�client�	responses�httplibrrrr<r<ds%����z��{�{�$�$�$�� � � rc�0�tdk\r|St||�Sr8)r9r6��param�charsets  r�
unicodestrrBks����z����u�g�&�&rc�L�tdk\r|St|�j|�Sr8)r9r6�encoder?s  r�
unicodeencoderErs#����z����u�~�$�$�W�-�-rc�:�tdk\r|S|j|�Sr8)r9�decoder?s  r�
unicodedecoderHys����z����|�|�G�$�$rc�h�tdk\rtjj|�St	|�Sr8)r9�urllib�parser2�rb2urlparse��uris rr2r2�s)����z��|�|�$�$�S�)�)��3��rc�|�tdk\rtjj|�Stj|�Sr8)r9rJ�request�url2pathname)�urls rrQrQ�s/����z��~�~�*�*�3�/�/��"�"�3�'�'rc�|�tdk\rtjj|�Stj|�Sr8)r9rJrP�urlopen��filenames rrTrT�s-����z��~�~�%�%�h�/�/��~�~�h�'�'rc�|�tdk\rtjj|�Stj|�Sr8)r9rJrP�pathname2urlrUs rrXrX�s/����z��~�~�*�*�8�4�4��"�"�8�,�,rc�|�tdk\rtjj|�Stj|�Sr8)r9rJrK�unquoterMs rrZrZ�s-����z��|�|�#�#�C�(�(��~�~�c�"�"rc���tdk\rB|r!tjj||��Stjj|�S|rtj||��Stj|�S)Nr1)�safe)r9rJrK�quote)rNr\s  rr]r]�s^����z���<�<�%�%�c��%�5�5��<�<�%�%�c�*�*���<�<��$�/�/��<�<��$�$rc�|�tdk\rtjj|�Stj|�Sr8)r9rJrK�
quote_plusrMs rr_r_�s/����z��|�|�&�&�s�+�+�� � ��%�%rc�N�ttjjd�ryy)N�
ui_managerFT)�hasattrr�Shell�props)�argss r�is_rb3rf�s���r�x�x�~�~�|�,��rc���eZdZdZdej
ddfiZ�fd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Z�xZS)�Menuz7
    Menu object used to create window popup menus
    �	pre-popupNrc�p��tt|��||_||_d|_i|_i|_y)z'
        Initializes the menu.
        rN)�superrh�__init__�plugin�shell�_unique_num�
_rbmenu_items�_rbmenu_objects)�selfrmrn�	__class__s   �rrlz
Menu.__init__�s8���	�d�D�"�$������
�������!��rc�*�|j||d|�S)a!
        add a new menu item to the popup
        :param menubar: `str` is the name GtkMenu (or ignored for RB2.99+)
        :param section_name: `str` is the name of the section to add the item
        to (RB2.99+)
        :param action: `Action`  to associate with the menu item
        ���)�insert_menu_item)rr�menubar�section_name�actions    r�
add_menu_itemzMenu.add_menu_item�s���$�$�W�l�B��G�Grc���|j}t|j�r�|jjj}tj�}|j|�|j|�||jvrg|j|<|j|j|�|j|||�|Stj|��}|j|�||j|<|j|�}|dk(r|j|�n|j||�|j�|jjj }	|	j#�|S)aq
        add a new menu item to the popup
        :param menubar: `str` is the name GtkMenu (or ignored for RB2.99+)
        :param section_name: `str` is the name of the section to add the item
        to (RB2.99+)
        :param position: `int` position to add to GtkMenu (ignored for RB2.99+)
        :param action: `Action`  to associate with the menu item
        )�labelru)r|rfrnrd�applicationr�MenuItem�associate_menuitem�	set_labelrp�append�add_plugin_menu_itemr�get_menu_object�insert�show_allra�
ensure_update)
rrrwrx�positionryr|�app�item�bar�uims
          rrvzMenu.insert_menu_item�s1�������$�*�*���*�*�"�"�.�.�C��<�<�>�D��%�%�d�+��N�N�5�!��4�#5�#5�5�35��"�"�<�0����|�,�3�3�E�:��$�$�\�5�$�?����<�<�e�,�D��%�%�d�+�(,�D���u�%��&�&�w�/�C��2�~��
�
�4� ��
�
�4��*��L�L�N��*�*�"�"�-�-�C������rc���t|j�s�tj�j	�}|jd�||jdt|j�z<|jdz|_|j|�}|j||�|j�|jjj}|j�yy)z�
        add a separator to the popup (only required for RB2.98 and earlier)
        :param menubar: `str` is the name GtkMenu (or ignored for RB2.99+)
        :param position: `int` position to add to GtkMenu (ignored for RB2.99+)
        T�	separatorr#N)rfrnr�SeparatorMenuItem�new�set_visiblerprror�r�r�rdrar�)rrrw�at_position�	menu_itemr�r�s      r�insert_separatorzMenu.insert_separators����d�j�j�!��-�-�/�3�3�5�I��!�!�$�'�FO�D���{�S��1A�1A�-B�B�C�#�/�/�!�3�D���&�&�w�/�C��J�J�y�+�.��L�L�N��*�*�"�"�-�-�C�����"rc�8�t|j�rx||jvry|jjj}|j|D]}|j||��|j|r|j|dd�=yy|jsy|jjj}|j|�}|jD] }|j|j|��"|j�|j�y)aG
        utility function to remove all menuitems associated with the menu
        section
        :param menubar: `str` is the name of the GtkMenu containing the menu
        items (ignored for RB2.99+)
        :param section_name: `str` is the name of the section containing the
        menu items (for RB2.99+ only)
        N)rfrnrprdr}�remove_plugin_menu_itemrar��remover�r�)rrrwrxr�r�r�r�s       r�remove_menu_itemszMenu.remove_menu_itemss���$�*�*���4�#5�#5�5���*�*�"�"�.�.�C�!�/�/��=�
E�	��+�+�L�)�D�
E��!�!�,�/��&�&�|�4�Q�7�0�
�%�%���*�*�"�"�-�-�C��&�&�w�/�C�!�/�/�
:�	��
�
�4�-�-�i�8�9�
:�
�L�L�N����rc�r�tj�|_	ddlm}|�}|jj|jj�t|j�r|}n|}||_
|jjtj|j|��y#Y�_xYw)z�
        utility function to load the menu structure
        :param rb2_ui_filename: `str` RB2.98 and below UI file
        :param rb3_ui_filename: `str` RB2.99 and higher UI file
        r)�CoverLocaleN)r�Builder�builder�coverart_browser_prefsr��set_translation_domain�Locale�
LOCALE_DOMAINrfrn�ui_filename�
add_from_file�rb�find_plugin_filerm)rr�rb2_ui_filename�rb3_ui_filenamer��clr�s      r�load_from_filezMenu.load_from_file6s����{�{�}���	�:���B��L�L�/�/��	�	�0G�0G�H��$�*�*��)�K�)�K�&������"�"�2�#6�#6�t�{�{�7B�$D�	E��	��s�<B2�2B6c�R���fd�}|j�D]\}}|||��y)Nc����tj|��}|jd|�|jd��jj
jj|�y)N)�name�activateT)r�SimpleAction�connect�set_enabledrnrd�window�
add_action)�action_name�funcryrrs   �r�
_menu_connectz0Menu._connect_rb3_signals.<locals>._menu_connectQsM����%�%�;�7�F��N�N�:�t�,����t�$��J�J���#�#�.�.�v�6r��items�rr�signalsr��key�values`    r�_connect_rb3_signalszMenu._connect_rb3_signalsPs-���	7�"�-�-�/�	&�J�C���#�u�%�	&rc�R���fd�}|j�D]\}}|||��y)Nc�L���j|�}|jd|�y�Nr�)r�r�)�menu_item_namer�r�rrs   �rr�z0Menu._connect_rb2_signals.<locals>._menu_connect[s#����,�,�^�<�I����j�$�/rr�r�s`    r�_connect_rb2_signalszMenu._connect_rb2_signalsZs-���	0�"�-�-�/�	&�J�C���#�u�%�	&rc�t�t|j�r|j|�y|j|�y)z�
        connect all signal handlers with their menuitem counterparts
        :param signals: `dict` key is the name of the menuitem
             and value is the function callback when the menu is activated
        N)rfrnr�r�)rrr�s  r�connect_signalszMenu.connect_signalsbs,���$�*�*���%�%�g�.��%�%�g�.rc��||jvr|j|S|jj|�}t|j�rc|jj
j}|j|�tjj|�}|j|d�n|}||j|<|S)z�
        utility function to obtain the GtkMenu from the menu UI file
        :param popup_name: `str` is the name menu-id in the UI file
        N)rqr��
get_objectrfrnrdr}�link_shared_menusrrh�new_from_model�attach_to_widget)rr�source�
popup_namer�r��
popup_menus      r�get_gtkmenuzMenu.get_gtkmenums���
��-�-�-��'�'�
�3�3��|�|�&�&�z�2���$�*�*���*�*�"�"�.�.�C��!�!�$�'����0�0��6�J��'�'���5��J�+5����Z�(��rc�F�||jvr|j|S|jj|�}t|j�r7|r|}n4|jj
j}|j|�}n|}t|�||j|<|S)z�
        utility function returns the GtkMenuItem/Gio.MenuItem
        :param menu_name_or_link: `str` to search for in the UI file
        )	rqr�r�rfrnrdr}�get_plugin_menu�print)rr�menu_name_or_linkr�r�r�s     rr�zMenu.get_menu_object�s���
�� 4� 4�4��'�'�(9�:�:��|�|�&�&�'8�9���$�*�*���!�
��j�j�&�&�2�2�� �0�0�1B�C�
��J�
�� �2<����.�/��rc���t|j�rA|jjjj	|�}|j|�y|j
|�}|j|�y)z�
        utility function to enable/disable a menu-item
        :param menu_or_action_item: `GtkMenuItem` or `Gio.SimpleAction`
           that is to be enabled/disabled
        :param enable: `bool` value to enable/disable
        N)rfrnrdr��
lookup_actionr�r��
set_sensitive)rr�menu_or_action_item�enabler�s    rr�zMenu.set_sensitive�s^���$�*�*���:�:�#�#�*�*�8�8�9L�M�D����V�$��'�'�(;�<�D����v�&rc�v�|jd�|j||�}|jdddd||�y)z9
        utility function to show the popup menu
        riN)�emitr��popup)rrr��	menu_name�button�time�menus      rr�z
Menu.popup�s8��	
�	�	�+������	�2���
�
�4��t�T�6�4�8r)�__name__�
__module__�__qualname__�__doc__r�SIGNAL_RUN_LAST�__gsignals__rlrzrvr�r�r�r�r�r�r�r�r�r��
__classcell__)rss@rrhrh�sh����	�g�-�-�t�R�8��L�
"�H�$�L �"! �FE�4&�&�	/��*�*
'�9rrhc�F�eZdZdZdZdZd�Zed��Zd�Z	d�Z
d�Zd	�Zy
)�ActionGroupzE
    container for all Actions used to associate with menu items
    rr#c�6�||_||_i|_t|j�rt	j
�|_ytj|�|_|jjj}|j|j�y)z�
        constructor
        :param shell: `RBShell`
        :param group_name: `str` unique name for the object to create
        N)�
group_namern�_actionsrfr�SimpleActionGroup�actiongrouprr�rdra�insert_action_group)rrrnr�r�s    rrlzActionGroup.__init__�sp��%�����
���
��$�*�*��"�4�4�6�D��"���z�:�D���*�*�"�"�-�-�C��#�#�D�$4�$4�5rc��|jSr)r��rrs rr�zActionGroup.name�s�����rc�x�|jj�D]}|jj|��y)zX
        utility function to remove all actions associated with the ActionGroup
        N)r��list_actions�
remove_action)rrrys  r�remove_actionszActionGroup.remove_actions�s6���&�&�3�3�5�	3�F����*�*�6�2�	3rc� �|j|S)z�
        utility function to obtain the Action from the ActionGroup

        :param action_name: `str` is the Action unique name
        )r�)rrr�s  r�
get_actionzActionGroup.get_action�s���}�}�[�)�)rc�4�||d<|j||fi|��S)a�
        Creates an Action with an accelerator and adds it to the ActionGroup

        :param func: function callback used when user activates the action
        :param action_name: `str` unique name to associate with an action
        :param accel: `str` accelerator
        :param args: dict of arguments - this is passed to the function
        callback

        Notes:
        see notes for add_action
        �accel)r�)rrr�r�r�res     r�add_action_with_accelz!ActionGroup.add_action_with_accel�s%����W�
��t���t�[�9�D�9�9rc�|�d|vr|d}n|}d|vr|d}nd}tj}d|vr|d}t|j��r|tjk(r6t
jj|dtjdd��}n t
jj|d�}d}d|vr
|dd	k(rd	}t
jj�}	|d	k(r|	j|�nJ|jjjj|�|j j|�|r�|	j#|d
z|z|g�n�d|vr|d}
nt$j&}
|tjk(rt%j(||d|
�
�}nt%j*||d|
�
�}|r|j j-||�n|j j|�t+|j|�}|j/d||�||_||_||j4|<|S)aX
        Creates an Action and adds it to the ActionGroup

        :param func: function callback used when user activates the action
        :param action_name: `str` unique name to associate with an action
        :param args: dict of arguments - this is passed to the function
        callback

        Notes:
        key value of "label" is the visual menu label to display
        key value of "action_type" is the RB2.99 Gio.Action type
        ("win" or "app") by default it assumes all actions are "win" type
        key value of "action_state" determines what action state to create
        r|r�N�action_stater5F�win�action_typer�r	�stock_id�)r|r��tooltipr�r�)r��STANDARDrfrn�TOGGLErr��new_statefulr�Variantr��Application�get_defaultr�rdr�r��set_accels_for_actionr�STOCK_CLEAR�ToggleAction�Actionr�r�r|r�r�)rrr�r�rer|r��stateryr�r�r��acts            rr�zActionGroup.add_action�s���d�?���M�E��E��d�?���M�E��E��$�$���T�!���(�E��$�*�*����*�*�*��)�)�6�6�{�D�7;�|�|�C�DI�8K�L���)�)�-�-�k�4�@���K���$��
�&�%�/�"'�K��/�/�-�-�/�C��e�#����v�&��
�
� � �'�'�2�2�6�:�� � �+�+�F�3���)�)�+��*;�k�*I�+0�'�3��T�!��
�+���?�?����*�*�*��)�)��/:�24�x�I�����%�)4�,.��C���� � �6�6�v�u�E�� � �+�+�F�3��T�Z�Z��(�����J��d�+���	���	�%(��
�
�k�"��
rN)
r�r�r�r�r�r�rl�propertyr�r�r�r�r�rrrr�r��sA���
�H�
�F�6�$����3�*�:� Qrr�c�:�eZdZdZdZGd�d�Zd�Zd�Zd�Zy)�ApplicationShellzP
    Unique class that mirrors RB.Application & RB.Shell menu functionality
    Nc�:�eZdZdZd�Zd�Z	d	d�Zd
d�Zd�Zd�Z	y)�ApplicationShell.__implz+ Implementation of the singleton interface c�v�||_t|j�ri|_i|_yg|_i|_yr)rnrf�_uids�_action_groups�rrrns  rrlz ApplicationShell.__impl.__init__Ks7���D�J��d�j�j�!���
�#%�D�� ��
�"$�D�rc�6�||j|j<y)z|
            Adds an ActionGroup to the ApplicationShell

            :param action_group: `ActionGroup` to add
            N)rr�)rr�action_groups  rr�z+ApplicationShell.__impl.insert_action_groupUs��6B�D���� 1� 1�2rc���t|j�re|dk(r0|jjjj	|�}n�|jjj
j	|�}nc|jjj}|j�}d}|D]}|j�|k(s�nd}|r|j|�}|rt|j|�Sy)a�
            looks up (finds) an action created by another plugin.
            If found returns an Action or None if no matching Action.

            :param action_group_name: `str` is the Gtk.ActionGroup name
            (ignored for RB2.99+)
            :param action_name: `str` unique name for the action to look for
            :param action_type: `str` RB2.99+ action type ("win" or "app")
            r�N)rfrnrdr}r�r�ra�get_action_groups�get_namer�r)rr�action_group_namer�r�ryr��ui_actiongroupsr�s        rr�z%ApplicationShell.__impl.lookup_action]s����d�j�j�!��%�'��
�
�(�(�4�4�B�B�;�O��"�Z�Z�-�-�4�4�B�B�;�O�F��j�j�&�&�1�1��"%�"7�"7�"9��"��#2��K�"�+�+�-�1B�B������(�3�3�K�@�F���d�j�j�&�1�1�rc�
�t|j��rtj|�}|j	d�D]�}|j
d}|j|}|j|�}tj�}	|	jd|z�|	j|j�|	jdtjd|j ��tj"j%�}
||z}|
j'|||	�||j(|<��y|jj*j,}|j(j/|j1|��|j3�y)a	
            utility function to add application menu items.

            For RB2.99 all application menu items are added to the "tools"
            section of the application menu. All Actions are assumed to be of
            action_type "app".

            For RB2.98 or less, it is added however the UI_MANAGER string
            is defined.

            :param ui_string: `str` is the Gtk UI definition.  There is not an
            equivalent UI definition in RB2.99 but we can parse out menu items
            since this string is in XML format

            :param group_name: `str` unique name of the ActionGroup to add menu
            items to
            :param menu: `str` RB2.99 menu section to add to - nominally either
              'tools' or 'view'
            �.//menuitemryzapp.r��sN)rfrn�ET�
fromstring�findall�attribrr�rr~�set_detailed_actionr�r|�set_attribute_valuerr�r�rrr�rrdrar��add_ui_from_stringr�)
rr�	ui_stringr�r��root�elemr��grouprr�r��indexr�s
             r�add_app_menuitemsz)ApplicationShell.__impl.add_app_menuitems�s7��(�d�j�j�!��}�}�Y�/�� �L�L��7�-�D�"&�+�+�h�"7�K� �/�/�
�;�E��*�*�;�7�C��<�<�>�D��,�,�V�k�-A�B��N�N�3�9�9�-��,�,�W�d�l�l�3�CF�9�9�7N�O��/�/�5�5�7�C� �;�.�E��,�,�T�-2�D�:�(,�D�J�J�u�%�-�"�j�j�&�&�1�1���
�
�!�!�#�"8�"8��"C�D��!�!�#rc�J�t|j��r3tj|�}|j	d�D�]}|j
d}|j
d�}|j
d}|j|}|j|�}	tj�}
|
jd|z�|
j|	j�tjj�}|dk(rd}n&|dk(rd	}n|d
k(rd}n|dk(rd
}nt!dz�||z}
|j#||
|
�||j$|
<��y|jj&j(}|j$j+|j-|��|j/�y)aS
            utility function to add popup menu items to existing browser popups

            For RB2.99 all menu items are are assumed to be of action_type
            "win".

            For RB2.98 or less, it is added however the UI_MANAGER string
            is defined.

            :param ui_string: `str` is the Gtk UI definition.  There is not an
            equivalent UI definition in RB2.99 but we can parse out menu items
            since this string is in XML format

            :param group_name: `str` unique name of the ActionGroup to add menu
            items to
            z./popupr�rry�win.�QueuePlaylistViewPopupzqueue-popup�BrowserSourceViewPopupz
browser-popup�PlaylistViewPopupzplaylist-popup�PodcastViewPopupzpodcast-episode-popupzunknown type %sN)rfrnrrrr�findrr�rr~rr�r|rrr�r�rrdrar�r!r�)rrr"r�r#r$r��menuelemr�r%rr�r��plugin_typer&r�s               r�add_browser_menuitemsz-ApplicationShell.__impl.add_browser_menuitems�sp��"�d�j�j�!��}�}�Y�/�� �L�L��3�4�D�!%���V�!4�J�#�y�y��7�H�"*�/�/�(�";�K� �/�/�
�;�E��*�*�;�7�C��<�<�>�D��,�,�V�k�-A�B��N�N�3�9�9�-��/�/�5�5�7�C�!�%=�=�&3��#�'?�?�&5��#�':�:�&6��#�'9�9�&=���/�+�=�>�'�+�5�E��,�,�[�%��F�(3�D�J�J�u�%�74�:�j�j�&�&�1�1���
�
�!�!�#�"8�"8��"C�D��!�!�#rc�l�t|j�rM|jD]=}tjj�j
|j||��?y|jjj}|jD]}|j|��|j�y)z?
            utility remove any menuitems created.
            N)rfrnrrrrr�rdra�	remove_uir�)rr�uidr�s   r�cleanupzApplicationShell.__impl.cleanup�s����d�j�j�!��:�:�.�C��O�O�/�/�1�I�I��
�
�3���.�.��j�j�&�&�1�1���:�:�'�C��M�M�#�&�'��!�!�#rN)r�)�tools)
r�r�r�r�rlr�r�r'r1r5rrr�__implrHs,��9�	%�	B�',�"	�H)	$�V2	$�h	$rr7c��tj�tj|�t_tj|jd<y)z Create singleton instance N�_ApplicationShell__instance)r
r9�_ApplicationShell__impl�__dict__rs  rrlzApplicationShell.__init__�s>���&�&�.�*:�*A�*A�%�*H��'�
�'�'�	
�
�
�3�4rc�.�t|j|�S�z# Delegate access to implementation )�getattrr9)rr�attrs  r�__getattr__zApplicationShell.__getattr__�s���t����-�-rc�0�t|j||�Sr=)�setattrr9)rrr?r�s   r�__setattr__zApplicationShell.__setattr__�s���t����e�4�4r)	r�r�r�r�r9r:rlr@rCrrrr
r
As*����J�d$�d$�L	(�.�5rr
c��eZdZdZd�Zd�Zd�Zed��Zejd��Zed��Z
e
jd��Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zy)rzE
    class that wraps around either a Gio.Action or a Gtk.Action
    c�X�||_||_d|_d|_d|_d|_y)zs
        constructor.

        :param shell: `RBShell`
        :param action: `Gio.Action` or `Gtk.Action`
        r�FTN)rnry�_label�_accel�_current_state�_do_update_state)rrrnrys   rrlzAction.__init__s0����
����������#��� $��rc���||_||_|dk(r|j}t|j�r|j
j
|||�y|j
j
||d|�yr�)�
_connect_func�
_connect_args�	_activaterfrnryr�)rr�addressr�res    rr�zAction.connects]��!���!����j� ��>�>�D��$�*�*���K�K�����t�4��K�K�����t�T�:rc��|jr-|j|_|j|j�|j|d|j�yr)rIrH�	set_staterKrL)rrryres   rrMzAction._activate"sF��� � �&*�&9�&9�"9�D���N�N�4�.�.�/����6�4��);�);�<rc�x�t|j�s|jj�S|jS)z�
        get the menu label associated with the Action

        for RB2.99+ actions dont have menu labels so this is managed
        manually
        )rfrnry�	get_labelrFr�s rr|zAction.label)s-���d�j�j�!��;�;�(�(�*�*��;�;�rc�r�t|j�s|jj|�||_yr)rfrnryr�rF)rr�	new_labels  rr|zAction.label6s'���d�j�j�!��K�K�!�!�)�,���rc��|jS)z@
        get the accelerator associated with the Action
        �rGr�s rr�zAction.accel=s��
�{�{�rc�&�|r||_yd|_y)Nr�rV)rr�new_accelerators  rr�zAction.accelDs���)�D�K��D�Krc��t|j�r|jj�S|jj	�S)ze
        get the sensitivity (enabled/disabled) state of the Action

        returns boolean
        )rfrnry�get_enabled�
get_sensitiver�s rr[zAction.get_sensitiveKs6���$�*�*���;�;�*�*�,�,��;�;�,�,�.�.rc���t|j�rQ|jjjr0|jjt
jd|��yyy)za
        set the state of a stateful action - this is applicable only
        to RB2.99+
        r5N)rfrnryrd�
state_type�change_staterr��rrr�s  rrPzAction.set_stateVsG��
�$�*�*��$�+�+�"3�"3�">�">��K�K�$�$�T�\�\�#�u�%=�>�#?�rc��t|j�r|jjd�y|jj�y)z<
        invokes the activate signal for the action
        N)rfrnryr�r�s rr�zAction.activate^s2���$�*�*���K�K� � ��&��K�K� � �"rc��t|j�rU|jjt	j
d|��||_d|_|j�d|_y|jj|�y)z�
        activate or deactivate a stateful action signal
        For consistency with earlier RB versions, this will fire the
        activate signal for the action

        :param value: `boolean` state value
        r5FTN)
rfrnryr^rr�rHrIr��
set_activer_s  rrbzAction.set_activegs`���$�*�*���K�K�$�$�T�\�\�#�u�%=�>�"'�D��$)�D�!��M�M�O�$(�D�!��K�K�"�"�5�)rc��t|j�r|j}|S|jj	�}|S)zT
        get the state of the action

        returns `boolean` state value
        )rfrnrHry�
get_active)rr�	returnvals  rrdzAction.get_activeys=���$�*�*���+�+�I������.�.�0�I��rc��t|j�r-|jd|jj	�z�y|j|j�y)z/
        links a menu with the action

        r)N)rfrnrryr�set_related_action)rr�menuitems  rrzAction.associate_menuitem�sB��
�$�*�*���(�(��$�+�+�2F�2F�2H�)H�I��'�'����4rN)r�r�r�r�rlr�rMrr|�setterr�r[rPr�rbrdrrrrrrs����
%�
;�=��
��
��\�\� �� ������\�\����	/�?�#�*�$�5rrr),�sys�xml.etree.ElementTree�etree�ElementTreerr��
gi.repositoryrrrrrrr$r0�version_infor9�urllib.requestrJ�urllib.parse�urllib.errorr2rL�http.clientr:r6r=r<rBrErHrQrTrXrZr]r_rf�Objectrh�objectr�r
rrrr�<module>rvs���0�"�"�	��!����/�	0��*	�������A�:�����0��A�:��
��!�'�.�%� �(�(�-�#�
%�&��n9�7�>�>�n9�bO�&�O�d~5�v�~5�BL5�V�L5r

Zerion Mini Shell 1.0