@@ -164,6 +164,7 @@ def __init__(self, canvas):
164164 self .save_timer = None
165165 self .save_listener = None
166166 self .save_anim_button = None
167+ self .anim_button = None
167168 self .listeners = []
168169 self .animation_last_frame_time = datetime .datetime .now ()
169170 # Map custom templates to their source template
@@ -541,7 +542,7 @@ def setup_animation(self):
541542 if self .initialized == False :
542543 self .canvas .animate .create ()
543544 anim_toolbar = self .toolbar .add_toolbar ("Animation" )
544- anim_toolbar .add_toggle_button ("Animation" , on = self .start_animating , off = self .stop_animating , on_prefix = "Run" , off_prefix = "Stop" )
545+ self . anim_button = anim_toolbar .add_toggle_button ("Animation" , on = self .start_animating , off = self .stop_animating , on_prefix = "Run" , off_prefix = "Stop" )
545546 anim_toolbar .add_button (["Step Forward" ], action = self .step_forward )
546547 anim_toolbar .add_button (["Step Backward" ], action = self .step_back )
547548 anim_toolbar .add_slider_button (0 , 0 , self .canvas .animate .number_of_frames (), "Time Slider" , update = self .set_animation_frame , end = self .final_animation_frame )
@@ -557,6 +558,9 @@ def step_back(self, state):
557558
558559 def save_animation_press (self , state ):
559560 if state == 1 :
561+ if self .animation_timer :
562+ self .stop_animating ()
563+ self .anim_button .set_state (0 )
560564 self .save_listener = self .interactor .AddObserver ("TimerEvent" , self .save_tick )
561565 self .save_timer = self .interactor .CreateRepeatingTimer (10 )
562566 else :
0 commit comments