ó
ÉÝ{Tc           @   s”  d  Z  d d l m Z m Z d d l Z d d l Z d d l Z d e j f d „  ƒ  YZ d e f d „  ƒ  YZ	 e
 d k r�d	 e j k r— e j ƒ  n  d
 „  Z d „  Z d „  Z d „  Z d „  Z e j e j ƒ Z e j ƒ  Z e j ƒ  Z e j d d d d ƒ e j d ƒ e d e d e j j d d ƒ e j j d d ƒ f ƒ Z e j d d ƒ e j d ƒ e j e ƒ e	 d e  d e j j d d ƒ e j j d d ƒ f ƒ Z e j d ƒ e j d d ƒ e j! e e j" d ƒ e ƒ e j! e e j" d ƒ e ƒ e j! e e j" d ƒ e ƒ e j! e e j" d  ƒ e ƒ e j! e e j" d! ƒ e ƒ e j e ƒ e j# e ƒ e j$ ƒ  e j e j% ƒ  ƒ n  d S("   sI  
     qtgui/ExponentialSlider.py: CCP4MG Molecular Graphics Program
     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   QtCoret   QtGuiNt   ExponentialSliderc           B   s€   e  Z d  Z d Z d e d d „ Z d „  Z d „  Z d „  Z	 d „  Z
 d „  Z d „  Z d	 „  Z d
 „  Z d „  Z d „  Z RS(   gš™™™™™¹?g      ð?c   	      C   s   t  j j |  | ƒ t  j ƒ  } | j d d d d ƒ | j d ƒ | |  _ t  j t j	 j
 ƒ |  _ |  j r‹ |  j j d d ƒ d |  _ n |  j j d d ƒ d |  _ |  j |  j t j d ƒ |  j ƒ |  j |  j t j d ƒ |  j ƒ |  j j t  j j t  j j ƒ | r²t | ƒ d k r²|  j rTt  j | d ƒ } t  j | d ƒ } n& t  j | d ƒ } t  j | d ƒ } | j | d d ƒ | j | d d d d t j	 j ƒ n  | j ƒ  } | j |  j | d d d ƒ t  j ƒ  |  _ |  j j d	 ƒ | j |  j | d d d ƒ |  j j t  j j t  j j ƒ t  j |  j ƒ } |  j j | ƒ |  j |  j t j d
 ƒ |  j ƒ |  j |  j t j d ƒ |  j  ƒ |  j |  j t j d ƒ |  j! ƒ |  j |  j t j d ƒ |  j" ƒ |  j |  j t j d ƒ |  j# ƒ |  j |  j t j d
 ƒ |  j$ ƒ | j% d d ƒ | j% d d ƒ |  j& | ƒ |  j j' t( ƒ |  j j) d ƒ |  j j' t* ƒ |  j d d ƒ |  j+ d ƒ d  S(   Ni    i   iœÿÿÿiÿÿÿÿid   i   s   valueChanged(int)s   sliderMoved(int)i2   s   textChanged(const QString &)s   sliderReleased()s   editingFinished()s   -1gü©ñÒMbP?i N  (,   R   t   QWidgett   __init__t   QGridLayoutt   setContentsMarginst
   setSpacingt   reversedt   QSliderR    t   Qtt
   Horizontalt   slidert   setRanget   reverseFactort   connectt   SIGNALt   valueChangedt   setSizePolicyt   QSizePolicyt	   Expandingt   Fixedt   lent   QLabelt	   addWidgett
   AlignRightt   rowCountt	   QLineEditt   lineEditt   setMaximumWidtht   QDoubleValidatort   setValidatort   textChangedt   sliderValueChangedSignalt   sliderMovedSignalt   sliderReleasedSignalt   textEditEditingFinishedSignalt   textEditTextChangedSignalt   setColumnStretcht	   setLayoutt   blockSignalst   Truet   setTextt   Falset   setValue(	   t   selft   labelsR   t   parentt   layoutt   l1t   l2t   rct   dv(    (    sD   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/ExponentialSlider.pyR   %   sX    			""	%""""""c         C   s   |  j  t j d ƒ ƒ d  S(   Nt   textEditingFinished(   t   emitR    R   (   R-   (    (    sD   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/ExponentialSlider.pyR$   a   s    c         C   s   |  j  t j d ƒ | ƒ d  S(   NR    (   R6   R    R   (   R-   t   val(    (    sD   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/ExponentialSlider.pyR%   d   s    c         C   s   |  j  t j d ƒ ƒ d  S(   Nt   sliderReleased(   R6   R    R   (   R-   (    (    sD   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/ExponentialSlider.pyR#   g   s    c         C   s#   |  j  t j d ƒ |  j ƒ  ƒ d  S(   Nt   sliderMoved(   R6   R    R   t   value(   R-   R7   (    (    sD   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/ExponentialSlider.pyR"   j   s    c         C   s#   |  j  t j d ƒ |  j ƒ  ƒ d  S(   Nt   sliderValueChanged(   R6   R    R   R:   (   R-   R7   (    (    sD   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/ExponentialSlider.pyR!   m   s    c         C   s,   y t  |  j j ƒ  ƒ } | SWn d SXd  S(   Ng        (   t   floatR   t   text(   R-   R7   (    (    sD   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/ExponentialSlider.pyR:   q   s
    c         C   sM   |  j  t | ƒ ƒ |  j j t ƒ |  j j t | ƒ ƒ |  j j t ƒ d  S(   N(   R    t   strR   R(   R)   R*   R+   (   R-   R7   (    (    sD   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/ExponentialSlider.pyR,   x   s    c         C   sî   |  j  j ƒ  } t | d ƒ } t | d ƒ } yv t j | ƒ |  j } t j | ƒ |  j } |  j r† |  j j	 | | ƒ d |  _
 n |  j j	 | | ƒ d |  _
 Wn d G| G| GHn X|  j  j t ƒ |  j  j | ƒ |  j  j t ƒ d  S(   Ngê-�™—q=g   ¢”mBiÿÿÿÿi   s)   Range error in ExponentialSlider.setRange(   R   R=   t   maxt   mint   matht   logt	   expFactorR   R   R   R   R(   R)   R*   R+   (   R-   t   minvalt   maxvalt   t(    (    sD   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/ExponentialSlider.pyR   ~   s     	c         C   s„   y- t  | ƒ } |  j t j | ƒ |  j } Wn d } n X|  j j t ƒ |  j j t	 t j
 | d ƒ ƒ ƒ |  j j t ƒ d  S(   NgH¯¼šò×z>g      à?(   R<   R   RA   RB   RC   R   R(   R)   R,   t   intt   floorR+   (   R-   R=   t   expvalR7   (    (    sD   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/ExponentialSlider.pyR    ‘   s    !
#c         C   sq   |  j  t j |  j |  j j ƒ  |  j ƒ } d | j ƒ  } |  j j	 t
 ƒ |  j j | ƒ |  j j	 t ƒ d  S(   Ns   %10.2f(   t	   preFactorRA   t   expR   R   R:   RC   t   stripR   R(   R)   R*   R+   (   R-   R7   RI   t	   expvalstr(    (    sD   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/ExponentialSlider.pyR   ›   s
    -(    N(   t   __name__t
   __module__RC   RJ   R+   t   NoneR   R$   R%   R#   R"   R!   R:   R,   R   R    R   (    (    (    sD   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/ExponentialSlider.pyR   !   s   <									
t   SignedExponentialSliderc           B   s5   e  Z d e d d  „ Z d „  Z d „  Z d „  Z RS(   c         C   sg   t  j |  | | | ƒ |  j j t ƒ |  j j d ƒ |  j j t ƒ |  j d d ƒ |  j d ƒ d  S(   Ns   -1gü©ñÒMbP?i N  iÿÿÿÿ(	   R   R   R   R(   R)   R*   R+   R   R,   (   R-   R.   R   R/   (    (    sD   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/ExponentialSlider.pyR   £   s    c         C   s·   | d k  rB | |  j  } |  j t j |  j | |  j ƒ } n1 | |  j  } |  j t j |  j | |  j ƒ } d | j ƒ  } |  j j t	 ƒ |  j j
 | ƒ |  j j t ƒ d  S(   Ni    s   %10.2f(   t   _minvalRJ   RA   RK   R   RC   RL   R   R(   R)   R*   R+   (   R-   R7   t	   slidervalRI   RM   (    (    sD   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/ExponentialSlider.pyR   «   s    ($c         C   sÆ   d } yi t  | ƒ } | d k  rJ |  j t j | ƒ |  j |  j } n$ |  j t j | ƒ |  j |  j } Wn d } n X|  j j t ƒ |  j j	 t
 t j | d ƒ ƒ ƒ |  j j t ƒ d  S(   Ni   i    gH¯¼šò×z>g      à?(   R<   R   RA   RB   RC   RR   R   R(   R)   R,   RG   RH   R+   (   R-   R=   RI   R7   (    (    sD   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/ExponentialSlider.pyR    ·   s    )(
#c         C   s   |  j  j ƒ  } t | d ƒ } t | d ƒ } y¨ t j | ƒ |  j } t j | ƒ |  j } | |  _ | |  _ | | |  _	 |  j	 } |  j	 } |  j
 r¸ |  j j | | ƒ d |  _ n |  j j | | ƒ d |  _ Wn d G| G| GHn X|  j  j t ƒ |  j  j | ƒ |  j  j t ƒ d  S(   Ngê-�™—q=g   ¢”mBiÿÿÿÿi   s)   Range error in ExponentialSlider.setRange(   R   R=   R?   R@   RA   RB   RC   RR   t   _maxvalt   rangeR   R   R   R   R(   R)   R*   R+   (   R-   RD   RE   RF   (    (    sD   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/ExponentialSlider.pyR   Å   s*    		
		(    N(   RN   RO   R+   RP   R   R   R    R   (    (    (    sD   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/ExponentialSlider.pyRQ   ¢   s   		t   __main__s   -quitc           C   s	   d GHd  S(   Ns   edit finish(    (    (    (    sD   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/ExponentialSlider.pyt   testEditFinishá   s    c         C   s   d G|  GHd  S(   Ns   text change(    (   R7   (    (    sD   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/ExponentialSlider.pyt   testTextChangeä   s    c         C   s   d G|  GHd  S(   Nt   change(    (   R7   (    (    sD   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/ExponentialSlider.pyt   testValueChangeç   s    c         C   s   d G|  GHd  S(   Nt   move(    (   R7   (    (    sD   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/ExponentialSlider.pyt   testMoveê   s    c           C   s	   d GHd  S(   Nt   release(    (    (    (    sD   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/ExponentialSlider.pyt   testReleaseí   s    i    i   R   R.   s   QtGui.QWidgett   Thickert   Thinnergü©ñÒMbP?i N  id   t   Closert   Furtheriöÿÿÿi   R8   R9   R;   R5   R    (&   t   __doc__t   PyQt4R    R   t   sysRA   t	   functoolsR   R   RQ   RN   t   argvt   exitRW   RX   RZ   R\   R^   t   QApplicationt   appt   windowt   QVBoxLayoutR0   R   R   R)   t   QCoreApplicationt	   translatet   widgetR   R,   R   R+   R   R   R'   t   showt   exec_(    (    (    sD   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/ExponentialSlider.pyt   <module>   sF   �;					99
