403Webshell
Server IP : 209.205.66.10  /  Your IP : 216.73.216.173
Web Server : Apache/2.4.52 (Ubuntu)
System : Linux ammon 5.15.0-186-generic #196-Ubuntu SMP Sat Jun 20 16:09:34 UTC 2026 x86_64
User :  ( 1006)
PHP Version : 8.5.8
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /lib/rhythmbox/plugins/alternative-toolbar/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/rhythmbox/plugins/alternative-toolbar/__pycache__/alttoolbar_rb3compat.cpython-310.pyc
o

1�b�p�@s�ddlZddlmmZddlZddlmZddlmZddlm	Z	ddlm
Z
ddlmZdd�Zd	d
�Z
dd�ZejdZed
krQddlZddlZddlZn
ddlZddlmZed
krhddlZdd�ZnddlZdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Z dd �Z!d!d"�Z"d1d#d$�Z#d%d&�Z$d'd(�Z%Gd)d*�d*ej&�Z'Gd+d,�d,e(�Z)Gd-d.�d.e(�Z*Gd/d0�d0e(�Z+dS)2�N)�GLib)�GObject)�Gio)�Gtk)�RBcCs ttt���dtt����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�rr�F/usr/lib/rhythmbox/plugins/alternative-toolbar/alttoolbar_rb3compat.py�gtk_version#s
�rcCs&dd�}|tj�}t|�dd�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)
    cS�d�dd�|D��S)Nrcs��|]}t|�VqdS�N�r	��.0�vrrr
�	<genexpr>2��z6pygobject_version.<locals>.<lambda>.<locals>.<genexpr>��join��trrr
�<lambda>2�z#pygobject_version.<locals>.<lambda>r�r)r�pygobject_versionr�rsplit)�	to_number�str_versionrrr
r-s
rcCsfdd�}|tj�}|�dd�}|�dd�}t|d�t|d�kr#dSt|d�t|d�kr1dSdS)	zS
    return True if version is less than pygobject_version
    i.e. 3.9 < 3.11
    cSr)Nrcsrrrrrrr
r>rz>compare_pygobject_version.<locals>.<lambda>.<locals>.<genexpr>rrrrr
r>rz+compare_pygobject_version.<locals>.<lambda>r�rTrF)rrr �int)�versionr!r"�split�
split_comparerrr
�compare_pygobject_version9s
r(�)�urlparsecCs||fSrr)�a�brrr
�unicode^sr-cCstdkrtjjStjS�Nr))�PYVER�http�client�	responses�httplibrrrr
r2dsr2cCstdkr|St||�Sr.)r/r-��param�charsetrrr
�
unicodestrk�
r7cCstdkr|St|��|�Sr.)r/r-�encoder4rrr
�
unicodeencodersr:cCstdkr|S|�|�Sr.)r/�decoder4rrr
�
unicodedecodeyr8r<cCstdkr
tj�|�St|�Sr.)r/�urllib�parser*�rb2urlparse��urirrr
r*�sr*cC�tdkr
tj�|�St�|�Sr.)r/r=�request�url2pathname)�urlrrr
rD��
rDcCrBr.)r/r=rC�urlopen��filenamerrr
rG�rFrGcCrBr.)r/r=rC�pathname2urlrHrrr
rJ�rFrJcCrBr.)r/r=r>�unquoter@rrr
rK�rFrKcCsDtdkr|rtjj||d�Stj�|�S|rtj||d�St�|�S)Nr))�safe)r/r=r>�quote)rArLrrr
rM�s
rMcCrBr.)r/r=r>�
quote_plusr@rrr
rN�rFrNcGsttjjd�r	dSdS)N�
ui_managerFT)�hasattrr�Shell�props)�argsrrr
�is_rb3�srTcs�eZdZdZdejddfiZ�fdd�Zdd�Zd	d
�Z	dd�Z
d
d�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Z�ZS)�Menuz7
    Menu object used to create window popup menus
    �	pre-popupNrcs0tt|���||_||_d|_i|_i|_dS)z'
        Initializes the menu.
        rN)�superrU�__init__�plugin�shell�_unique_num�
_rbmenu_items�_rbmenu_objects)�selfrYrZ��	__class__rr
rX�s
z
Menu.__init__cCs|�||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)r^�menubar�section_name�actionrrr
�
add_menu_item�szMenu.add_menu_itemc
Cs�|j}t|j�r6|jjj}t��}|�|�|�|�||j	vr%g|j	|<|j	|�
|�|�|||�|Stj|d�}|�|�||j	|<|�
|�}|dkrU|�
|�n|�||�|��|jjj}	|	��|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
        )�labelra)rgrTrZrR�applicationr�MenuItem�associate_menuitem�	set_labelr\�append�add_plugin_menu_itemr�get_menu_object�insert�show_allrO�
ensure_update)
r^rcrd�positionrerg�app�item�bar�uimrrr
rb�s,	





�



zMenu.insert_menu_itemcCsxt|j�s:t����}|�d�||jdt|j�<|jd|_|�	|�}|�
||�|��|jjj
}|��dSdS)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�	separatorrN)rTrZr�SeparatorMenuItem�new�set_visibler\r	r[rnrorprRrOrq)r^rc�at_position�	menu_itemrurvrrr
�insert_separators



�zMenu.insert_separatorcCs�t|j�r0||jvrdS|jjj}|j|D]}|�||�q|j|r.|j|dd�=dSdS|js5dS|jjj}|�|�}|jD]
}|�|j|�qB|�	�|�
�dS)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)rTrZr\rRrh�remove_plugin_menu_itemrOrn�removerprq)r^rcrdrsr|rvrurrr
�remove_menu_itemss"
	


�


zMenu.remove_menu_itemscCsnt��|_zddlm}|�}|j�|jj�WnYt|j	�r%|}n|}||_
|j�t�
|j|��dS)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_DOMAINrTrZ�ui_filename�
add_from_file�rb�find_plugin_filerY)r^�rb2_ui_filename�rb3_ui_filenamer��clr�rrr
�load_from_file6s


�zMenu.load_from_filec�,�fdd�}|��D]	\}}|||�q
dS)Ncs6tj|d�}|�d|�|�d��jjj�|�dS)N)�name�activateT)r�SimpleAction�connect�set_enabledrZrR�window�
add_action)�action_name�funcre�r^rr
�
_menu_connectQs
z0Menu._connect_rb3_signals.<locals>._menu_connect��items�r^�signalsr��key�valuerr�r
�_connect_rb3_signalsPs�zMenu._connect_rb3_signalscr�)Ncs��|�}|�d|�dS�Nr�)rnr�)�menu_item_namer�r|r�rr
r�[s
z0Menu._connect_rb2_signals.<locals>._menu_connectr�r�rr�r
�_connect_rb2_signalsZs�zMenu._connect_rb2_signalscCs&t|j�r|�|�dS|�|�dS)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)rTrZr�r�)r^r�rrr
�connect_signalsbs
zMenu.connect_signalscCsj||jvr
|j|S|j�|�}t|j�r,|jjj}|�|�tj	�
|�}|�|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)r]r��
get_objectrTrZrRrh�link_shared_menusrrU�new_from_model�attach_to_widget)r^�source�
popup_namertrs�
popup_menurrr
�get_gtkmenums





zMenu.get_gtkmenucCsd||jvr
|j|S|j�|�}t|j�r%|r|}n
|jjj}|�|�}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
        )	r]r�r�rTrZrRrh�get_plugin_menu�print)r^�menu_name_or_linkrtr�rsrrr
rn�s




zMenu.get_menu_objectcCs@t|j�r|jjj�|�}|�|�dS|�|�}|�|�dS)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)rTrZrRr��
lookup_actionr�rn�
set_sensitive)r^�menu_or_action_item�enablertrrr
r��s


zMenu.set_sensitivecCs.|�d�|�||�}|�dddd||�dS)z9
        utility function to show the popup menu
        rVN)�emitr��popup)r^r��	menu_name�button�time�menurrr
r��s
z
Menu.popup)�__name__�
__module__�__qualname__�__doc__r�SIGNAL_RUN_LAST�__gsignals__rXrfrbr}r�r�r�r�r�r�rnr�r��
__classcell__rrr_r
rU�s"�
&#
rUc@sLeZdZdZdZdZdd�Zedd��Zdd	�Z	d
d�Z
dd
�Zdd�ZdS)�ActionGroupzE
    container for all Actions used to associate with menu items
    rrcCsP||_||_i|_t|j�rt��|_dSt�|�|_|jj	j
}|�|j�dS)z�
        constructor
        :param shell: `RBShell`
        :param group_name: `str` unique name for the object to create
        N)�
group_namerZ�_actionsrTr�SimpleActionGroup�actiongrouprr�rRrO�insert_action_group)r^rZr�rvrrr
rX�s

zActionGroup.__init__cC�|jSr)r�r�rrr
r��szActionGroup.namecCs |j��D]}|j�|�qdS)zX
        utility function to remove all actions associated with the ActionGroup
        N)r��list_actions�
remove_action)r^rerrr
�remove_actions�s�zActionGroup.remove_actionscCs
|j|S)z�
        utility function to obtain the Action from the ActionGroup

        :param action_name: `str` is the Action unique name
        )r�)r^r�rrr
�
get_action�s
zActionGroup.get_actioncKs||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�)r^r�r�r�rSrrr
�add_action_with_accel�s
z!ActionGroup.add_action_with_accelcKs�d|vr	|d}n|}d|vr|d}nd}tj}d|vr!|d}t|j�rx|tjkr8tj�|dt�	dd��}ntj�
|d�}d}d|vrM|dd	krMd	}tj��}	|d	kr\|	�
|�n|jjj�
|�|j�
|�|rw|	�|d
||g�n4d|vr�|d}
ntj}
|tjkr�tj||d|
d
�}n	tj||d|
d
�}|r�|j�||�n|j�
|�t|j|�}|�d||�||_||_||j|<|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
        rgr�N�action_stater,F�win�action_typersr�stock_id�)rgr��tooltipr�r�)r��STANDARDrTrZ�TOGGLErr��new_statefulr�Variantry�Application�get_defaultr�rRr�r��set_accels_for_actionr�STOCK_CLEAR�ToggleAction�Actionr�r�rgr�r�)r^r�r�rSrgr��staterer�rsr��actrrr
r��sh




��
��

��
zActionGroup.add_actionN)
r�r�r�r�r�r�rX�propertyr�r�r�r�r�rrrr
r��s
r�c@s:eZdZdZdZGdd�d�Zdd�Zdd�Zd	d
�ZdS)�ApplicationShellzP
    Unique class that mirrors RB.Application & RB.Shell menu functionality
    Nc@sFeZdZdZdd�Zdd�Z	ddd�Zdd
d�Zdd
�Zdd�Z	dS)zApplicationShell.__implz+ Implementation of the singleton interface cCs(||_t|j�ri|_ng|_i|_dSr)rZrT�_uids�_action_groups�r^rZrrr
rXKs


z ApplicationShell.__impl.__init__cCs||j|j<dS)z|
            Adds an ActionGroup to the ApplicationShell

            :param action_group: `ActionGroup` to add
            N)r�r�)r^�action_grouprrr
r�Usz+ApplicationShell.__impl.insert_action_grouprscCs�t|j�r|dkr|jjj�|�}n*|jjj�|�}n!|jjj}|��}d}|D]
}|��|kr2nq(d}|r<|�	|�}|rDt
|j|�SdS)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")
            rsN)rTrZrRrhr�r�rO�get_action_groups�get_namer�r�)r^�action_group_namer�r�rerv�ui_actiongroupsr�rrr
r�]s$
�
�
z%ApplicationShell.__impl.lookup_action�toolsc
Cs�t|j�rTt�|�}|�d�D]B}|jd}|j|}|�|�}t�	�}	|	�
d|�|	�|j�|	�
dt�d|j��tj��}
||}|
�|||	�||j|<qdS|jjj}|j�|�|��|��dS)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'
            �.//menuitemrezapp.r��sN)rTrZ�ET�
fromstring�findall�attribr�r�rri�set_detailed_actionrkrg�set_attribute_valuerr�r�r�r�rmr�rRrOrl�add_ui_from_stringrq)
r^�	ui_stringr�r��root�elemr��groupr�rtrs�indexrvrrr
�add_app_menuitems�s,




�
��
z)ApplicationShell.__impl.add_app_menuitemscCst|j�rut�|�}|�d�D]c}|jd}|�d�}|jd}|j|}|�|�}	t	�
�}
|
�d|�|
�|	j
�t	j��}|dkrGd}n|dkrNd	}n|d
krUd}n
|dkr\d
}ntd|�||}
|�||
|
�||j|
<qdS|jjj}|j�|�|��|��dS)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�r�re�win.�QueuePlaylistViewPopupzqueue-popup�BrowserSourceViewPopupz
browser-popup�PlaylistViewPopupzplaylist-popup�PodcastViewPopupzpodcast-episode-popupzunknown type %sN)rTrZr�r�r�r��findr�r�rrir�rkrgr�r�r�rmr�rRrOrlr�rq)r^r�r�r�r�r��menuelemr�r�r�rtrs�plugin_typer�rvrrr
�add_browser_menuitems�s8







�
z-ApplicationShell.__impl.add_browser_menuitemscCs^t|j�r|jD]}tj���|j||�qdS|jjj}|jD]}|�	|�q!|�
�dS)z?
            utility remove any menuitems created.
            N)rTrZr�rr�r�r~rRrO�	remove_uirq)r^�uidrvrrr
�cleanup�s



��

zApplicationShell.__impl.cleanupN)rs)r�)
r�r�r�r�rXr�r�r�rrrrrr
�__implHs
	
�
$+4rcCs&tjdurt�|�t_tj|jd<dS)z Create singleton instance N�_ApplicationShell__instance)r�r	�_ApplicationShell__impl�__dict__r�rrr
rX�s
�zApplicationShell.__init__cCst|j|�S�z# Delegate access to implementation )�getattrr	)r^�attrrrr
�__getattr__�szApplicationShell.__getattr__cCst|j||�Sr)�setattrr	)r^rr�rrr
�__setattr__�szApplicationShell.__setattr__)	r�r�r�r�r	r
rXrrrrrr
r�As'r�c@s�eZdZdZdd�Zdd�Zdd�Zedd	��Zej	d
d	��Zedd��Z
e
j	d
d��Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�ZdS)r�zE
    class that wraps around either a Gio.Action or a Gtk.Action
    cCs(||_||_d|_d|_d|_d|_dS)zs
        constructor.

        :param shell: `RBShell`
        :param action: `Gio.Action` or `Gtk.Action`
        r�FTN)rZre�_label�_accel�_current_state�_do_update_state)r^rZrerrr
rXs
zAction.__init__cCsN||_||_|dkr
|j}t|j�r|j�|||�dS|j�||d|�dSr�)�
_connect_func�
_connect_args�	_activaterTrZrer�)r^�addressr�rSrrr
r�s
zAction.connectcGs0|jr|j|_|�|j�|�|d|j�dSr)rr�	set_staterr)r^rerSrrr
r"s
zAction._activatecCst|j�s
|j��S|jS)z�
        get the menu label associated with the Action

        for RB2.99+ actions dont have menu labels so this is managed
        manually
        )rTrZre�	get_labelrr�rrr
rg)s

zAction.labelcCs t|j�s|j�|�||_dSr)rTrZrerkr)r^�	new_labelrrr
rg6s

cCr�)z@
        get the accelerator associated with the Action
        �rr�rrr
r�=szAction.accelcCs|r||_dSd|_dS)Nr�r)r^�new_acceleratorrrr
r�Ds

cCst|j�r
|j��S|j��S)ze
        get the sensitivity (enabled/disabled) state of the Action

        returns boolean
        )rTrZre�get_enabled�
get_sensitiver�rrr
r Ks


zAction.get_sensitivecCs4t|j�r|jjjr|j�t�d|��dSdSdS)za
        set the state of a stateful action - this is applicable only
        to RB2.99+
        r,N)rTrZrerR�
state_type�change_staterr��r^r�rrr
rVs�zAction.set_statecCs(t|j�r
|j�d�dS|j��dS)z<
        invokes the activate signal for the action
        N)rTrZrer�r�rrr
r�^s
zAction.activatecCsLt|j�r|j�t�d|��||_d|_|��d|_dS|j�	|�dS)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
        r,FTN)
rTrZrer"rr�rrr��
set_activer#rrr
r$gs
	
zAction.set_activecCs"t|j�r
|j}|S|j��}|S)zT
        get the state of the action

        returns `boolean` state value
        )rTrZrre�
get_active)r^�	returnvalrrr
r%ys


�zAction.get_activecCs2t|j�r|�d|j���dS|�|j�dS)z/
        links a menu with the action

        r�N)rTrZr�rer��set_related_action)r^�menuitemrrr
rj�s
zAction.associate_menuitemN)r�r�r�r�rXr�rr�rg�setterr�r rr�r$r%rjrrrr
r�s&



	
r�r),�sys�xml.etree.ElementTree�etree�ElementTreer�r��
gi.repositoryrrrrrrrr(�version_infor/�urllib.requestr=�urllib.parse�urllib.errorr*r?�http.clientr0r-r3r2r7r:r<rDrGrJrKrMrNrT�ObjectrU�objectr�r�r�rrrr
�<module>sR





rB

Youez - 2016 - github.com/yon3zu
LinuXploit