%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/xdg/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/xdg/__pycache__/DesktopEntry.cpython-312.pyc

�

�u�c6D��f�dZddlmZmZddlZddlmZddlm	Z	ddl
ZddlZddl
Z
Gd�de�Zy)a/
Complete implementation of the XDG Desktop Entry Specification
http://standards.freedesktop.org/desktop-entry-spec/

Not supported:
- Encoding: Legacy Mixed
- Does not check exec parameters
- Does not check URL's
- Does not completly validate deprecated/kde items
- Does not completly check categories
�)�IniFile�is_asciiN)�ParsingError)�whichc�`�eZdZdZdZd;d�Zd�Zd�Zd�Zd�Z	d	�Z
d
�Zd�Zd�Z
d
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z d �Z!d!�Z"d"�Z#d#�Z$d$�Z%d%�Z&d&�Z'd'�Z(d(�Z)d)�Z*d*�Z+d+�Z,d,�Z-d-�Z.d.�Z/d/�Z0d0�Z1d1�Z2d2�Z3d3�Z4d4�Z5d5�Z6d6�Z7d7�Z8d8�Z9d9�Z:d:�Z;y)<�DesktopEntryz+Class to parse and validate Desktop Entries�
Desktop EntryNc��t�|_|r1tjj	|�r|j|�y|r|j
|�yy)z�Create a new DesktopEntry.
        
        If filename exists, it will be parsed as a desktop entry file. If not,
        or if filename is None, a blank DesktopEntry is created.
        N)�dict�content�os�path�exists�parse�new)�self�filenames  �2/usr/lib/python3/dist-packages/xdg/DesktopEntry.py�__init__zDesktopEntry.__init__s?���v���������x�0��J�J�x� �
��H�H�X���c�"�|j�S�N)�getName�rs r�__str__zDesktopEntry.__str__&s���|�|�~�rc�6�tj||ddg�y)z�Parse a desktop entry file.
        
        This can raise :class:`~xdg.Exceptions.ParsingError`,
        :class:`~xdg.Exceptions.DuplicateGroupError` or
        :class:`~xdg.Exceptions.DuplicateKeyError`.
        r	�KDE Desktop EntryN)rr)r�files  rrzDesktopEntry.parse)s��	�
�
�d�D�?�4G�"H�Irc�>�|jdd��}t|�S)z�Looks in the PATH for the executable given in the TryExec field.
        
        Returns the full path to the executable if it is found, None if not.
        Raises :class:`~xdg.Exceptions.NoKeyError` if TryExec is not present.
        �TryExecT)�strict)�getr)r�tryexecs  r�findTryExeczDesktopEntry.findTryExec2s ���(�(�9�T�(�2���W�~�rc�$�|jd�S)N�Type�r"rs r�getTypezDesktopEntry.getType<����x�x���rc�(�|jdd��S)z)deprecated, use getVersionString instead �Version�numeric��typer'rs r�
getVersionzDesktopEntry.getVersion>s���x�x�	�	�x�2�2rc�$�|jd�S)Nr+r'rs r�getVersionStringzDesktopEntry.getVersionStringA����x�x�	�"�"rc�(�|jdd��S)N�NameT��localer'rs rrzDesktopEntry.getNameC����x�x��t�x�,�,rc�(�|jdd��S)N�GenericNameTr5r'rs r�getGenericNamezDesktopEntry.getGenericNameE����x�x�
�d�x�3�3rc�(�|jdd��S)N�	NoDisplay�booleanr-r'rs r�getNoDisplayzDesktopEntry.getNoDisplayGs���x�x��)�x�4�4rc�(�|jdd��S)N�CommentTr5r'rs r�
getCommentzDesktopEntry.getCommentIs���x�x�	�$�x�/�/rc�(�|jdd��S)N�IconTr5r'rs r�getIconzDesktopEntry.getIconKr7rc�(�|jdd��S)N�Hiddenr>r-r'rs r�	getHiddenzDesktopEntry.getHiddenMs���x�x��y�x�1�1rc�(�|jdd��S)N�
OnlyShowInT��listr'rs r�
getOnlyShowInzDesktopEntry.getOnlyShowInO����x�x��4�x�0�0rc�(�|jdd��S)N�	NotShowInTrKr'rs r�getNotShowInzDesktopEntry.getNotShowInQ����x�x��$�x�/�/rc�$�|jd�S)Nr r'rs r�
getTryExeczDesktopEntry.getTryExecSr2rc�$�|jd�S)N�Execr'rs r�getExeczDesktopEntry.getExecUr)rc�$�|jd�S)N�Pathr'rs r�getPathzDesktopEntry.getPathWr)rc�(�|jdd��S)N�Terminalr>r-r'rs r�getTerminalzDesktopEntry.getTerminalY����x�x�
��x�3�3rc�*�|jddd��S)z%deprecated, use getMimeTypes instead �MimeTypeT�regex)rLr.r'rs r�getMimeTypezDesktopEntry.getMimeType[s���x�x�
��G�x�<�<rc�(�|jdd��S)Nr`TrKr'rs r�getMimeTypeszDesktopEntry.getMimeTypes^s���x�x�
��x�.�.rc�(�|jdd��S)N�
CategoriesTrKr'rs r�
getCategorieszDesktopEntry.getCategories`rNrc�(�|jdd��S)N�
StartupNotifyr>r-r'rs r�getStartupNotifyzDesktopEntry.getStartupNotifybs���x�x��i�x�8�8rc�$�|jd�S)N�StartupWMClassr'rs r�getStartupWMClasszDesktopEntry.getStartupWMClassds���x�x�(�)�)rc�$�|jd�S)N�URLr'rs r�getURLzDesktopEntry.getURLf����x�x���rc�(�|jdd��S)N�ServiceTypesTrKr'rs r�getServiceTypeszDesktopEntry.getServiceTypesks���x�x��T�x�2�2rc�$�|jd�S)N�DocPathr'rs r�
getDocPathzDesktopEntry.getDocPathmr2rc�*�|jddd��S)N�KeywordsT)rLr6r'rs r�getKeywordszDesktopEntry.getKeywordsos���x�x�
��d�x�;�;rc�$�|jd�S)N�InitialPreferencer'rs r�getInitialPreferencez!DesktopEntry.getInitialPreferenceqs���x�x�+�,�,rc�$�|jd�S)N�Devr'rs r�getDevzDesktopEntry.getDevsrqrc�$�|jd�S)N�FSTyper'rs r�	getFSTypezDesktopEntry.getFSTypeus���x�x��!�!rc�$�|jd�S)N�
MountPointr'rs r�
getMountPointzDesktopEntry.getMountPointw����x�x��%�%rc�(�|jdd��S)N�ReadOnlyr>r-r'rs r�getReadonlyzDesktopEntry.getReadonlyyr^rc�(�|jdd��S)N�UnmountIconTr5r'rs r�getUnmountIconzDesktopEntry.getUnmountIcon{r;rc�(�|jdd��S)N�MiniIconTr5r'rs r�getMiniIconzDesktopEntry.getMiniIcon�s���x�x�
�4�x�0�0rc�$�|jd�S)N�TerminalOptionsr'rs r�getTerminalOptionszDesktopEntry.getTerminalOptions�s���x�x�)�*�*rc�$�|jd�S)N�
DefaultAppr'rs r�
getDefaultAppzDesktopEntry.getDefaultApp�r�rc�(�|jdd��S)N�	ProtocolsTrKr'rs r�getProtocolszDesktopEntry.getProtocols�rRrc�(�|jdd��S)N�
ExtensionsTrKr'rs r�
getExtensionszDesktopEntry.getExtensions�rNrc�$�|jd�S)N�
BinaryPatternr'rs r�getBinaryPatternzDesktopEntry.getBinaryPattern�s���x�x��(�(rc�$�|jd�S)N�	MapNotifyr'rs r�getMapNotifyzDesktopEntry.getMapNotify�s���x�x��$�$rc�$�|jd�S)N�Encodingr'rs r�getEncodingzDesktopEntry.getEncoding�s���x�x�
�#�#rc�(�|jdd��S)N�SwallowTitleTr5r'rs r�getSwallowTitlezDesktopEntry.getSwallowTitle�s���x�x��t�x�4�4rc�$�|jd�S)N�SwallowExecr'rs r�getSwallowExeczDesktopEntry.getSwallowExec�s���x�x�
�&�&rc�(�|jdd��S)N�	SortOrderTrKr'rs r�getSortOrderzDesktopEntry.getSortOrder�rRrc�(�|jdd��S)N�FilePatternrar-r'rs r�getFilePatternzDesktopEntry.getFilePattern�s���x�x�
�G�x�4�4rc�(�|jdd��S)N�ActionsTrKr'rs r�
getActionszDesktopEntry.getActions�s���x�x�	��x�-�-rc�B�tjj|�ddk(rd}n4tjj|�ddk(rd}ntd|��t	�|_|j
|j�|jd|�||_	y)	a$Make this instance into a new, blank desktop entry.
        
        If filename has a .desktop extension, Type is set to Application. If it
        has a .directory extension, Type is Directory. Other extensions will
        cause :class:`~xdg.Exceptions.ParsingError` to be raised.
        ��.desktop�Application�
.directory�	DirectoryzUnknown extensionr&N)
r
r�splitextrrr�addGroup�defaultGroup�setr)rrr.s   rrzDesktopEntry.new�s����7�7���H�%�a�(�J�6� �D�
�W�W�
�
�h�
'��
*�l�
:��D��2�H�=�=��v����
�
�d�'�'�(������� ��
rc�P�|jdk(r|jjd�|jdk(r|jjd�n9|jdk7r*|jdk7r|jjd�	|j|jd|_	|j|jd
|_y#t$r|jjd	�Y�IwxYw#t$r|jjd�YywxYw)Nrz([KDE Desktop Entry]-Header is deprecatedz.kdelnkz$File extension .kdelnk is deprecatedr�r�zUnknown File extensionr&zKey 'Type' is missingr4zKey 'Name' is missing)	r��warnings�append�
fileExtensionrr.�KeyError�errors�namers r�checkExtraszDesktopEntry.checkExtras�s������ 3�3��M�M� � �!K�L�����*��M�M� � �!G�H�
�
�
�:�
-�$�2D�2D��2T��M�M� � �!9�:�	8����T�%6�%6�7��?�D�I�
	8����T�%6�%6�7��?�D�I���	8��K�K���6�7�	8���	8��K�K���6�7�	8�s$�!C�2!C>�$C;�:C;�>$D%�$D%c�L�||jk(sVtjd|�s@tjd|�rt|�s|jjd|z�yd|j|vr.d|j|vr|jjd�yyy)Nz^Desktop Action [a-zA-Z0-9-]+$z^X-zInvalid Group name: %srJrPz;Group may either have OnlyShowIn or NotShowIn, but not both)r��re�matchrr�r�r)r�groups  r�
checkGroupzDesktopEntry.checkGroup�s�����*�*�*�
�8�8�4�e�<��H�H�U�E�"�x����K�K���7�%�?�@�����U� 3�3�+����V[�I\�:\����"�"�#`�a�;]�3rc�V�|dk(�rC|dk(s
|dk(s|dk(r|jjd|z�nN|dk(r|jjd�n-|dk(s(|d	k(s#|d
k(s|jjd|z�|jdk(r$|d
k(s|jjd
|z�n/|jdk(r |d
k(r|jjd�|dk(r,d|j|vr|jjd�|d	k(r.d|j|vr|jjd�yyy|dk(r|j||�yt
jdtjjzdz|�ryt
jdtjjzdz|�ry|dk(r|j||d��yt
jdtjjzdz|�ryt
jdtjjzdz|�r|j||�y|dk(r|j||d��y|dk(r&|j||d� �|j|�y|d!k(r&|j||d� �|j|�y|d"k(r%|j||�|j|d�y|dk(r%|j||�|j|d�y|d#k(r%|j||�|j|d�y|d$k(r'|j||d��|j|d�y|d%k(r'|j||d� �|j|d�y|dk(r'|j||d� �|j|d�y|d&k(r6|j||�|j|d�|j|�yt
jd'tjjzdz|�r(|j||d(d�)�|j|d�y|d*k(r'|j||d��|j|d�y|d+k(r|j|d�y|dk(r%|j||�|j|d�y|d,k(r3|j||d� �|jjd-|z�y|d.k(r1|j||�|jjd-|z�y|d/k(r3|j||d0��|jjd-|z�y|d1k(rC|j||�|j|d�|jjd-|z�y|d2k(rC|j||�|j|d�|jjd-|z�y|d3k(rC|j||�|j|d�|jjd-|z�y|d4k(rE|j||d��|j|d�|jjd-|z�yt
jd5tjjzdz|�rC|j||�|j|d�|jjd-|z�y|d6k(r1|j||�|jjd7|z�yt
jd8tjjzdz|�r1|j||�|jjd7|z�y|d9k(r1|j||�|jjd7|z�y|d:k(r1|j||�|jjd7|z�y|d;k(r3|j||d� �|jjd7|z�y|d<k(r3|j||d� �|jjd7|z�y|d=k(r1|j||�|jjd7|z�y|d>k(r1|j||�|jjd7|z�yt
jd?tjjzdz|�r|jjd7|z�y|d@k(r1|j||�|jjd7|z�y|dAk(r4|j||dBd�)�|jjd7|z�y|dCk(r3|j||d� �|jjd7|z�yt
jdD|�ry|jjdE|z�y)FNr&�ServiceType�Service�FSDevicezType=%s is a KDE extensionr`zType=MimeType is deprecatedr��Linkr�zGValue of key 'Type' must be Application, Link or Directory, but is '%s'r�z.File extension is .directory, but Type is '%s'r�z>Files with Type=Directory should have the extension .directoryrVz!Type=Application needs 'Exec' keyrozType=Link needs 'URL' keyr+z^Name�$z^GenericNamer=r>r-z^Commentz^IconrGrJTrKrPr rYr\r�rfz	^Keywords�localestring)r.rLrirlrszKey '%s' is a KDE extensionrvr|r,rr�r�r�z^UnmountIconr�zKey '%s' is deprecatedz	^MiniIconr�r�r�r�r�r�z
^SwallowTitler�r�rar�z^X-[a-zA-Z0-9-]+zInvalid key: %s)r�r�r�r�r�
checkValuer�r��xdg�Localera�checkOnlyShowIn�	checkType�checkCategories)r�key�valuer�s    r�checkKeyzDesktopEntry.checkKey�s����&�=��
�%��)�);�u�
�?R��
�
�$�$�%A�C�%G�H��*�$��
�
�$�$�%B�C��}�,����5�K�CW����"�"�#l�ot�#t�u��!�!�\�1�%�;�:N��
�
�$�$�%U�X]�%]�^��#�#�z�1�e�{�6J��
�
�$�$�%e�f��
�%�����e�!4�4��M�M�(�(�)L�M��������U� 3�3��M�M�(�(�)D�E�4���I�
��O�O�C��'�
�X�X�g�c�j�j�.�.�.�s�2�C�
8��
�X�X�n�S�Z�Z�%5�%5�5�c�9�3�
?��
�K�
��O�O�C��Y�O�7�
�X�X�j����!1�!1�1�#�5�s�
;��
�X�X�g�c�j�j�.�.�.�s�2�C�
8��O�O�C��'�
�H�_��O�O�C��Y�O�7�
�L�
 ��O�O�C��T�O�2�� � ��'�
�K�
��O�O�C��T�O�2�� � ��'�
�I�
��O�O�C��'��N�N�3�
�.�
�F�]��O�O�C��'��N�N�3�
�.�
�F�]��O�O�C��'��N�N�3�
�.�
�J�
��O�O�C��Y�O�7��N�N�3�
�.�
�I�
��O�O�C��T�O�2��N�N�3�
�.�
�J�
��O�O�C��T�O�2��N�N�3�
�.�
�L�
 ��O�O�C��'��N�N�3�
�.�� � ��'�
�X�X�k�#�*�*�"2�"2�2�3�6��
<��O�O�C��^�$�O�G��N�N�3�
�.�
�O�
#��O�O�C��Y�O�7��N�N�3�
�.�
�$�
$��N�N�3�
�.�
�E�\��O�O�C��'��N�N�3��&��N�
"��O�O�C��T�O�2��M�M� � �!>��!D�E�
�I�
��O�O�C��'��M�M� � �!>��!D�E�
�'�
'��O�O�C��Y�O�7��M�M� � �!>��!D�E�
�E�\��O�O�C��'��N�N�3�
�+��M�M� � �!>��!D�E�
�H�_��O�O�C��'��N�N�3�
�+��M�M� � �!>��!D�E�
�L�
 ��O�O�C��'��N�N�3�
�+��M�M� � �!>��!D�E�
�J�
��O�O�C��Y�O�7��N�N�3�
�+��M�M� � �!>��!D�E�
�X�X�n�S�Z�Z�%5�%5�5�c�9�3�
?��O�O�C��'��N�N�3�
�+��M�M� � �!>��!D�E��J�
��O�O�C��'��M�M� � �!9�C�!?�@�
�X�X�k�#�*�*�"2�"2�2�3�6��
<��O�O�C��'��M�M� � �!9�C�!?�@�
�%�
%��O�O�C��'��M�M� � �!9�C�!?�@�
�L�
 ��O�O�C��'��M�M� � �!9�C�!?�@�
�K�
��O�O�C��T�O�2��M�M� � �!9�C�!?�@�
�L�
 ��O�O�C��T�O�2��M�M� � �!9�C�!?�@�
�O�
#��O�O�C��'��M�M� � �!9�C�!?�@�
�K�
��O�O�C��'��M�M� � �!9�C�!?�@�
�X�X�o�c�j�j�&6�&6�6�s�:�C�
@��M�M� � �!9�C�!?�@�
�M�
!��O�O�C��'��M�M� � �!9�C�!?�@�
�M�
!��O�O�C��W�4�O�@��M�M� � �!9�C�!?�@�
�K�
��O�O�C��T�O�2��M�M� � �!9�C�!?�@��X�X�(�#�
.��
�K�K���0�3�6�7rc�n�|j�|k(s"|jjd|�d|���yy)NzKey 'z' only allowed in Type=)r(r�r�)rr�r.s   rr�zDesktopEntry.checkType�s,���|�|�~��%��K�K���S�$�O�P�&rc��|j|�}gd�}|D].}||vs�|dddk7s�|jjd|z��0y)N)
�GNOME�KDE�LXDE�MATE�Razor�ROX�TDE�Unity�XFCE�Oldr��X-z)'%s' is not a registered OnlyShowIn value)�getListr�r�)rr��values�valid�items     rr�zDesktopEntry.checkOnlyShowIn�sV�����e�$�� ���	X�D��5� �T�!�A�Y�$�%6����"�"�#N�QU�#U�V�	Xrc���|j|�}gd��t�fd�|D��s|jjd�gd�}|�z}|D]7}||vs�|j	d�r�|jjd|z��9y)N)
�
AudioVideo�Audio�Video�Development�	Education�Game�Graphics�Network�Office�Science�Settings�System�Utilityc3�&�K�|]}|�v���
y�wr�)�.0r��mains  �r�	<genexpr>z/DesktopEntry.checkCategories.<locals>.<genexpr>�s�����3�D�4�4�<�3�s�zMissing main category)~�Building�Debugger�IDE�GUIDesigner�	Profiling�RevisionControl�Translation�Calendar�ContactManagement�Database�
Dictionary�Chart�Email�Finance�	FlowChart�PDA�ProjectManagement�Presentation�Spreadsheet�
WordProcessor�
2DGraphics�VectorGraphics�RasterGraphics�
3DGraphics�Scanning�OCR�Photography�
Publishing�Viewer�	TextTools�DesktopSettings�HardwareSettings�Printing�PackageManager�Dialup�InstantMessaging�Chat�	IRCClient�Feed�FileTransfer�HamRadio�News�P2P�RemoteAccess�	Telephony�TelephonyTools�VideoConference�
WebBrowser�WebDevelopment�Midi�Mixer�	Sequencer�Tuner�TV�AudioVideoEditing�Player�Recorder�DiscBurning�
ActionGame�
AdventureGame�
ArcadeGame�	BoardGame�
BlocksGame�CardGame�KidsGame�	LogicGame�RolePlaying�Shooter�
Simulation�
SportsGame�StrategyGame�Art�Construction�Music�	Languages�ArtificialIntelligence�	Astronomy�Biology�	Chemistry�ComputerScience�DataVisualization�Economy�Electricity�	Geography�Geology�
Geoscience�History�
Humanities�ImageProcessing�
Literature�Maps�Math�NumericalAnalysis�MedicalSoftware�Physics�Robotics�Spirituality�Sports�ParallelComputing�	Amusement�	Archiving�Compression�Electronics�Emulator�Engineering�	FileTools�FileManager�TerminalEmulator�
Filesystem�Monitor�Security�
Accessibility�
Calculator�Clock�
TextEditor�
Documentation�Adult�Corer�r�r��GTK�Qt�Motif�Java�ConsoleOnlyr�z!'%s' is not a registered Category)r��anyr�r��
startswith)rr�r��
additional�
allcategoriesr�r�s      @rr�zDesktopEntry.checkCategories�s�������e�$��a���3�F�3�3��K�K���6�7�c�
�"�T�)�
��	P�D��=�(�����1F����"�"�#F��#M�N�	Prc�X�tjdt�|j|�S)z`Deprecated alias for checkCategories - only exists for backwards
        compatibility.
        z1checkCategorie is deprecated, use checkCategories)r��warn�DeprecationWarningr�)rr�s  r�checkCategoriezDesktopEntry.checkCategorie�s(��	�
�
�I�<N�	P��#�#�E�*�*rr)<�__name__�
__module__�__qualname__�__doc__r�rrrr$r(r/r1rr:r?rBrErHrMrQrTrWrZr]rbrdrgrjrmrprtrwrzr}r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rr�r�r�r�r�r�r�r�rrrrs$��1�"�L�
��J�� �3�#�-�4�5�0�-�2�1�0�#� � �4�=�/�1�9�*��
3�#�<�-��"�&�4�4�
1�+�&�0�1�)�%�$�5�'�0�5�.�
!�*8�.	b�z8�xQ�X�P�+rr)r��xdg.IniFilerr�
xdg.Localer��xdg.Exceptionsr�xdg.utilr�os.pathr
r�r�rr�rr�<module>r�s/��
�*��'���	��[+�7�[+r

Zerion Mini Shell 1.0