%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__/alternative-toolbar.cpython-312.pyc

�

 ]e�S��F�ddlZddlZddlZddlmZddlmZddlmZejdd�ddlmZddlm	Z	dd	l
mZdd
lm
Z
ddlmZddlmZdd
lmZddlmZddlmZddlmZddlmZddlmZdZdZdZdZGd�dej8ej:�Zy)�N)�GObject)�Gio)�Gtk�Peasz1.0)r)�RB)�PluginDialog)�CoverLocale)�GSetting)�Preferences)�ActionGroup)�ApplicationShell)�gtk_version)�AltToolbarCompact)�AltToolbarHeaderBar)�AltToolbarStandarda
<ui>
  <menubar name="MenuBar">
    <menu name="ViewMenu" action="View">
        <menuitem name="Show Toolbar" action="ToggleToolbar" />
        <menuitem name="Show Source Toolbar"
        action="ToggleSourceMediaToolbar" />
    </menu>
  </menubar>
</ui>
z�
<ui>
  <menubar name="MenuBar">
    <menu name="ViewMenu" action="View">
        <menuitem name="SeekBackward" action="SeekBackward" />
        <menuitem name="SeekForward" action="SeekForward" />
    </menu>
  </menubar>
</ui>
��
c��eZdZdZdZejej��Zeje	d��Z
eje	d��Zeje	d��Zeje	d��Z
dejde	ffiZd�Zd�Zd	�Zd
�Zd�Zd�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Ze dd��Z!d�Z"dd�Z#dd�Z$d�Z%d�Z&y)�AltToolbarPluginz^
    Main class of the plugin. Manages the activation and deactivation of the
    plugin.
    )�typeF)r�defaultztoolbar-visibilityNc�z�tjj|�d|_dx|_x|_|_y)z0
        Initialises the plugin object.
        N)r�Object�__init__�appshell�sh_psc�sh_op�sh_pc��selfs �E/usr/lib/rhythmbox/plugins/alternative-toolbar/alternative-toolbar.pyrzAltToolbarPlugin.__init__Xs2��	������%���
�04�4���4�d�j�4�:�c�
�|j|_|jjj|_|jjj|_d|_d|_d|_d|_t�}|j|jj�tjj�}|j!t#j$|d��t&j)|jjj*dd�|_t/�|_|j0j3|j0j4j6�|_|j8|j0j:j<}|j8|j0j:j>|_ |j8|j0j:jB|_"|j8|j0j:jF|_$|j8|j0j:jJ|_&|j8|j0j:jN|_(|j8|j0j:jR|_*|j8|j0j:jV|_,|j8|j0j:jZ|_.|j8|j0j:j^|_0|j8|j0j:jb|_2tg|j�|_4|jk�|dk(rUdtljnd	jq�vrd
}nd}||j8|j0j:j<<d|_9|d
k(rtu�|_9n+|jDrtw�|_9nty�|_9|jrj{|�|jrj}�	t~j�j�dd
gt~j�j��}|j�d�\}}}|r|dd}|j�d�d
}|j��|j��||j_H|j|jj��y#d}Y�]xYw)z�
        Called by Rhythmbox when the plugin is activated. It creates the
        plugin's source and connects signals to manage the plugin's
        preferences.
        rNi�i&�imgzmain-toolbar�by_id�gnome�XDG_CURRENT_DESKTOP���	rhythmboxz	--version���� z	999.99.99)J�object�shell�props�db�shell_player�
song_duration�entry�_plugin_dialog_width�_plugin_dialog_heightr	�
switch_locale�Locale�
LOCALE_DOMAINr�	IconTheme�get_default�append_search_path�rb�find_plugin_filer�find�window�
rb_toolbarr
�gs�get_setting�Path�PLUGIN�plugin_settings�	PluginKey�DISPLAY_TYPE�VOLUME_CONTROL�volume_control�SHOW_COMPACT�show_compact_toolbar�COMPACT_POS�compact_toolbar_pos�START_HIDDEN�start_hidden�INLINE_LABEL�inline_label�ENHANCED_SIDEBAR�enhanced_sidebar�
SHOW_TOOLTIPS�
show_tooltips�HORIZ_CATEGORIES�horiz_categories�APP_MENU�app_menu�
DARK_THEME�prefer_dark_themer
r�_add_menu_options�os�environ�lower�toolbar_typerrr�
initialise�post_initialiser�
Subprocess�new�SubprocessFlags�STDOUT_PIPE�communicate_utf8�split�_connect_signals�_connect_properties�alternative_toolbarr)	r �cl�theme�display_type�process�passval�buf�err�vers	         r!�do_activatezAltToolbarPlugin.do_activate`s%���[�[��
��*�*�"�"�%�%��� �J�J�,�,�9�9��������
�$'��!�%(��"��]��
������0�0�1��
�
�)�)�+��
� � ��!4�!4�T�5�!A�B�+�/�/��
�
�0@�0@�0G�0G�0>��I����*���#�w�w�2�2�4�7�7�<�<�3F�3F�G����+�+�D�G�G�,=�,=�,J�,J�K��"�2�2��G�G���,�,�.���$(�$8�$8��G�G���*�*�%,��!�#'�#7�#7��G�G���)�)�$+�� � �0�0��G�G���*�*�,��� �0�0��G�G���*�*�,��� $� 4� 4��G�G���.�.�!0���!�1�1��G�G���+�+�-��� $� 4� 4��G�G���.�.�!0����,�,��G�G���&�&�(��
�
� � ����!2�!2�!=�!=�>�	
��)����4��
���� ��1���"�*�*�%:�;�A�A�C�C� �� ��CO�D� � ����!2�!2�!?�!?�@� ����1�� 3� 5�D��
�
&�
&� 1� 3�D�� 2� 4�D�����$�$�T�*����)�)�+�		��n�n�(�(�+�{�)C��#�#�/�/�1�G� '� 8� 8�� >��G�S�#���#�2�h���i�i��n�Q�'��	
����� � �"�*.��
�
�&�
��������&��	��C�s
�A*U�Uc��t|jt�}t�dkrd}t	|j
jj|�}d}|j|j|j�|dk\r!|j�}t|�|dk\r�!|j�\|_	|_
|j�y)zK
          display our implementation of the LibPeas Plugin window
        g�(\��@FrN)�
isinstancer`rrrr.r/r?�set_default_sizer4r5�run�print�get_size�destroy)r �args�
has_headerbar�dlg�responses     r!�_display_pluginsz!AltToolbarPlugin._display_plugins�s���
#�4�#4�#4�6I�J�
��=�4��!�M��4�:�:�+�+�2�2�M�B�������T�6�6�!�7�7�	9��!�m��w�w�y�H��(�O��!�m�AD����=��!�4�#=����
r"c�8�|jj�y�N)r`�on_search_toggle�r r|s  r!�	on_searchzAltToolbarPlugin.on_search�s�����*�*�,r"c��t|jd�|_|jj|jdtd�ddtd���|jj|j�t|jd�|_|jj|jdtd�dd	td
���|jj|jdtd�dd
td���|jj|j�|jjtdd�t|jd�|_
|jj|jdtd�tjdtd���|jj|j dtd�tjddtd���|jj|j�|jjt"dd�y)zC
          add the various menu options to the application
        �AltToolbarPluginSearchActions�Search�appz<Ctrl>f)�func�action_name�label�action_type�accel�tooltip�AltToolbarPluginSeekActions�SeekBackwardz
Seek Backwardz	<Alt>Leftz.Seek backward, in current track, by 5 seconds.�SeekForwardzSeek Forwardz
<Alt>Rightz.Seek forward, in current track, by 10 seconds.�view�AltToolbarPluginActions�
ToggleToolbarzShow Play-Controls Toolbarz&Show or hide the play-controls toolbar)r�r�r��action_stater�r��ToggleSourceMediaToolbarzShow Source Toolbarz<Ctrl>tzShow or hide the source toolbar)r�r�r�r�r�r�r�N)rr.�search_action_group�
add_actionr��_r�insert_action_group�seek_action_group�on_skip_backward�on_skip_forward�add_app_menuitems�view_seek_menu_ui�toggle_action_group�toggle_visibility�TOGGLE�toggle_sourcemedia_visibility�view_menu_uirs r!r\z"AltToolbarPlugin._add_menu_options�s��$/�t�z�z�-L�$N�� �� � �+�+����6>�01�(��6;�9�23�.6�38�		,�	9�	
�
�
�)�)�$�*B�*B�C�!,�T�Z�Z�-J�"L������)�)�t�/D�/D�6D�01�/�0B�6;�;�23�/E�3F�		*�	G�	
���)�)�t�/C�/C�6C�01�.�0A�6;�0<�23�/F�3G�	*�	H�	
�
�
�)�)�$�*@�*@�A��
�
�'�'�(9�(E�v�	O�$/�t�z�z�/H�$J�� �� � �+�+��1G�1G�8G�23�0L�3N�9D�9K�9K�8=�45�1H�5I�
	,�	J�	
� � �+�+��3�3�2��)�*�$�+�+��Y��7�8�
	,�	:�	
�
�
�)�)�$�*B�*B�C��
�
�'�'��(A�6�	Kr"c��|jj|jjj|dt
jj�y)zk
          bind plugin properties to various gsettings that we dynamically
          interact with
        �
playing_labelN)rE�bindrArF�
PLAYING_LABELr�SettingsBindFlags�GETrs r!rjz$AltToolbarPlugin._connect_propertiess>��
	
���!�!�$�'�'�"3�"3�"A�"A�4�"1�"%�"7�"7�";�";�	=r"c��|jjjjd|j�|_|jjd|j�|_|jjd|j�|_
|jjd|j�|_|jjd|j�|_tj j#d�|_|j$j'd|dtj(j*�|jd	|j,�|j-d
�|j$j'd|dtj(j*�|jd
|j.�|j/d
�y
)zO
          connect to various rhythmbox signals that the toolbars need
        �selectedzplaying-song-changedzelapsed-changedzplaying-changedzplaying-song-property-changedzorg.gnome.rhythmboxzshow-album-art�show_album_artznotify::show-album-artNzshow-song-position-slider�show_song_position_sliderz!notify::show-song-position-slider)r.r/�display_page_tree�connect�on_page_change�sh_display_page_treer1�_sh_on_song_changer�_sh_on_playingr�_sh_on_playing_changer�_sh_on_song_property_changed�sh_pspcr�Settingsrd�rb_settingsr�r�r��show_album_art_settings_changed�*show_song_position_slider_settings_changedrs r!riz!AltToolbarPlugin._connect_signals s���%)�J�J�$4�$4�$F�$F�$N�$N���+�+�%
��!��'�'�/�/�0F�04�0G�0G�I����&�&�.�.�/@�/3�/B�/B�D��
��&�&�.�.�/@�/3�/I�/I�K��
��(�(�0�0�+��-�-�/����<�<�+�+�,A�B��������.��6F�!�3�3�7�7�	9����-��9�9�	;��,�,�T�2������9�4�9�!�3�3�7�7�	9�	
���8��D�D�	F��7�7��=r"c���|j�ra|dddtjtjtjfvr,|j�}|jj|�yyy)zP
           shell-player "playing-song-property-changed" signal handler
        �artist�album�titleN)�get_playingr� RHYTHMDB_PROP_STREAM_SONG_ARTIST�RHYTHMDB_PROP_STREAM_SONG_ALBUM�RHYTHMDB_PROP_STREAM_SONG_TITLE�get_playing_entryr`�display_song)r �sp�uri�property�oldrdr3s       r!r�z-AltToolbarPlugin._sh_on_song_property_changedDsj���>�>�������4�4��3�3��3�3�5�!5��(�(�*�E����*�*�5�1�!5�r"c�D�|jj||�|jdk7r|jjd�y|jjd�t	|jd�r(d}|jj
j
|�yy)z?
        Shell-player 'playing-change' signal handler.
        rTF�total_time_label�N)r`�play_control_changer2�
enable_slider�hasattrr��
set_markup)r �player�playingr�s    r!r�z&AltToolbarPlugin._sh_on_playing_changeRs���	
���-�-�f�g�>����!�#����+�+�D�1����+�+�E�2���)�)�+=�>����!�!�2�2�=�=�e�D�?r"c�P�|�/|jtjj�|_nd|_t|jd�r=|jjjj|jxsd�|jj|�y)zE
        Shell-player 'playing-song-changed' signal handler.
        Nr�
song_progressr()�	get_ulongr�RhythmDBPropType�DURATIONr2r�r`r��
adjustment�	set_upperr�)r r�r3s   r!r�z#AltToolbarPlugin._sh_on_song_change_s���
��!&����1D�1D�1M�1M�!N�D��!"�D���4�$�$�o�6����+�+�6�6�@�@��"�"�'�a�
)����&�&�u�-r"c�6�|jdk(ry	|jj}|j	|j
�5|jj|�ddd�t|d�\}}t|d�\}}t|jd�\}}t|d�\}}|rdj||||||�}	ndj||||�}	|jjj|	�y#t$rYywxYw#1swY��xYw)z@
        Shell-player 'elapsed-changed' signal handler.
        rN�<z.<small>{}:{:02}:{:02} / {}:{:02}:{:02}</small>z(<small>{:02}:{:02} / {:02}:{:02}</small>)r2r`r��AttributeError�
handler_block�changed_callback_idr��	set_value�divmod�formatr�r�)
r r��seconds�slider�minutes�hours�
total_minutes�
total_seconds�total_hoursr�s
          r!r�zAltToolbarPlugin._sh_on_playingms ������"��	��&�&�4�4�F��
!�
!�&�"<�"<�
=�	1����'�'��0�	1�"�'�2�.�������,���w�'-�d�.@�.@�"�'E�$�
�}�%+�M�2�%>�"��]��D�K�K��w���]�M�;�E�?�E�E���-��@�E����*�*�5�5�e�<��#�	��	��	1�	1�s�D�D�	D�D�Dc��|jjj}|j�drI|j	�dt
z
}t
|�|dkrd}t
|�|j|�yy)z;
           keyboard seek backwards signal handler
        r(rN)r-r/r1r��get_playing_time�seek_backward_timery�set_playing_time)r r|r��	seek_times    r!r�z!AltToolbarPlugin.on_skip_backward�sp���[�[�
�
�
+�
+���N�N��Q���+�+�-�a�0�3E�E�I��)���A�
��	��)�����	�*�
 r"c��|jjj}|j�drI|j	�dt
z}|j
�}|dkDr||kDr|}|j|�yyy)z:
           keyboard seek forwards signal handler
        r(rN)r-r/r1r�r��seek_forward_time�get_playing_song_durationr�)r r|r�r�r2s     r!r�z AltToolbarPlugin.on_skip_forward�s|���[�[�
�
�
+�
+���N�N��Q���+�+�-�a�0�3D�D�I��8�8�:�M���!��
�-� -�I��#�#�I�.�	"�
 r"c�N�|jj|j�y)z9
           rhythmbox show-slider signal handler
        N)r`�show_sliderr�r�s  r!r�z;AltToolbarPlugin.show_song_position_slider_settings_changed�s��	
���%�%�d�&D�&D�Er"c�N�|jj|j�y)z<
           rhythmbox show-album-art signal handler
        N)r`�
show_coverr�r�s  r!r�z0AltToolbarPlugin.show_album_art_settings_changed�s��	
���$�$�T�%8�%8�9r"c��td|�|jj|�|jj|�|jj	|�y)z8
           sources display-tree signal handler
        zpage changedN)ryr`�reset_categories_pos�
reset_toolbar�reset_entryview)r r��pages   r!r�zAltToolbarPlugin.on_page_change�sJ��	�n�d�#����.�.�t�4����'�'��-����)�)�$�/r"c���d�}t|tj�r�|dk(rCtjj|�|k(rZ|�d|j�vrF||�|k(r;|S|dk(r4|j�|k(r!|�d|j�vr
||�|k(r|St|tj�r3|j�D] }tj||||�}|s�|cSy)ad
        find various GTK Widgets
        :param node: node is the starting container to find from
        :param search_id: search_id is the GtkWidget type string or
        GtkWidget name
        :param search_type: search_type is the type of search
                            "by_name" to search by the type of GtkWidget
                            e.g. GtkButton
                            "by_id" to search by the GtkWidget (glade name)
                            e.g. box_1
        :param button_label: button_label to find specific buttons where we
        cannot use by_id
        :return:N/A
        c��|j�}|r|S|j�}|r#|j�dk(r|j�Sy)N�GtkLabel)�	get_label�	get_child�get_name�get_text)�buttonr��childs   r!�
extract_labelz,AltToolbarPlugin.find.<locals>.extract_label�sG���$�$�&�E�����$�$�&�E�����)�Z�7��~�~�'�'�r"r%N�Button�by_name)rvr�	Buildabler�	Container�get_childrenrr>)�node�	search_id�search_type�button_labelrr�rets       r!r>zAltToolbarPlugin.find�s���*		��d�C�M�M�*��g�%��=�=�)�)�$�/�9�<�#�+�$��
�
��7�M� �="�%1�=2�#���	�)��=�=�?�i�/�#�+�$��
�
��7�M� �="�%1�=2�#���d�C�M�M�*��*�*�,�
��&�+�+�E�9�k�,8�:����J�	
�r"c�x�|`|jr�|jj|j�|jj|j�|jj|j
�|jj|j�|jjjj|j�|`|jr|jj�|jjd�|jj�|`y)z�
        Called by Rhythmbox when the plugin is deactivated. It makes sure to
        free all the resources used by the plugin.
        TN)r0rr1�
disconnectrrr�r.r/r�r�r�cleanupr@�set_visibler`rs r!�
do_deactivatezAltToolbarPlugin.do_deactivate�s���

�G��:�:����(�(����4����(�(����5����(�(����4����(�(����6��J�J���.�.�9�9��)�)�
+��!��=�=��M�M�!�!�#����#�#�D�)����!�!�#��Jr"c��|jjd�}|jj|j	��y)z�
        Display or Hide PlayControls signal handler
        :param action:
        :param param:
        :param data:
        :return:
        r�N)r��
get_actionr`r�
get_active�r �action�param�datas    r!r�z"AltToolbarPlugin.toggle_visibility
s7���)�)�4�4�_�E�����%�%�f�&7�&7�&9�:r"c��|jjd�}|jj|j	��y)z�
        Display or Hide the source toolbar
        :param action:
        :param param:
        :param data:
        :return:
        r�N)r�rr`�source_toolbar_visibilityrrs    r!r�z.AltToolbarPlugin.toggle_sourcemedia_visibilitys<���)�)�4�4�&�(��	
���3�3�F�4E�4E�4G�Hr"c�Z�td�}|dz
}td�}|dz
}t�}|S)zs
        a method just to help out with translation strings
        it is not meant to be called by itself
        zAlternative Toolbar�dummyzgReplace the Rhythmbox large toolbar with a Client-Side Decorated or Compact Toolbar which can be hidden)r�r)r �plugin�desc�prefs    r!�_translation_helperz$AltToolbarPlugin._translation_helper#s@���(�)���'����
?�@��	
�����}���r"c�:�|jj|�y)z�
        a method to return the toolbar itself
        :param callback: function callback - func(AT.ToolbarCallback)
        passed
        :return:
        N)r`�setup_completed_async)r �callbacks  r!�get_toolbarzAltToolbarPlugin.get_toolbar5s��	
���/�/��9r"r�)NN)'�__name__�
__module__�__qualname__�__doc__�_AltToolbarPlugin__gtype_namerr�rr-�bool�display_page_tree_visibler�r�r��SIGNAL_RUN_LAST�__gsignals__rrtr�r�r\rjrir�r�r�r�r�r�r�r�r��staticmethodr>rr�r�r"r&�r"r!rrFs���&�L�
�W�
�
�7�>�>�
2�F� 0�� 0� 0�d�E� J��%�W�%�%�4��?�N� 0�� 0� 0�d�E� J��$�G�$�$�$��>�M�
	�w�6�6��t�g�F��L�5�a'�F�,-�9K�v=�">�H2�E�.�=�6+�/�F�:�0��4��4�l�4
;�I��$:r"r)�gir<r]�
gi.repositoryrrr�require_versionrr�alttoolbar_pluginsr�alttoolbar_preferencesr	r
r�alttoolbar_rb3compatrr
r�alttoolbar_typerrrr�r�r�r�r�Activatablerr1r"r!�<module>r:s���*
�	�	�!�������6�5�!���+�.�+�.�,�1�,�-�/�.�
��	������w:�w�~�~�t�'7�'7�w:r"

Zerion Mini Shell 1.0