ó
ÉŻ{Tc           @   s6  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 e j f d     YZ	 d e j
 f d     YZ d	 e j f d
     YZ d e f d     YZ d e f d     YZ d e j f d     YZ d e f d     YZ d e f d     YZ d e f d     YZ d e f d     YZ d S(   s  
     qtgui/mgPreferences.py: CCP4MG Molecular Graphics Program
     Copyright (C) 2001-2008 University of York, CCLRC
     Copyright (C) 2009-2011 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   preferenceButtonsc           B   s   e  Z d    Z RS(   c      	   C   s  t  j j |  |  t  j   } t d d d d d d d d  } x· d d d d g D]£ } t  j |  } | j | |  | j t  j j	 t  j j
  | j |  | j |  | d k rS t  j |   } | j d	  } | j |  | j d
  qS qS W|  j |  d  S(   Nt   applyt   Applyt   resets   Reset defaultst   helpt   Helpt   closet   Closes   Apply to allt	   apply_all(   R    t   QFramet   __init__t   QHBoxLayoutt   dictt   QToolButtont   setTextt   setSizePolicyt   QSizePolicyt	   Expandingt	   Preferredt   setObjectNamet	   addWidgett   QMenut	   addActiont   setMenut	   setLayout(   t   selft   parentt   layoutt   textt   itemt   widgett   menut   applyAll(    (    s@   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/mgPreferences.pyR   $   s$    	(   t   __name__t
   __module__R   (    (    (    s@   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/mgPreferences.pyR      s   t   preferencesBrowserc           B   s   e  Z d  Z d Z g  Z d   Z d d d d  Z d   Z d   Z	 d d	  Z
 d
   Z d   Z d   Z d d  Z d   Z RS(   ié  iź  c         C   s*   |  j  |  j j    t j j |   d  S(   N(   t   loadNewWidgett   visibleWidgett
   objectNameR    t   QDialogt   show(   R   (    (    s@   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/mgPreferences.pyR+   G   s    i  i^  c   	      C   s  t  t |   j |  | |  _ d  |  _ | |  _ t j   } t j	   } | j
 t j j  t j |   } |  j d  |  _ | j |  j  | j t j j  | j |  | j d  |  j j |  | j |  |  j |  j t j d  |  j  t j |   } | j t j j  | j   j   |  _ | j |  | j | |  j  t j   } | j d d d d  t j   |  _  | j |  j   | j |  | j! | d  | |  _" t# |   |  _$ xW d d d d	 g D]C } |  j |  j$ j% t j& |  t j d
  t' j( |  j) |   qŚW|  j$ j% t j* d  |  j$ j% t j* d  j+ t,  |  j |  j$ j% t j* d  t j d  t' j( |  j) d   | j- |  | j |  j$  |  j. |  |  j/   j0 d  |  j1 d  |  j t2   t j d  |  j3  d  S(   Nt   model_drawing_stylei   s   itemSelectionChanged()i    i
   R   R   R   R	   s   clicked(bool)R   s   triggered(bool)t   Preferencest   CustomDrawingStyleChanged(4   t   superR&   R   t   scrollHeightt   NoneR(   t   container_widthR    t   QVBoxLayoutR   t   setSizeConstraintt   QLayoutt   SetFixedSizet   QScrollAreat   drawTreet   treet	   setWidgett   setHorizontalScrollBarPolicyR   t   Qtt   ScrollBarAlwaysOfft   setMinimumHeightt   setMinimumWidthR   t   connectt   SIGNALt   handleTreeClickt   verticalScrollBart   heightt   scrollWidtht   setContentsMarginst   QLabelt
   scrollHeadt	   addLayoutt	   containerR   t   buttonst	   findChildt   QWidgett   guiUtilst   partialt   handleButtonst   QActiont
   setEnabledt   Falset   addItemR   t   windowt   setWindowTitleR'   t   DISPLAYTABLEt   handleCustomDrawingStyleChanged(	   R   R   RD   t   widtht
   top_layoutR   t   scrollt   scrollLayoutR    (    (    s@   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/mgPreferences.pyR   K   sP    			"	A=c         C   s   |  j  |  j j    d  S(   N(   R'   R(   R)   (   R   (    (    s@   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/mgPreferences.pyRX      s    c         C   s   | d k r |  j  j   n| | d k r8 |  j  j   n` | d k rT |  j  j   nD | d k rs |  j   j   n% | d k r |  j  j   n	 d G| GHd  S(   NR   R   R   R	   R   s   Unknown request:(   R(   R   t   resetDefaultsR   RU   R	   R#   (   R   R    (    (    s@   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/mgPreferences.pyRP      s    t    c         C   sł   d d  l  } d  } t j   } |  j d  } x | D] } |  j |  } | r4 t j | g t j  } | j |  xK | D]@ }	 |  j	 |	  }
 |
 r{ | j
 |
  |	 | k r» |
 } q» q{ q{ Wq4 q4 W| j   j d  | rõ | rõ | j |  n  | S(   Ni’’’’t   preferenceGroupsi   (   t   typesR1   R    t   QTreeWidgett	   getGuiDeft   QTreeWidgetItemR&   t   typeNodet   addTopLevelItemt   makeTreeWidgetItemt   addChildt
   headerItemt	   setHiddent   setCurrentItem(   R   t   selectedR`   t   selected_itemR9   t   treeDeft   nodet   mdefR    t   actiont   item0(    (    s@   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/mgPreferences.pyR8      s&      c         C   s¬   |  j  |  } | r¢ t j | j d d  g t j  } | j d | j d d   | j d  } | r} | j d |  n  | j d t	 j
 j t	 j |   n d  } | S(   NR   R^   i   t   toolTipi    (   t   getActionDefR    Rc   t   getR&   t   typeLeafR   t
   setToolTipt   setDataR   R<   t   UserRolet   QVariantR1   (   R   t   namet   adefR    Rr   (    (    s@   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/mgPreferences.pyRf   ®   s    $ %c         C   s¢  | d k r. |  j  j t j d  j t  n |  j  j t j d  j t  |  j j d  |  j j	   |  j
 r |  j
 j   n  |  j t j |  |  _
 |  j
 rÉ |  j
 j   d k rÉ |  j
 j   n| d k r’ t |  d t   j   d |  j |  _
 n@| d k rpt |  d |  j d t d	  j   |  _
 |  j
 j d
  |  j
 j |  j
 t j d  |  j
 j  nĻ| d k r£t |  d t d  d |  j |  _
 n| d k rßd d  l } | j |  d t   j   |  _
 n`| d k rd d  l } | j |  d t   j   |  _
 n$t |  } | r;d d  l  } t! | | j"  rlt# |  d | d |  j |  _
 nd t$ |  d | d |  j |  _
 t% | d  rŠt& | j'  rŠ|  j
 j |  j
 t j d  | j'  n  | d k r+t( d d  } g  } x2 | D]* } t% | d  rų| j) |  | GHqųqųWt* |  d k r+d }	 xē t+ t, t* |   |  D]Ē \ }
 } |	 | j- j. d }	 t* | j/ j0  d k r¶|	 t1 | j/ j0  d d !d }	 n |	 t1 | j/ j0  }	 |	 d | j2 d }	 |
 t* |  d k  r|	 d }	 n  |  j j |	  |  j j   qZWq+n  |  j
 j   n d  S|  j
 j |  |  j3 |  } |  j4   j5 d | j6 d d   |  j7 j8 |  j
  |  j7 j9 |  j
 j:   |  j;  |  j9 |  j
 j:   |  j; |  j< j:    |  j  j t j d  } | r| j t  n  | r@t% |  j
 d   r@|  j
 j= r@| j t  n  | rt% |  j
 d  rt> |  j
 j? d d  rt> |  j
 j? d d  d  k r| j t  n  d  S(!   Nt   font_browserR   R^   R,   t   pick_atom_label_stylet   paramsRY   t   moldisp_atom_label_stylet   atom_label_paramst   GenericMolLabelR   t   HBond_drawing_stylet   pmi’’’’t   mouse_bindingst   apply_actiont   object_typet   MolDispt   drawingStylePMi    s4   Caution some objects have custom drawing styles:<br>t   :i   s   ...t   (t   )i   s   <br>s   Preferences  R   R   t   _has_no_help_(@   RK   RL   R    RQ   RR   t   TrueRS   RH   R   t   hideR(   R	   RM   R)   R+   t   pickAtomLabelStyleGuit	   PICKLABELt	   getparamsR2   t   moldispAtomLabelStyleGuit   PMR   R@   R   RA   t   applyDefaultMolLabelt   hbondStyleGuit   FontBrowsert   FONTMANAGERt   MouseBindingst
   MAINWINDOWt   mouseBindingst   servicest
   isinstancet   ColourSchemeManagert   colourManagerGuit   paramsManagerGuit   hasattrt   callableR   t   get_dispobjt   appendt   lent   zipt   rangeR   t
   name_labelt	   SelHandlet   labelt   strt   style_labelRs   RU   RV   Rt   RJ   R:   R?   RY   RE   R9   R   t   getattrR   (   R   t   modeR   R   R   R   t   obj_listt   customst   oR   t   it   custR{   t   help_button(    (    s@   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/mgPreferences.pyR'   Į   s    "	 **+'$$!(($# * $Nc         C   s5  | d k r1 d d d d d d d d	 d
 d d g S| d k rM d d d d g S| d k ro d d  l  } | j j S| d k r d d d d g S| d k r” d d g S| d k rĆ d d d d d d g S| d k rÖ d g S| d k rģ d d  g S| d	 k rd! d" d# d$ d% g S| d
 k rd& g S| d k r1|  j Sd  S('   NR_   s   Model displays   Model colourss   Model analysist   Surfacest   Mapst   Displays   Images and moviest	   Behaviourt   Toolst   Applicationss   Plugins preferencesR,   R   R   R}   i’’’’t   HBond_paramt   Contacts_paramt   SecStr_paramt   SASArea_paramt   surface_drawing_stylet   Surface_electrot   render_qualityR|   t   Animation_paramt   stereo_prefst   ambient_occlusion_prefst   miscell_prefst   MapDispParamsManagert   screenshot_preferencest   movie_preferencest   user_interfaceR   t   save_session_optionst   centre_modet   advanced_optionst   download_preferences(   R   R   t   colour_pref_aliast   plugin_preferences(   R   Rz   R   (    (    s@   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/mgPreferences.pyRb     s2    	


c         C   sŖ  t  |  } | d k r@ t d d d t j |  j d  d d  S| d k rt t d d d t j |  j d  d d	  S| d
 k rØ t d d d t j |  j d
  d d  S| d k rÜ t d d d t j |  j d  d d  S| d k rt d d d t j |  j d  d d  Sd d  l } | j j j |  rlt d | j j	 | j j j
 |  d t j |  j |   St |  } | r¦t d | j   d t j |  j |   Si  S(   NR}   R   s   Pick atom label stylet   slotRr   s>   Set label content and maximum number of labels on picked atomsR   s   Atom label styles5   Set label content and select which atoms are labelledt   hbond_styles   HBond drawing styles:   Set default drawing style and labelling for Hydrogen bondsR|   t   Fontss5   Change the default fonts for atom labels, legend etc.R   s   Mouse bindingss6   Change the mouse binding for rotate,translate,zoom etci’’’’(   RŖ   R   RN   RO   R'   R   R   RĶ   t   countt   colour_pref_menut   indexR   t   getTitle(   R   Rz   R   R   (    (    s@   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/mgPreferences.pyRs   G  sJ    c         C   si   |  j  j   } | j   t j k r( d  S|  j | j d t j j	  j
    } t | d g  i   } d  S(   Ni   RĻ   (   R9   t   currentItemt   typeR&   Ru   Rs   t   dataR   R<   Rx   t   toStringR   (   R   R    R{   R!   (    (    s@   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/mgPreferences.pyRB     s
     'N(   R$   R%   Rd   Ru   RĪ   R+   R1   R   RX   RP   R8   Rf   R'   Rb   Rs   RB   (    (    (    s@   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/mgPreferences.pyR&   >   s   	7				^	(?t   preferenceGuic           B   sk   e  Z d  d  Z d d  Z d   Z d   Z d   Z d   Z d   Z d	   Z	 i  d
  Z
 d   Z RS(   i^  c         C   s-   t  j j |  |  |  j |  d |  _ d  S(   Ni    (   R    RM   R   t   setFixedWidtht   block_signal(   R   R   RY   (    (    s@   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/mgPreferences.pyR     s    i    c         C   s   | |  _  d  S(   N(   RÜ   (   R   t   block(    (    s@   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/mgPreferences.pyt   setBlockSignal  s    c         C   s   |  j  |  j    d  S(   N(   t	   setParamst   defaults(   R   (    (    s@   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/mgPreferences.pyR]   ¤  s    c         C   s   |  j  t j d   d  S(   NR   (   t   emitR   RA   (   R   (    (    s@   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/mgPreferences.pyR   Ŗ  s    c         C   s   |  j  t j d   d  S(   NR   (   Rį   R   RA   (   R   (    (    s@   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/mgPreferences.pyR   Æ  s    c         C   s&   |  j  s" |  j t j d   n  d  S(   Nt   changed(   RÜ   Rį   R   RA   (   R   (    (    s@   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/mgPreferences.pyt   handleChange³  s    	 c         C   s&   |  j  s" |  j t j d   n  d  S(   NRā   (   RÜ   Rį   R   RA   (   R   t   p(    (    s@   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/mgPreferences.pyt   handleChange1ø  s    	 c         C   s   i  S(   N(    (   R   (    (    s@   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/mgPreferences.pyRą   ¾  s    c         K   s   d  S(   N(    (   R   R~   t   kw(    (    s@   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/mgPreferences.pyRß   Ā  s    c         C   s   i  S(   N(    (   R   (    (    s@   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/mgPreferences.pyt	   getParamsÅ  s    (   R$   R%   R   RŽ   R]   R   R   Rć   Rå   Rą   Rß   Rē   (    (    (    s@   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/mgPreferences.pyRŚ     s   						R   c           B   sV   e  Z d  d  Z d   Z d   Z i  d  Z d   Z d   Z d   Z d   Z	 RS(	   i^  c         C   sS   t  j |  | d | | |  _ |  j | j  |  j   |  j |  j j    d  S(   NRY   (   RŚ   R   R   R   Rz   t   drawRß   R   (   R   R   R   RY   (    (    s@   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/mgPreferences.pyR   Š  s
    	
c         C   s   d d  l  } | j |  d |  j |  } |  j | t j d  | j  |  j | t j d  | j  | j t	  | j
   d  S(   Ni’’’’t   titlet   open(   t	   mgWidgetst   MGOpenFileDialogt   trR@   R   RA   R	   R   t   setModalR   R+   (   R   R!   R   Rė   t   fd(    (    s@   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/mgPreferences.pyt   getDirectoryŲ  s    c      
   C   sÉ  d d  l  } |  j   j |  j j    t j   } xJ|  j j   D]9} |  j j |  } | j	 d d  } d  } | d k rś t j |   } t j d  } |  j | t j d  |  j  |  j | t j d  t j |  j | | j	 d d	    n| d
 k r(| j	 d d  } | j |  nd| d k rFt j |   } nF| d k rPt j |   } |  j | t j d  |  j  | j	 d d	  rd  }	 | d t k rŗt j |   }	 n" | d t k rÜt j |   }	 n  |	 rM| j |	  | j	 d d	  d	 k r|	 j | d  n  | j	 d d	  d	 k rJ|	 j | d  qJqMqn<| d k rZ| j	 d t  t k r„t j |   } |  j | t j d  |  j  n. t j |   } |  j | t j d  |  j  | j	 d d	  d	 k r’| j | d  n  | j	 d d	  d	 k r+| j  | d  n  | j	 d d	  d	 k r| j! | d  qn2| d k rt j" |   } |  j | t j d  |  j  nõ| d k r7t j# |   } x0 | j	 d g   D] }
 | j$ t j% |
   qÅW| j	 d d	  d	 k r| j | t j d  t j | j	 d d	  |    qnU| d k re| j& |   } | j	 d d	  d	 k r | j	 d d	  d	 k r | j' j( | d | d  n  | j	 d d	  d	 k rŅ| j' j) j* | d  n  | j	 d d	  d	 k r| j' j+ j* | d  n  | j	 d d	  d	 k r3| j, j- | d  n  | j	 d d	  d	 k r| j. j- | d  qn' | d k r| j/ |  d  d! d" } n  | rD t j0 |   } t j1 |  } | j2 d# d# d# d#  | j3 |  t j | j	 d d	  |   } | j4 |  | j4 |  | j5 | t j6 j7  | j5 | t j6 j8  | j9 |  | d k rm| j4 |  | j: d$  n  | j4 |  qD qD W|  j9 |  t; |  j d%  rÅt< |  j j=  rÅ|  j j= |   n  d  S(&   Ni’’’’t   stylet   lineeditt   fileedits   ...s   editingFinished()s   clicked(bool)R©   R^   t   spacert   sizei   R×   t   maxt   mint   spinboxs   valueChanged(int)s   valueChanged(double)t   stept   checkboxs   stateChanged(int)t   comboboxR"   t   onchanges#   currentIndexChanged(const QString&)t   doublecolourslidert
   lowerValuet
   upperValuet   lowerColourt   upperColourt   colourcombot   redt   browseri   i    i   t   onCreate(>   Rė   RU   RV   R   RÕ   R    R3   Rb   t   getParamDefRt   R1   t	   QLineEditt   QPushButtonR@   R   RA   Rć   t	   functoolsRO   Rš   t
   addSpacingRG   t   floatt   QDoubleValidatort   intt   QIntValidatort   setValidatort   setTopt	   setBottomt   QSpinBoxt   QDoubleSpinBoxt
   setMaximumt
   setMinimumt   setSingleStept	   QCheckBoxt	   QComboBoxRT   t   QStringt   DoubleColourSlidert   slidert   setRanget	   lowerSpint   setValuet	   upperSpint   lowColourCombot
   set_colourt   highColourCombot   mgColourComboRM   R   RF   R   R   t   setAlignmentR<   t	   AlignLeftt
   AlignRightR   t   setMaximumWidthR    R”   R  (   R   Rė   R   Rz   t   defnRń   R!   t   locationButtonRõ   t   valR    t   linet   line_layoutR©   (    (    s@   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/mgPreferences.pyRč   ā  sŖ    =  "   ":0    $c   	      K   sĒ  d d  l  } | j |  |  j d  x| j   D]\ } } |  j t j |  } | r3 t | t j  r | j	 t
 j |   q²t | t j  r§ | j |  q²t | t j  rÉ | j |  q²t | | j  rō | j | j |   q²t | t j  r²|  j j |  } d } | j d g   j |  rW| j d g   j |  } n9 | j d g   j |  r| j d g   j |  } n  | d k rÆ| j |  qÆq²q3 q3 W|  j d  d  S(   Ni’’’’i   t   aliasR"   i    (   Rė   t   updateRŽ   t   itemsRL   R    RM   R   R  R   R   R  t   QAbstractSpinBoxR  R  t
   setCheckedR#  t   setCurrentIndext   findTextR  R   R  Rt   RŅ   RŌ   (	   R   R~   Rę   Rė   t   keyt   valueR!   R(  t   ii(    (    s@   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/mgPreferences.pyRß   @  s0     c         C   s~  d d  l  } i  } xe|  j j   D]T} |  j t j |  } | r" t | t j  rn t | j	    | | <qvt | t j
  r | j   | | <qvt | t j  r¾ t | j    | | <qvt | | j  rć | j   | | <qvt | t j  rK|  j j |  } | j d g   } | s4| j d g   } n  | | j   | | <qvt | | j  rv| j | j    qvq" q" W| S(   Ni’’’’R-  R"   (   Rė   R   Rb   RL   R    RM   R   R  RŖ   R   R0  R5  R  R  t	   isCheckedR#  t
   get_colourR  R  Rt   t   currentIndexR  R.  t	   getValues(   R   Rė   R~   R4  R!   R(  t
   alias_list(    (    s@   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/mgPreferences.pyRē   ]  s,     c         C   s   |  j  j   S(   N(   R   t   getDefaults(   R   (    (    s@   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/mgPreferences.pyRą   x  s    c         C   sM   t  |  j d d  } t  |  j d d  } | rI t   j | d | n  d  S(   NR   R^   t   plugin(   R¬   R   t   HELPBROWSERt
   loadMgHelp(   R   t   targetR=  (    (    s@   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/mgPreferences.pyR   }  s     c         C   s'   |  j  j |  j    t j |   d  S(   N(   R   t	   setparamsRē   RŚ   R   (   R   (    (    s@   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/mgPreferences.pyR     s    (
   R$   R%   R   Rš   Rč   Rß   Rē   Rą   R   R   (    (    (    s@   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/mgPreferences.pyR   Ė  s   	
	^			R   c           B   sz   e  Z d  d d g Z d d d g Z d d g Z d d	  Z d d
  Z i  d  Z d   Z d   Z	 d   Z
 d   Z RS(   s   no interpolations   around colour wheels   between RGB valuest   NOt   HSVt   RGBt	   clockwises   anti-clockwisei^  c         C   sV   t  j |  | d | | |  _ |  j | j  |  j |  |  j |  j j    d  S(   NRY   (   RŚ   R   R   R   Rz   Rč   Rß   R   (   R   R   R   RY   (    (    s@   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/mgPreferences.pyR     s
    	c   	      C   sš  d d  l  } |  j   j d |  j j    t j   } d } |  j j d  j d d  d k rZt j	   } t j
 d |   } | j |  | j |  d	  } | j d
  | j |  t j
 d |   } | j |  | j |  d	  } | j d  | j |  | | j   } | j |  t j	   } t j
 d |   } | j |  t j |   } x' t j D] } | j t j |   qeW| j d  | j |  | | j   } | j |  t j	   } t j
 d |   } | j |  t j |   } x' t j D] } | j t j |   q W| j d  | j |  | | j   } | j |  n  | d |  _ |  j j d  j d d  } | j |  d t d | d | d d d d |  j   j j   |  j |  _ | j |  j  |  j |  d  S(   Ni’’’’s   Colour i    t   rangesR×   RŖ   R  s   Below ranget   magentat   colour0s   above ranget   colourns   Interpolate between colours:t   interpolate_modes&   RGB interpolation around colour wheel:t   colour_wheel_directioni(   t
   extensiblei   R!   t
   ifEditableRY   i   t   ifApplyRD   (   Rė   RU   RV   R   RÕ   R    R3   R  Rt   R   RG   R   R#  R   RD   RI   R  R   t   interpolate_menuRT   R   R  t   direction_menut   fixed_content_heightt   extendingFramet
   colourLineR   RJ   t   exFrameR   (	   R   RY   Rė   R   RD   R,  R!   R©   RM  (    (    s@   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/mgPreferences.pyRč   ”  sV     $Jc         K   sė  d d  l  } | j |  |  j t j d  } | ry | j d  ry t j j | d  ry | j	 t j j
 | d   n  |  j t j d  } | rŁ | j d  rŁ t j j | d  rŁ | j	 t j j
 | d   n  | j d  rē| j d  rē|  j j d  j d d  d k rŗ|  j | j d	  j | d d
  |  j | j d  j | d d  i | d d d !d 6| d d d !d 6} |  j d  |  j j |  |  j d
  qē|  j d  |  j j |  |  j d
  n  d  S(   Ni’’’’RJ  RK  t   coloursRF  R×   RŖ   R  RH  i    RI  i   (   Rė   R.  RL   R    R  t   has_keyR   t   interpolate_aliasRŅ   R2  RŌ   RP  R   R  Rt   R#  R!  RŽ   RT  Rß   (   R   R~   Rę   Rė   R!   t   pars(    (    s@   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/mgPreferences.pyRß   Ų  s(    + + $$$c         C   s#  d d  l  } |  j j i g  d 6g  d 6 } |  j j d  j d d  d k r| d j d d  | d j d  | d j d t |  j	 | j
 d	  j     | d j t |  j	 | j
 d
  j     t j |  j	 t j d  j   | d <t j |  j	 t j d  j   | d <n  | S(   Ni’’’’RF  RU  R×   RŖ   R  i    g        RH  RI  RJ  RK  (   Rė   RT  Rē   R   R  Rt   t   insertR£   RŖ   RL   R#  R8  R   RW  R    R  R9  RP  (   R   Rė   R~   (    (    s@   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/mgPreferences.pyRē   ö  s     $/,&)c         C   s   |  j  j   S(   N(   R   R<  (   R   (    (    s@   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/mgPreferences.pyRą   	  s    c         C   s=   |  j  j |  j    t j |   d d  l } | j   d  S(   Ni’’’’(   R   RA  Rē   RŚ   R   t   rebuildt   UpdateDisplay(   R   RZ  (    (    s@   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/mgPreferences.pyR     s    c         C   s   t    j d d  d  S(   Nt   files   model.html#colour(   R>  R?  (   R   (    (    s@   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/mgPreferences.pyR     s    (   R$   R%   RO  RW  RP  R   Rč   Rß   Rē   Rą   R   R   (    (    (    s@   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/mgPreferences.pyR     s   	7			RS  c           B   s   e  Z d d   Z d   Z RS(   c         C   s¾  d d  l  } t j j |  |  t j   } | j d d d d  | j d  |  j   j j	 d  } | j
 d d  } | d k r t j |   } n± | d k r“ t j |   } n | d k rG| j
 d d	  d	 k rź t j |   } n t j |   } | j | j
 d
 d   | j | j
 d d   | j | j
 d d   n  | j d  | j d  | j |  | j |  d d d } | j d  | j d  | j |  |  j |  d  S(   Ni’’’’i    RF  Rń   Rņ   R©   Rų   R×   R  R÷   g        Rö   g      š?Rł   g¹?s
   Data valueRG  R  i   RU  t   Colour(   Rė   R    RM   R   R   RF   t
   setSpacingR   R   R  Rt   RG   R  R  R  R  R  R  R   Rv   R   R#  R   (   R   R   Rė   R   R(  Rń   R!   (    (    s@   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/mgPreferences.pyR   %  s4    c         C   s<   |  j  t j d  j d  |  j  t j d  j d  d  S(   NRF  g        RU  RG  (   RL   R    RM   R  R!  (   R   (    (    s@   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/mgPreferences.pyt
   setDefaultJ  s    N(   R$   R%   R1   R   R_  (    (    (    s@   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/mgPreferences.pyRS  !  s   %t   atomLabelStylec           B   sG   e  Z i  d  d  Z d   Z i  d  Z d   Z d   Z d   Z RS(   i^  c         K   s`   t  j |  | d | d |  _ |  j   |  j   } | j |  | j |  |  j |  d  S(   NRY   i   (   RŚ   R   t
   autoUpdateRč   Rą   R.  Rß   (   R   R   R~   RY   Rę   RX  (    (    s@   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/mgPreferences.pyR   Z  s    	
c         C   s   t  d t j d d d d  S(   Nt   label_stylet   truncate_mol_name_lengthi   t   truncate_mol_namei    (   R   t   MolLabelt   DEFAULT_LABEL_STYLE(   R   (    (    s@   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/mgPreferences.pyRą   f  s    	c         K   s  | j  |  |  j d  | j d  rL |  j t j d  j | d  n  | j d  r~ |  j t j d  j | d  n  | j d  rt t	 | d  t	 t
 j   } xT t d |  D]@ } |  j t j t
 j |  } | ræ | j | d |  qæ qæ Wn  |  j d  d  S(   Ni   Rd  Rc  Rb  i    (   R.  RŽ   RV  RL   R    RM   R1  R  R÷   R¤   Re  t   LABEL_STYLE_PARAMR¦   (   R   R~   Rę   t   llR6  R!   (    (    s@   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/mgPreferences.pyRß   p  s    ##" c         C   s   i  } |  j  t j d  j   | d <|  j  t j d  j   | d <g  } x9 t j D]. } | j t |  j  t j |  j     qT W| | d <| S(   NRd  Rc  Rb  (	   RL   R    RM   R7  R5  Re  Rg  R£   R  (   R   RX  Rb  R    (    (    s@   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/mgPreferences.pyRē     s    ,
c   	      C   sŠ  |  j    } t j   } t j   } t j d |   } |  j ra |  j | t j d  |  j	  n  | j
 d  | j |  t j |   } | j
 d  | j d d  |  j rŅ |  j | t j d  |  j	  n  | j |  | j   | j |  | j   } | j | | d d d	  | d } d
 } x t j D] } t j | } t j t j | |   } | j
 |  | d } | j | | | d	 | d	 d d  |  j r5|  j | t j d  |  j	  q5q5Wd  S(   Ns   Truncate model name tos
   released()Rd  Rc  i    id   s   valueChanged(int)i   i   i’’’’(   R   R    RM   R   R  Ra  R@   R   RA   R   R   R   R  R  t
   addStretchR   t   rowCountRe  t   LABEL_STYLE_GUI_ORDERRg  t   LABEL_STYLE_ALIAS(	   R   R   R+  R,  R!   t   nrR6  t   orderR©   (    (    s@   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/mgPreferences.pyRč     s8    	"	"


%	c         C   s   |  j  |  j    d  S(   N(   Rß   Rą   (   R   (    (    s@   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/mgPreferences.pyR_  ø  s    (   R$   R%   R   Rą   Rß   Rē   Rč   R_  (    (    (    s@   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/mgPreferences.pyR`  T  s   	
		%R   c           B   sP   e  Z i  d  d  Z i  d  Z d   Z d   Z d   Z d   Z d   Z RS(   i^  c         K   s*   | j  |  t j |  | | d | d  S(   NRY   (   R.  R`  R   (   R   R   R~   RY   Rę   (    (    s@   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/mgPreferences.pyR   Ē  s    c         K   sm   | j  |  |  j d  t j |  |  | j d  r\ |  j t j d  j | d  n  |  j d  d  S(   Ni   t
   max_labels(	   R.  RŽ   R`  Rß   RV  RL   R    RM   R  (   R   R~   Rę   (    (    s@   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/mgPreferences.pyRß   Ķ  s    #c         C   s2   t  j |   } |  j t j d  j   | d <| S(   NRo  (   R`  Rē   RL   R    RM   R5  (   R   RX  (    (    s@   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/mgPreferences.pyRē   Ł  s    c         C   s   t  j |   } d | d <| S(   Ni   Ro  (   R`  Rą   (   R   t   defs(    (    s@   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/mgPreferences.pyRą   ą  s    
c         C   sų   t  j   } |  j |  t j |   t  j   } t  j   } t  j d  } | j |  t  j	 |   } | j
 d  | j d d  | j |  | j   | j |  |  j   j | d d d d  |  j rō |  j | t j d  |  j  n  d  S(   Ns$   Maximum number of picked atom labelsRo  i    iē  i   i   s   valueChanged(int)(   R    t   QGridLayoutR   R`  Rč   RM   R   RG   R   R  R   R  Ri  R   Ra  R@   R   RA   R   (   R   R   R+  R,  R!   (    (    s@   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/mgPreferences.pyRč   ē  s     
	c         C   s   t    j |  j    d  S(   N(   R   RA  Rē   (   R   (    (    s@   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/mgPreferences.pyR     s    c         C   s   t    j d d  d  S(   NR\  s$   display_menu.html#picked_atom_labels(   R>  R?  (   R   (    (    s@   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/mgPreferences.pyR   	  s    (	   R$   R%   R   Rß   Rē   Rą   Rč   R   R   (    (    (    s@   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/mgPreferences.pyR   Ā  s   				R   c           B   sP   e  Z i  d  d  Z i  d  Z d   Z d   Z d   Z d   Z d   Z RS(   i^  c         K   s*   | j  |  t j |  | | d | d  S(   NRY   (   R.  R`  R   (   R   R   R~   RY   Rę   (    (    s@   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/mgPreferences.pyR     s    c         K   sĶ   | j  |  |  j d  t j |  |  | j d  r¼ d } t j j | d  rn t j j | d  } n/ t j	 j | d  r t j	 j | d  } n  |  j
 t j d  j |  n  |  j d  d  S(   Ni   t   label_selecti    (   R.  RŽ   R`  Rß   RV  Re  t   LABEL_SELECTION_MENURŅ   RŌ   t   LABEL_SELECTION_ALIASRL   R    RM   R2  (   R   R~   Rę   t   idx(    (    s@   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/mgPreferences.pyRß     s    c         C   s?   t  j |   } |  j t j d  j   } t j | | d <| S(   NRr  (   R`  Rē   RL   R    RM   R9  Re  Rt  (   R   RX  Ru  (    (    s@   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/mgPreferences.pyRē   /  s    c         C   s   t  j |   } d | d <| S(   Nt   noRr  (   R`  Rą   (   R   Rp  (    (    s@   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/mgPreferences.pyRą   7  s    
c         C   s	  t  j   } |  j |  t  j   } t  j   } t  j d  } | j |  t  j |   } | j d  x t	 j
 D] } | j |  qs W| j |  | j   | j |  |  j   j | d d d d  t j |   |  j r|  j | t j d  |  j  n  d  S(   Ns   Put labels onRr  i    i   i   s   currentIndexChanged(int)(   R    Rq  R   RM   R   RG   R   R  R   Re  Rs  RT   Ri  R   R`  Rč   Ra  R@   R   RA   R   (   R   R   R+  R,  R!   R    (    (    s@   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/mgPreferences.pyRč   >  s"    
	c         C   s   t    j d d  d  S(   NR\  s   display_menu.html#atom_labels(   R>  R?  (   R   (    (    s@   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/mgPreferences.pyR   a  s    c         C   s3   t  d  j |  j    d d  l } | j   d  S(   NR   i’’’’(   R   RA  Rē   RZ  R[  (   R   RZ  (    (    s@   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/mgPreferences.pyR   f  s    (	   R$   R%   R   Rß   Rē   Rą   Rč   R   R   (    (    (    s@   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/mgPreferences.pyR     s   			#	R   c           B   s>   e  Z d i  d  e e d  Z d   Z i  d  Z d   Z RS(   i^  c         C   s2   | |  _  | |  _ t j |  | d | d | d  S(   NR   RY   (   t   hbondst   contactsR   R   (   R   R   R   R~   RY   t
   doContactst   doHbonds(    (    s@   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/mgPreferences.pyR   y  s    		c         C   s  |  j    j |  j j    t j   } t j d |   } | j | d d d d  |  j si | j	   n  t j
 |   } t j d |   } | j d  | j |  |  j | t j d  |  j  | j | d d d d  |  j sņ | j	   n  t j d |   } | j d	  | j |  |  j | t j d  |  j  | j | d d d d  |  j sl| j	   n  t j d
 |   } | j | d d d d  |  j s­| j	   n  t j |   } | j d d  | j d  |  j | t j d  |  j  | j | d d d d  |  j s'| j	   n  t j d |   } | j d  | j | d d d d  |  j | t j d  |  j  |  j s| j	   n  t j |   } | j t j j  | j t j j  | j | d d d d  |  j sö|  j r| j	   n  t j d |   } | j | d d d d  |  j sD| j	   n  t j
 |   } t j d |   } | j d  | j |  |  j | t j d  |  j  | j | d d d d  |  j sĶ| j	   n  t j d |   } | j d  | j |  |  j | t j d  |  j  | j | d d d d  |  j sG| j	   n  t j d
 |   } | j | d d d d  |  j s| j	   n  t j |   } | j d d  | j d  |  j | t j d  |  j  | j | d d d d  |  j s| j	   n  t j d |   } | j d  | j | d d d d  |  j | t j d  |  j  |  j so| j	   n  |  j |  d  S(   Ns   Draw hydrogen bonds asi    i   i   t   linest   style_liness
   released()t	   cylinderst   style_cylinderss
   with widthi   t
   line_widths   valueChanged(int)s   Label with distance/bond lengtht
   label_modei   s   stateChanged(int)i   s   Draw contacts asi   t   contacts_style_linesi   t   contacts_style_cylinderst   contacts_line_widtht   contacts_label_modei	   (   RU   RV   R   RÕ   R    Rq  RG   R   Rw  R   t   QButtonGroupt   QRadioButtonR   t	   addButtonR@   R   RA   Rć   R  R  Rå   R  R   t   setFrameShapet   HLinet   setFrameShadowt   SunkenRx  R   (   R   R   R!   t   groupt   group2(    (    s@   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/mgPreferences.pyRč     s¢    												c         K   sÆ  | j  |  |  j d  | j d  rx |  j t j d  j | d d k  |  j t j d  j | d d k  n  | j d  rŖ |  j t j d  j | d  n  | j d  rÜ |  j t j d  j | d  n  | j d	  r:|  j t j d
  j | d	 d k  |  j t j d  j | d	 d k  n  | j d  rl|  j t j d  j | d  n  | j d  r|  j t j d  j | d  n  |  j d  d  S(   Ni   t   contacts_line_styleR  R{  R  R}  R  R  t
   line_styleR|  R~  R  R  i    (   R.  RŽ   RV  RL   R    RM   R1  R  (   R   R~   Rę   (    (    s@   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/mgPreferences.pyRß   ź  s"    &)##&)##c         C   sź   i  } |  j  t j d  j   r. d | d <n
 d | d <|  j  t j d  j   | d <|  j  t j d  j   | d <|  j  t j d  j   r d | d <n
 d | d <|  j  t j d	  j   | d	 <|  j  t j d
  j   | d
 <| S(   NR  R{  R  R}  R  R  R|  R  R  R  (   RL   R    RM   R7  R5  (   R   R~   (    (    s@   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/mgPreferences.pyRē   ’  s    

N(   R$   R%   R1   R   R   Rč   Rß   Rē   (    (    (    s@   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/mgPreferences.pyR   s  s   		h(   t   __doc__t   PyQt4R    R   t   global_definitionsRN   Re  R	  R   R   R*   R&   RM   RŚ   R   R   RS  R`  R   R   R   (    (    (    s@   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/mgPreferences.pyt   <module>   s    
’ W7Ä3nOb