
ѫYc           @   s  d  d l  Z  d  d l Z d  d l Z d  d l Z y d  d l m Z m Z Wn e k
 r y d  d l	 m Z m Z Wq e k
 r y d  d l
 m Z m Z Wq e k
 r d  d l m Z m Z q Xq Xn Xd  d l m Z d  d l m Z d  d l m Z e j e  Z e j Z e  j d k  r3d	   Z n  d a d a d
   Z d   Z d e f d     YZ d e  f d     YZ! d e  f d     YZ" d S(   iN(   t   parset
   SubElement(   t   NoSuchWidgetError(   t   QObjectCreator(   t
   Propertiesi   i   i    c         c   s4   x- t  t |   d d d  D] } |  | Vq Wd  S(   Ni   i(   t   xranget   len(   t   seqt   i(    (    s6   /usr/lib/python2.7/dist-packages/PyQt4/uic/uiparser.pyt   reversedC   s    #c         C   sj   d } x] |  j d  D]L } | j d  \ } } t t j |  } | d k rX | } q | | O} q W| S(   s5    Convert a C++ alignment to the corresponding flags. t   |s   ::N(   t   Nonet   splitt   getattrt   QtCoret   Qt(   t	   alignmentt   align_flagst   qt_alignt   _t   align(    (    s6   /usr/lib/python2.7/dist-packages/PyQt4/uic/uiparser.pyt   _parse_alignmentK   s    	c         C   s   |  j  j d  } |  j  j d  } |  j  j d  } | d k sN | d k rn | d k r^ d	 Sd t |  f St |  } t |  } t |  j  j d d   } t |  j  j d d   } | d k r | | | | f S| | | | t |  f S(
   s    Return either (), (0, alignment), (row, column, rowspan, colspan) or
    (row, column, rowspan, colspan, alignment) depending on the type of layout
    and its configuration.  The result will be suitable to use as arguments to
    the layout.
    t   rowt   columnR   i    t   rowspani   t   colspanN(    (   t   attribt   getR   R   t   int(   t   elemR   R   R   R   R   (    (    s6   /usr/lib/python2.7/dist-packages/PyQt4/uic/uiparser.pyt   _layout_position[   s    t   WidgetStackc           B   sD   e  Z d Z d    Z d   Z d   Z d   Z d   Z d   Z	 RS(   c         C   sU   t  d | j   j   | j   f  |  j |  t | t j  rQ | |  _ n  d  S(   Ns
   push %s %s(	   t   DEBUGt
   metaObjectt	   classNamet
   objectNamet   appendt
   isinstancet   QtGuit   QWidgett	   topwidget(   t   selft   item(    (    s6   /usr/lib/python2.7/dist-packages/PyQt4/uic/uiparser.pyt   push|   s
    c         C   s9   t  j |   } t d | j   j   | j   f  | S(   Ns   pop layout %s %s(   t   listt   popR    R!   R"   R#   (   R)   t   layout(    (    s6   /usr/lib/python2.7/dist-packages/PyQt4/uic/uiparser.pyt	   popLayout   s    c         C   s   t  j |   } t d | j   j   | j   f  x< t |   D]% } t | t j	  rB | |  _
 PqB qB Wd  |  _
 t d |  j
 f  | S(   Ns   pop widget %s %ss   new topwidget %s(   R,   R-   R    R!   R"   R#   R	   R%   R&   R'   R(   R   (   R)   t   widgetR*   (    (    s6   /usr/lib/python2.7/dist-packages/PyQt4/uic/uiparser.pyt	   popWidget   s    		c         C   s   |  d S(   Ni(    (   R)   (    (    s6   /usr/lib/python2.7/dist-packages/PyQt4/uic/uiparser.pyt   peek   s    c         C   s   t  |  d t j  S(   Ni(   R%   R&   t   QLayout(   R)   (    (    s6   /usr/lib/python2.7/dist-packages/PyQt4/uic/uiparser.pyt   topIsLayout   s    c         C   sJ   t  |  d  t j k	 r t St |   d k  r3 t St  |  d  t j k	 S(   Nii   i(   t   typeR&   R'   t   FalseR   t   QMainWindow(   R)   (    (    s6   /usr/lib/python2.7/dist-packages/PyQt4/uic/uiparser.pyt   topIsLayoutWidget   s
    N(
   t   __name__t
   __module__R   R(   R+   R/   R1   R2   R4   R8   (    (    (    s6   /usr/lib/python2.7/dist-packages/PyQt4/uic/uiparser.pyR   z   s   					t   ButtonGroupc           B   s   e  Z d  Z d   Z RS(   sM    Encapsulate the configuration of a button group and its implementation.
    c         C   s   t  |  _ d |  _ d S(   s    Initialise the button group. N(   t   Truet	   exclusiveR   t   object(   R)   (    (    s6   /usr/lib/python2.7/dist-packages/PyQt4/uic/uiparser.pyt   __init__   s    	(   R9   R:   t   __doc__R?   (    (    (    s6   /usr/lib/python2.7/dist-packages/PyQt4/uic/uiparser.pyR;      s   t   UIParserc           B   s  e  Z d    Z d   Z d   Z e d  Z d   Z d   Z d   Z	 d   Z
 d   Z d	   Z d
   Z d   Z d   Z d   Z e d    Z d   Z d   Z d   Z d   Z d   Z i
 e d 6e d 6e d 6e
 d 6e d 6e d 6e d 6e d 6e d 6e d 6Z 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- d.  Z( e d/    Z) RS(0   c         C   sA   t  |  |  _ t |  j | |  |  _ | a | a |  j   d  S(   N(   R   t   factoryR   t   wpropsR   R&   t   reset(   R)   t   QtCoreModulet   QtGuiModulet   creatorPolicy(    (    s6   /usr/lib/python2.7/dist-packages/PyQt4/uic/uiparser.pyR?      s
    c         C   sX   y |  j  | } Wn t k
 r2 d |  j  | <| SX| d 7} | |  j  | <d | | f S(   s   UIParser.uniqueName(string) -> string

        Create a unique name from a string.
        >>> p = UIParser(QtCore, QtGui)
        >>> p.uniqueName("foo")
        'foo'
        >>> p.uniqueName("foo")
        'foo1'
        i    i   s   %s%i(   t   name_suffixest   KeyError(   R)   t   namet   suffix(    (    s6   /usr/lib/python2.7/dist-packages/PyQt4/uic/uiparser.pyt
   uniqueName   s    

c         C   s   y |  j  j   Wn t k
 r$ n Xd  |  _ t   |  _ i  |  _ i d d 6d d 6|  _ g  |  _	 d  |  _
 g  |  _ i  |  _ d  S(   Nit   spacingt   margin(   RC   RD   t   AttributeErrorR   t   toplevelWidgetR   t   stackRH   t   defaultst   actionst   currentActionGroupt	   resourcest   button_groups(   R)   (    (    s6   /usr/lib/python2.7/dist-packages/PyQt4/uic/uiparser.pyRD      s      					c         C   s   |  j  | j j d  p% | d j    } | d  k r@ d } n	 | f } |  j j | | | |  } |  j j | |  | j	 |  | r t
 |  j | |  n  | S(   NRJ   i   (    (   RL   R   R   t   lowerR   RB   t   createQObjectRC   t   setPropertiest   setObjectNamet   setattrRP   (   R)   t   clsnamet   parentt   brancht   is_attributeRJ   t   argst   obj(    (    s6   /usr/lib/python2.7/dist-packages/PyQt4/uic/uiparser.pyt   setupObject   s    +		c         C   s5   x. | j  d  D] } | j d | k r | Sq Wd  S(   Nt   propertyRJ   (   t   findallR   R   (   R)   R   RJ   t   prop(    (    s6   /usr/lib/python2.7/dist-packages/PyQt4/uic/uiparser.pyt   getProperty   s    c      	   C   s  d |  _  d |  _ d |  _ g  |  _ d  |  _ | j d j d d  } | d k r[ d } n  |  j j	 } t
 | t j t j t j t j t j t j t j f  r d  } n  |  j j |  j | | |   t
 |  j j	 t j  r]|  j | d  d  k r|  j j	 j t | j d    n  |  j | d	  d  k r]|  j j	 j t | j d
    q]n  |  j |  |  j j   } t
 | t j  r|  j | d | j    nzt
 | t j   r|  j | d | j!    |  j | d | j"    n3t
 | t j#  r!|  j$ j% | d  } | d  k	 r!y | j& } Wn t' k
 rMt( |  } n X| s]d } n  y |  j) | } Wn% t* k
 rt+   } |  j) | <n X| j, d  k r|  j- j. d | |  j/ f  | _, t0 |  j/ | | j,  | j, j1 |  | j2 s| j, j3 t4  qn  | j, j5 |  q!n  |  j d  k	 rL| j6 |  j  d  |  _ n  |  j j7   r|  j j8   } | j d }	 t
 | t j9  r| j: |	 d |  j; |	  |  q| j< | |	  n  |  j j	 }
 t
 |
 t j  r|  j$ j% | d  } | d  k	 r#|
 j= | | |  j$ j% | d   n |
 j= | |  j$ j% | d   |  j$ j% | d  } | d  k	 r|
 j> |
 j? |  |  qnkt
 |
 t j  r9|  j$ j% | d  } | d  k	 r|
 j@ | | |  j$ j% | d   n |
 j@ | |  j$ j% | d   |  j$ j% | d  } | d  k	 r|
 jA |
 j? |  |  qnt
 |
 t j  r[|
 jB |  nt
 |
 t j  r}|
 j< |  npt
 |
 t j t j f  r|
 j: |  nEt
 |
 t jC  rtD |  t jE k r|
 jF |  qt
 | t jG  r`|  j$ j% | d  } | d  k r"|
 jH |  n |
 jH | |  |  j$ j% | d  } | r|
 jI |  qqt
 | t jJ  r|
 jK |  qt
 | t jL  r|
 jM |  qt
 | t j  r|  j$ j% | d  } |
 jN tO jP jQ |  |  qn  d  S(   Ni    t   classs   ::t   .t   Linet   QFramet   columnCountR   t   rowCountR   t   headert   horizontalHeadert   verticalHeadert   buttonGroupt   QButtonGroups   layout-positiont   icont   labelt   toolTipt   titlet   toolBarAreat   toolBarBreakt   dockWidgetArea(R   t   column_countert   row_countert   item_nrt	   itemstackR   t   sorting_enabledR   t   replaceRQ   R(   R%   R&   t   QDockWidgett   QMdiAreat   QScrollAreat   QStackedWidgett   QToolBoxt
   QTabWidgett   QWizardR+   Rb   t   QTableWidgetRf   t   setColumnCountR   Rd   t   setRowCountt   traverseWidgetTreeR1   t	   QTreeViewt   handleHeaderViewRm   t
   QTableViewRn   Ro   t   QAbstractButtonRC   t   getAttributet   stringRO   t   strRV   RI   R;   R>   RB   RX   RP   R[   RZ   R=   t   setExclusiveR6   t	   addButtont   setSortingEnabledR4   R2   t   QFormLayoutt	   setWidgett   _form_layout_rolet	   addWidgett   addItemt   setItemToolTipt   indexOft   addTabt   setTabToolTipt   addPageR7   R5   R'   t   setCentralWidgett   QToolBart
   addToolBart   insertToolBarBreakt   QMenuBart
   setMenuBart
   QStatusBart   setStatusBart   addDockWidgetR   R   t   DockWidgetArea(   R)   R   t   widget_classR]   R0   t   bg_i18nt   bg_namet   bgt   layt   lpR(   Rr   t   tooltipt   tbAreat   tbBreakt   dwArea(    (    s6   /usr/lib/python2.7/dist-packages/PyQt4/uic/uiparser.pyt   createWidget   s    							%(		#%%c         C   sw  |  j  j | | d  } | d  k	 r5 | j |  n  |  j  j | | d  } | d  k	 rj | j |  n  |  j  j | | d  } | d  k	 r | j |  n  |  j  j | | d  } | d  k	 r | j |  n  |  j  j | | d  } | d  k	 r	| j |  n  |  j  j | | d  } | d  k	 r>| j |  n  |  j  j | | d  } | d  k	 rs| j	 |  n  d  S(   Nt   Visiblet   CascadingSectionResizest   DefaultSectionSizet   HighlightSectionst   MinimumSectionSizet   ShowSortIndicatort   StretchLastSection(
   RC   R   R   t
   setVisiblet   setCascadingSectionResizest   setDefaultSectionSizet   setHighlightSectionst   setMinimumSectionSizet   setSortIndicatorShownt   setStretchLastSection(   R)   R   RJ   Rm   t   value(    (    s6   /usr/lib/python2.7/dist-packages/PyQt4/uic/uiparser.pyR     s*    c   
      C   sa  | j  d  } | j  d  } | d  k s6 | d  k r? d } n t |  t |  f } |  j j | d t j j  } t j j | f } |  j j | d  t	 j
 j k r | d | d f } n  |  j j d |  j d  | | d	 t } |  j j   r]|  j j   } | j d
 }	 t | t j  rJ| j |	 d |  j |	  |  q]| j | |	  n  d  S(   Ns   property/size/widths   property/size/heightt   sizeTypet   orientationi   i    t   QSpacerItemt
   spacerItemR_   s   layout-position(    (   t   findtextR   R   RC   Rf   R&   t   QSizePolicyt	   Expandingt   MinimumR   R   t
   HorizontalRB   RX   RL   R6   RQ   R4   R2   R   R%   R   t   setItemR   R   (
   R)   R   t   widtht   heightt	   size_argsR   t   policyt   spacerR   R   (    (    s6   /usr/lib/python2.7/dist-packages/PyQt4/uic/uiparser.pyt   createSpacer  s&    	!	#c         C   sX  |  j  j | d |  j d  } |  j  j | d |  } |  j  j | d |  } |  j  j | d |  } |  j  j | d |  } |  j j   r | d k  r d } n  | d k  r d } n  | d k  r d } n  | d k  r d } q n  | d k s| d k s| d k s| d k rt | d d d	 } t |  t | d
  _ t |  t | d
  _ t |  t | d
  _ t |  t | d
  _ n  |  j  j | d |  j d  } |  j  j | d |  }	 |  j  j | d |  }
 |	 d k s|
 d k r<t | d d d } t |	  t | d
  _ t |
  t | d
  _ n  | j d } |  j j	   rad  } n |  j j } d | j k r| d j   | j d <n  |  j j |  j | | |   |  j |  |  j j   } |  j | |  |  j j	   rT|  j j   } | j d } t | t j  rA| j | d |  j |  |  qT| j | |  n  d  S(   NRN   t
   leftMargint	   topMargint   rightMargint   bottomMargini    Rc   RJ   t   pyuicMarginst   numberRM   t   horizontalSpacingt   verticalSpacingt   pyuicSpacingRg   i   s   layout-position(   RC   Rf   RR   RQ   R8   R   R   t   textR   R4   R   R(   RW   R+   Rb   R   R/   t   configureLayoutR2   R%   R&   R   t	   setLayoutR   t	   addLayout(   R)   R   RN   t   leftt   topt   rightt   bottomt   cmeRM   t   horizt   vertt	   classnameR]   R.   t
   top_layoutR   (    (    s6   /usr/lib/python2.7/dist-packages/PyQt4/uic/uiparser.pyt   createLayout  sZ     	 	 	 0	#c         C   s   t  | t j  rm |  j | d | j  |  j | d | j  |  j | d | j  |  j | d | j  n+ t  | t j  r |  j | d | j	  n  d  S(   Nt   columnminimumwidtht   rowminimumheightt   columnstretcht
   rowstretcht   stretch(
   R%   R&   t   QGridLayoutt   setArrayt   setColumnMinimumWidtht   setRowMinimumHeightt   setColumnStretcht   setRowStretcht
   QBoxLayoutt
   setStretch(   R)   R   R.   (    (    s6   /usr/lib/python2.7/dist-packages/PyQt4/uic/uiparser.pyR   
  s    

c         C   sm   | j  j |  } | ri xN t | j d   D]4 \ } } t |  } | d k r. | | |  q. q. Wn  d  S(   Nt   ,i    (   R   R   t	   enumerateR   R   (   R)   R   RJ   t   settert   arrayt   idxR   (    (    s6   /usr/lib/python2.7/dist-packages/PyQt4/uic/uiparser.pyR     s    "c         C   s>   |  j  d k r: |  j j d | j  |  _ | j t  n  d  S(   Ni    t   __sortingEnabled(   R{   RB   t   invoket   isSortingEnabledR}   R   R6   (   R)   t   w(    (    s6   /usr/lib/python2.7/dist-packages/PyQt4/uic/uiparser.pyt   disableSorting  s    c         C   s`  |  j  j   r6 t |  | d j d <|  j |  n&|  j  j } t | t j  r |  j	 j
 | d  } |  j	 j
 | d  } | r | j | d  n | j d  | j |  j |  nt | t j  r|  j |  |  j d | | j |  j  } | j |  nFt | t j  r|  j rK|  j d \ } } |  j d \ } } n | } |  j } |  j j d d	 t |  j  | f t  } |  j d k r|  j r|  j j d
 | j  |  _ | j t  n  |  j j | |  j f  d |  _ | j |  }	 x* |  j d D] \ }
 } |	 j |  }	 qWd } x|| j d  D]k} |  j	 j  |  } | j d } | d k r| d 7} | r|	 j! | |  qq=| d k r| j" | |  q=| d k r| j# | |  q=| d k r| j$ | |  q=| d k r| j% | |  q=| d k r/| j& | |  q=| d k rN| j' | |  q=| d k rm| j( | |  q=| d k r| j) |  q=| d k r=| j* | |  q=q=W|  j |  |  j j+   \ } |  _ ny t | t j,  rMt- | j d  } t- | j d  } |  j |  |  j d | | j | |  } | j. | | |  n  |  j d 7_ d  S(   Ni    s   layout-positionR   Rr   t    t   QListWidgetItemit   QTreeWidgetItems   item_%dR   i   Rc   RJ   t	   statusTipRt   t	   whatsThist   fontt
   backgroundt
   foregroundt   flagst
   checkStateR   R   t   QTableWidgetItem(/   RQ   R4   R   R   R   R(   R%   R&   t	   QComboBoxRC   Rf   R   t   setItemTextR{   t   QListWidgetR   t   createWidgetItemR*   t   QTreeWidgetR|   RB   RX   R   R6   R   R   R}   R   R$   t   topLevelItemt   childRd   t   convertt   setTextt   setStatusTipt
   setToolTipt   setWhatsThist   setFontt   setIcont   setBackgroundt   setForegroundt   setFlagst   setCheckStateR-   R   R   R   (   R)   R   R   R   Rr   R*   R]   R   t
   nr_in_roott   titmR  t   nr_in_parentR   Re   t   c_propt   c_prop_nameR   t   col(    (    s6   /usr/lib/python2.7/dist-packages/PyQt4/uic/uiparser.pyt
   handleItem$  s    			
c         C   s'   |  j  j |  j j | j d f  d  S(   NRJ   (   RS   R$   RQ   R(   R   (   R)   R   (    (    s6   /usr/lib/python2.7/dist-packages/PyQt4/uic/uiparser.pyt	   addAction~  s    c          G   s5   x. |  D]& } | d k	 r t | t  r t Sq Wt S(   s;    Return True if any argument appears to be an i18n string. N(   R   R%   R   R<   R6   (   R`   t   a(    (    s6   /usr/lib/python2.7/dist-packages/PyQt4/uic/uiparser.pyt   any_i18n  s    c         G   s  |  j  j | d d t  } |  j } | j | d  } | j | d  } | j | d  }	 | j | d  }
 |  j | | |	 |
  r |  j  j d | |  n  | r | j |  n  | r | j |  n  |	 r | j	 |	  n  |
 r | j
 |
  n  | j | d  } | r| j |  n  | j | d  } | rE| j |  n  | j | d  } | rm| j |  n  | j | d	  } | r| j |  n  | j | d
  } | r| j |  n  | j | d  } | r| j |  n  | j | d  } | r| j |  n  | S(   s(    Create a specific type of widget item. R*   R   R  Rt   R  t   textAlignmentR  Rr   R  R  R  R	  (    (   RB   RX   R6   RC   Rf   R&  R   R  R  R  R  t   setTextAlignmentR  R  R  R  R  R  (   R)   t	   item_typeR   t   gettert   getter_argsR*   t   propsR   t
   status_tipt   tool_tipt
   whats_thist   text_alignmentR  Rr   R  R  R  t   check_state(    (    s6   /usr/lib/python2.7/dist-packages/PyQt4/uic/uiparser.pyR    sL    	c         C   s  |  j  j } t | t j  r|  j } |  j } | j | d  } | ra | j   j	 | |  n  | j | d  } | r | j   j
 | |  n  | j | d  } | r | j   j | |  n  | j | d  } | r | j   j | |  n  | j | d  }	 |	 r%| j   j | |	  n  | j | d  }
 |
 rV| j   j | |
  n  | j | d  } | r| j   j | |  n  | j | d  } | r| j   j | |  n  | j | d	  } | r| j   j | |  n  |  j d
 7_ n t | t j  rt |  d k r| j d k rq|  j d | | j |  j  } | j |  j |  |  j d
 7_ q| j d k r|  j d | | j |  j  } | j |  j |  |  j d
 7_ qqn  d  S(   NR   R  Rt   R  R'  R  Rr   R  R  i   i    R   R
  R   (   RQ   R(   R%   R&   R  RC   Ry   Rf   t
   headerItemR  R  R  R  R(  R  R  R  R  R   R   t   tagR  t   horizontalHeaderItemt   setHorizontalHeaderItemt   verticalHeaderItemRz   t   setVerticalHeaderItem(   R)   R   R   R,  R"  R   R-  R.  R/  R0  R  Rr   R  R  R*   (    (    s6   /usr/lib/python2.7/dist-packages/PyQt4/uic/uiparser.pyt	   addHeader  sX    		c         C   sH   | j  d  k r d  Sy t |  j | j   j   Wn t k
 rC n Xd  S(   N(   R   R   R   RP   t   raise_RO   (   R)   R   (    (    s6   /usr/lib/python2.7/dist-packages/PyQt4/uic/uiparser.pyt	   setZOrder   s    c         C   s#   |  j  d |  j p |  j |  d  S(   Nt   QAction(   Rb   RT   RP   (   R)   R   (    (    s6   /usr/lib/python2.7/dist-packages/PyQt4/uic/uiparser.pyt   createAction  s    c         C   s;   |  j  d |  j |  } | |  _ |  j |  d  |  _ d  S(   Nt   QActionGroup(   Rb   RP   RT   R   R   (   R)   R   t   action_group(    (    s6   /usr/lib/python2.7/dist-packages/PyQt4/uic/uiparser.pyt   createActionGroup  s    	R0   t	   addactionR.   R   R*   t   actiont   actiongroupR   R   t   zorderc         C   sS   xL t  |  D]> } y |  j | j } Wn t k
 r= q n X| |  |  q Wd  S(   N(   t   itert   widgetTreeItemHandlersR3  RI   (   R)   R   R  t   handler(    (    s6   /usr/lib/python2.7/dist-packages/PyQt4/uic/uiparser.pyR   $  s    c         C   s  | j  d } | j  d } | s] | } | j d  rB | d } n  | d j   | d } n  |  j | |  |  _ |  j j |  t d |  j j   j    |  j	 j
 |  j |  |  j j |  j  |  j |  |  j j   |  j   |  j   |  j   d  S(   NRg   RJ   t   Qi   i    s   toplevel widget is %s(   R   t
   startswithRW   t   createToplevelWidgetRP   RZ   R    R!   R"   RC   RY   RQ   R+   R   R1   t
   addActionst
   setBuddiest   setDelayedProps(   R)   R   t   cnamet   wname(    (    s6   /usr/lib/python2.7/dist-packages/PyQt4/uic/uiparser.pyt   createUserInterface-  s$    

c         C   s   x |  j  D] \ } } | d k r/ | j   q
 t d | | j    t |  j |  } t | t j  r | j	 | j
    q
 t | t j  s
 | j	 |  q
 q
 Wd  S(   Nt	   separators   add action %s to %s(   RS   t   addSeparatorR    R#   R   RP   R%   R&   t   QMenuR$  t
   menuActionR=  (   R)   R0   t   action_namet
   action_obj(    (    s6   /usr/lib/python2.7/dist-packages/PyQt4/uic/uiparser.pyRJ  G  s    c         C   sU   xN |  j  j D]@ \ } } } } | r4 | j   } n  t | |  } | |  q Wd  S(   N(   RC   t   delayed_propsR.   R   (   R)   R0   R.   R   R`   (    (    s6   /usr/lib/python2.7/dist-packages/PyQt4/uic/uiparser.pyRL  S  s
    c         C   s~   xw |  j  j D]i \ } } t d | | j    y | j t |  j |   Wq t k
 ru t d | | j    q Xq Wd  S(   Ns   %s is buddy of %ss1   ERROR in ui spec: %s (buddy of %s) does not exist(   RC   t   buddiesR    R#   t   setBuddyR   RP   RO   (   R)   R0   t   buddy(    (    s6   /usr/lib/python2.7/dist-packages/PyQt4/uic/uiparser.pyRK  [  s    c         C   sT   t  d | j  | j } | d  k r. d } n  | |  _ | |  j _ |  j |  d  S(   Ns   uiname is %sR   (   R    R   R   t   uinameRC   t
   setContext(   R)   R   RJ   (    (    s6   /usr/lib/python2.7/dist-packages/PyQt4/uic/uiparser.pyR   d  s    			c         C   s   d S(   sc   
        Reimplemented by a sub-class if it needs to know the translation
        context.
        N(    (   R)   t   context(    (    s6   /usr/lib/python2.7/dist-packages/PyQt4/uic/uiparser.pyR[  o  s    c         C   s8   t  | j d  |  j d <t  | j d  |  j d <d  S(   NRN   RM   (   R   R   RR   (   R)   R   (    (    s6   /usr/lib/python2.7/dist-packages/PyQt4/uic/uiparser.pyt   readDefaultsv  s    c         C   sX   d  } xK | D]C } t |  j | j  } | d  k	 rJ |  j j | |  n  | } q Wd  S(   N(   R   R   RP   R   t   setTabOrder(   R)   R   t
   lastwidgett   widget_elemR0   (    (    s6   /usr/lib/python2.7/dist-packages/PyQt4/uic/uiparser.pyt   setTaborderz  s    c         C   s   y t  | d  } Wn  t k
 r5 t  | d  } n Xx} | d  D]o } | j j d  } | rC | j d  rC t j j | d  |  j  } | |  j	 k r |  j	 j
 |  q qC qC Wd S(   sk   
        Read a "resources" tag and add the module to import to the parser's
        list of them.
        RD  t   getiteratort   includet   locations   .qrciN(   R   RO   R   R   t   endswitht   ost   patht   basenamet   _resource_suffixRU   R$   (   R)   R   t   iteratorRc  t   loct   mname(    (    s6   /usr/lib/python2.7/dist-packages/PyQt4/uic/uiparser.pyt   readResources  s    c            s     f d   } x t  |  D]q } t j j | | j d   t j | j d     j j | | j d   | j d  j d  d   q Wt j	 j
   j  d  S(   Nc            s*   |    j  k r   j St   j |   Sd  S(   N(   RZ  RP   R   (   Ra   (   R)   (    s6   /usr/lib/python2.7/dist-packages/PyQt4/uic/uiparser.pyt   name2object  s    t   sendert   signalt   receivert   slott   (i    (   RD  R   t   QObjectt   connectR   t   SIGNALRB   t   getSlotR   t   QMetaObjectt   connectSlotsByNameRP   (   R)   R   Rn  t   conn(    (   R)   s6   /usr/lib/python2.7/dist-packages/PyQt4/uic/uiparser.pyt   createConnections  s    $c         C   s   d   } xu t  |  D]g } | j d  } | j d  rI t |   n  |  j j | | j d  pg d | | j d    q Wd  S(   Nc         S   s   |  j  d  r |  d  }  n  g  } xN |  j d  D]= } | d k r2 | d k r_ t d   n  | j |  q2 q2 Wd j |  S(	   s   header2module(header) -> string

            Convert paths to C++ header files to according Python modules
            >>> header2module("foo/bar/baz.h")
            'foo.bar.baz'
            s   .hit   /R   Rh   s   ..s4   custom widget header file name may not contain '..'.(   R   Rh   (   Re  R   t   SyntaxErrorR$   t   join(   Rm   t   mpatht   part(    (    s6   /usr/lib/python2.7/dist-packages/PyQt4/uic/uiparser.pyt   header2module  s    Rg   t   Q3t   extendsR'   Rm   (   RD  R   RH  R   RB   t   addCustomWidget(   R)   R   R  t   custom_widgetR   (    (    s6   /usr/lib/python2.7/dist-packages/PyQt4/uic/uiparser.pyt   customWidgets  s    	c         C   s
   t   d  S(   N(   t   NotImplementedError(   R)   R   t
   widgetname(    (    s6   /usr/lib/python2.7/dist-packages/PyQt4/uic/uiparser.pyRI    s    c         C   s   x t  |  D]} } | j d k r | j d } t   } | |  j | <|  j | d  } | d  k	 r | j d  d k r t | _	 q q q q Wd  S(   Nt   buttongroupRJ   R=   t   boolt   false(
   RD  R3  R   R;   RV   Rf   R   R   R6   R=   (   R)   R   t   button_groupR   R   Re   (    (    s6   /usr/lib/python2.7/dist-packages/PyQt4/uic/uiparser.pyt   buttonGroups  s    	c         C   s   d  S(   N(    (   R)   (    (    s6   /usr/lib/python2.7/dist-packages/PyQt4/uic/uiparser.pyt   finalize  s    R   c      	   C   s!  |  j  j |  | |  _ d |  j f d |  j f d |  j f d |  j f d |  j f d |  j f d |  j	 f d |  j
 f f } t |  } | j   j d	 } t d
 | f  | d k s t  x< | D]4 \ } } | j |  }	 |	 d  k	 r | |	  q q W|  j   |  j }
 |  j   |
 S(   Nt   layoutdefaultRg   t   buttongroupst   customwidgetsR0   t   connectionst   tabstopsRU   t   versions   UI version is %ss   4.0(   s   4.0(   RC   t   set_base_dirRi  R]  R   R  R  RO  R{  Ra  Rm  R    t   getrootR   R    t   AssertionErrort   findR   R  RP   RD   (   R)   t   filenamet   resource_suffixt   base_dirt   branchHandlerst   documentR  t   tagnamet   actorR   R   (    (    s6   /usr/lib/python2.7/dist-packages/PyQt4/uic/uiparser.pyR      s,    	
	
c         C   sN   |  d d k r t  j j } n+ |  d d k r> t  j j } n t  j j } | S(   Ni   i   (   R&   R   t   SpanningRolet	   FieldRolet	   LabelRole(   t   layout_positiont   role(    (    s6   /usr/lib/python2.7/dist-packages/PyQt4/uic/uiparser.pyR     s    (*   R9   R:   R?   RL   RD   R<   Rb   Rf   R   R   R   R   R   R   R   R#  R$  t   staticmethodR&  R  R8  R:  R<  R?  RE  R   RO  RJ  RL  RK  R   R[  R]  Ra  Rm  R{  R  RI  R  R  R    R   (    (    (    s6   /usr/lib/python2.7/dist-packages/PyQt4/uic/uiparser.pyRA      s`   	
							B				Z	
	;	:			
											
			 			!(   i   i   i    (#   t   syst   loggingt   os.pathRf  t   ret   xml.etree.ElementTreeR    R   t   ImportErrort   ElementTreet   elementtree.ElementTreet   PyQt4.elementtree.ElementTreet   PyQt4.uic.exceptionsR   t   PyQt4.uic.objcreatorR   t   PyQt4.uic.propertiesR   t	   getLoggerR9   t   loggert   debugR    t   version_infoR	   R   R   R&   R   R   R,   R   R>   R;   RA   (    (    (    s6   /usr/lib/python2.7/dist-packages/PyQt4/uic/uiparser.pyt   <module>)   s6   "			0