%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_sidebar.cpython-312.pyc

�

 ]e�X���ddlZddlmZddlmZddlmZddlmZddlmZddlm	Z	ddlm
Z
dd	lmZdd
lmZddlm
Z
Gd�d
ej�Zy)�N)�AltControllerCategory)�CoverLocale)�GSetting)�GLib)�GObject)�Gdk)�Gio)�Gtk)�Pango)�RBc���eZdZejed��Z�fd�Zd�Zd�Z	d�Z
d�Zd�Zd	�Z
d
�Zd�Zd�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z�xZS)�AltToolbarSidebarz{1:True})�type�defaultc�f���tt���|j�_|�_|j
�_|�_d�_d�_t�}|j|jj��jd�i�_d�_d�_t#�}|j%|j&j(�}|j+|j,j.�dt0j2j4�t6j8j;t<t>j@tBg��_"�jDjGd���_$�jHjKd��jM�jH��jO�}|jQt6jR��jUd��fd�}|tWd	�tXjZ�|tWd
�tXj\�|tWd�tXj^�|tWd�tXj`��fd
�}tcjdd|�t6jfj;�}	|	jid�|	jkt6jljn��jq|	�t6jfj;�}	t7jr�}
|	ju|
d�t7jv�}|jyd�jz�|�_>|	ju|d�|	j|
�j��|	j|�j��|	�_B�jq|	��j�|	��j���j�d�t�}|j|jj��y)z)
        Initialises the object.
        N����AltToolbarSideBarF�	expanders)�root�c�~���jjd�}|ddg�j|<|�j|<y)NF)�	treestore�append�	_category)�text�category�local�selfs   ��D/usr/lib/rhythmbox/plugins/alternative-toolbar/alttoolbar_sidebar.py�define_categoryz3AltToolbarSidebar.__init__.<locals>.define_categoryLs:����N�N�)�)�$�/�E�%)�4��$7�D�N�N�5�!�',�D�N�N�8�$�zLocal collectionzOnline sourcesz
Other sources�	Playlistsc�����jjj}|j�}d}�j	||d|��j��j
�t�j�}t|�t�j�|D]P}t|��jj�j|�}|s�9||s�?�j|d��Ry)NrF)�shell�props�display_page_model�get_iter_first�_traverse_rows�_refresh_headers�_connect_signals�evalr�printr�get_pathr�
expand_row)�args�model�rootiter�depthrr�pathrs       �r�delayedz+AltToolbarSidebar.__init__.<locals>.delayedVs�����J�J�$�$�7�7�E��+�+�-�H��E�����x��u�=�
�!�!�#�
�!�!�#��T�^�^�,�I��)���$�.�.�!�%�
1���h���~�~�.�.�t�~�~�h�/G�H���I�h�/��O�O�D�%�0�

1�r!���editedT)G�superr�__init__r$�toolbar�plugin�rbtree�_drag_dest_source�_drag_motion_counterr�
switch_locale�Locale�
LOCALE_DOMAIN�set_namer�_last_click_source�
_user_clickedr�get_setting�Path�PLUGIN�bind�	PluginKey�	EXPANDERSr	�SettingsBindFlags�DEFAULTr
�	TreeStore�new�strr�Object�boolr�
filter_new�treestore_filter�set_visible_column�	set_model�get_style_context�	add_class�STYLE_CLASS_SIDEBAR�set_headers_visible�_r�LOCAL�ONLINE�OTHER�PLAYLISTr�timeout_add_seconds�TreeViewColumn�set_fixed_width�
set_sizing�TreeViewColumnSizing�FIXED�
append_column�CellRendererPixbuf�
pack_start�CellRendererText�connect�on_renderertext_edited�
text_renderer�set_cell_data_func�_set_pixbuf�	_set_text�tree_column�set_expander_column�show_all�
set_can_focusr)
rr:r<�cl�gs�plugin_settings�contextr r4�column�pixbuf_renderer�renderer�	__class__s
`           �rr9zAltToolbarSidebar.__init__$s���	���/�1��]�]��
�����n�n������!%���$&��!��]��
������0�0�1��
�
�)�*����"&���"���
�Z���.�.������8�����R�\�\�3�3�T�;� �2�2�:�:�	<����*�*�C�����+F�G��� $��� 9� 9�t� 9� D������0�0��3����t�,�,�-��(�(�*�����#�1�1�2�� � ��'�	-�
	��,�-�/D�/J�/J�K���*�+�-B�-I�-I�J���/�*�,A�,G�,G�H���+��(=�(F�(F�G�	�8	
� � ��G�,��#�#�'�'�)�����q�!����#�2�2�8�8�9����6�"��#�#�'�'�)���0�0�2�����/�5�1��'�'�)������4�#>�#>�?�%������(�E�*��!�!�/�4�3C�3C�D��!�!�(�D�N�N�;�!������6�"�� � ��(��
�
�����4� �
�]��
��������&r!c�h�|jjj}|jd|j�|_|jd|j�|_|jd|j�|jjj}|jjjd|j�|jd|j�|jjjjd|j�|jgt j"j$�|j'�|jd|j(�|jd|j*�|jd	|j,�y)
Nz
page-insertedzrow-deletedzbutton-press-eventzrow-inserted�selectedzplaying-song-changed�	drag-drop�drag-data-receivedzdrag-motion)r$r%r&ri�_model_page_inserted�_cpi�_model_page_deleted�_crd�
_row_click�display_page_treer0�_tree_inserted�_display_page_tree_selected�shell_player�_on_playing_song_changed�enable_model_drag_destr�
DragAction�COPY�drag_dest_add_uri_targets�on_drag_drop�on_drag_data_received�on_drag_motion)rr0�trees   rr*z"AltToolbarSidebar._connect_signals�s;���
�
� � �3�3���M�M�/�4�3L�3L�M��	��M�M�-��1I�1I�J��	�
	
���)�4�?�?�;��z�z���1�1���
�
��� � ���1D�1D�E����Z��5�5�	7��
�
���%�%�-�-�.D�.2�.K�.K�	M�	
�#�#�B����(;�(;�<��&�&�(����[�$�"3�"3�4����)��/�/�	1����]�D�$7�$7�8r!c��|jjj}|j|j�|j|j
�y�N)r$r%r&�
disconnectr�r�)rr0s  r�cleanupzAltToolbarSidebar.cleanup�s;���
�
� � �3�3��
������#�
������#r!c��td�|jd�|j|d�}|j|||�d|_y)z�
        Callback called when a drag operation finishes over the treeview
        It decides if the dropped item can be processed.
        r�r}NT)r,�stop_emission_by_name�drag_dest_find_target�
drag_get_datar=)r�widgetrv�x�y�time�targets       rr�zAltToolbarSidebar.on_drag_drop�sI��
	�n���$�$�[�1��+�+�G�T�:�����W�f�d�3�!%���r!c�b��d}	|j||�\}}d}|r�tjjk(s|tjjk(rf|tjjk(rtjj
}	ntjj}	|jd|	�d}|r��j|d}
	|
sd}n|
j�rd}|
r_|r]|
�jk7r�jdk7rd�_|
�_
�fd�}�jdk(rd�_tjd|�|r2tj|tj j"|�|Stj|d|�d�_
|S#Y���xYw#d}Y��xYw)NFr5Trrc�Z���jdkr"�jr�xjdz
c_y�jrf�jdk\rW�jjj}|r5|j�j��jj�d�_y)Nrr5TrF)r>r=r$r%r��selectr<�
expand_all)r/r�rs  �rr4z1AltToolbarSidebar.on_drag_motion.<locals>.delayed�s�����0�0�1�4� �2�2��1�1�Q�6�1�#��-�-� $� 9� 9�Q� >�#�z�z�/�/�A�A��� �K�K��(>�(>�?� �K�K�2�2�4�02�D�-� r!)�get_dest_row_at_posr
�TreeViewDropPosition�BEFORE�AFTER�INTO_OR_BEFORE�
INTO_OR_AFTER�set_drag_dest_rowrS�	can_paster=r>rr_r�drag_statusr�r�)rr��drag_contextr�r�r�r3�pos�result�drop_pos�dest_sourcer4s`           rr�z AltToolbarSidebar.on_drag_motion�s������	��2�2�1�a�8�I�D�#�����s�/�/�6�6�6�#��AY�AY�A_�A_�:_��c�.�.�5�5�5��3�3�B�B���3�3�A�A���$�$�T�8�4��D���/�/��5�a�8�K�
�#�"�F� �*�*�,�!�F��v��$�"8�"8�8��0�0�B�6�45��1�-8�D�*�!� �,�,��2�01�D�-��,�,�Q��8���O�O�L�#�.�.�*=�*=�t�D�
�z��
�O�O�L�!�T�2�%)�D�"��z���{	���2
���s�F �F(� F%�(F.c��td�|jd�|j||�\}}	|j|d}
|j	dd|�|j�}g}|D]E}
|jjjj|
�}|s�5|j|��G|
j|�y)zl
        Callback called when the drag source has prepared the data (pixbuf)
        for us to use.
        r�r~r5TFN)r,r�r�rS�finish�get_urisr$r%�db�entry_lookup_by_locationr�paste)rr�r�r�r��data�infor�r3r�r��uris�entries�uri�entrys               rr�z'AltToolbarSidebar.on_drag_data_receiveds���	�%�&��$�$�%9�:��.�.�q�!�4�	��c��+�+�D�1�!�4�����D�%��.��}�}������	&�C��J�J�$�$�'�'�@�@��E�E�����u�%�	&�
	���'�"r!c�~�td�t|jd�rtd�|j�yy)z�
          signal when a playing song changes - need to invoke a tree-refresh
          to ensure the user can see which source
        :param args:
        :return:
        zplaying song changedr��queuingN)r,�hasattrr;�
queue_draw)rr/s  rr�z*AltToolbarSidebar._on_playing_song_changeds2��	�$�%��4�;�;��%��)���O�O��&r!c��td�t|�t|�||j|dj_y)Nr7r5)r,rSr%�name)rryr3�new_texts    rrjz(AltToolbarSidebar.on_renderertext_edited*s5��
�h��
�d��
�h��4<����d�#�A�&�,�,�1r!c��|��Ft||dtj�rH|j|�r%|j	|�}|j||||�|j
|�}�k|dk(r3|j||d�}|jj|�}n|jj|�}||d|j|d<d|j|d<d|j|d<|j|�r(|j	|�}|j||||dz�|j
|�}|���Eyy)Nr5r�Tr)
�
isinstancer�DisplayPageGroup�iter_has_child�
iter_childrenr(�	iter_next�_get_category_iterrr)r�store�treeiter�new_parent_iterr2�	childiter�
category_iter�	leaf_iters        rr(z AltToolbarSidebar._traverse_rows2s<���"��%��/�!�,�b�.A�.A�B��'�'��1� %� 3� 3�H� =�I��'�'��y�(�E�J� �?�?�8�4�����z� $� 7� 7��h���8J� K�
� �N�N�1�1�-�@�	� �N�N�1�1�/�B�	�+0��?�1�+=�D�N�N�9�%�a�(�+-�D�N�N�9�%�a�(�+/�D�N�N�9�%�a�(��#�#�H�-�!�/�/��9�	��#�#�E�9�i����K����x�0�H�/�"r!c���t|�t|�t||djj�t||d�|j|||d|�y�Nr5)r,r%r�r)rr0r3�	page_iters    rr�z AltToolbarSidebar._tree_insertedQsW��
�d��
�i��
�e�D�k�!�n�"�"�'�'�(�
�e�D�k�!�n���!�!�%��t��Q���Cr!c�$�	�|r|jjsyt|�t|�|j|�}t|��	fd��	|jj�}�	|j||�ry|r t
||dtj�s|s-|j|�}|jj|�}n7||d}�	|j||�}|jj|�}||j|d<d|j|d<d|j|d<|j�dt|�jvr|j|�|jj!�y)Nc����|�`||d}t|�|�||k(r|S|j|�r|j|�}�|||�}|r|S|j|�}|��`td�y)Nr5z
nothing found)r,r�r�r�)r�r��page�
found_pager��ret�find_lookup_rowss      �rr�z@AltToolbarSidebar._model_page_inserted.<locals>.find_lookup_rows`s�����&�"�8�_�Q�/�
��j�!��)�j�D�.@�#�O��'�'��1� %� 3� 3�H� =�I�*�5�)�T�B�C��"�
� �?�?�8�4���&�"
�/�"�r!r5r�rTr�PlaylistSource)r%�
visibilityr,�iter_parentrr'r�rr�r�rr)r�__name__�
edit_playlistr<r�)
rr0r�r��parent_iterr1r�r��
searchpager�s
         @rrz&AltToolbarSidebar._model_page_insertedXs^�����
�
�-�-��
�d��
�i���'�'�	�2��
�k��	�,�>�>�0�0�2���D�N�N�H�d�;���J�u�[�'9�!�'<�')�':�':�<��!�3�3�D�9�M����-�-�m�<�I�
�{�+�A�.�J�(�����:�N�I����-�-�i�8�I�'+����y�!�!�$�')����y�!�!�$�'+����y�!�!�$������t�D�z�2�2�2�
���y�)������ r!c�0���td�d�jj_�jj|���jj���t���j���fd�}tjd|d�y)z`
           edit the playlist
        :param leaf_iter: treestore iter
        :return:
        r�Tc�V���j��j�jd�y)NT)�set_cursor_on_cellrork)r/r3rs ��rr4z0AltToolbarSidebar.edit_playlist.<locals>.delayed�s'����#�#�D�$(�$4�$4�d�6H�6H�$�
Pr!r5N)r,rkr%�editablerr-rS�convert_child_path_to_path�
grab_focusrr_)rr�r4r3s`  @rr�zAltToolbarSidebar.edit_playlist�sv���	�o��,0���� � �)��~�~�&�&�y�1���$�$�?�?��E��
�d������	P�	
� � ��G�T�2r!c�����i�|jj�}��fd���|j|���fd��|j�}�||��D] }|jj�|��"|j�y)z�
          signal from the displaytreemodel - we dont actually know what is
          deleted ... just that something has been
        :param model:
        :param path:
        :return:
        c���|�S||d�|�||d<|j|�r|j|�}�||�|j|�}|��Ryyr��r�r�r��r�r�r�r��lookups   ��rr�z?AltToolbarSidebar._model_page_deleted.<locals>.find_lookup_rows�sk����&���?�1�%�1�19�F�5��?�1�-�.��'�'��1� %� 3� 3�H� =�I�$�U�I�6� �?�?�8�4���&r!c���|�S||d�vr	�||d=|j|�r|j|�}�||�|j|�}|��Ryyr�r�)r�r�r��	find_rowsr�s   ��rr�z8AltToolbarSidebar._model_page_deleted.<locals>.find_rows�si����&���?�1�%��/��u�X��q�1�2��'�'��1� %� 3� 3�H� =�I��e�Y�/� �?�?�8�4���&r!N)rr'�remover))rr0r3r1�sourcer�r�r�s     @@@rr�z%AltToolbarSidebar._model_page_deleted�s�������>�>�0�0�2��	5�	�����2�	5��'�'�)���%��"��	2�F��N�N�!�!�&��.�1�	2�	
���r!c�p��td�	|j|j|j�\}}}}�j|d}t|�|r�d�_�jjjj|��jj��j|k(r1dt|�jv�jj_n"d�jj_|�_�fd�}t#j$d|�y#td�YyxYw)	z5
        event called when clicking on a row
        r��exitNr5Tr�Fc����i}�jD]A}�jj�j|�}|s�.�j|�||<�Ct	|��_t
�j
�yr�)rrr-�row_expandedrOrr,)r/�cat_valsrr3rs    �rr4z-AltToolbarSidebar._row_click.<locals>.delayed�sk����H� �N�N�
A���~�~�.�.�t�~�~�h�/G�H���)-�):�):�4�)@�H�X�&�
A�
!��]�D�N��$�.�.�!r!)r,�get_path_at_posr�r�rSrDr$r%r�r�r<r�rCrr�rkr�rr_)	rr��event�treepath�
treecolumn�cellx�celly�
active_objectr4s	`        rr�zAltToolbarSidebar._row_click�s
���	�l��	��&�&�u�w�w����8�
/�H�j�%���-�-�h�7��:�
�
�m���!%�D���J�J���.�.�5�5�m�D��K�K�"�"�$��&�&�-�7�$��]�(;�(D�(D�D��"�"�(�(�1�5:��"�"�(�(�1�*7��'�		"�	
� � ��G�,��=	��&�M��s�+D&�&
D5c�$���|jrd|_yi�|jj�}��fd���|j|�|�vrA|jj�|�}|j	|�|j|�yy)z�
        signal from when a page is selected in the display-page-tree -
        we need to sync with our tree
        :param display_page_tree:
        :param page:
        :return:
        FNc���|�x||d�0|�||d<t||djj�|j|�r|j	|�}�||�|j|�}|��wyyr�)r,r%r�r�r�r�r�s   ��rr�zGAltToolbarSidebar._display_page_tree_selected.<locals>.find_lookup_rowss�����&���?�1�%�1�19�F�5��?�1�-�.��%��/�!�,�2�2�7�7�8��'�'��1� %� 3� 3�H� =�I�$�U�I�6� �?�?�8�4���&r!)rDrSr'r-�expand_to_path�
set_cursor)rr�r�r1r3r�r�s     @@rr�z-AltToolbarSidebar._display_page_tree_selecteds�������!&�D������(�(�7�7�9��
	5�	��.�.��9��6�>��(�(�1�1�&��,�?�D�����%��O�O�D�!�r!c��|�y|�y||d}|�xtjj|j_||d|j_t
|jj
�||d|j_�nnd|j_|jjj}|jxr|j�|k(}|jjr�t�}	|	j|	jj �t#j"|jj�}
|	j|	jj$�|
|j_nd|j_|r*tjj|j_n)tjj&|j_d|j_|j+|�}|j-�dk(r#d|j_d|j_n"d|j_d|j_tj0j2|j_y)Nr5rrTr���)r�Weight�BOLDr%�weightrr,�visibler$r��get_playing�get_playing_sourcer�rr?r@rA�gettextr�NORMAL�ypadr-�	get_depth�xpad�
EllipsizeMode�END�	ellipsize)rrwryr0r��argr��player�playingrs�translationr3s            rrnzAltToolbarSidebar._set_text-s�������=���x���#���>�$)�L�L�$5�$5�H�N�N�!�"'��/�!�"4�H�N�N���(�.�.�%�%�&�%*�8�_�Q�%7�H�N�N�"�%)�H�N�N�"��Z�Z�%�%�2�2�F��"�"�L�v�'@�'@�'B�f�'L�
����!�!� �]��� � ����!8�!8�9�%�o�o�f�l�l�.?�.?�@��� � ������.�&1����#�&(����#��(-���(9�(9����%�(-���(;�(;����%�"#�H�N�N���~�~�h�'���>�>��q� �"#�H�N�N��"#�H�N�N��"#�H�N�N��"#�H�N�N��#(�#6�#6�#:�#:���� r!c���|jj�}|�J|jj|�|j|d<|jj|�}|��Iyy)Nr)rr'r�r�)rr�s  rr)z"AltToolbarSidebar._refresh_headersXs]���>�>�0�0�2���"����-�-�h�7�
�N�N�8�$�Q�'��~�~�/�/��9�H�	�"r!c��||d}|�d|j_nO|jj|�\}}|j	|�|j_d|j_|j|�}	|	j�dk(rd|j_	nd|j_	d|j_
y)Nr5TrFr)r%�pixbufr:�
is_controlled�	get_gicon�gicon�follow_stater-rrr
)
rrwryr0r�rr��ret_bool�
controllerr3s
          rrmzAltToolbarSidebar._set_pixbufas����x���#���>�$(�H�N�N�!�#'�<�<�#=�#=�f�#E� �H�j�#-�#7�#7��#?�H�N�N� �*.�H�N�N�'��~�~�h�'���>�>��q� �%)�H�N�N�"�&+�H�N�N�"� ����r!c��|jj|�\}}tj}|r|j	�}|j
|Sr�)r:rrr]�get_categoryr)rr�rrrs     rr�z$AltToolbarSidebar._get_category_iterusF��#�|�|�9�9�&�A���*�(�.�.���!�.�.�0�H��~�~�h�'�'r!)r��
__module__�__qualname__r�propertyrOrr9r*r�r�r�r�r�rjr(r�rr�r�r�r�rnr)rmr��
__classcell__)rzs@rrr!s���� �� � �c�:�>�I�i'�V9�6$�� B�H#�2�=�1�>D�?!�B3�&1 �f'-�R#"�J);�V:� �((r!r)r	�alttoolbar_controllerr�alttoolbar_preferencesrr�
gi.repositoryrrrr	r
rr�TreeViewr�r!r�<module>r)s:��&�7�.�+��!������\	(����\	(r!

Zerion Mini Shell 1.0