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

�

 ]e`?����ddlmZddlmZddlmZddlmZddlmZddlmZddlmZGd�d	ej�Z
Gd
�dej�ZGd�d
ej�Zy)�)�CoverLocale)�GSetting)�GLib)�GObject)�Gdk)�Gio)�Gtkc�D�eZdZdZdZdZd�Zd�Zd�Zd�Z	dd�Z
d	�Zd
�Zy)
�Repeatzn
    Object handling song repeating, with an additional feature of
    repeating one song, one song only.
    r�c��tjj|�d|_||_|j
|_|jj}|jjjd|j�|jd|j�	tjj|�}|j!d�t'||�}|j)|�|jd|j*||�|jd|j,�|j-||j/��y#t"$rt%|�}Y��wxYw#t'|�}|j)|�wxYw)zy
        :param shell: the plugin object
        :param toggle_button: button that controls the repeat functions
        F�eoszplaying-song-changed�toggled�repeat-type-changedN)r�Object�__init__�repeat_song�
toggle_button�SONG_CHANGED_MANUAL�song_changed�props�shell_player�player�connect�on_gst_player_eos�on_song_changer	�Popover�new�	set_modal�AttributeError�
CustomPopover�RepeatPopContainer�add�
_on_toggle�_on_repeat_type_changed�get_repeat_type)�self�shellrr�popover�repeats      �C/usr/lib/rhythmbox/plugins/alternative-toolbar/alttoolbar_repeat.pyrzRepeat.__init__&s7��
	������%�!���*��� �4�4������)�)��	�����#�#�E�4�+A�+A�B����-�t�/B�/B�C�		 ��k�k�o�o�m�4�G�

���e�$�'���?�F��K�K������i����'�6�J����,�d�.J�.J�K��$�$�V�V�-C�-C�-E�F���	3�#�M�2�G�	3��(���?�F��K�K���s*�"E
�E$�
E!�E$� E!�!E$�$Fc��|j�r7|j�|j�tjk(|_n|j
�d|_|j|�td|j
�y)NFz	on toggle)	�
get_active�show_allr&r"�ONE_SONGr�hide�_set_toggle_tooltip�print)r'�toggler)r*s    r+r$zRepeat._on_toggleMsk�����������&�&�(�,>�,G�,G�G�
��
�L�L�N�$�D��� � ��(�
�k�4�+�+�,�c��t�}|j|jj�|jj�rS|j
�tjk(rtd�}ntd�}|jj|�t�}|j|jj�y)N�Repeat all tracks�Repeat the current track)r�
switch_locale�Locale�
LOCALE_DOMAINr�get_has_tooltipr&r"�	ALL_SONGS�_�set_tooltip_text�RB)r'r*�cl�messages    r+r1zRepeat._set_toggle_tooltipZs���
�]��
������0�0�1����-�-�/��%�%�'�+=�+G�+G�G��/�0���6�7�����/�/��8�
�]��
��������&r4c���|jj�r#|tjk(rd|_nd|_nd|_|j|�t
d|j�y)NTFzrepeat type changed)rr-r"r/rr1r2)r'r*�repeat_types   r+r%zRepeat._on_repeat_type_changedgsZ�����(�(�*��0�9�9�9�#'�� �#(�� �$�D��� � ��(�
�#�T�%5�%5�6r4c�@�|jr|j|_yy)zs
        Set song_changed to SONG_CHANGED_EOS so that on_song_change will
        know to repeat the song.
        N)r�SONG_CHANGED_EOSr)r'�
gst_player�stream_data�earlys    r+rzRepeat.on_gst_player_eosts ��
��� $� 5� 5�D��r4c�z�|j|jk(r"|j|_|j�yy)zd
        Repeat song that has just been played
        (when called on song change signal).
        N)rrEr�do_previous)r'r�times   r+rzRepeat.on_song_change|s7��
���� 5� 5�5� $� 8� 8�D����� �6r4c�~�|jr1|j�}|dkDr||dz
k\r|jd�yyyy)zs
        This is a old method to 'repeat' the current song as soon as
        it reaches the last seconds.
        r�N)r�get_playing_song_duration�set_playing_time)r'rrK�durations    r+�on_elapsed_changezRepeat.on_elapsed_change�sO��
����7�7�9�H��!�|��8�a�<�'��+�+�A�.�(�	�r4N)r)
�__name__�
__module__�__qualname__�__doc__rrErr$r1r%rrrQ�r4r+rrs:���
����%G�N-�'�7�6�!�/r4rc�\��eZdZdejdeffiZdZdZ�fd�Z	d�Z
d�Zd�Z�xZ
S)	r"rNrrMc�
��tt|�
|i|��|jtj
j�|jtjj�d|j_|j�}|jd�d}tjjd�}|j!d�d}t"j$j'|�}	t	j(�}
|
j+|	|�d|
j_|j-|
�|j/d|j0�|j/d|j0�|j/d|j2�t5�}|j7|j8j:�|j=�r|j?tAd	��||_!|jE|�|jG|d
d�|jI�t	j(�|_%|jJj+|	|�d|jJj_tjjM|�}|j!d�d}
t"j$j'|
�}t	j(�}|j+||�d|j_|j-|�|j=�r|j?tAd
��t	j(�|_'|jNj+||�d|jNj_|j/d|j0�|j/d|j0�|j/d|j2�|jI�||_(|jE|�|jG|d
d�d|_)|j/d|j0�|j/d|j0�|j/d|j0�|j/d|j0�|j-|jJ�||_*||_+tY�|_-|jZj]|jZj^j`�|_1|jb|jZjdjf}|tjhk(r|jPjkd�yy)N��linked�Fzmedia-playlist-repeat-symboliczleave-notify-eventzenter-notify-eventrr6znon-homogeneousTz#media-playlist-repeat-song-symbolicr7r)6�superr"r�set_orientationr	�Orientation�
HORIZONTAL�
set_layout�ButtonBoxStyle�STARTr�margin�get_style_context�	add_class�RadioButtonr�set_moder�
ThemedIcon�new_with_default_fallbacks�Image�set_from_gicon�	set_imager�_on_popover_mouse_over�_on_popover_button_toggledrr8r9r:r;r>r=�_repeat_buttonr#�child_set_propertyr.�
_repeat_image�new_from_widget�_repeat_song_image�_repeat_song_button�_popover_inprogress�_parent_container�_parent_buttonr�gs�get_setting�Path�PLUGIN�plugin_settings�	PluginKey�REPEAT_TYPEr/�
set_active)r'�parent_container�
parent_button�args�kwargs�context�	icon_size�toggle1�fallback�icon�imager@�toggle2�sym�icon2�image2rC�	__class__s                 �r+rzRepeatPopContainer.__init__�s���
� �$�0�$�A�&�A����S�_�_�7�7�8�����*�*�0�0�1���
�
���(�(�*�����(�#��	��/�/�%�%�d�+�������3���~�~�8�8��B���	�	���
���T�9�-���������%� ����,�d�.I�.I�J����,�d�.I�.I�J����	�4�#B�#B�C��]��
������0�0�1��(�(�*��$�$�Q�':�%;�<�%������������):�D�A����� �Y�Y�[������)�)�$�	�:�*+���� � �'��/�/�1�1�'�:�������3�����9�9�#�>����������e�Y�/���������&�!��(�(�*��$�$�Q�'A�%B�C�"%�)�)�+������.�.�u�i�@�/0����%�%�,����,�d�.I�.I�J����,�d�.I�.I�J����	�4�#B�#B�C�����#*�� ����������):�D�A�#$�� �� � �!5�!%�!<�!<�	>�� � �!5�!%�!<�!<�	>����2�"�9�9�	;����2�"�9�9�	;�	���� 2� 2�3�!1���+����*���#�w�w�2�2�4�7�7�<�<�3F�3F�G����*�*�4�7�7�+<�+<�+H�+H�I���,�5�5�5��$�$�/�/��5�6r4c�^�td�|j��r||jk(r�|jj	|j
�|j
dtj�tj|j|jjj<y|jj	|j�|j
dtj�tj|j|jjj<yy)Nzpopover toggler)r2r-rorwrlrq�emitr"r<r|rxr}r~rsr/)r'�buttonr�s   r+rnz-RepeatPopContainer._on_popover_button_toggled�s���
���������,�,�,��#�#�-�-�d�.@�.@�A��	�	�/�1C�1M�1M�N�&�0�0��$�$�T�W�W�%6�%6�%B�%B�C��#�#�-�-�d�.E�.E�F��	�	�/�1C�1L�1L�M�&�/�/��$�$�T�W�W�%6�%6�%B�%B�C�r4c�z�tj}|jj�rtj}|S�N)r"r<rtr-r/)r'rCs  r+r&z"RepeatPopContainer.get_repeat_types0��(�2�2���#�#�.�.�0�,�5�5�K��r4c�4��|jtjjk(r��jdk(rd�_td�nd�_td�d�_t|�tjur]td�|j�rBt�j��jj�ntd�d�_�fd	�}�jdk(r)td
�d�_tjd|�yy)Nrr�enter1rM�enter2�here�exit�c�����jdk(rR�xjdz
c_�jdkry�jj�d�_t	d�yy)Nr�rrYTrzexit timeoutF)ru�_popover_inprogress_countrvr0r2)r�r's �r+�delayedz:RepeatPopContainer._on_popover_mouse_over.<locals>.delayed%s[����'�'�1�,��.�.�!�3�.��1�1�A�5���&�&�+�+�-�+,��(��n�%��r4zadding timeout�d)�typer�	EventType�ENTER_NOTIFYrur2r�r	�ToggleButtonr-rvr.r�timeout_add)r'�widget�
eventcrossingr�s`   r+rmz)RepeatPopContainer._on_popover_mouse_overs����������!;�!;�;��'�'�1�,�+,��(��h��+,��(��h��-.�D�*��F�|�s�/�/�/��f�
��$�$�&��$�0�0�1��*�*�3�3�5��&�M�'(�D�$�	��#�#�q�(��"�#�'(�D�$����S�'�*�)r4)rRrSrTr�SIGNAL_RUN_LAST�int�__gsignals__r/r<rrnr&rm�
__classcell__�r�s@r+r"r"�s@����� 7� 7���v�F��L�
�H��I�V6�p0��$+r4r"c�:��eZdZ�fd�Z�fd�Zd�Zd�Zd�Z�xZS)r!c���tt|�
|dtjj
i|��|j
d�|jd�|jtjj�|j�||_
|jd|j�|j!d|j"�y)Nr�F�showzconfigure-event)r\r!rr	�
WindowType�POPUP�
set_decorated�
set_resizable�
set_type_hintr�WindowTypeHint�DOCK�stickrw�
connect_after�_on_showr�on_window_config)r'r�r�r�r�s    �r+rzCustomPopover.__init__:s����
�m�T�+��	6����1E�1E�	6�.4�	6�	
���5�!����5�!����3�-�-�2�2�3��
�
��+������6�4�=�=�1����&��(=�(=�>r4c����tj�|_|jj|�tt
|�|j�|jj
�yr�)r	�Frame�_framer#r\r!r.)r'r�r�s  �r+r#zCustomPopover.addGsC����i�i�k����������
�m�T�&�t�{�{�3������r4c�T�|jj�}|jj�}|j�j	�\}}}||j
z}||jz|jz}|j||�\}	}
|j|	|
�yr�)
rw�get_allocation�get_toplevel�
get_window�
get_origin�x�y�height�apply_screen_coord_correction�move)r'r��rect�main_window�val�win_x�win_y�cal_x�cal_yr�r�s           r+r�zCustomPopover._on_showgs����"�"�1�1�3���)�)�6�6�8��)�4�4�6�A�A�C���e�U���������������,���3�3�E�5�A���A��	�	�!�Q�r4c��|}|}|j�}tjj�}tjj	�}|||jzz
}|||jzz
}	|dkr||z
}td�|dkrd}|jj�}
|jj�j�\}}||
j|
jdzzz
}
|	dks|
dkrA|jj�j}||jz
|z
}td�|dkrd}||gS)Nrzat xrMzat y)
r�r�Screen�widthr�r2rwr��get_sizer�)r'r�r��corrected_y�corrected_xr��screen_w�screen_h�delta_x�delta_y�button_rect�window_width�
window_height�calc�btn_hgts               r+r�z+CustomPopover.apply_screen_coord_correctionys5�������"�"�$���:�:�#�#�%���:�:�$�$�&���a�$�*�*�n�-���a�$�+�+�o�.���Q�;��7�"�K��&�M���?��K��)�)�8�8�:�����,�,�.�7�7�9�	$��m�����+�2D�2D�q�2H�!I�J���Q�;�4�!�8��)�)�8�8�:�A�A�G��d�k�k�/�G�3�K��&�M���?��K��[�)�)r4c��|j�r�|jj�}|jj�}|j	�j�\}}}||jz}||jz|jz}	|j�|j||	�\}
}|j|
|�yyr�)�
get_mappedrwr�r�r�r�r�r�r�r.r�r�)r'r��eventr�r�r�r�r�r�r�r�r�s            r+r�zCustomPopover.on_window_config�s����?�?���&�&�5�5�7�D��-�-�:�:�<�K�"-�"8�"8�":�"E�"E�"G��S�%���D�F�F�N�E��D�F�F�N�T�[�[�0�E��M�M�O��7�7��u�E�F�Q���I�I�a��O�r4)	rRrSrTrr#r�r�r�r�r�s@r+r!r!9s���?��@�$*�>r4r!N)�alttoolbar_preferencesrr�
gi.repositoryrrrrr	rr�	ButtonBoxr"�Windowr!rVr4r+�<module>r�sT��(/�+��!����|/�W�^�^�|/�~Z+����Z+�zj�C�J�J�jr4

Zerion Mini Shell 1.0