ó
ÉŻ{Tc           @   sÄ   d  Z  d d l Td d l m Z m Z m 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 S(   sy  
     qtgui/vectorsGui.py: CCP4MG Molecular Graphics Program
     Copyright (C) 2001-2008 University of York, CCLRC
     Copyright (C) 2009-2011 University of York

     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   *(   t   QtCoret   QtGuit   QtOpenGLNt   VectorLineStylec           B   sM   e  Z d d  d  Z d   Z d   Z d   Z d   Z d   Z d   Z	 RS(	   t   Vectorsc         C   s3   t  j j |  |  | |  _ d |  _ |  j   d  S(   Ni    (   R   t   QDialogt   __init__t	   data_typet   block_applyt   draw(   t   selft   parentR   (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/vectorsGui.pyR   "   s    		c   
      C   są
  d d  l  } d d  l } |  j |  j |  j d   t j   } | j d  | j d d d 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  |  j j d  x$ | j j D] } |  j j |  qW| j |  j  | j |  t j   } | j t j d |    | j |  d	 d
 |  _ | j |  j  | j |  | j d  | j |  | j | d d d
 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   } | j t j d |    t j  |   |  _! |  j! j d d  |  j! j d  | j |  j!  | j |  | j d  | j |  | j | d d
 d
 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  |  j" j d  x$ | j j# D] } |  j" j |  qW| j |  j"  | j t j d |    | j d  | j |  t j$ |   |  _% t j   } t j& d |   |  _' |  j% j( |  j' d  | j |  j'  | j d  t j  |   |  _) |  j) j d d  |  j) j d  | j |  j)  | j |  t j   } t j& d |   |  _* |  j% j( |  j* d
  | j |  j*  t j  |   |  _+ |  j+ j d d  |  j+ j d  | j |  j+  | j |  | j |  | j | d
 d d
 d
  t j	 |   } | j
 t j	 j t j	 j B t j   } | j t j d |    t j, d |   |  _- | j |  j-  t j   } | j t j d |    t j  |   |  _. |  j. j d d  |  j. j d  | j |  j.  | j |  | j d  | j |  | j | d
 d
 d
 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  |  j/ j d   x$ | j j0 D] } |  j/ j |  q­W| j |  j/  | j d  | j t j d |    | j |  d	 d
 |  _1 | j |  j1  | j d  | j |  t j   } | j t j d! |    t2 j3 |   |  _4 | j |  j4  | j |  | j |  | j | d d d
 d  t j5   } | j( d" t j5 j6  }	 |  j7 |	 t8 j9 d#  |  j:  | j | d$ d
 d
 d  |  j |  |  j7 |  j t8 j9 d%  |  j;  |  j7 |  j t8 j9 d%  |  j;  |  j7 |  j" t8 j9 d%  |  j;  |  j7 |  j t8 j9 d&  |  j;  |  j7 |  j! t8 j9 d'  |  j;  |  j7 |  j% t8 j9 d(  |  j;  |  j7 |  j) t8 j9 d'  |  j;  |  j7 |  j+ t8 j9 d'  |  j;  |  j7 |  j- t8 j9 d)  |  j;  |  j7 |  j. t8 j9 d'  |  j;  |  j7 |  j1 t8 j9 d%  |  j;  |  j7 |  j/ t8 j9 d%  |  j;  |  j7 |  j4 t8 j9 d*  |  j<  d S(+   Ni’’’’s    line stylei   R   t   Stylei    s&   Choose a drawing style for the vectorst   Colourt   browseri   i   s   Vector widths   Thickness (A)i   s   Cylinder radius (A)g¹?g      $@s
   Arrow headt   Ats   Place arrow head on the vector?s	   of vectors   fixed radiuss   fraction of vector lengthg      š?g©?t   Dashess   End with gaps   Dash lengthg{®Gįz?g       @t   Labelss$   Choose position of labels on vectorst   Fontt   Closes	   clicked()i   s   currentIndexChanged(int)s   valueChanged(int)s   valueChanged(double)s   buttonClicked(int)s   stateChanged(int)t   fontChanged(=   t	   mgWidgetst   VectorsDispobjt   setWindowTitlet   trR   R   t   QGridLayoutt
   setSpacingt   setContentsMarginst   QFramet   setFrameStylet   Boxt   Plaint   QVBoxLayoutt	   addWidgett   QLabelt   QHBoxLayoutt	   QComboBoxt
   line_stylet   setEditablet
   setToolTipt   line_style_menut   addItemt	   addLayoutt   mgColourCombot   line_colourt
   addStretcht	   setLayoutt   QSpinBoxt
   line_widtht   setRanget   setSingleStept   QDoubleSpinBoxt   cylinder_radiust
   arrow_headt   arrow_head_menut   QButtonGroupt	   cone_modet   QRadioButtont   cone_mode_radiust	   addButtont   cone_radiust   cone_mode_fractiont   cone_fractiont	   QCheckBoxt   dash_endt   dash_lengtht
   label_modet   label_mode_menut   label_colourt   FontBrowsert   MGFontSelectort   fontSelectort   QDialogButtonBoxt
   RejectRolet   connectR   t   SIGNALt   closet   applyt	   applyFont(
   R   R   R   t   grid_layoutt   boxt
   box_layoutt   line_layoutt   itemt   dialog_buttonst   cancel_button(    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/vectorsGui.pyR
   )   s"   """""""""""""c         C   s*   |  j  r d  S|  j t j d  d  d  S(   Nt   changedt   style(   R	   t   emitR   RL   (   R   t   args(    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/vectorsGui.pyRN   Ģ   s    	 c         C   s*   |  j  r d  S|  j t j d  d  d  S(   NRW   t   font(   R	   RY   R   RL   (   R   t   widget(    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/vectorsGui.pyRO   Ņ   s    	 c         C   sė  d d  l  } d |  _ | j d  r; |  j j | d  n  | j d  r | j  j j | d  r |  j j | j  j j	 | d   n  | j d  r× | j  j
 j | d  r× |  j j | j  j
 j	 | d   n  | j d  r|  j j t | d   n  | j d  r/|  j j t | d   n  | j d  r| d d	 k rq|  j j d  |  j j d
  q|  j j d  |  j j d
  n  | j d  rĄ|  j j t | d   n  | j d  rģ|  j j t | d   n  | j d  r|  j j | d d k  n  | j d  rD|  j j t | d   n  | j d  rj|  j j | d  n  | j d  rŽ| j  j j | d  rŽ|  j j | j  j j	 | d   | j d  rŽ|  j j | d  qŽn  d
 |  _ d  S(   Ni’’’’i   R-   R&   R6   R1   R5   R9   t   fractioni    R=   R?   RA   t   gapRB   RE   RC   R[   (   R   R	   t   has_keyR-   t
   set_colourR)   t   countR&   t   setCurrentIndext   indexR7   R6   R1   t   setValuet   intR5   t   floatR>   t
   setCheckedR;   R=   R?   RA   RB   RE   RD   RC   RH   t	   setParams(   R   t   paramsR   (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/vectorsGui.pyRh   Ų   sB    	(&(&(# c         C   sf  i  } d d  l  } |  j j   | d <| j  j |  j j   | d <t |  j j    | d <t	 |  j
 j    | d <| j  j |  j j   | d <d d g |  j j   | d	 <t	 |  j j    | d
 <t	 |  j j    | d <d d g t |  j j    | d <t	 |  j j    | d <|  j j   | d <| j  j |  j j   | d <| j |  j j    | S(   Ni’’’’R-   R&   R1   R5   R6   t   fixedR]   R9   R=   R?   t   dashR^   RA   RB   RE   RC   (   R   R-   t
   get_colourR)   R&   t   currentIndexRe   R1   t   valueRf   R5   R7   R6   R9   t	   checkedIdR=   R?   RA   t	   isCheckedRB   RE   RD   RC   t   updateRH   t	   getParams(   R   t   parsR   (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/vectorsGui.pyRr   ’   s     #c         C   s   |  j  j   S(   N(   RH   Rr   (   R   (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/vectorsGui.pyt   getFont  s    N(
   t   __name__t
   __module__t   NoneR   R
   RN   RO   Rh   Rr   Rt   (    (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/vectorsGui.pyR      s   	£			'	t   VectorSelectionc           B   sJ   e  Z d d  d  Z d   Z d d  Z g  d  Z d   Z d   Z RS(	   t    c         C   sĪ  t  j j |  |  |  j d  | |  _ t  j |   |  _ t  j   } |  j j |  |  j	   t  j   } t  j
   } | j |  | j |  j  | j d  | j t j j  t  j   } | j t  j j  } | j d t  j j  } | j d t  j j  }	 | j t  j j  }
 | j |  |  j |  |  j | t j d  |  j  |  j | t j d  t j |  j d   |  j |	 t j d  t j |  j d   |  j |
 t j d  |  j  d  S(   Ns   Select vectors by tagsi   s
   Select allt   Clears	   clicked()t   allt   clear(   R   R   R   R   t   VectorsDataNameR   t   contentsR!   R/   t   loadt   QScrollAreaR"   t	   setWidgett   setWidgetResizablet   setHorizontalScrollBarPolicyR   t   Qtt   ScrollBarAlwaysOffRI   R<   t   Applyt
   ActionRolet   CancelRK   RL   RN   t   guiUtilst   partialt   selectRM   (   R   R   R}   t   layoutt   d_layoutt
   scrollareaRU   t   apply_buttont
   all_buttont   clear_buttonRV   (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/vectorsGui.pyR   !  s0    	
++c         C   s   t  |  j  } | s d  S|  j j t j  } x | D] } | j   q5 W| j   } xC | D]; } t j | |   } | j |  |  j j	   j
 |  q\ Wd  S(   N(   t   dataR}   R~   t   findChildrenR   R@   RM   t
   getTagListt   setObjectNameR   R"   (   R   t   dobjt   currentR\   t   tagListt   tag(    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/vectorsGui.pyR   @  s      R{   c         C   s\   | d k r d } n d } |  j  j t j  } x | D] } | j |  q7 W|  j   d  S(   NR{   i   i    (   R~   R   R   R@   Rg   RN   (   R   t   modet   checkedR   R\   (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/vectorsGui.pyR   Q  s    	 c         C   s~   | d k r |  j  d  n^ |  j j t j  } xF | D]> } | j t | j     ri | j d  q8 | j d  q8 Wd  S(   NR{   i   i    (	   R   R~   R   R   R@   Ra   t   strt
   objectNameRg   (   R   t	   selectionR   R\   (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/vectorsGui.pyt   setSelection]  s    c         C   sX   g  } |  j  j t j  } x6 | D]. } | j   r" | j t | j     q" q" W| S(   N(   R~   R   R   R@   Rp   t   appendR   R   (   R   R   R   R\   (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/vectorsGui.pyt   getSelectionj  s      c         C   s   |  j  t j d   d  S(   NRW   (   RY   R   RL   (   R   (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/vectorsGui.pyRN   s  s    N(	   Ru   Rv   Rw   R   R   R   R   R”   RN   (    (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/vectorsGui.pyRx     s   			t   editVectorDialogc           B   sĪ   e  Z d d  d d g d 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   Z d   Z d   Z d   Z d   Z RS(   Ry   t   atomi’’’’c         C   s  t  j  j |  |  | |  _ | |  _ d |  _ |  j d |  d  |  _ t j	 |   } | j
 d  | j d d d d  t j |   |  _ |  j j t j j  |  j |  j t j d  |  j  |  j   |  j d d k rBt j   } t j   } t j d |   |  _ |  j j d  | j |  j  | j d	  t j |   |  _ |  j j d
  d
 } xS d d d g D]B }	 t j  |	 |   }
 |  j j! |
 |  | d
 } | j |
  qsW|  j j" t# |  j  j$    j% d
  | j d	  | j& |  |  j |  j t j d  |  j'  |  j |  j t j d  |  j(  n  t j) d |   } |  j | t j d  |  j*  t j) d |   } |  j | t j d  |  j+  t j,   } | j |  j d d d d
  | j | d d
  | j | d
 d
  | j- |  |  j d d k r"| j |  n  t j.   } | j! d t j. j/  } | j! d t j. j0  } | j! d t j. j1  } | j! d t j. j2  } x' | | | | g D] } | j3 d  q”W|  j | t j d  |  j4  |  j | t j d  |  j5  |  j | t j d  |  j6  |  j | t j d  |  j7  t j8 |  j9 d   } t j8 |  j9 d   } t j,   } | j | d d  |  j d d k r¾t: j;   |  _< | j |  j< d
 d  nM |  j d d k rt: j= d d d d d d  |  _> | j |  j> d
 d  n  | j | d d  |  j d
 d k rYt: j;   |  _? | j |  j? d d  nM |  j d d k r¦t: j= d d d d d d  |  _@ | j |  j@ d d  n  | j- |  t j   } | j t j8 d  |    t jA |   |  _B |  jB jC d!  |  jB jD d
  |  jE   | j |  jB  t j) d" |   } |  j | t j d  |  jF  | j |  | j- |  t j8 |  j9 d#   } d d  lG } | jH   |  _I | j |  | j |  jI  | j |  |  j |  |  jJ t jK jL  |  j& |  |  jM d  |  jN   d  S($   Ni’’’’s   Edit vectors i   s   currentRowChanged(int)i    t   points   Move vector interactively:s9   Move vector by holding down x key and middle mouse buttoni   i   s   whole vectors   start points	   end points   buttonReleased(int)s   stateChanged(int)s   Delete selected vectors	   clicked()s   Create new vectors   Save vector and closes   Save vectorR   t   Helps   Start points	   End pointR£   t   xg        t   yt   zi   g      š?s   Add vector to groupi   s   Group detailss   Vector annotation(O   t   MGSimpleDialogR   R}   R   t   vectorIdR   Rw   t   editTagWidgetR   R!   R   R   t   QListWidgett   selectVectort   setSelectionModet   QAbstractItemViewt   SingleSelectionRK   R   RL   t   setVectorIdt   loadSelectVectorR   R$   R@   t   moveR(   R"   R.   R8   t	   move_modet   setExclusiveR:   R<   t   buttonR   t   getTransformModeRg   R/   t   handleMoveModet
   handleMovet   QPushButtont   deleteVectort	   handleNewR   R+   RI   t
   AcceptRoleR   RJ   t   HelpRolet   setAutoDefaultR   R   t   ApplyAndCloseR„   R#   R   R   t   mgAtomPickert   startAtomPickert   CartesianPickert   startCartesianPickert   endAtomPickert   endCartesianPickerR%   R   t   setMinimumContentsLengthR'   t   loadTagst   editTagst   TextEditt   TextEditWidgett   editort   setWindowFlagsR   t   Dialogt   setSizeGripEnabledt   CreateMenuEntry(   R   R   R}   R   RŖ   R   t
   move_frameRS   t   bidRT   t   bt   delete_buttont
   new_buttont
   editLayoutRU   t	   ok_buttonR   RV   t   help_buttonR¶   t
   startLabelt   endLabelt   pickerLayoutt   edit_tagt	   editLabelRŹ   (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/vectorsGui.pyR     s¾    				"

("%  !!
c         C   s   |  j  d  d  S(   Ni’’’’(   R±   (   R   (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/vectorsGui.pyR¼     s    c         C   sb   |  j  j j   |  j j j   |  j  j j d d d |  j   |  j j j d d d |  j  d  S(   Nt   object_typet   MolDataR   (   RĀ   t	   dataComboR|   RÅ   t   populateMenu(   R   (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/vectorsGui.pyt   handleDTChanged  s    c         C   sk   |  j    } t |  j  j | |  j    } | d k rg |  j   |  j   |  j   |  j |  n  d  S(   Ni    (	   t   getVectorIdR   R}   t   set_vector_dataRr   t   redrawR²   RČ   R±   (   R   t   saveIdt   iV(    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/vectorsGui.pyR     s    !


c         C   s   t    j d  d  S(   Ns   vector.html(   t   HELPBROWSERt
   loadMgHelp(   R   (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/vectorsGui.pyR„   (  s    c         C   s   d d  l  } | j   d  S(   Ni’’’’(   t   rebuildt   UpdateDisplay(   R   Rź   (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/vectorsGui.pyRå   +  s    c         C   sw   |  j  j t  t |  j  j   } |  j  j   x | D] } |  j  j |  q9 W|  j  j d  |  j  j t  d  S(   Ns   New vector.. (	   R­   t   blockSignalst   TrueR   R}   t   getVectorMenuR|   R*   t   False(   R   t   vector_listRT   (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/vectorsGui.pyR²   0  s    c         C   sr   |  j  j   } | d k rn | |  j  j   d k  rn t |  j  j |  |  j   |  j   |  j |  n  d  S(   Ni    i   (	   R­   t
   currentRowRa   R   R}   t   delete_vectorRå   R²   R±   (   R   Rē   (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/vectorsGui.pyR»   :  s    %

c         K   s  | j  |  |  j d d k r | j d  rś | j d  rś | d rv | d rv |  j j d | d d | d  q |  j j   qś nq |  j d d k rś | j d  rś i  } d } x* d D]" } | d | | | <| d } q¾ W|  j j |  qś n  |  j d d k rv| j d  rē| j d  rē| d rc| d rc|  j j d | d d | d  qs|  j j   qēnq |  j d d k rē| j d  rēi  } d } x* d D]" } | d | | | <| d } q«W|  j	 j |  qēn  | j d  rdd d  l
 } t | d | j  rMt |  j  j   j | d  } |  j j |  qd|  j j | d  n  | j d  r|  j j | d  n  d  S(   Ni    R£   t	   start_molt
   start_atomRß   t   atomNameR¤   t	   start_xyzR¦   R§   RØ   i   t   end_molt   end_atomt   end_xyzR   i’’’’t   label(   R¦   R§   RØ   (   R¦   R§   RØ   (   Rq   R   R_   RĀ   R   t   resetRÄ   Rh   RÅ   RĘ   t   typest
   isinstancet
   StringTypeR   R}   R   Ra   R   Rb   RĢ   t   setText(   R   Ri   t   kwRs   t   iiRT   Rü   t   iT(    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/vectorsGui.pyRh   D  sF    $$"c         C   sĒ  d } } } d } } } d  } } }	 }
 |  j d d k rY |  j j   \ }	 } nj |  j d d k rĆ t |  j j d j    } t |  j j d j    } t |  j j d j    } n  |  j d d k rī |  j j   \ }
 } nj |  j d d k rXt |  j	 j d j    } t |  j	 j d j    } t |  j	 j d j    } n  i | | | g d	 6| | | g d
 6| d 6| d 6|	 d 6|
 d 6t
 |  j j j    d 6t
 |  j j    d 6S(   Ng        i    R£   R¤   R¦   R§   RØ   i   Rö   Rł   Rō   Rų   Ró   R÷   Rś   R   (   Rw   R   RĀ   t   modelAtomPtrRf   RÄ   t   widgetst   textRÅ   RĘ   R   RĢ   t   textEditt   toPlainTextR   t   currentText(   R   t   startxt   startyt   startzt   endxt   endyt   endzt	   startAtomt   endAtomt
   startModelt   endModel(    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/vectorsGui.pyRr   t  s0    c         C   sQ   |  j  j   |  j  j d  x- t |  j  j   D] } |  j  j |  q3 Wd  S(   Nt    (   R   R|   R*   R   R}   R   (   R   Rś   (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/vectorsGui.pyRČ     s    c         C   sT   |  j  sC t |  |  j  |  _  |  j |  j  t j d  |  j  n  |  j  j   d  S(   NRW   (   R«   t   editVectorTagsR}   RK   R   RL   t   handleChangedTagst   show(   R   (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/vectorsGui.pyRÉ     s    	%c         C   s   |  j    |  j   d  S(   N(   RČ   R²   (   R   (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/vectorsGui.pyR    s    
c         C   s   |  j  S(   N(   RŖ   (   R   (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/vectorsGui.pyRć   £  s    c         C   s¼   | d k  s% | |  j  j   d k rj |  j |  j  j   d  d d  l } |  j | j j  d |  _ n5 |  j |  |  j t |  j	  j
 |   | |  _ t |  j	  j |  j  d  S(   Ni    i   i’’’’(   R­   Ra   t   setRowR   Rh   t   VectorsDatat   initialise_vectorRŖ   R   R}   t   get_vector_datat   setTransformVector(   R   t   vidR   (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/vectorsGui.pyR±   ¦  s    %	c         C   sM   | |  j  j   k r d  S|  j  j t  |  j  j |  |  j  j t  d  S(   N(   R­   Rń   Rģ   Rķ   t   setCurrentRowRļ   (   R   t   irow(    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/vectorsGui.pyR  “  s
     c         C   s   |  j    |  j   d  S(   N(   R   R   (   R   (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/vectorsGui.pyRĄ   »  s    
c         C   s    t  |  j  j t |   d  S(   N(   R   R}   t   setTransformModeRe   (   R   RŅ   (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/vectorsGui.pyRø   æ  s    c         C   sŚ   |  j  j t  |  j j t  | \ } } i  } d } x& d D] } | | | | <| d } q? W|  j  j |  i  } d } x& d D] } | | | | <| d } q W|  j j |  |  j  j t  |  j j t  d  S(   Ni    R¦   R§   RØ   i   (   R¦   R§   RØ   (   R¦   R§   RØ   (   RÄ   Rģ   Rķ   RĘ   Rh   Rļ   (   R   RW   t   startt   endRs   R  RT   (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/vectorsGui.pyt   handleMoveFromObjectĀ  s"    c         C   s  t  | t j j k  } t   j |  j  j |  | d k r© t   j |  j  j t	  |  j
 t   j |  j  t j d  |  j  t   j |  j  j t  nf t   j |  j  j t	  |  j t   j |  j  t j d  |  j  t   j |  j  j t  d  S(   Ni   t   DataChanged(   Re   R   R   t   Checkedt   DISPLAYTABLEt
   getDataObjR}   t   toggleMovingRģ   Rķ   RK   RL   R"  Rļ   t
   disconnect(   R   t   state(    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/vectorsGui.pyR¹   Õ  s    ..N(   Ru   Rv   Rw   R   R¼   Rā   R   R„   Rå   R²   R»   Rh   Rr   RČ   RÉ   R  Rć   R±   R  RĄ   Rø   R"  R¹   (    (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/vectorsGui.pyR¢   {  s(   						
	
	0										R  c           B   s\   e  Z d d  d d  Z d   Z d d  Z d   Z d   Z d   Z d	   Z	 d
   Z
 RS(   Ry   i’’’’c         C   s$  t  j  j |  |  | |  _ d |  _ |  j d |  t j |   } | j d  | j d d d d  t j	 |   |  _
 |  j
 j t j j  |  j |  j
 t j d  |  j  |  j   t j d |   } |  j | t j d  |  j  t j d |   } |  j | t j d  |  j  t j   } | j |  j
 d d d d	  | j | d d	  | j | d	 d	  | j |  t j   } | j t j d
 |    t j |   |  _ | j |  j  | j |  t j   } | j t j d |    | j |  t j |   |  _ | j |  j  t j   }	 |	 j  d t j j!  }
 |	 j  d t j j"  } |	 j  d t j j#  } x1 |
 | | g D]  } | j$ d  | j% d  qW|  j | t j d  |  j&  |  j |
 t j d  |  j'  |  j | t j d  |  j(  | j |	  |  j |  d  S(   Ni’’’’s   Edit vectors i   s   currentRowChanged(int)s   Delete selected tags	   clicked()s   Create new tagi    i   s   Tag names   Tag annotations
   Save groupR   s   Save group and close()   R©   R   R}   t   tagIdR   R   R!   R   R   R¬   t	   selectTagR®   RÆ   R°   RK   R   RL   t   setTagIdt   loadSelectTagRŗ   t	   deleteTagR¼   R   R"   R+   R$   R#   t	   QLineEditt   namet	   QTextEditt
   annotationRI   R<   R   RJ   R½   Ræ   t
   setDefaultR   R   RĄ   (   R   R   R}   R*  R   RŌ   RÕ   RÖ   RS   RU   R   RV   R×   R¶   (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/vectorsGui.pyR   ł  sT    		"
c         C   s   |  j  d  d  S(   Ni   (   R   (   R   (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/vectorsGui.pyRĄ   /  s    i    c         C   s6  t  |  j  } t |  j j    } t |  j j   j    } | j   } |  j	 d k  r£ | r | j
 |  r | j d | |  q’ t j j |  d d  d  Sn\ | rå | | |  j	 k sĢ | j
 |  rå | j |  j	 | |  n t j j |  d d  d  S|  j   |  j t j d   | r2|  j   n  d  S(   Ni    i’’’’s   Creating new tags#   Enter a unique name for the new tags   Editing tagRW   (   R   R}   R   R0  R  R2  t   documentR  R   R*  Ra   RÜ   R   t   QMessageBoxt   warningR-  RY   R   RL   R   (   R   RM   t   targetR0  R2  t   taglist(    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/vectorsGui.pyR   4  s"    )
 c         C   s   |  j  d  d  S(   Ni’’’’(   R,  (   R   (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/vectorsGui.pyR¼   L  s    c         C   sJ   t  |  j  j |  j  |  j   |  j d  |  j t j d   d  S(   Ni’’’’RW   (	   R   R}   t
   delete_tagR*  R-  R,  RY   R   RL   (   R   (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/vectorsGui.pyR.  Q  s    
c         C   sw   |  j  j t  t |  j  j   } |  j  j   x | D] } |  j  j |  q9 W|  j  j d  |  j  j t  d  S(   Ns	   New tag..(	   R+  Rģ   Rķ   R   R}   R   R|   R*   Rļ   (   R   R8  RT   (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/vectorsGui.pyR-  Y  s    c         C   sÕ   | d k  s% | |  j  j   d k rn |  j |  j  j   d  |  j j d  |  j j   j   d |  _ nc |  j |  t	 |  j
  j |  \ } } |  j j |  |  j j   j t j |   | |  _ d  S(   Ni    i   Ry   i’’’’(   R+  Ra   R  R0  R’   R2  R4  R|   R*  R   R}   t   get_tagt   setPlainTextR   t   QString(   R   R  R0  R2  (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/vectorsGui.pyR,  e  s    %c         C   sM   | |  j  j   k r d  S|  j  j t  |  j  j |  |  j  j t  d  S(   N(   R+  Rń   Rģ   Rķ   R  Rļ   (   R   R  (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/vectorsGui.pyR  w  s
     N(   Ru   Rv   Rw   R   RĄ   R   R¼   R.  R-  R,  R  (    (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/vectorsGui.pyR  ō  s   6					(   t   __doc__t   global_definitionst   PyQt4R   R   R   R©   R   RF   R   R   R   Rx   R¢   R  (    (    (    s=   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/vectorsGui.pyt   <module>   s   
$’_’ z