
    ը	f&                     .   d Z ddlZddlmZmZ ddlmZ ddlmZ ddl	m
Z
  ed ed      	       ed
 ed      	       ed ed      	       ed ed      	       ed ed      	       ed ed      	       ed ed      	       ed ed       ed             ed ed       ed             ed ed       ed            d
ZdZd ed  ed!       ed"            iZ G d# d$e      Z G d% d&e      Z G d' d(e      Z G d) d*e      Zy)+a  
@package animation.toolbars

@brief Animation toolbars

Classes:
 - toolbars::MainToolbar(BaseToolbar)
 - toolbars::AnimationToolbar(BaseToolbar)
 - toolbars::MiscToolbar(BaseToolbar)
 - toolbars::AnimSimpleLmgrToolbar


(C) 2013 by the GRASS Development Team

This program is free software under the GNU General Public License
(>=v2). Read the file COPYING that comes with GRASS for details.

@author Anna Petrasova <kratochanna gmail.com>
    N)BaseToolbar	BaseIcons)MetaIcon)SimpleLmgrToolbar)
ReplayModemovezChange animation speed)imglabelexecutezPlay forwardzplayer-backz	Play backzplayer-stopStopzplayer-pausePauseredrawRepeatzplayer-repeat-back-forwardzPlay back and forwardz	layer-addzAdd new animation)r	   r
   descz
layer-morezAdd, edit or remove animationzlayer-exportzExport animation)
speedplayForwardplayBackstoppauseoneDirectionReplaybothDirectionReplayaddAnimationeditAnimationexportAnimation   	addSeriesz
mapset-addz.Add space-time dataset or series of map layersz<Add space-time dataset or series of map layers for animationc                       e Zd ZdZd Zd Zy)MainToolbarzMain toolbar (data management)c                     t        j                  | |       | j                  | j                                | j	                          y)zMain toolbar constructorNr   __init__InitToolbar_toolbarDataRealizeselfparents     3/usr/lib/grass83/gui/wxpython/animation/toolbars.pyr!   zMainToolbar.__init__@   s4    T6***,- 	    c                    t         }| j                  d|d   j                  f|d   | j                  j                  fd|d   j                  f|d   | j                  j
                  fdt        d   j                  ft        d   | j                  j                  fd|d   j                  f|d   | j                  j                  ff      S )*Returns toolbar data (name, icon, handler)r   r   reloadrenderr   )	
ganimIcons_getToolbarDatar
   r'   OnAddAnimationOnEditAnimationr   ReloadOnExportAnimationr&   iconss     r(   r#   zMainToolbar._toolbarDataI   s     ## $U>%:%@%@A.)KK.. %eO&<&B&BC/*KK// y2889h'KK&& '.?(@(F(FG+,KK11!
 	
r)   N__name__
__module____qualname____doc__r!   r#    r)   r(   r   r   =   s    (
r)   r   c                   d    e 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y)AnimationToolbarz(Animation toolbar (to control animation)c                     t        j                  | |       | j                  | j                                | j	                          d| _        | j                  d       y)zAnimation toolbar constructorTFN)r   r!   r"   r#   r$   isPlayingForwardEnableAnimToolsr%   s     r(   r!   zAnimationToolbar.__init__k   sJ    T6***,- 	 $U#r)   c                 b   t         }| j                  d|d   j                  f|d   | j                  fd|d   j                  f|d   | j                  fd|d   j                  f|d   | j
                  t        j                  fd|d   j                  f|d   | j                  fdd|d   j                  f|d   | j                  t        j                  fd|d   j                  f|d   | j                  t        j                  fdd|d	   j                  f|d	   | j                  j                  ff	      S )
r+   r   r   r   r   Nr   r   adjustSpeedr   )r.   r/   r
   
OnPlayBackOnPlayForwardOnPausewx
ITEM_CHECKOnStopOnOneDirectionReplayOnBothDirectionReplayr'   OnAdjustSpeedr4   s     r(   r#   zAnimationToolbar._toolbarDataw   sr    ##  z!2!8!89*%OO #E-$8$>$>?-(&& eGn223'NLLMM	 U6]001&MKK
  -2399 ./--MM .34:: /0..MM "E'N$8$89'NKK--U/1
 1	
r)   c                 Z    | j                          | j                  j                  |       y rB   )PlayForwardr'   rE   r&   events     r(   rE   zAnimationToolbar.OnPlayForward   s     !!%(r)   c                 *   | j                  | j                  d       | j                  | j                  d       | j                  | j                  d       | j                  | j                  d       | j                  | j                  d       d| _        y )NFT
EnableToolr   r   r   r   
ToggleToolr?   r&   s    r(   rN   zAnimationToolbar.PlayForward   sf    ((%0t,

D)		4(

E* $r)   c                 Z    | j                          | j                  j                  |       y rB   )PlayBackr'   rD   rO   s     r(   rD   zAnimationToolbar.OnPlayBack   s    u%r)   c                 *   | j                  | j                  d       | j                  | j                  d       | j                  | j                  d       | j                  | j                  d       | j                  | j                  d       d| _        y NTFrR   rU   s    r(   rW   zAnimationToolbar.PlayBack   sf    (($/u-

D)		4(

E* %r)   c                 Z    | j                          | j                  j                  |       y rB   )r   r'   rF   rO   s     r(   rF   zAnimationToolbar.OnPause   s    

E"r)   c                 F   | j                  | j                        r9| j                  | j                  d       | j                  | j                  d       y | j                  | j                  | j
                          | j                  | j                  | j
                         y )NT)GetToolStater   rS   r   r   r?   rU   s    r(   r   zAnimationToolbar.Pause   so    TZZ(OOD,,d3OODMM40OOD,,$2G2G.GHOODMM4+@+@Ar)   c                 Z    | j                          | j                  j                  |       y rB   )r   r'   rI   rO   s     r(   rI   zAnimationToolbar.OnStop   s    		5!r)   c                    | j                  | j                  d       | j                  | j                  d       | j                  | j                  d       | j                  | j                  d       | j                  | j                  d       y rY   )rS   r   r   r   r   rT   rU   s    r(   r   zAnimationToolbar.Stop   s^    (($/t,

E*		5)

E*r)   c                     |j                         r| j                  | j                  d       | j                  j	                  |       y NF)	IsCheckedrT   r   r'   rJ   rO   s     r(   rJ   z%AnimationToolbar.OnOneDirectionReplay   s2    ??OOD44e<((/r)   c                     |j                         r| j                  | j                  d       | j                  j	                  |       y r`   )ra   rT   r   r'   rK   rO   s     r(   rK   z&AnimationToolbar.OnBothDirectionReplay   s2    ??OOD33U;))%0r)   c                     d\  }}|t         j                  k(  rd}n|t         j                  k(  rd}| j                  | j                  |       | j                  | j
                  |       y )N)FFT)r   REPEATREVERSErT   r   r   )r&   modeoneboths       r(   SetReplayModezAnimationToolbar.SetReplayMode   sY     	T:$$$CZ'''D//500$7r)   c                     | j                  | j                  |       | j                  | j                  |       | j                  | j                  |       | j                  | j                  |       y)z!Enable or disable animation toolsN)rS   r   r   r   r   )r&   enables     r(   r@   z AnimationToolbar.EnableAnimTools   sL    ((&1v.

F+		6*r)   N)r7   r8   r9   r:   r!   r#   rE   rN   rD   rW   rF   r   rI   r   rJ   rK   ri   r@   r;   r)   r(   r=   r=   h   sM    2
$6
p)%&&#B"+0
1
8+r)   r=   c                       e Zd ZdZd Zd Zy)MiscToolbarz/Toolbar with miscellaneous tools related to appc                     t        j                  | |       | j                  | j                                | j	                          y)zToolbar constructorNr    r%   s     r(   r!   zMiscToolbar.__init__  s2    T6***,-r)   c                 P   | j                  dt        d   j                  ft        d   | j                  j                  fdt        d   j                  ft        d   | j                  j
                  fdt        d   j                  ft        d   | j                  j                  ff      S )zToolbar datasettingshelpquit)r/   r   r
   r'   OnPreferencesOnHelpOnCloseWindowrU   s    r(   r#   zMiscToolbar._toolbarData
  s    ##  :!6!<!<=j)KK-- Yv.445f%KK&& Yv.445f%KK--
 	
r)   Nr6   r;   r)   r(   rm   rm      s    9
r)   rm   c                   $    e Zd ZdZd Zd ZddZy)AnimSimpleLmgrToolbarzmSimple layer manager toolbar for animation tool.
    Allows adding space-time dataset or series of maps.
    c                 2    t        j                  | ||       y rB   )r   r!   )r&   r'   	lmgrStyles      r(   r!   zAnimSimpleLmgrToolbar.__init__&  s    ""4;r)   c                     t        j                  |       }| j                  t        z  rC|j	                  ddt
        d   j                  ft
        d   | j                  j                  f       |S )Nr   r   )	r   r#   _styleSIMPLE_LMGR_STDSinsertsimpleLmgrIconsr
   r'   	OnAddStds)r&   datas     r(   r#   z"AnimSimpleLmgrToolbar._toolbarData)  sb     --d3;;))KK /+">"D"DE#K0KK)) r)   c                 J    |D ]  }| j                  t        | |      |         y rB   )rS   getattr)r&   toolsrk   tools       r(   EnableToolsz!AnimSimpleLmgrToolbar.EnableTools6  s&     	9DOOGD$/8	9r)   N)T)r7   r8   r9   r:   r!   r#   r   r;   r)   r(   rw   rw   !  s    <9r)   rw   )r:   rG   gui_core.toolbarsr   r   
icons.iconr   gui_core.simplelmgrr   animation.animr   _r.   r|   r~   r   r=   rm   rw   r;   r)   r(   <module>r      sM  & 
 4  1 % &*B(CD	>1BC]!K.Aai8.'
;"xq{C#(2I0J q!45A>Q<R /0./
  !$6"7a@R>S%
.   @AMN(
+ (
VT+{ T+n
+ 
D9- 9r)   