ó
ÉÝ{Tc           @   sÝ  d  Z  d d l m Z m Z d d l Td d l Z d d l Z d d l Z d d l Z d d l	 Z	 d e j f d „  ƒ  YZ
 d e j f d „  ƒ  YZ d	 e j f d
 „  ƒ  YZ d e j f d „  ƒ  YZ d e j f d „  ƒ  YZ d e j f d „  ƒ  YZ d e j f d „  ƒ  YZ d e j f d „  ƒ  YZ d e j f d „  ƒ  YZ d e j f d „  ƒ  YZ d e j f d „  ƒ  YZ d e j f d „  ƒ  YZ d e j f d „  ƒ  YZ d e j f d  „  ƒ  YZ d! e j f d" „  ƒ  YZ d S(#   s‘  
     qtgui/modelUtils.py: CCP4MG Molecular Graphics Program
     Copyright (C) 2009 University of York, CCLRC
     Copyright (C) 2009-2010 University of York
     Copyright (C) 2012 STFC

     This library is free software: you can redistribute it and/or
     modify it under the terms of the GNU Lesser General Public License
     version 3, modified in accordance with the provisions of the 
     license to address the requirements of UK law.
 
     You should have received a copy of the modified GNU Lesser General 
     Public License along with this library.  If not, copies may be 
     downloaded from http://www.ccp4.ac.uk/ccp4license.php
 
     This program is distributed in the hope that it will be useful,
     but WITHOUT ANY WARRANTY; without even the implied warranty of
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     GNU Lesser General Public License for more details.
iÿÿÿÿ(   t   QtGuit   QtCore(   t   *Nt   ModelSecStrEditorc           B   s\   e  Z d  d „ Z d „  Z d „  Z d	 d „ Z d „  Z g  d „ Z d „  Z	 i  d „ Z
 RS(
   t    c      
   C   s   t  j  j |  | ƒ | |  _ |  j d | ƒ t j ƒ  } t j d |  ƒ } | j | ƒ t j	 |  d t
 d d d d d d ƒ|  _ |  j j ƒ  | j |  j ƒ |  j | ƒ |  j |  j t j d	 ƒ |  j ƒ |  j |  j t j d
 ƒ |  j ƒ |  j t ƒ  t j d ƒ |  j ƒ |  j ƒ  d  S(   Ns   Edit secondary structure for s1   Override automatic secondary structure assignmentt   widgett   ifClosei   t   ifCleart   widthi    s
   accepted()s   close()t   atomContextMenu(   t   MGSimpleDialogt   __init__t   MolDatat   setWindowTitleR    t   QVBoxLayoutt   QLabelt	   addWidgett	   mgWidgetst   extendingFramet   ModelSecStrLinet   exFramet   showt	   setLayoutt   connectR   t   SIGNALt   applyt   closet
   MAINWINDOWt   atomPickMenut   loadFromModelInfo(   t   selft   parentR   t   layoutR   (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/modelUtils.pyR   '   s    	*"""c         C   sn   t  ƒ  j d |  j d d ƒ \ } } | rj | j d ƒ rj | j d ƒ rj |  j d | d d | d ƒ n  d  S(   Nt   sett   infot   edit_secstrt   secstrt   selection_command(   t	   MODELINFOt   get_infoR   t   has_keyt	   setParams(   R   t   statust   data(    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/modelUtils.pyR   J   s    $%c      
   C   sú   |  j  ƒ  } | j d ƒ rö | d rö g  } x8 | d D], } | j t j j t j j j | ƒ ƒ q6 Wt ƒ  j	 d |  j d d d d d | ƒ t ƒ  j	 d |  j d d d d d | d ƒ t
 |  j ƒ } | rö | j d d	 ƒ | j ƒ  t ƒ  qö n  d  S(
   NR%   R$   R!   R"   R#   t   keyt   valueR   i   (   t	   getParamsR(   t   appendt   modelR   t   secstr_aliast   secstr_menut   indexR&   t   add_infoR+   t   apply_edit_secstrt   redraw_all_objectst   UPDATEDISPLAY(   R   t   paramsR$   t   itemt   target(    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/modelUtils.pyR   T   s    *(,
c      	   C   s¤   |  j  ƒ  s d  S| j ƒ  } | j ƒ  } | sI | sI | j |  j k rM d  St |  j ƒ  ƒ } t j |  | d | d | d | d g g |  j	 d i | d 6ƒd  S(   Ns    Set secondary structure for thist   range_2t   residuet   range_1R"   t	   pickevent(
   t	   isVisiblet
   getDataObjt   getContextMenut   nameR   t   strt
   objectNamet   guiUtilst   populateMenut   getActionDef(   R   R>   t   dobjt   menuRB   (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/modelUtils.pyR   f   s     ! c      	   K   s  | t  t |  j ƒ  ƒ ƒ } | j d d ƒ } | s8 d  S| | j d d ƒ g } | d k r„ t d d d d	 d
 |  j | g d d ƒ S| d k r¸ t d d d d d
 |  j | g d d ƒ S| d k rt |  d ƒ s× i  St d d |  j d d d
 |  j | g d d ƒ Si  Sd  S(   NR>   R   t   formatt   fullR<   t   textt   Residuet   tips   Colour the selected residuet   slott   deleteLateri   R=   s   Start ranges   Select first residue in a rangeR;   t   pickedRangeStarts   Range from s   Select end residue in a range(	   t   lenRC   RD   t   gett   getLabelt   dictt   editPickedResiduet   hasattrRQ   (   R   RB   R"   R>   t   args(    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/modelUtils.pyRG   q   s.      c         C   s÷   | \ } } d d g j  | ƒ rE t |  j ƒ j d d d | ƒ } nX | d k r� t |  j ƒ j d d d | ƒ } t |  j ƒ j |  j | ƒ d } |  ` n  | d k r¶ | |  _ d  S|  j j ƒ  |  j j d i | g d 6d	 |  j j	 ƒ  d ƒ d  S(
   NR<   R=   t   outt   atomIDR;   i   R8   R%   R3   (
   t   countR+   R   t   convertAtomIDt   interpretRangesRQ   R   t   addLineR)   t   getNofLines(   R   RX   RB   t   atom_idt	   selectiont   res2(    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/modelUtils.pyRV   ‘   s    $!"		c         C   s$   |  j  j i g  d 6g  d 6ƒ } | S(   NR%   R$   (   R   R.   (   R   R8   (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/modelUtils.pyR.   ¥   s     c         K   s²   | j  | ƒ | j d ƒ r® | j d ƒ r® g  } x] | d D]Q } t j j j | ƒ r€ | j t j j t j j j | ƒ ƒ q< | j | ƒ q< W| | d <|  j	 j
 | ƒ n  d  S(   NR%   R$   (   t   updateR(   R0   R   R1   R[   R/   R2   R3   R   R)   (   R   R8   t   kwR$   R9   (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/modelUtils.pyR)   ª   s    )
N(   t   __name__t
   __module__R   R   R   t   NoneR   RG   RV   R.   R)   (    (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/modelUtils.pyR   !   s   #	
		 	R   c           B   s   e  Z d d  „ Z d „  Z RS(   c         C   s(  t  j j |  | ƒ t  j ƒ  } | j d d d d ƒ | j d ƒ t |  j ƒ  j ƒ j	 } t
 j |  | d d g d g  ƒ|  _ |  j j d ƒ |  j j d ƒ | j |  j ƒ t  j |  ƒ |  _ x$ t j j D] } |  j j | ƒ qÍ W|  j j d ƒ |  j j d ƒ | j |  j ƒ |  j | ƒ d  S(	   Ni    t   modelGroupst   peptidet   selectionWidgetss#   Select residue or range of residuesR%   s-   Secondary structure assignment for residue(s)R$   (   R    t   QWidgetR   t   QHBoxLayoutt   setContentsMarginst
   setSpacingR+   t   windowR   t	   treeModelR   t   mgSelectionCombot	   seleCombot
   setToolTipt   setObjectNameR   t	   QComboBoxt   secstrComboR0   R2   t   addItemR   (   R   R   R    t   abstractModelR9   (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/modelUtils.pyR   À   s     $c         C   s!   |  j  j ƒ  |  j j d ƒ d  S(   Ni    (   Rr   t   clearRv   t   setCurrentIndex(   R   (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/modelUtils.pyt
   setDefaultÚ   s    N(   Re   Rf   Rg   R   R{   (    (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/modelUtils.pyR   »   s   t   editCIFFilesGuic           B   s2   e  Z d d  d „ Z d „  Z d „  Z d „  Z RS(   R   c         C   s  t  j  j |  | ƒ | |  _ |  j d |  j ƒ |  j t j j ƒ t j	 ƒ  } | j
 t j d |  ƒ ƒ | j
 t j d |  ƒ ƒ t j |  d t d d d d ƒ|  _ | j
 |  j ƒ |  j | ƒ |  j |  j t j d	 ƒ |  j ƒ |  j |  j t j d
 ƒ |  j ƒ |  j ƒ  d  S(   Ns   Edit residue types for sF   For residue types not recognised by the monomer library enter the names.   of residue and the cif file that goes with it.R   R   i   R   i    s
   accepted()s   close()(   R
   R   t   MolData_nameR   t   setAttributeR   t   Qtt   WA_DeleteOnCloseR    R   R   R   R   R   t   editCIFFilesLineR   R   R   R   t   ApplyR   t   loadData(   R   R   R   R    (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/modelUtils.pyR   ÷   s    	$""c         C   sX   |  j  ƒ  } t |  j ƒ } | rT t | d ƒ rT | j | ƒ | j ƒ  | j ƒ  n  d  S(   Nt   setCustomResCIFFiles(   R.   R+   R}   RW   R„   t   GetMolBondsR6   (   R   R8   R:   (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/modelUtils.pyR‚     s    
c         C   s\   |  j  j i g  d 6g  d 6ƒ } i  } x/ t | d | d ƒ D] \ } } | | | <q> W| S(   Nt   resnameRU   (   R   R.   t   zip(   R   R8   t   pR,   t   val(    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/modelUtils.pyR.     s
     $c         C   sŒ   t  |  j ƒ } | rˆ g  } g  } x7 | j j ƒ  D]& \ } } | j | ƒ | j | ƒ q1 Wi  } | | d <| | d <|  j j | ƒ n  d  S(   NR†   RU   (   R+   R}   t   customResCIFFilest   itemsR/   R   R)   (   R   R:   t   keyst   valsR,   R‰   R8   (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/modelUtils.pyRƒ     s    

N(   Re   Rf   Rg   R   R‚   R.   Rƒ   (    (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/modelUtils.pyR|   ö   s   		R�   c           B   s   e  Z d  „  Z d „  Z RS(   c            s  t  j j |  | ƒ t  j ƒ  } | j d d d d ƒ | j d ƒ t  j |  ƒ } | j d ƒ | j d ƒ | j	 | ƒ t  j |  ƒ ‰  ˆ  j d ƒ ˆ  j d ƒ | j	 ˆ  ƒ t  j
 d |  ƒ } | j t ƒ | j d ƒ | j	 | ƒ t ‡  f d † } | j j | ƒ |  j | ƒ d  S(	   Ni    s$   Residue name (usually 3-letter code)R†   s   CIF dictionary fileRU   t   Browses+   Pick a CIF dictionary file on your computerc            se   t  j ƒ  } | j t  j j ƒ | j t  j j t ƒ | j ƒ  } | ra ˆ  j | j	 ƒ  d ƒ n  d  S(   Ni    (
   R    t   QFileDialogt   setFileModet   ExistingFilet	   setOptiont   DontUseNativeDialogt   Truet   exec_t   setTextt   selectedFiles(   t   dumt   wt   f(   t   ciffilewidget(    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/modelUtils.pyt   getFile<  s    (   R    Rk   R   Rl   Rm   Rn   t	   QLineEditRs   Rt   R   t   QPushButtont   setAutoDefaultt   FalseR”   t   clickedR   R   (   R   R   R    R   Rœ   (    (   R›   s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/modelUtils.pyR   (  s&    c         C   s<   |  j  t j d ƒ j d ƒ |  j  t j d ƒ j d ƒ d  S(   NR†   R   RU   (   t	   findChildR    Rk   R–   (   R   (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/modelUtils.pyR{   G  s    (   Re   Rf   R   R{   (    (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/modelUtils.pyR�   '  s   	t   editRestypesGuic           B   s>   e  Z d d  d „ Z d „  Z d „  Z d „  Z i  d „ Z RS(   R   c         C   s!  t  j  j |  | ƒ | |  _ |  j d |  j ƒ |  j t j j ƒ t j	 ƒ  } | j
 t j d |  ƒ ƒ | j
 t j d |  ƒ ƒ t j |  d t d d d d ƒ|  _ |  j j ƒ  | j
 |  j ƒ |  j | ƒ |  j |  j t j d	 ƒ |  j ƒ |  j |  j t j d
 ƒ |  j ƒ |  j ƒ  d  S(   Ns   Edit residue types for sF   For residue types not recognised by the monomer library enter the namesI   of residue and either the equivalent library name and/or the residue typeR   R   i   R   i    s
   accepted()s   close()(   R
   R   R}   R   R~   R   R   R€   R    R   R   R   R   R   t   editRestypesLineR   R   R   R   R   R‚   R   Rƒ   (   R   R   R   R    (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/modelUtils.pyR   S  s    	$""c         C   s+  |  j  ƒ  } i  } x  t t | d ƒ ƒ D]ˆ } | j | d | ƒ sb i g  d 6| | d | <n  | | d | d j | d | ƒ s) | | d | d j | d | ƒ q) q) Wxv t j j D]h } | j | ƒ rt	 ƒ  j
 d |  j d d d | d | | ƒ } qÂ t	 ƒ  j d |  j d d d | ƒ qÂ Wt	 ƒ  j d |  j d d	 d d
 ƒ xw t t | d ƒ ƒ D]_ } | d | rg| d | rgt	 ƒ  j
 d |  j d d	 d | d | d | d | ƒ } qgqgWt	 ƒ  j d |  j ƒ t |  j ƒ } | r'| j ƒ  | j ƒ  | j ƒ  | j ƒ  t ƒ  n  d  S(   NR†   t   restypet   ORDERR!   R"   t   selection_protocolsR,   R-   t   residue_aliasesR   t   alias(   R.   t   rangeRR   R(   R[   R/   R0   R   t   restype_aliasR&   R4   R}   t   delete_infot   saveR+   t   updateCustomResTypest   analyse_restypesR…   R6   R7   (   R   R8   t   sel_prott   iit   typet   retR:   (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/modelUtils.pyR‚   m  s4     ',"&



c         C   s€  d d  l  } g  } g  } g  } t ƒ  j d |  j d d ƒ \ } } | s� xD | j ƒ  D]3 \ } } | j | ƒ | j | ƒ | j d ƒ qU Wn  t ƒ  j d |  j d d ƒ \ } }	 x¤ t j j D]– }
 |	 j	 |
 ƒ rÀ |	 |
 j	 d ƒ rÀ xk |	 |
 d D]X } | j
 | ƒ r(| j | ƒ } |
 | | <q÷ | j |
 ƒ | j | ƒ | j d ƒ q÷ WqÀ qÀ W|  j i | d 6| d	 6| d
 6ƒ d  S(   NiÿÿÿÿR!   R"   R¨   R   R§   R¦   R†   R©   R¥   (   t   typesR&   R'   R}   R‹   R/   R0   R   R«   R(   R[   R3   R)   (   R   R´   t   restype_typet   restype_resR«   R*   R©   R,   R-   R°   R²   R9   R±   (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/modelUtils.pyRƒ   ›  s.    $$"c         C   s›   |  j  j i g  d 6g  d 6g  d 6ƒ } g  } x] | d D]Q } t j j j | ƒ r| | j t j j t j j j | ƒ ƒ q8 | j | ƒ q8 W| | d <| S(   NR†   R©   R¥   (	   R   R.   R0   R   t   restype_menuR[   R/   R«   R3   (   R   R8   R¥   R9   (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/modelUtils.pyR.   Á  s    ')
c         K   s¾   | j  | ƒ x* d d d g D] } | j | ƒ s d  Sq Wg  } x] | d D]Q } t j j j | ƒ r� | j t j j t j j j | ƒ ƒ qK | j | ƒ qK W| | d <|  j	 j
 | ƒ d  S(   NR†   R©   R¥   (   Rc   R(   R0   R   R«   R[   R/   R·   R3   R   R)   (   R   R8   Rd   R9   R¥   (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/modelUtils.pyR)   Ð  s     )
N(   Re   Rf   Rg   R   R‚   Rƒ   R.   R)   (    (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/modelUtils.pyR£   N  s
   	.	&	R¤   c           B   s   e  Z d  „  Z d „  Z RS(   c         C   s  t  j j |  | ƒ t  j ƒ  } | j d d d d ƒ | j d ƒ t  j |  ƒ } | j d ƒ | j d ƒ | j	 | ƒ t  j |  ƒ } | j d ƒ | j d ƒ | j	 | ƒ t  j
 |  ƒ } | j d ƒ | j d ƒ x! t j j D] } | j | ƒ qä W| j	 | ƒ |  j | ƒ d  S(   Ni    s$   Residue name (usually 3-letter code)R†   s4   Alternative residue name used in the monomer libraryR©   s6   Assign residue to chemical type to help atom selectionR¥   (   R    Rk   R   Rl   Rm   Rn   R�   Rs   Rt   R   Ru   R0   R   R·   Rw   R   (   R   R   R    R   R9   (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/modelUtils.pyR   ê  s&    c         C   sX   |  j  t j d ƒ j d ƒ |  j  t j d ƒ j d ƒ |  j  t j d ƒ j d ƒ d  S(   NR†   R   R©   R¥   i    (   R¢   R    Rk   R–   Rz   (   R   (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/modelUtils.pyR{     s    (   Re   Rf   R   R{   (    (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/modelUtils.pyR¤   å  s   	t   editBondsGuic           B   sh   e  Z d
 d  d „ Z d „  Z d „  Z d „  Z d „  Z i  d „ Z d
 d „ Z	 d „  Z
 g  d	 „ Z RS(   R   c         C   s  t  j  j |  | ƒ | |  _ |  j d |  j ƒ t j ƒ  } | j t j d |  ƒ ƒ t j	 |  d t
 d d d d ƒ|  _ |  j j ƒ  | j |  j ƒ |  j | ƒ |  j |  j t j d ƒ |  j ƒ |  j |  j t j d	 ƒ |  j ƒ |  j t ƒ  t j d
 ƒ |  j ƒ |  j ƒ  d  S(   Ns   Edit bonds for s$   Add or remove bonds in the structureR   R   i   R   i    s
   accepted()s   close()R	   (   R
   R   R}   R   R    R   R   R   R   R   t   editBondsLineR   R   R   R   R   R   R‚   R   R   R   Rƒ   (   R   R   R   R    (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/modelUtils.pyR     s    	$"""c      	   C   sÕ   |  j  ƒ  } g  } xk t t | d ƒ ƒ D]S } | d | r) | d | r) | j | d | | d | | d | g ƒ q) q) Wt ƒ  j d |  j d d d d d | ƒ t |  j ƒ j ƒ  d	 d  l	 } | j
 ƒ  d  S(
   Nt
   first_atomt   second_atomt   actionR!   R"   t
   edit_bondsR,   R-   iÿÿÿÿ(   R.   Rª   RR   R/   R&   R4   R}   R+   t   apply_edit_bondst   rebuildt   UpdateDisplay(   R   R8   R½   t   iR¿   (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/modelUtils.pyR‚   *  s    5(c         C   s6   |  j  t ƒ  t j d ƒ |  j ƒ t j j |  ƒ d  S(   NR	   (   t
   disconnectR   R   R   R   R
   t   Close(   R   (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/modelUtils.pyRÃ   :  s    "c         C   s¼   g  } g  } g  } t  ƒ  j d |  j d d d d ƒ \ } } | j d ƒ r– xH | d D]9 } | j | d ƒ | j | d ƒ | j | d ƒ qV Wn  |  j i | d 6| d	 6| d
 6ƒ d  S(   NR!   R"   R½   R,   i    i   i   Rº   R»   R¼   (   R&   R'   R}   R(   R/   R)   (   R   Rº   R»   R¼   R*   R½   R9   (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/modelUtils.pyRƒ   @  s    c         C   s+   |  j  j i g  d 6g  d 6g  d 6ƒ } | S(   NRº   R»   R¼   (   R   R.   (   R   R8   (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/modelUtils.pyR.   U  s    'c         K   s!   | j  | ƒ |  j j | ƒ d  S(   N(   Rc   R   R)   (   R   R8   Rd   (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/modelUtils.pyR)   \  s    c      	   C   s�   | j  ƒ  } |  j ƒ  s3 | s3 | j |  j k r7 d  S| j ƒ  } | sM d  St |  j ƒ  ƒ } t j |  | d | d | d g g |  j	 d i | d 6ƒd  S(   Ns   Add/delete bondt   atom_2t   atom_1R"   R>   (
   R@   R?   RB   R}   RA   RC   RD   RE   RF   RG   (   R   R>   RH   RI   RB   (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/modelUtils.pyR   b  s    '  c      	   K   sÚ   | t  t |  j ƒ  ƒ ƒ } | j d d ƒ } | s8 d  S| | j d d ƒ g } | d k r„ t d d d d	 d
 |  j | g d d ƒ S| d k rÒ t |  d ƒ s£ i  St d d |  j d d d
 |  j | g d d ƒ Si  Sd  S(   NR>   R   RJ   RK   RÅ   RL   s
   First atomRN   s   Select first atom in bondRO   RP   i   RÄ   t   firstPickedAtoms
   Bond from s   Select second atom for bond(	   RR   RC   RD   RS   RT   RU   t   handlePickedAtomRW   RÆ   (   R   RB   R"   R>   RX   (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/modelUtils.pyRG   l  s$      c         C   s—   | \ } } d g j  | ƒ r* | |  _ ni | d k r“ |  j j ƒ  |  j j d i |  j g d 6| g d 6d |  j j ƒ  d ƒ |  ` |  j ƒ  n  d  S(   NRÅ   RÄ   R8   Rº   R»   R3   i   (   R[   RÆ   R   R^   R)   R_   R‚   (   R   RX   RB   R`   (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/modelUtils.pyRÇ   …  s    N(   Re   Rf   Rg   R   R‚   RÃ   Rƒ   R.   R)   R   RG   RÇ   (    (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/modelUtils.pyR¸     s   				
	R¹   c           B   s   e  Z d  „  Z d „  Z RS(   c         C   s7  t  j j |  | ƒ t  j ƒ  } | j d d d d ƒ | j d ƒ t  j |  ƒ } | j d ƒ | j d ƒ x! d d g D] } | j	 | ƒ qx W| j
 | ƒ t j |  d |  j ƒ  j ƒ} | j d ƒ | j d ƒ | j
 | ƒ t j |  d |  j ƒ  j ƒ} | j d	 ƒ | j d
 ƒ | j
 | ƒ |  j | ƒ d  S(   Ni    s   Add or delete bondR¼   t   addt   deleteR}   s   First atom of bondRº   s   Second atom of bondR»   (   R    Rk   R   Rl   Rm   Rn   Ru   Rs   Rt   Rw   R   R   t   mgAtomPickerRo   R}   R   (   R   R   R    R   R9   (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/modelUtils.pyR   ›  s&    c         C   sR   |  j  t j d ƒ j ƒ  |  j  t j d ƒ j ƒ  |  j  t j d ƒ j d ƒ d  S(   NRº   R»   R¼   i    (   R¢   R    Rk   t   resetRz   (   R   (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/modelUtils.pyR{   µ  s    (   Re   Rf   R   R{   (    (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/modelUtils.pyR¹   –  s   	t   editLinksGuic           B   sG   e  Z d d  d „ Z d „  Z d „  Z d „  Z d „  Z i  d „ Z RS(   R   c         C   sõ   t  j  j |  | ƒ | |  _ |  j d |  j ƒ t j ƒ  } | j t j d |  ƒ ƒ t j	 |  d t
 d d d d ƒ|  _ |  j j ƒ  | j |  j ƒ |  j | ƒ |  j |  j t j d ƒ |  j ƒ |  j |  j t j d	 ƒ |  j ƒ |  j ƒ  d  S(
   Ns   Edit links for s   Define intra-residue linksR   R   i   R   i    s
   accepted()s   close()(   R
   R   R}   R   R    R   R   R   R   R   t   editLinksLineR   R   R   R   R   R   R‚   R   Rƒ   (   R   R   R   R    (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/modelUtils.pyR   Ã  s    	$""c      	   C   sü   |  j  ƒ  } g  } x’ t t | d ƒ ƒ D]z } | d | r) | d | r) | d | r) | d | r) | j | d | | d | | d | | d | g ƒ q) q) Wt ƒ  j d |  j d d d d d	 | ƒ t |  j ƒ j ƒ  d
 d  l	 } | j
 ƒ  d  S(   NRº   R»   t	   first_rest
   second_resR!   R"   t
   edit_linksR,   R-   iÿÿÿÿ(   R.   Rª   RR   R/   R&   R4   R}   R+   t   apply_edit_linksR¿   RÀ   (   R   R8   RÐ   RÁ   R¿   (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/modelUtils.pyR‚   Ü  s    @(c         C   s   t  j  j |  ƒ d  S(   N(   R
   RÃ   (   R   (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/modelUtils.pyRÃ   í  s    c         C   sÚ   g  } g  } g  } g  } t  ƒ  j d |  j d d d d ƒ \ } } | j d ƒ r­ xY | d D]J } | j | d ƒ | j | d ƒ | j | d ƒ | j | d ƒ q\ Wn  |  j i | d	 6| d
 6| d 6| d 6ƒ d  S(   NR!   R"   RÐ   R,   i    i   i   i   Rº   R»   RÎ   RÏ   (   R&   R'   R}   R(   R/   R)   (   R   Rº   R»   RÎ   RÏ   R*   RÐ   R9   (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/modelUtils.pyRƒ   ó  s     c         C   s2   |  j  j i g  d 6g  d 6g  d 6g  d 6ƒ } | S(   NRº   R»   RÎ   RÏ   (   R   R.   (   R   R8   (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/modelUtils.pyR.     s    c         K   s!   | j  | ƒ |  j j | ƒ d  S(   N(   Rc   R   R)   (   R   R8   Rd   (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/modelUtils.pyR)     s    N(	   Re   Rf   Rg   R   R‚   RÃ   Rƒ   R.   R)   (    (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/modelUtils.pyRÌ   ¾  s   				RÍ   c           B   s   e  Z d  „  Z d „  Z RS(   c         C   s+  t  j j |  | ƒ t  j ƒ  } | j d d d d ƒ | j d ƒ t  j |  ƒ } | j d ƒ | j d ƒ | j	 | ƒ t  j |  ƒ } | j d ƒ | j d ƒ | j	 | ƒ t  j |  ƒ } | j d ƒ | j d ƒ | j	 | ƒ t  j |  ƒ } | j d ƒ | j d	 ƒ | j	 | ƒ |  j
 | ƒ d  S(
   Ni    s/   Add first residue name (usually 3-letter code) RÎ   s   Add first atom nameRº   s0   Add second residue name (usually 3-letter code) RÏ   s   Add second atom nameR»   (   R    Rk   R   Rl   Rm   Rn   R�   Rs   Rt   R   R   (   R   R   R    R   (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/modelUtils.pyR   #  s*    c         C   st   |  j  t j d ƒ j d ƒ |  j  t j d ƒ j d ƒ |  j  t j d ƒ j d ƒ |  j  t j d ƒ j d ƒ d  S(   NRº   R   R»   RÎ   RÏ   (   R¢   R    Rk   R–   (   R   (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/modelUtils.pyR{   @  s    (   Re   Rf   R   R{   (    (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/modelUtils.pyRÍ     s   	t   SymmetryMatesGuic           B   s’   e  Z d d  d „ Z d „  Z d „  Z d „  Z d „  Z d „  Z d d „ Z	 d „  Z
 d	 „  Z d
 „  Z d „  Z d „  Z d „  Z i  d „ Z RS(   R   c      
   C   s~  t  j  j |  | ƒ | |  _ |  j d |  j ƒ |  j t j j ƒ t j	 ƒ  } | j
 d d d d ƒ | j d ƒ t j ƒ  } | j t j j t j j Bƒ t j	 ƒ  } | j t j d |  ƒ ƒ t j ƒ  } | j t j d |  ƒ ƒ t j |  ƒ |  _ |  j j d d ƒ |  j j d ƒ | j |  j ƒ | j t j d |  ƒ ƒ | j | ƒ t j ƒ  } | j t j d |  ƒ ƒ t |  j ƒ j } t j |  | d	 g  ƒ|  _ |  j j d
 ƒ | j |  j ƒ | j | ƒ t j ƒ  } | j d ƒ t j d |  ƒ } | j  d ƒ |  j! | t j" d ƒ |  j# ƒ | j | ƒ | j | ƒ | j$ | ƒ | j | ƒ t |  j ƒ j% j& }	 t j ƒ  } | j t j j t j j Bƒ t j	 ƒ  } t j ƒ  } t j' d |  ƒ |  _( | j |  j( ƒ t j) |  ƒ |  _* x |	 D] }
 |  j* j+ |
 ƒ qîW| j |  j* ƒ | j t j d |  ƒ ƒ | j d ƒ | j | ƒ | j$ | ƒ | j | ƒ |  j( j, t |  j ƒ j% j( ƒ t |  j ƒ j% j* } |	 j- | ƒ rÄ|  j* j. |	 j/ | ƒ ƒ n  |  j! |  j( t j" d ƒ |  j0 ƒ |  j! |  j* t j" d ƒ |  j0 ƒ | j t j d |  ƒ ƒ t j1 |  d t2 d d d d d d ƒ|  _3 |  j! |  j3 t j" d ƒ t4 j5 |  j6 d ƒ ƒ |  j! |  j3 t j" d ƒ |  j7 ƒ |  j3 j8 ƒ  | j |  j3 ƒ |  j$ | ƒ |  j! |  j3 t j" d ƒ |  j6 ƒ |  j! |  j3 t j" d ƒ |  j9 ƒ |  j j: d ƒ |  j j; d ƒ |  j< ƒ  |  j! |  j= ƒ  t j" d  ƒ |  j< ƒ |  j! t> ƒ  t j" d! ƒ |  j? ƒ d  S("   Ns   Show symmetry mates for i   s8   Automatic search for symmetry mates contacting the models    Search for symmetry mates withing      à?g      $@s   A ofs   Contact area of modelRj   s/   Optionally select limited contact area of modeli   s$   Search for contacting symmetry matesi    s	   clicked()t   Shows,   of symmetry mates in separate display objects   toggled(bool)s   currentIndexChanged(int)s   Enter transformationsR   R   i   R   R   t   clearedRy   s   lineAdded(int)s
   accepted()s   close()g      @t   allt   symmetryMatesChangedR	   (@   R
   R   R}   R   R~   R   R   R€   R    R   Rm   Rn   t   QFramet   setFrameStylet   Boxt   PlainR   R   Rl   t   QDoubleSpinBoxt   radiust   setRanget   setSingleStept	   addLayoutR+   Rp   R   Rq   Rr   Rs   t
   addStretchRž   RŸ   R   R   t
   autoSearchR   t   model_symmetryt   MolDisp_selection_menut	   QCheckBoxt   MolDisp_visibleRu   t   MolDisp_selectionRw   t
   setCheckedR[   Rz   R3   t   handleMolDispR   t   symmetryMatesLineR   t	   functoolst   partialR‚   t   handleNewLineR   RÃ   t   setValueR–   Rƒ   R   R   R   (   R   R   R   R    t   framet   frame_layoutt   line_layoutRx   R   Rã   R9   t   sele(    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/modelUtils.pyR   P  sŽ    	 ""*."""
%c   	   	   C   sÿ   |  j  ƒ  s d  S| j ƒ  } | j ƒ  } | j ƒ  } | s\ | s\ | s\ | j |  j k r` d  S| d j ƒ  } t |  j ƒ j } | s˜ | | j	 k  rœ d  S| j
 | ƒ } t |  j ƒ  ƒ } t j |  | d | | d | d g g |  j d i | d 6ƒd  S(   Ni    s   For symmetry mate RÉ   t   hideR"   R>   (   R?   R@   RA   t   getPickedAtomsRB   R}   t   GetModelNumR+   Râ   t   firstSymModelt
   modelSymopRC   RD   RE   RF   RG   (	   R   R>   RH   RI   t   atomlistR0   Râ   t   symopRB   (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/modelUtils.pyR   ¯  s     (  c      	   K   sÉ   | t  t |  j ƒ  ƒ ƒ } | j d d ƒ } | s8 d  S| j ƒ  } | d j ƒ  } | g } | d k r‘ t d d d d d	 |  j | g d
 d ƒ S| d k rÅ t d d d d d	 |  j | g d
 d ƒ Sd  S(   NR>   R   i    RÉ   RL   t   DeleteRN   s   Delete the symmetry mateRO   RP   i   Rò   t   Hides   Hide the symmetry mate(	   RR   RC   RD   RS   Ró   Rô   RU   t   deleteSymmMatet   hideSymmMate(   R   RB   R"   R>   R÷   R0   RX   (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/modelUtils.pyRG   Â  s"     	c         C   sj   | d } |  j  j d i g  d 6ƒ } | d j | ƒ rf |  j  j d | d j | ƒ ƒ |  j ƒ  n  d  S(   Ni    R8   t	   model_numt   line(   R   R.   R[   t
   deleteLineR3   R‚   (   R   RX   R0   R8   (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/modelUtils.pyRû   Ö  s
    
 c         C   sy   | d } |  j  j d i g  d 6ƒ } | d j | ƒ ru |  j  j | d j | ƒ ƒ } | j j d ƒ | j ƒ  n  d  S(   Ni    R8   Rý   (   R   R.   R[   t   getLineR3   t   visibleRç   t   handleVisibility(   R   RX   R0   R8   t
   sym_widget(    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/modelUtils.pyRü   ß  s    
c   	      C   s  d d  l  } |  j j ƒ  } | j | ƒ d k r9 d } n  |  j j ƒ  } d } t |  j ƒ j } | j	 ƒ  | j
 g  ƒ | j ƒ  } d G| GH| j d | d | d | ƒ } | d	 s| j
 | d
 ƒ | j ƒ  |  j ƒ  t |  j ƒ j j ƒ  } |  j | ƒ n  d  S(   NiÿÿÿÿR   RÕ   i   s   This should be emptyRa   RÜ   t	   xtl_limiti    i   (   t   stringRr   RL   t   stripRÜ   R-   R+   R}   Râ   t   delete_MolDispt   setSymmetryMatest   get_symmetry_modelst   findSymmetryNeighbourst   showSymmetryMatest   redrawt   getGuiParamsR)   (	   R   R  Ra   RÜ   R  t   sym_objt   modelst   rvR8   (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/modelUtils.pyRá   é  s$     	
	


c         C   sÚ   |  j  ƒ  } t |  j ƒ j } t |  j ƒ } x! t d d ƒ D] } | j ƒ  q= W| j | d d ƒ| d k r} | j ƒ  n
 | j ƒ  | j	 ƒ  } | GH| rÌ |  j
 j i | d 6| j d 6| j d 6ƒ n  |  j ƒ  d  S(	   Nt   object_typet   MolDispR/   i    Ry   Rý   R  t   colour(   R.   R+   R}   Râ   t   get_dispobjt   clearPickedAtomst   setGuiParamsR  R  R	  R   R)   t   symmetry_visiblet   symmetry_coloursR  (   R   RX   R8   R  t   molDatat   objR  (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/modelUtils.pyR‚     s     
 
c         C   s   t  j  j |  ƒ d  S(   N(   R
   RÃ   (   R   (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/modelUtils.pyRÃ     s    c         C   s8   |  j  j | ƒ } | j j t |  j ƒ j j ƒ  ƒ d  S(   N(   R   R   R  t
   set_colourR+   R}   Râ   t
   nextColour(   R   R3   R   (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/modelUtils.pyRì     s    c         K   sl   t  |  j ƒ } | s d  S| j j d t |  j j ƒ  ƒ d t |  j j	 ƒ  ƒ ƒ } | rh t
 d |  ƒ n  d  S(   NR  Ra   t   controllingWidget(   R+   R}   Râ   t
   setMolDispt   intRå   t	   isCheckedRC   Ræ   t   currentTextR7   (   R   Rd   R:   R  (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/modelUtils.pyRè   $  s     ! c         C   s)   t  |  j ƒ j j ƒ  } |  j | ƒ d  S(   N(   R+   R}   Râ   R  R)   (   R   R8   (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/modelUtils.pyRƒ   /  s    c         C   sH   t  |  j ƒ j } d d  l } | j d |  ƒ |  j t j d ƒ ƒ d  S(   NiÿÿÿÿR  t   nofModelsChanged(   R+   R}   Râ   R¿   RÀ   t   emitR   R   (   R   R  R¿   (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/modelUtils.pyR  6  s    c         C   s@   |  j  j i g  d 6g  d 6g  d 6g  d 6g  d 6g  d 6ƒ } | S(   NRø   t   tran_at   tran_bt   tran_cR  R  (   R   R.   (   R   R8   (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/modelUtils.pyR.   >  s    (c         K   sA   | j  | ƒ |  j j t ƒ |  j j | ƒ |  j j t ƒ d  S(   N(   Rc   R   t   blockSignalsR”   R)   R    (   R   R8   Rd   (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/modelUtils.pyR)   E  s    N(   Re   Rf   Rg   R   R   RG   Rû   Rü   Rá   R‚   RÃ   Rì   Rè   Rƒ   R  R.   R)   (    (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/modelUtils.pyRÒ   I  s   _					
							Ré   c           B   sq   e  Z d  d d d d d d d d d	 d
 g Z d „  Z d „  Z d „  Z d „  Z d „  Z d d „ Z d „  Z	 RS(   s   -5s   -4s   -3s   -2s   -1t   0t   1t   2t   3t   4t   5c         C   sA  t  j j |  | ƒ t |  j ƒ  j ƒ } | s2 d  St j ƒ  } | j d d d d ƒ | j	 d ƒ t j
 d |  ƒ |  _ | j |  j ƒ |  j j d ƒ |  j j d ƒ | j t j
 d |  ƒ ƒ t j |  ƒ |  _ |  j j d ƒ |  j j d ƒ x$ | j j D] } |  j j | ƒ qþ W|  j |  j t j d ƒ |  j ƒ | j |  j ƒ x¼ d	 d
 d g D]« } d | } t j |  ƒ } | j | ƒ t |  | | ƒ | j d | d ƒ x t j D] } | j | ƒ qµW| j d ƒ |  j | t j d ƒ |  j ƒ | j | ƒ qZW| j d ƒ t j
 d |  ƒ |  _ | j |  j ƒ | j d ƒ |  j j d ƒ t j |  ƒ |  _ |  j j d ƒ |  j j  d ƒ |  j j d ƒ |  j |  j t j d ƒ |  j! ƒ | j |  j ƒ t  j" |  ƒ |  _# |  j# j d ƒ |  j# j d ƒ |  j |  j# t j d ƒ |  j$ ƒ | j |  j# ƒ |  j% | ƒ d  S(   Ni    s   /1Rý   s&   Model number for use in atom selectiont    Rø   s   Symmetry operations   currentIndexChanged(int)t   at   bt   ct   tran_s   Unit cell translation in s
    directioni   i   t   1_555s/   Symmetry id which can be used in atom selections)   Model shown the 'symmetry' display objectR  s   toggled(bool)R  s(   Colour of model in the 'symmetry' objects"   currentIndexChanged(const QString)(&   R   t	   frameLineR   R+   Ro   R}   R    Rl   Rm   Rn   R   Rý   R   Rt   Rs   Ru   Rø   Râ   t   symops_titlesRw   R   R   R   t   updateSymidt   setattrRé   t	   TRAN_MENURz   Rà   t   symidRä   R  Rç   R  t   mgColourComboR  t   handleColourR   (   R   R   R:   R    R9   t   dirnRB   R   (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/modelUtils.pyR   Y  s^      "
""c         C   sf   |  j  j d ƒ x? d d d g D]. } t |  d | ƒ } | j | j d ƒ ƒ q  W|  j j d ƒ d  S(   Ni    R/  R0  R1  R2  R(  i   (   Rø   Rz   t   getattrt   findTextR  Rç   (   R   R<  R   (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/modelUtils.pyR{   •  s
    c         C   s¨   i t  t |  j j ƒ  ƒ d ƒ d 6t |  j j ƒ  ƒ d 6t |  j j ƒ  ƒ d 6t |  j j ƒ  ƒ d 6t |  j j ƒ  ƒ d 6t  |  j	 j
 ƒ  ƒ d 6|  j j ƒ  d 6} | S(	   Ni   Rý   Rø   R$  R%  R&  R  R  (   R  RC   Rý   RL   Rø   R!  R$  R%  R&  R  R   R  t
   get_colour(   R   t   pars(    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/modelUtils.pyR.      s    #c         C   s/  | j  d d ƒ } | r7 |  j j |  j j | ƒ ƒ n  | j  d d ƒ } | rb |  j j | ƒ n  xz d d d g D]i } t | j  d | d ƒ ƒ } | rr t j j	 | ƒ rr t
 |  d | ƒ } | j t j j | ƒ ƒ qr qr W| j d ƒ r|  j j | d ƒ n  | j d	 ƒ r+|  j j | d	 ƒ n  d  S(
   NRø   R   Rý   R/  R0  R1  R2  R  R  (   RS   Rø   Rz   R>  Rý   R–   RC   Ré   R8  R[   R=  R3   R(   R  Rç   R  R  (   R   R8   Rø   Rý   R<  t   tranR   (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/modelUtils.pyR)   ­  s         c         C   sˆ   t  |  j j ƒ  d ƒ d t  t |  j j ƒ  ƒ d ƒ t  t |  j j ƒ  ƒ d ƒ t  t |  j j ƒ  ƒ d ƒ } |  j j	 | ƒ d  S(   Ni   t   _i   (
   RC   Rø   t   currentIndexR  R$  R!  R%  R&  R9  R–   (   R   t   junkt   idx(    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/modelUtils.pyR6  ¿  s    T iÿÿÿÿc         C   sƒ   t  |  j ƒ  j ƒ } | s d  St t |  j j ƒ  ƒ j d ƒ ƒ } | j j	 | t |  j
 j ƒ  ƒ ƒ | j j ƒ  t d |  ƒ d  S(   Nt   /R  (   R+   Ro   R}   R  RC   Rý   RL   R  Râ   t   setVisibilityR  R   t   select_MolDispR7   (   R   t   stateR:   R0   (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/modelUtils.pyR  Ê  s     $"c         C   s}   t  |  j ƒ  j ƒ } | s d  St t |  j j ƒ  ƒ j d ƒ ƒ } | j j	 | |  j
 j ƒ  ƒ | j j ƒ  t d |  ƒ d  S(   NRF  R  (   R+   Ro   R}   R  RC   Rý   RL   R  Râ   t	   setColourR  R?  t   colour_MolDispR7   (   R   R  R:   R0   (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/modelUtils.pyR;  Õ  s     $(
   Re   Rf   R8  R   R{   R.   R)   R6  R  R;  (    (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/modelUtils.pyRé   R  s   '	<				t   DispObjTreec           B   s2   e  Z d g  d  g g  d „ Z d „  Z d „  Z RS(   R  c         C   s„   t  j j |  | ƒ |  j ƒ  j d ƒ |  j t  j j ƒ | |  _ | |  _	 | |  _
 |  j ƒ  |  j t ƒ  t j d ƒ |  j ƒ d  S(   Ni   t   DisplayTableChanged(   R    t   QTreeWidgetR   t
   headerItemt	   setHiddent   setSelectionModet   QAbstractItemViewt   SingleSelectiont   object_typest   excludet   dataobj_listt   populateR   t   DISPLAYTABLER   R   (   R   R   RV  RT  RU  (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/modelUtils.pyR   é  s    			
c         C   só  |  j  ƒ  } i  } | r� |  j  ƒ  j ƒ  r� xT t d |  j  ƒ  j ƒ  ƒ D]4 } | j | ƒ } | j ƒ  | t | j d ƒ ƒ <qF Wn  |  j ƒ  g  |  _ |  j	 rÐ g  } x9 |  j	 D] } | j
 t d | ƒ ƒ q­ Wn t d d ƒ } x|  j D]} xù | D]ñ } t j | j g ƒ } | j d | j ƒ | j t j j ƒ |  j | ƒ | j d | ƒ }	 x^ |	 D]V } |  j j | j ƒ s]t j | j ƒ  g ƒ }
 | j |
 ƒ |
 j d | j ƒ q]q]W| j | ƒ rÚ| j | | ƒ qö | j d ƒ qö Wqé Wd  S(   Ni    RB   R  R   i   (   t   invisibleRootItemt
   childCountRª   t   childt
   isExpandedRC   RL   Ry   t	   disp_listRV  R/   R+   t   get_dataobjRT  R    t   QTreeWidgetItemRB   R–   t   setChildIndicatorPolicyt   ShowIndicatort   addTopLevelItemR  RU  R[   t   get_selection_labelt   addChildRs   R(   t   setExpanded(   R   t   rootR*   RÁ   R9   RV  R  t   dataobjt   topt   dispobj_listRþ   (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/modelUtils.pyRW  õ  s8    "&
		 c         C   s7   |  j  ƒ  } | s  | j ƒ  r$ d St | j d ƒ ƒ S(   NR   i    (   t   currentItemR   RC   t   toolTip(   R   R9   (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/modelUtils.pyt   getCurrentDispObj  s     N(   Re   Rf   Rg   R   RW  Rl  (    (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/modelUtils.pyRL  ã  s   	(t   AsDispObjGuic           B   s>   e  Z d g  g  d  g d „ Z d d „ Z d „  Z d „  Z RS(   R   c         C   sJ  t  j j |  | ƒ t  j ƒ  } t d | d | d | ƒ |  _ | j |  j ƒ t  j |  ƒ } | j d t  j j	 ƒ } |  j
 | t j d ƒ t j |  j d ƒ ƒ |  j
 | t j d ƒ |  j ƒ | j d t  j j ƒ } |  j
 | t j d ƒ |  j ƒ | j d t  j j ƒ } |  j
 | t j d ƒ |  j ƒ | j | ƒ |  j | ƒ d  S(	   NRV  RU  RT  t   OKs	   clicked()i   R‚   RÃ   (   R    t   QDialogR   R   RL  t   treeR   t   QDialogButtonBoxt	   addButtont
   AcceptRoleR   R   R   RE   Rë   t	   emitApplyR   t	   ApplyRolet
   RejectRoleR   (   R   R   RV  RU  RT  R    t   buttonst   but(    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/modelUtils.pyR   .  s    +i    c         C   sT   |  j  t j d ƒ t j |  j ƒ  ƒ t j |  j ƒ  ƒ f ƒ | rP |  j ƒ  n  d  S(   NR   (   R#  R   R   t   QVariantRD   Rl  R   (   R   R   (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/modelUtils.pyRt  C  s    = c         C   s   |  j  j ƒ  d  S(   N(   Rp  RW  (   R   (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/modelUtils.pyRW  G  s    c         C   s   |  j  j ƒ  S(   N(   Rp  Rl  (   R   (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/modelUtils.pyRl  J  s    N(   Re   Rf   Rg   R   Rt  RW  Rl  (    (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/modelUtils.pyRm  )  s   	t   AsDataObjGuic           B   s8   e  Z d g  d  d „ Z d d „ Z d „  Z d „  Z RS(   R   c         C   s¨  t  j j |  | ƒ t  j ƒ  } t  j ƒ  } t  j d |  ƒ |  _ |  j j d ƒ | j |  j ƒ | j	 | ƒ t
 j d | ƒ |  _ | r› |  j j | ƒ n  | j |  j ƒ t  j |  ƒ } | j d t  j j ƒ } |  j | t j d ƒ t j |  j d ƒ ƒ |  j | t j d ƒ |  j ƒ | j d t  j j ƒ } |  j | t j d ƒ |  j ƒ | j d t  j j ƒ } |  j | t j d ƒ |  j ƒ | j | ƒ |  j | ƒ d  S(   Ns   Clear existing display objectsi   R  Rn  s	   clicked()R‚   RÃ   (   R    Ro  R   R   Rl   Rä   Ry   Rç   R   Rß   R   t   mgDataObjCombot	   dataCombot   setExcludeDataObjListRq  Rr  Rs  R   R   R   RE   Rë   Rt  R   Ru  Rv  R   (   R   R   t   exclude_listR  R    Rþ   Rw  Rx  (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/modelUtils.pyR   T  s,     +i    c         C   s{   | r |  j  ƒ  n  |  j ƒ  rw |  j t j d ƒ t j |  j ƒ  ƒ t j |  j ƒ  j ƒ t j |  j j	 ƒ  ƒ f ƒ n  d  S(   NR   (
   R   t   getCurrentDataObjR#  R   R   Ry  RD   RB   Ry   R   (   R   R   (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/modelUtils.pyRt  p  s     c         C   s   |  j  j ƒ  d  S(   N(   R|  RF   (   R   (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/modelUtils.pyRW  u  s    c         C   s   |  j  j ƒ  S(   N(   R|  R  (   R   (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/modelUtils.pyR  x  s    N(   Re   Rf   Rg   R   Rt  RW  R  (    (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/modelUtils.pyRz  P  s   	(   t   __doc__t   PyQt4R    R   t   global_definitionsRE   R
   R   R0   Rê   R   Rk   R   R|   R�   R£   R¤   R¸   R¹   RÌ   RÍ   RÒ   R4  Ré   RN  RL  Ro  Rm  Rz  (    (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/modelUtils.pyt   <module>   s,   
š;1'—'Š(`+ÿ 
‘F'