Sindbad~EG File Manager
�
%ٜg�M����ddlZddlZddlZddlmZej
d�Zej
d�Zej
d�Zej
d�Z dZ
dZdZd Z
Gd
�de�ZGd�d
�Zej"Gd�d��Zd�Zd�Zd�Zd�Zd�Zd�ZGd�d�ZGd�de�ZGd�de�ZGd�de�ZGd�de�Ze�ZGd �d!e�Ze�Z Gd"�d#e�Z!e!�Z"Gd$�d%e�Z#ejHfd&�Z%ed'�ed'�ed(�ed(�ed)�ed)�ed*�ed+�ed,d-�eed.�ed.�d/�Z&y)0�N)�lockz^\s*!z#^\s*([-_a-zA-Z0-9?.*]+)\s*:\s*(.*)$z\\([ n\\]|[0-7]{3,3})z([.*]+)���c��eZdZy)�OptionErrorN)�__name__�
__module__�__qualname__���3/usr/local/lib/python3.12/site-packages/Xlib/rdb.pyrr/s��r
rc�L�eZdZdd�Zd�Zd�Zd�Zd�Zd�Zd
d�Z d �Z
d
�Zd�Zy)�
ResourceDBNc��i|_tj�|_|�|j|�|�|j |�|�|j|�yy�N)�dbr�
allocate_lock�insert_file�
insert_string�insert_resources)�self�file�string� resourcess r�__init__zResourceDB.__init__4sZ������&�&�(�� ������T�"������v�&�� ��!�!�)�,�!r
c�|�t|�turt|d�}|j|j ��y)z�insert_file(file)
Load resources entries from FILE, and insert them into the
database. FILE can be a filename (a string)or a file object.
�rN)�type�str�openr�read)rrs rrzResourceDB.insert_file?s/����:�����c�?�D����4�9�9�;�'r
c�b�|jd�}|�r|d}|d=|s�tj|�r�$|ddk(r |r|dd|dz}|d=n|dd}n |ddk(r� tj|�}|s�d|j dd�\}}t
j|�}t
dt|�d�D]9}||} t| �dk(rtt| d ��||<�/| d
k(s�5d||<�;|dj�|d<dj|�}|j||�|r��yy)zqinsert_string(data)
Insert the resources entries in the string DATA into the
database.
�
r����\N�r���n�)
�split�
comment_re�match�resource_spec_re�group�value_escape_re�range�len�chr�int�rstrip�join�insert)
r�data�lines�line�m�res�value�splits�i�ss
rrzResourceDB.insert_stringMsN���
�
�4� �����8�D��a��������%���r�(�d�"�����9�u�Q�x�/�D��a�����9�D��
�r�(�d�"�!�&�&�t�,�A�������A��J�C��%�*�*�5�1�F��1�c�&�k�1�-���1�I���q�6�Q�;� #�C��1�I��F�1�I��#�X� $�F�1�I�.� ���*�*�,�F�2�J��G�G�F�O�E��K�K��U�#�]r
c�<�|D]\}}|j||��y)ainsert_resources(resources)
Insert all resources entries in the list RESOURCES into the
database. Each element in RESOURCES should be a tuple:
(resource, value)
Where RESOURCE is a string and VALUE can be any Python value.
N)r8)rrr=r>s rrzResourceDB.insert_resources�s ��$�J�C���K�K��U�#�$r
c��tj|�}|ddk(ry|jj�|j}tdt
|�d�D]=}||dz
|vr
iif|||dz
<d||vr|||dz
d}�0|||dz
d}�?|d|vr||ddd|fz||d<nii|f||d<|jj�y)z�insert(resource, value)
Insert a resource entry into the database. RESOURCE is a
string and VALUE can be any Python value.
r%r+Nr'r�*r)�resource_parts_rer,r�acquirerr2r3�release)r�resourcer>�partsrr@s rr8zResourceDB.insert�s
��"�'�'��1����9��?��� � ����
�W�W���q�#�e�*�a�(�A��Q��U�|�2�%�$&��8��5��Q��<� ��e�A�h����a�!�e��%�a�(����a�!�e��%�a�(��)���9��?��u�R�y�M�"�1�-�� �9�B�u�R�y�M���U�O�B�u�R�y�M�� � ���r
c �2�|\}}|jd�}|jd�}t|�t|�k7rtd|�d|����t|�}g}|jj � |d|j
vr+t
|ttf|j
|d��|d|j
vr+t
|ttf|j
|d��d|j
vr(t
|ttf|j
d��|dk(rO|rM|d}|j|�r*|j�|jj�St||f��d|j
vr&t
|td|j
dd��|r�|d}|d=|j�} || tf|| tfdtffD]�\}
}|j!|
|�}|rI|j|�r,|j�c|jj�St
||�|j#|�}|s�wt
||���|r��t||f��#|jj�wxYw) z�db[name, class]
Return the value matching the resource identified by NAME and
CLASS. If no match is found, KeyError is raised.
�.z2Different number of parts in resource name/class: �/r�?r'r+r)r,r3�
ValueErrorrrFr�
bin_insert�_Match�
NAME_MATCH�CLASS_MATCH�
WILD_MATCH�finalr>rG�KeyError�match_lengthr.�
skip_match)
r�nc�name�cls�namep�clsp�complen�matches�xr@�part�scorer.s
r�__getitem__zResourceDB.__getitem__�s[��� ��c��
�
�3����y�y��~��
�u�:��T��"��Z^�`c�d�e�e��e�*����
� � ����U ��Q�x�4�7�7�"��7�F�J�>�4�7�7�5��8�;L�$M�N��A�w�$�'�'�!��7�F�K�?�D�G�G�D��G�<L�$M�N��d�g�g�~��7�F�J�>�4�7�7�3�<�$H�I�
�!�|���A�J���7�7�7�#��7�7�9�D
�I�I����A#�D�#�;�/�/�
�T�W�W�}��7�F�2�t�w�w�r�{�1�~�$>�?�$��A�J���A�J��N�N�$��%*�1�X�z�$:�%)�!�W�k�$:�%(�*�$5�$7�K�D�%�
�G�G�D�%�0�E�� �;�;�w�/�#(�;�;�=�0�
�I�I����'�w��6��L�L��1�E��"�7�E�2�%$7�!�J�D�#�;�'�'��
�I�I����s&�8CI:�-B4I:�<I:�I:�-
I:�:Jc�4� |||fS#t$r|cYSwxYw)z�get(name, class [, default])
Return the value matching the resource identified by NAME and
CLASS. If no match is found, DEFAULT is returned, or None if
DEFAULT isn't specified.
)rU)rr=rZ�defaults r�getzResourceDB.get0s*�� ���c�
�#�#��� ��N� �s� ��c��|jj�t|j|j�|jj �y)zrupdate(db)
Update this database with all resources entries in the resource
database DB.
N)rrF� update_dbrrG)rrs r�updatezResourceDB.update>s6��
� � �����$�'�'�2�5�5�!�� � ���r
c��|jj�td|j�}|jj �|S)zOoutput()
Return the resource database in text representation.
r+)rrF� output_dbrrG)r�texts r�outputzResourceDB.outputJs9��
� � ������T�W�W�%��� � �����r
c���|r=|dr8|dddk(r- ||dj|||�}|r|dr|dddk(r�-|S#t$rtd|dz��t$rtd|dz��wxYw)a,getopt(name, argv, opts)
Parse X command line options, inserting the recognised options
into the resource database.
NAME is the application name, and will be prepended to all
specifiers. ARGV is the list of command line arguments,
typically sys.argv[1:].
OPTS is a mapping of options to resource specifiers. The key is
the option flag (with leading -), and the value is an instance of
some Option subclass:
NoArg(specifier, value): set resource to value.
IsArg(specifier): set resource to option itself
SepArg(specifier): value is next argument
ResArg: resource and value in next argument
SkipArg: ignore this option and next argument
SkipLine: ignore rest of arguments
SkipNArgs(count): ignore this option and count arguments
The remaining, non-option, oparguments is returned.
rdb.OptionError is raised if there is an error in the argument list.
r�-zunknown option: %szmissing argument to option: %s)�parserUr�
IndexError)rrY�argv�optss r�getoptzResourceDB.getoptUs���6�t�A�w�4��7�1�:��#4�
N��D��G�}�*�*�4��t�<���t�A�w�4��7�1�:��#4�����
B�!�"6��a��"@�A�A��
N�!�"B�T�!�W�"L�M�M�
N�s�A�4A6)NNNr)
r r
rrrrrr8rbrerhrlrsrr
rrr3s8�� -�(�9$�x
$�%�No �b�
� �#r
rc�<�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z d�Z
y )
rPc�n�||_t|�turd|_||_yd|_||_y�Nrr')�pathr�tuple�skipr0r)rrw�dbss rrz_Match.__init__}s3���� ���9����D�I��D�J��D�I��D�Gr
c�4�|j|jk(Sr�rw�r�others r�__eq__z
_Match.__eq__�s���y�y�E�J�J�&�&r
c�4�|j|jkSrr|r}s r�__lt__z
_Match.__lt__�s���y�y�5�:�:�%�%r
c�,�t|j�Sr)r3rw�rs rrVz_Match.match_length�s���4�9�9�~�r
c�z�|jr6||jvr't|j|fz|j|�Sy||jdvr*t|j|fz|jd|�S||jdvr-t|j|dzfz|jd|�Syrv)ryrrPrwr0)rr`ras rr.z_Match.match�s����9�9��t�w�w���d�i�i�5�)�3�T�W�W�T�]�C�C���t�z�z�!�}�$��d�i�i�5�)�3�T�Z�Z��]�4�5H�I�I�����A��&��d�i�i�5�1�9�-�7����A��t�9L�M�M�r
c�2�t|j�dz|k\ry|jr5|jr(t |jt
fz|j�Sy|jdr+t |jt
fz|jd�Sy�Nr')r3rwryrrP�
MATCH_SKIPr0�rr]s rrWz_Match.skip_match�s{���t�y�y�>�A���(���9�9��w�w��d�i�i�:�.�8�$�'�'�B�B���Z�Z��]��$�)�)�z�n�4�d�j�j��m�D�D�r
c�~�|js1t|j�|k(rt|j�dkDryy)Nrr'r)ryr3rwr0r�s rrTz_Match.final�s-���y�y�S����^�w�6�3�t�z�z�?�Q�;N��r
c� �|jdS�Nr�r0r�s rr>z_Match.value�s���z�z�!�}�r
N)r r
rrrr�rVr.rWrTr>rr
rrPrP{s*�� �'�&����*�r
rPc�.�|s|j|�yd}t|�dz
}||kr3||zdz}|||kr|dz
}n|||kDr|dz}n |||k(ry||kr�3|||kr|j||�y|||kDr|j|dz|�yy)z�bin_insert(list, element)
Insert ELEMENT into LIST. LIST must be sorted, and ELEMENT will
be inserted to that LIST remains sorted. If LIST already contains
ELEMENT, it will not be duplicated.
Nrr'r)�appendr3r8)�list�element�lower�upper�centers rrOrO�s�������G���
�E���I��M�E�
�5�.��%�-�A�%���T�&�\�!��Q�J�E�
�t�F�|�
#��Q�J�E�
��V��
$���5�.���e������E�7�#� �4��;� ����E�A�I�w�'�
r
c���|j�D]b\}}||vrKt||d|d�t||d|d�t|�dkDs�C||dd|ddz||<�Ut|�||<�dy�Nrr'r)�itemsrgr3�
copy_group)�dest�src�compr0s rrgrg�s����y�y�{���e��4�<�
�d�4�j��m�U�1�X�.��d�4�j��m�U�1�X�.�
�5�z�A�~�!�$�Z���^�e�A�B�i�7��T�
�$�E�*�D��J�##r
c�F�t|d�t|d�f|ddzSr�)�copy_dbr�s rr�r��s*���E�!�H��w�u�Q�x�0�1�E�!�"�I�=�=r
c�V�i}|j�D]\}}t|�||<�|Sr)r�r�)r�newdbr�r0s rr�r��s0���E��x�x�z���e� ��'��d��"��Lr
c ���d}|j�D]\\}}t|�dkDr||�|�dt|d��d�z}|t||zdz|d�z}|t||zdz|d�z}�^|S) Nr+rz: r$rKrrDr')r�r3�
output_escaperj)�prefixrr=r�r0s rrjrjs���
�C��x�x�z���e��u�:��>����m�E�!�H�6M�N�N�C��I�f�t�m�c�1�5��8�<�<���I�f�t�m�c�1�5��8�<�<��"��Jr
c��t|�}|s|SdD]\}}|j||�}�|ddvrd|z}|ddvr|dddk7r|dddz|dz}|S)N))r&z\\)�z\000)r$z\nrz r&r%���)r �replace)r>�char�escs rr�r�s�����J�E����%� ��c��
�
�d�C�(�� %�
�Q�x�5���u����R�y�E��e�B�r�l�d�2��c�r�
�T�!�E�"�I�-���Lr
c��eZdZd�Zd�Zy)�Optionc��yrrr�s rrzOption.__init__/���r
c��yrr�rrYr�argss rrozOption.parse2r�r
N)r r
rrrorr
rr�r�.s��
�
r
r�c��eZdZdZd�Zd�Zy)�NoArgz!Value is provided to constructor.c� �||_||_yr)� specifierr>)rr�r>s rrzNoArg.__init__7s��"�����
r
c�^�|j||jz|j�|ddSr�)r8r�r>r�s rrozNoArg.parse;s(��
� � �$����'����4��A�B�x�r
N�r r
r�__doc__rrorr
rr�r�5s��+��r
r�c��eZdZdZd�Zd�Zy)�IsArgz"Value is the option string itself.c��||_yr�r��rr�s rrzIsArg.__init__A� ��"��r
c�P�|j||jz|d�|ddSrv�r8r�r�s rrozIsArg.parseD�(��
� � �$����'��a��1��A�B�x�r
Nr�rr
rr�r�?s��,�#�r
r�c��eZdZdZd�Zd�Zy)�SepArgzValue is the next argument.c��||_yrr�r�s rrzSepArg.__init__Jr�r
c�P�|j||jz|d�|ddS�Nr'rr�r�s rrozSepArg.parseMr�r
Nr�rr
rr�r�Hs��%�#�r
r�c��eZdZdZd�Zy)�ResArgClassz(Resource and value in the next argument.c�4�|j|d�|ddSr�)rr�s rrozResArgClass.parseSs��
����a��!��A�B�x�r
N�r r
rr�rorr
rr�r�Qs
��2�r
r�c��eZdZdZd�Zy)�SkipArgClassz%Ignore this option and next argument.c��|ddSr�rr�s rrozSkipArgClass.parse[s
���A�B�x�r
Nr�rr
rr�r�Ys
��/�r
r�c��eZdZdZd�Zy)�
SkipLineClasszIgnore rest of the arguments.c��gSrrr�s rrozSkipLineClass.parsebs��� r
Nr�rr
rr�r�`s
��'�r
r�c��eZdZdZd�Zd�Zy)� SkipNArgsz0Ignore this option and the next COUNT arguments.c��||_yr��count)rr�s rrzSkipNArgs.__init__is ����
r
c�&�|d|jzdSr�r�r�s rrozSkipNArgs.parsels���A��
�
�N�O�$�$r
Nr�rr
rr�r�gs��:��%r
r�c��ddlm}m}ddl}|jj|jj
|d��d}t�}|j||dd|�}|j|dz|dzd�}|j|�} | jd�jj|j|j�}
|
r
|
j }nd}t|��}|j#|�| |||fS)a!display, name, db, args = get_display_opts(options, [argv])
Parse X OPTIONS from ARGV (or sys.argv if not provided).
Connect to the display specified by a *.display resource if one is
set, or to the default X display otherwise. Extract the
RESOURCE_MANAGER property and insert all resources from ARGV.
The four return values are:
DISPLAY -- the display object
NAME -- the application name (the filname of ARGV[0])
DB -- the created resource database
ARGS -- any remaining arguments
r)�display�XatomNr'�.displayz.Display)r)�Xlibr�r��osrw�splitext�basenamerrsre�Display�screen�root�get_full_property�RESOURCE_MANAGER�STRINGr>rh)
�optionsrqr�r�r�rY�optdb�leftargv�dname�d� rdbstringr9rs
r�get_display_optsr�qs��� $�
�
�7�7���B�G�G�,�,�T�!�W�5�6�q�9�D��L�E��|�|�D�$�q�r�(�G�4�H��I�I�d�Z�'��
�):�D�A�E������A������ � �2�2�5�3I�3I�38�<�<�A�I�������� �T� "�B��I�I�e���d�B�� � r
z*backgroundz*foregroundz*fontz.namez.titlez*synchronous�onr�)z-bgz-backgroundz-fgz-foregroundz-fnz-fontz-namez-titlez-synchronousz-xrmz-displayz-d)'� functools�re�sys�Xlib.supportr�compiler-r/r1rErQrRrSr�� Exceptionrr�total_orderingrPrOrgr�r�rjr�r�r�r�r�r��ResArgr��SkipArgr��SkipLiner�rqr��stdoptsrr
r�<module>r�s���2� �
���R�Z�Z��
!�
��2�:�:�D�E���"�*�*�:�;���B�J�J�z�*���
���
�
�
�
� �)� �E�E�P
���?�?��?�L(�F+�(>����0
�
��F���F���V���&��
����6��
�.���F��
�?��%��%�&)�X�X�%!�R��'� ��/���'� ��/���/��7�O��7�O��H�%� ���6���j�)��
�#�
�r
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists