ó
ÉÝ{Tc           @   sÊ   d  Z  d d l 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 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(   sw  
     qtgui/movieGui.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ÿÿÿÿN(   t   QtGuit   QtCore(   t   *t   movieGuic           B   s×   e  Z d  d d d d g Z d  d d d d g Z d d „ Z d „  Z d	 d d
 „ Z d „  Z d „  Z	 d d	 d „ Z
 d	 d „ Z d	 d „ Z d „  Z d	 d „ Z d „  Z d „  Z d „  Z d d „ Z d	 d „ Z RS(   t   fixeds   rotate about yt   rockt	   transforms   glide tot   rotatet   glidec         C   s¨   t  j  j |  | d | ƒ|  j |  j d ƒ |  j j ƒ |  j j |  j d ƒ |  j j ƒ |  j |  t j	 d ƒ |  j
 ƒ |  j |  t j	 d ƒ |  j
 ƒ |  j ƒ  d  S(   Nt   presentations   Movie editor: t
   frameAddedt   frameDeleted(   t   mgPresentationt   __init__t   setWindowTitlet   trR	   t
   identifiert
   dockWidgett   connectR   t   SIGNALt   updateToSnapshott   updateGlideTo(   t   selft   parentR	   (    (    s;   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/movieGui.pyR   $   s     #c         C   s8   x! |  j  t ƒ D] } | j ƒ  q Wt j j |  ƒ d  S(   N(   t   findChildrent   movieTransformDetailsGuit   closeR   t   Close(   R   t   win(    (    s;   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/movieGui.pyR   0   s    t    c         C   s­   | d k rC d |  j  d ƒ d g d |  j  d ƒ d g d d g g S| d k rƒ d	 d
 d |  j  d ƒ d d d g d |  j g d g S| d k r– d g S| d k r© d g Sd  S(   Nt   menust   actions   &Actiont   aboutToShowt   edits   &Editt   helps   &Helpt   stopt   previewt
   make_movies   Make movie in stagest   recordt   compilet   merget   PlayR   t   movie_preferences(   R   t   playMovieGui(   R   t   namet	   pickevent(    (    s;   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/movieGui.pyt	   getGuiDef8   s    74c      	      sÀ  d d  l  } | d k rF t d ˆ  j d ƒ d ˆ  j d ƒ d ˆ  j ƒ S| d k r˜ ‡  f d	 †  } t d ˆ  j d
 ƒ d ˆ  j d ƒ d ˆ  j j d | ƒ S| d k rÞ t d ˆ  j d ƒ d ˆ  j d ƒ d | j ˆ  j d ƒ ƒ S| d k r't d ˆ  j d ƒ d ˆ  j d ƒ d | j ˆ  j j d ƒ ƒ S| d k rmt d ˆ  j d ƒ d ˆ  j d ƒ d | j ˆ  j d ƒ ƒ S| d k r¶t d ˆ  j d ƒ d ˆ  j d ƒ d | j ˆ  j j d ƒ ƒ S| d k rÿt d ˆ  j d ƒ d ˆ  j d ƒ d | j ˆ  j j d ƒ ƒ S| d k r9t d ˆ  j d ƒ d ˆ  j d ƒ d ˆ  j ƒ S| d k rst d ˆ  j d ƒ d ˆ  j d  ƒ d ˆ  j	 ƒ S| d! k r­t d ˆ  j d" ƒ d ˆ  j d# ƒ d ˆ  j
 ƒ St j j ˆ  | ƒ S($   NiÿÿÿÿR   t   texts   Close movie editort   tips-   Close this movie editor saving current statust   slotR#   c              s
   ˆ  j  j S(   N(   R	   t   interruptable(    (   R   (    s;   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/movieGui.pyt   eP   s    s   Stop preview/recordings%   Stop any running preview or recordingt   enabledR$   t   Previews!   Preview currently selected scenesR%   s
   Make movies)   Make movie from currently selected scenest   makeR&   s   Record framess+   Record movie from currently selected scenesR'   s   Make movie scenes    Merge frames to make movie sceneR(   s   Merge movie scenest   plays
   Play movieR*   s   Movie preferencess   Set preferences for this movieR"   s   &Helps   Help on CCP4mg Movies(   t   guiUtilst   dictR   R   R	   t   setInterruptt   partialt   applyR+   t   preferencesGuiR"   R   t   getActionDef(   R   R,   t   infoR8   R3   (    (   R   s;   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/movieGui.pyR>   E   sl    



c         C   s   t  ƒ  j d ƒ d  S(   Ns   movies.html(   t   HELPBROWSERt
   loadMgHelp(   R   (    (    s;   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/movieGui.pyR"   Š   s    c         C   sú  d d  l  } |  j j | ƒ j | i  ƒ } |  j j ƒ  } t j | ƒ } | j d ƒ t j ƒ  } t j	 ƒ  } d }	 | j
 |	 |	 |	 |	 ƒ | j |	 ƒ t j ƒ  }
 t j |  j d ƒ | ƒ } |
 j | ƒ t j | ƒ } | j d ƒ | j d d ƒ | j d ƒ | j d d	 ƒ } | d
 k r*d } n  | j t | ƒ ƒ |  j | t j d ƒ | j |  j | ƒ ƒ |
 j | ƒ t j |  j d ƒ | ƒ } |
 j | ƒ |
 j ƒ  | j |
 ƒ t j ƒ  }
 t j |  j d ƒ | ƒ } |
 j | ƒ t j | ƒ } | j d ƒ xG t d t t j  ƒ ƒ D]- } | j! t j  | t j" t j# | ƒ ƒ qW| j d d ƒ t j# k r‘| j$ t j# j% | j d d ƒ ƒ ƒ n  |  j | t j d ƒ | j |  j& | ƒ ƒ |  j | t j d ƒ | j |  j' | ƒ ƒ |
 j | ƒ t j | ƒ } | j d ƒ | j( d ƒ | j) | ƒ r§x( | | j% | ƒ D] } | j! | ƒ q@W| j) | j d | ƒ ƒ r§| j$ | j% | j d | ƒ ƒ | j% | ƒ ƒ q§n  |  j | t j d ƒ | j |  j | ƒ ƒ |  j | t j d ƒ | j |  j' | ƒ ƒ |
 j | ƒ |
 j ƒ  | j |
 ƒ t j ƒ  }
 t j* |  j d ƒ | ƒ } | j d ƒ |  j | t j d ƒ | j |  j+ | ƒ ƒ |
 j | ƒ | j |
 ƒ | j, | ƒ | j | ƒ t j ƒ  } t j	 ƒ  } t j ƒ  }
 t j |  j d ƒ | ƒ } |
 j | ƒ | j |
 ƒ t j ƒ  }
 |
 j t j d ƒ ƒ | j |
 ƒ t j ƒ  }
 t- j. t j/ j0 |  ƒ } | j d ƒ | j d d ƒ | j d ƒ |  j | t j d ƒ | j |  j | ƒ ƒ |
 j | ƒ | j |
 ƒ | j, | ƒ | j | ƒ | j$ d ƒ | S(   Niÿÿÿÿt   stacki   t   Recordt   timeg        g      I@g      ð?g       @R   s   valueChanged(double)t   secst   Viewt   viewi    R   s   currentIndexChanged(QString)t   to_snapshots   currentIndexChanged(int)t   Detailst   detailss	   clicked()s   ..glide through..s   for time proportional  tot   interpolate_timeg      $@(1   R8   R	   t   get_snapshot_detailst   gett   get_snapshot_listR    t   QStackedWidgett   setObjectNamet   QFramet   QVBoxLayoutt   setContentsMarginst
   setSpacingt   QHBoxLayoutt   QLabelR   t	   addWidgett   QDoubleSpinBoxt   setRanget   setSingleStept   setValuet   floatR   R   R   R;   t   updateSnapshotDetailst
   addStretcht	   addLayoutt	   QComboBoxt   ranget   lenR   t   transform_menut   addItemt   QVariantt   transform_aliast   setCurrentIndext   indext   updateFrameGuiR   t
   setVisiblet   countt   QPushButtont   handleTransformDetailst	   setLayoutt	   mgWidgetst   mgSlidert   Qtt
   Horizontal(   R   t   framet   idR8   t   paramst   snapshot_listRB   t	   containert   layoutt   margint   line_layoutt   widgetRD   t   iit   item(    (    s;   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/movieGui.pyt   drawFrameGui�   s¢     	+
+(++5++
++c         C   so   |  j  t j t | ƒ ƒ } t | j  t j d ƒ j ƒ  ƒ } | j  t j d ƒ j | d k ƒ |  j | ƒ d S(   sX   
    User has changed the view mode in snapshot 'id'
    Update the GUI accordingly
    RG   RH   s   glide toN(	   t	   findChildR   t   presentationFrameWidgett   strR    R`   t   currentTextRj   R]   (   R   Rt   Rs   RG   (    (    s;   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/movieGui.pyRi   ú   s    !"c         K   sE   |  j  r d  S|  j d | d d d d d g ƒ } |  j j | ƒ d  S(   NRh   t   keyListRD   RG   RH   RK   (   t   block_updatet	   getParamsR	   t	   setparams(   R   Rt   t   kwRu   (    (    s;   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/movieGui.pyR]     s    	 $c   	      C   si  g  } x\t  |  j j ƒ  j ƒ  d d d ƒ D]5} |  j j ƒ  j | ƒ j ƒ  } t | j ƒ  ƒ } | d k r, | j d | ƒ | j	 t
 j d ƒ } t | d ƒ rat | j ƒ rat | d ƒ rat | j ƒ rat | d ƒ rat | j ƒ rad d  l } t | j ƒ  ƒ } | j ƒ  x | D] } | j | ƒ qW| j | ƒ r^| j | j | ƒ ƒ q^qaq, q, Wd  S(	   Ni   iÿÿÿÿt   insert_framei    RH   R‚   Rd   Rg   (   Ra   t   bodyRx   Rk   t   itemAtR{   R�   t
   objectNamet   insertR   R    R`   t   hasattrt   callableR‚   Rd   Rg   R8   t   clearRh   (	   R   Rv   t   indxRs   Rt   R{   R8   t   currentR}   (    (    s;   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/movieGui.pyR     s    ,Z
 c         C   s³  |  j  ƒ  } t | ƒ d k r" d  S| rI | j | ƒ rI | j | ƒ } n d } x]| t | ƒ k  r®| | } |  j t j t | ƒ ƒ } | j t j	 d ƒ j
 d ƒ t | j t j d ƒ j ƒ  ƒ } | d k r¡t | j t j d ƒ j ƒ  ƒ } | j | ƒ s| j | ƒ | k  r7| j t j d ƒ j
 d ƒ q¡xg | | j | ƒ k  r�| d } | | } |  j t j t | ƒ ƒ } | j t j	 d ƒ j
 d ƒ q:Wn  | d } qR Wd  S(   Ni   i    RB   RG   s   glide toRH   (   t   snapshotListRb   Rk   Rh   R   R   R€   R�   R    RO   Rg   R`   R‚   (   R   Rt   Rv   t   idxRs   RG   RH   (    (    s;   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/movieGui.pyR   '  s*     
!!%

#c         C   s»   d d  l  } | \ } } |  j j ƒ  } | j ƒ  xƒ | D]{ } |  j t j | ƒ } | s¦ t j | |  ƒ } | j | ƒ |  j | t	 j
 d ƒ | j |  j | ƒ ƒ n  | j | ƒ q8 Wd  S(   Niÿÿÿÿs   triggered(bool)(   R8   R	   t   get_movie_filesR�   R   R    t   QActionRP   R   R   R   R;   t	   playMoviet	   addAction(   R   R?   R8   t   menut   titlet   movie_filesR}   t   a(    (    s;   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/movieGui.pyR+   K  s    
.c   	      C   si  t  j j ƒ  } g  } x? | D]7 } | j t | ƒ j ƒ  ƒ s | j t | ƒ ƒ q q Wd d  l } | j j	 |  j
 j | ƒ } | j j | ƒ re| j j | ƒ } t | ƒ d k r	d | d k r	| j | d d ƒ r	t |  j
 j ƒ } | j | d d d | ƒqet j d k rFt |  j
 j ƒ } | j | d d d | ƒqet  j j t j j | ƒ ƒ n  d  S(	   Niÿÿÿÿi   t   .t   formatt   movieR™   t   linux2t   movie_phonon(   R    t   QMoviet   supportedFormatsRk   R�   t   lowert   appendt   ost   patht   joinR	   t
   master_dirt   existst   splitextRb   t
   FILEVIEWERR   t   opent   syst   platformt   QDesktopServicest   openUrlR   t   QUrlt   fromLocalFile(	   R   R,   t   image_formats_ct   image_formatst   imR¥   t   filenamet
   name_splitt   viewer(    (    s;   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/movieGui.pyR–   \  s     9c         C   s5   t  |  d d  ƒ s$ t |  ƒ |  _ n |  j j ƒ  d  S(   Nt   preferenceGui(   t   getattrt   Nonet   moviePreferenceGuiR¹   t   show(   R   (    (    s;   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/movieGui.pyR=   u  s    i    c         C   sl   |  j  t j t | ƒ ƒ } | j  t j d ƒ } | sE t | ƒ } n  | j ƒ  | rh | j j d ƒ n  d  S(   Nt   transform_detailsi   (	   R   R   R€   R�   t   MGSimpleDialogR   R½   t   tabRg   (   R   Rt   R   Rs   t   gui(    (    s;   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/movieGui.pyRm   }  s    
 c         C   s*   |  j  j | ƒ t ƒ  j j d d ƒ d  S(   Nt   alli   (   R	   R<   t
   MAINWINDOWt   MGDisplayTablet   update(   R   t   mode(    (    s;   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/movieGui.pyR<   Š  s    N(   t   __name__t
   __module__Rc   Rf   R»   R   R   R.   R>   R"   R~   Ri   R]   R   R   R+   R–   R=   Rm   R<   (    (    (    s;   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/movieGui.pyR      s"   		E	k		$			R   c           B   s/   e  Z d  „  Z d „  Z i  d „ Z d „  Z RS(   c   
      C   s  t  j  j |  | ƒ |  j d ƒ |  j |  j d ƒ t |  j ƒ  j ƒ  ƒ ƒ t j	 ƒ  } t j
 |  ƒ |  _ t j |  ƒ } t j	 ƒ  } t j ƒ  } t j |  j d ƒ |  ƒ } | j | ƒ | j | ƒ t j ƒ  } t j |  j d ƒ |  ƒ } | j d ƒ |  j | t j d ƒ |  j ƒ | j | ƒ t j |  ƒ } | j d ƒ | j d d	 ƒ | j d ƒ |  j | t j d
 ƒ |  j ƒ | j | ƒ | j d ƒ | j | ƒ | j | ƒ |  j j | |  j d ƒ ƒ t j |  ƒ } t j	 ƒ  } t j ƒ  } t j |  j d ƒ |  ƒ } | j | ƒ | j | ƒ t j ƒ  } xŸ d d d g D]Ž } t j | |  ƒ } | j | ƒ t j |  ƒ } | j d | ƒ | j d d ƒ | j d ƒ |  j | t j d ƒ |  j ƒ | j | ƒ qFW| j d ƒ | j | ƒ t j ƒ  } t j |  j d ƒ |  ƒ } | j | ƒ | j | ƒ t j ƒ  } | j | ƒ xž d d d d g D]Š } t j | |  ƒ } | j | ƒ t j |  ƒ } | j | ƒ | j d d	 ƒ | j d ƒ |  j | t j d ƒ |  j ƒ | j | ƒ q_W| j | ƒ | j | ƒ |  j j | |  j d ƒ ƒ t j |  ƒ } t j	 ƒ  } t j ƒ  } t j |  j d ƒ |  ƒ } | j | ƒ t j |  ƒ } | j d d ƒ | j d ƒ | j d ƒ |  j | t j d
 ƒ |  j ƒ | j | ƒ t j |  j d ƒ |  ƒ } | j | ƒ t j |  ƒ } | j d ƒ | j d d ƒ | j d  ƒ |  j | t j d ƒ |  j ƒ | j | ƒ t j |  j d! ƒ |  ƒ } | j | ƒ | j d ƒ | j | ƒ | j | ƒ |  j j | |  j d" ƒ ƒ t j |  ƒ } t j	 ƒ  } t j ƒ  } t j |  j d# ƒ |  ƒ } | j | ƒ | j | ƒ t j ƒ  } t j |  ƒ } | j d$ ƒ | j d d	 ƒ | j d ƒ |  j | t j d
 ƒ |  j ƒ | j | ƒ t j |  j d% ƒ |  ƒ } | j | ƒ t j |  ƒ } | j d& ƒ | j d d	 ƒ | j d ƒ |  j | t j d
 ƒ |  j ƒ | j | ƒ t j |  j d' ƒ |  ƒ } | j | ƒ | j d ƒ | j | ƒ | j | ƒ |  j j | |  j d( ƒ ƒ | j |  j ƒ |  j | ƒ t |  j ƒ  j ƒ  ƒ } |  j ƒ  j j j | ƒ }	 |	 j  | ƒ r|  j! |	 | ƒ n  d  S()   NR¾   s   Transform details for s%   Rock or repeat a transform or glide..s%   Rock back to initial position. Repeatt   interpolate_rocks   stateChanged(int)t   interpolate_repeatsi   id   s   valueChanged(int)i   t   Generalt   Rotationt   xt   yt   zt   roti˜þÿÿih  i   s   valueChanged(double)t   Translationt   zoomi    s   Specify transforms
   Rock anglet
   rock_anglet   periodt   rock_periodg        g      4@g      à?RE   s   Rock optionss$   Ramp speed at start and end of glidet
   ramp_starts   frames at startt   ramp_ends   frames at ends   Glide options("   R¿   R   RP   R   R   R�   R   R‹   R    RR   t
   QTabWidgetRÀ   RQ   RU   RV   RW   R_   t	   QCheckBoxR   R   R   RÅ   t   QSpinBoxRY   RZ   R^   Rn   t   addTabRX   t   presentationGuiR	   RL   t   has_keyt	   setParams(
   R   R   Rx   Rs   t   frame_layoutRz   R{   R}   Rt   Ru   (    (    s;   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/movieGui.pyR   ›  sð    , c         K   s‡   d d  l  } t j j |  | j  j ƒ } g  | d <xO d d d d d d d	 g D]2 } | d j t |  j t j | ƒ j	 ƒ  ƒ ƒ qM W| S(
   NiÿÿÿÿR   t   rotxt   rotyt   rotzRÍ   RÎ   RÏ   RÒ   (
   R	   R¿   R…   t   default_detailsR¤   R\   R   R    RX   t   value(   R   R‡   R	   Ru   t   key(    (    s;   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/movieGui.pyR…   H  s    
"0c         C   sƒ   t  j  j |  | ƒ d } | j d ƒ r xT d d d d d d d	 g D]4 } |  j t j | ƒ j | d | ƒ | d
 } qD Wn  d  S(   Ni    R   Rà   Rá   Râ   RÍ   RÎ   RÏ   RÒ   i   (   R¿   RÞ   RÝ   R   R    RX   R[   (   R   Ru   R|   Rå   (    (    s;   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/movieGui.pyRÞ   S  s    "$c         C   sD   |  j  ƒ  } |  j ƒ  j j j d t |  j ƒ  j ƒ  ƒ d | ƒ d  S(   NRh   Ru   (   R…   R   RÜ   R	   t   handle_movie_detailsR�   R‹   (   R   Ru   (    (    s;   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/movieGui.pyRÅ   _  s    (   RÇ   RÈ   R   R…   RÞ   RÅ   (    (    (    s;   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/movieGui.pyR   •  s   	­	t   FFMPEGSizeValidatorc           B   s&   e  Z d d  „ Z d „  Z d „  Z RS(   c         C   s   t  j j |  | ƒ d  S(   N(   R    t
   QValidatorR   (   R   R   (    (    s;   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/movieGui.pyR   g  s    c         C   sG   t  | j ƒ  ƒ } | d d d } | j d t | ƒ t | ƒ ƒ d  S(   Ni   i   i    (   t   intt   toAsciit   replaceRb   R�   (   R   t   inputt   vt   vnew(    (    s;   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/movieGui.pyt   fixupi  s    c         C   s   t  j j | f S(   N(   R    Rè   t   Intermediate(   R   Rì   t   pos(    (    s;   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/movieGui.pyt   validatem  s    N(   RÇ   RÈ   R»   R   Rï   Rò   (    (    (    s;   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/movieGui.pyRç   f  s   	R¼   c           B   s8   e  Z d d  „ Z d „  Z d „  Z d „  Z d „  Z RS(   c         C   s¸  t  j j |  | ƒ |  j |  j d ƒ |  j ƒ  j j ƒ t  j ƒ  } t  j	 ƒ  } | j
 t  j |  j d ƒ ƒ ƒ t j |  ƒ |  _ |  j j d d ƒ |  j j d ƒ | j
 |  j ƒ | j d ƒ | j | ƒ t  j	 ƒ  } | j
 t  j |  j d ƒ ƒ ƒ t j |  ƒ |  _ |  j j d d ƒ |  j j d	 ƒ | j
 |  j ƒ | j | ƒ | j
 t  j |  j d
 ƒ ƒ ƒ t j |  ƒ |  _ |  j j d d ƒ |  j j d	 ƒ | j
 |  j ƒ | j d ƒ | j | ƒ t  j	 ƒ  } | j
 t  j |  j d ƒ ƒ ƒ t  j t j j ƒ |  _ |  j j d ƒ | j
 |  j ƒ | j | ƒ t  j	 ƒ  } t  j |  j d ƒ |  ƒ |  _ | j
 |  j ƒ | j d ƒ | j | ƒ t  j	 ƒ  } t  j |  j d ƒ |  ƒ |  _ | j
 |  j ƒ | j d ƒ | j | ƒ t  j	 ƒ  } t  j |  j d ƒ |  ƒ |  _ | j
 |  j ƒ | j d ƒ | j | ƒ t  j	 ƒ  } t  j |  j d ƒ |  ƒ |  _  | j
 |  j  ƒ | j d ƒ | j | ƒ t  j	 ƒ  } | j
 t  j |  j d ƒ ƒ ƒ t  j! |  ƒ |  _" x* |  j ƒ  j j# D] } |  j" j$ | ƒ qÚW| j
 |  j" ƒ | j d ƒ | j | ƒ t  j	 ƒ  } | j
 t  j |  j d ƒ ƒ ƒ t  j! |  ƒ |  _% x* |  j ƒ  j j& D] } |  j% j$ | ƒ qnW| j
 |  j% ƒ | j d ƒ | j | ƒ |  j' |  j% t j( d ƒ |  j) ƒ t  j* ƒ  } | j+ |  j d ƒ t  j* j, ƒ } | j+ |  j d ƒ t  j* j- ƒ } |  j' | t j( d ƒ |  j. ƒ |  j' | t j( d ƒ |  j/ ƒ | j
 | ƒ |  j0 | ƒ |  j1 |  j ƒ  j j2 ƒ  ƒ |  j) ƒ  |  j. ƒ  |  j3 ƒ  d  S(   Ns   Movie preferences s
   Frame ratei   id   i   s   Frame widthi    iˆ  i   t   heights   Encoder qualitys   Create higher quality snapshots   Use true transparency (slow!)s   User renderer (slow!)s   Scale fonts and imagess    Create movie file with extensions   Use movie encoder programs&   currentIndexChanged ( const QString &)t   ApplyR   s	   clicked()(4   R    t   QDialogR   R   R   R   R	   R   RR   RU   RW   RV   Ro   t   RestrictedSpinBoxt
   frame_rateRY   RZ   R^   R_   t   RoundToMultipleSpint   frame_widtht   frame_heightt   QSliderR   Rq   Rr   t   encoder_qualityR[   RÙ   t   render_qualityt   true_transparencyt	   do_rendert   scale_fonts_and_imagesR`   t	   movie_extt   movie_ext_menuRd   t   movie_encodert   movie_encoder_menuR   R   t   setAllowedValuest   QDialogButtonBoxt	   addButtont	   ApplyRolet
   RejectRoleRô   R   Rn   RÞ   t	   getparamsR½   (   R   R   Rx   Rz   R}   t   dialog_buttonst   apply_buttont   cancel_button(    (    s;   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/movieGui.pyR   x  sž    &"!!

c         K   s~  |  j  j ƒ  } |  j ƒ  j j | } |  j ƒ  j j | } |  j ƒ  j j | } |  j ƒ  j j | } |  j j	 | ƒ |  j
 j	 | ƒ |  j
 j d ƒ |  j j d ƒ |  j j ƒ  |  j
 j ƒ  |  j j ƒ  xB | D]: } |  j ƒ  j j j | ƒ d k rÕ |  j j | ƒ qÕ qÕ W|  j j d ƒ |  j j | ƒ t | ƒ d k rg|  j j t | ƒ t | ƒ ƒ n |  j j d d ƒ d  S(   Ni   i    i   id   (   R  t   currentIndexR   R	   t   movie_encoder_aliast   movie_encoder_formatst   movie_encoder_size_multiplet   movie_encoder_fpsRù   t   setMultipleRú   RZ   t   fixValueR  R�   R  Rk   Rd   Rg   R÷   t   setRestrictionRb   RY   t   mint   max(   R   R‡   t   cit   enct   formatst   multiplet   fpsR}   (    (    s;   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/movieGui.pyR  Ù  s(    !"c         C   sõ   i	 t  |  j j ƒ  ƒ d 6t  |  j j ƒ  ƒ d 6t  |  j j ƒ  ƒ t  |  j j ƒ  ƒ g d 6t  |  j j ƒ  ƒ d 6t  |  j j ƒ  ƒ d 6t  |  j	 j ƒ  ƒ d 6t  |  j
 j ƒ  ƒ d 6|  j ƒ  j j |  j j ƒ  d 6t |  j j ƒ  j ƒ  ƒ d	 6} | S(
   NRü   R÷   t
   frame_sizeRý   Rþ   Rÿ   R   R  R  (   Ré   Rü   Rä   R÷   Rù   Rú   Rý   t	   isCheckedRþ   Rÿ   R   R   R	   R  R  R  R�   R  R‚   Rê   (   R   Ru   (    (    s;   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/movieGui.pyR…   ö  s    + c         C   s  | j  d ƒ r, |  j j t | d ƒ ƒ n  | j  d ƒ rX |  j j t | d ƒ ƒ n  | j  d ƒ r¦ |  j j t | d d ƒ ƒ |  j j t | d d ƒ ƒ n  | j  d ƒ rÒ |  j j t | d ƒ ƒ n  | j  d ƒ rþ |  j	 j t | d ƒ ƒ n  | j  d ƒ r*|  j
 j t | d ƒ ƒ n  | j  d	 ƒ rV|  j j t | d	 ƒ ƒ n  | j  d
 ƒ r°|  j ƒ  j j j | d
 ƒ r°|  j j |  j ƒ  j j j | d
 ƒ ƒ n  | j  d ƒ r
|  j ƒ  j j j | d ƒ r
|  j j |  j ƒ  j j j | d ƒ ƒ n  d  S(   NR÷   Rü   R  i    i   Rý   Rþ   Rÿ   R   R  R  (   RÝ   R÷   R[   Ré   Rü   Rù   Rú   Rý   t
   setCheckedRþ   Rÿ   R   R   R	   R  Rk   R  Rg   Rh   R  R  (   R   Ru   (    (    s;   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/movieGui.pyRÞ     s&      !    .,.c         C   s#   |  j  ƒ  j j d |  j ƒ  ƒ d  S(   NRu   (   R   R	   t   set_movie_paramsR…   (   R   (    (    s;   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/movieGui.pyRô     s    N(   RÇ   RÈ   R»   R   R  R…   RÞ   Rô   (    (    (    s;   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/movieGui.pyR¼   s  s
   a			(   t   __doc__R­   t   PyQt4R    R   t   global_definitionsR¥   R   R¿   Ro   R   R   Rè   Rç   Rõ   R¼   (    (    (    s;   /opt/xtal/ccp4-6.5-linux32/lib/py2/ccp4mg/qtgui/movieGui.pyt   <module>   s   
$ÿ yÑ