
     zc                     8    d dl Z  G d de      Z G d de      Zy)    Nc                   2    e Zd ZdZd Zd Zd Zed        Zy)StyleRuleDescriptorzStyleRule descriptor.c                     || _         y)znInitialize the StyleRuleDescriptor instance.

        :param name: The attribute name of type string

        N)name)selfr   s     @/usr/lib/python3/dist-packages/qstylizer/descriptor/stylerule.py__init__zStyleRuleDescriptor.__init__	   s     	    c                 ,   ddl }t        ||j                  j                        sJ |j	                  | j
                        9| j                  | j
                  |      }|j                  | j
                  |       |j	                  | j
                        S )zGet the value from the StyleRule's ordered dict.

        If value doesn't exist, create a new StyleRule instance and add it
        to the StyleRule's ordered dict.

        :param instance: The StyleRule instance

        r   Nr   parent)qstylizer.style
isinstancestyle	StyleRulefind_child_ruler   rule_clsset_child_rule)r   instanceargskwargs	qstylizer	new_styles         r   __get__zStyleRuleDescriptor.__get__   s~     	(IOO$=$=>>>##DII.6YY & I ##DIIy9''		22r
   c                 6   t        || j                        r9t        j                  |      }||_        |j                  | j                  |       y| j                  | j                  |      }|j                  |       |j                  | j                  |       y)ap  Set the value in the StyleRule's ordered dict.

        If the value is a StyleRule, simply add it to the ordered dict.
        Otherwise create a new StyleRule instance, set its value
        attribute to the value, and add it to the ordered dict.

        :param instance: The StyleRule instance
        :param value: The value to set in StyleRule instance

        r   N)r   r   copydeepcopy_parentr   r   setValue)r   r   valuer   s       r   __set__zStyleRuleDescriptor.__set__$   s|     eT]]+MM%(E$EM##DIIu5YY & I u%##DIIy9r
   c                 6    dd l }|j                  j                  S )Nr   )r   r   r   )r   r   s     r   r   zStyleRuleDescriptor.rule_cls;   s    (((r
   N)	__name__
__module____qualname____doc__r	   r   r!   propertyr    r
   r   r   r      s(    3&:. ) )r
   r   c                   4    e Zd ZdZeZed        Zed        Zy)StyleRuleParentzfStyleRule descriptor.

    Contains functions for getting all known attributes of the StyleRule.

    c                    i }| j                   D ]  }t        |t              s|j                  |j                  j                         D ci c]  \  }}t        ||j                        r||  c}}       |j                  |j                                 |j                  | j                  j                         D ci c]  \  }}t        || j                        r||  c}}       |S c c}}w c c}}w )zGet all of the settable attributes of the StyleRule.

        Loop through all base classes to gather all known attributes.
        Returns a dictionary with the attribute name as the key and descriptor
        as the value.

        )		__bases__
issubclassr*   update__dict__itemsr   _descriptor_clsget_attributes)cls
attributesclass_keyr    s        r   r2   zStyleRuleParent.get_attributesI   s     
mm 	7Ffo6-3__-B-B-D)sEeV%;%;< U
  f3356	7 	),););)=
%3%!4!45 J
 	 

s   #C,?#C2
c                     t        | j                         j                         D cg c]  }|j                   c}      S c c}w )z{Get all of the attribute names of the StyleRule.

        Returns a set of all possible dashcase attribute names.

        )setr2   valuesr   )r3   r    s     r   get_attr_optionsz StyleRuleParent.get_attr_optionsa   s8     %(%7%7%9%@%@%BCEUZZC
 	
Cs   A N)	r#   r$   r%   r&   r   r1   classmethodr2   r:   r(   r
   r   r*   r*   A   s4    
 *O . 
 
r
   r*   )r   objectr   r*   r(   r
   r   <module>r=      s#    8)& 8)v)
f )
r
   