Skip to content

Commit f084cab

Browse files
committed
Merge pull request #1113 from chaosphere2112/vcs2d_animation_interaction
VCS2D Animation while Interacting
2 parents 86b82fb + 3012236 commit f084cab

File tree

12 files changed

+531
-166
lines changed

12 files changed

+531
-166
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
set(libcdms_deps ${netcdf_pkg}
1+
set(libcdms_deps ${netcdf_pkg}
22
${jasper_pkg} ${g2clib_pkg} ${tiff_pkg}
33
${png_pkg} ${jpeg_pkg} )

Packages/vcs/Lib/Canvas.py

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -469,8 +469,7 @@ def start(self,*args,**kargs):
469469
self.interact(*args,**kargs)
470470

471471
def interact(self,*args,**kargs):
472-
if self.configurator is not None:
473-
self.configurator.show()
472+
self.configure()
474473
self.backend.interact(*args,**kargs)
475474

476475
def _datawc_tv(self, tv, arglist):
@@ -942,7 +941,7 @@ def __init__(self, gui = 0, mode = 1, pause_time=0, call_from_gui=0, size=None,
942941

943942
self._animate = self.backend.Animate( self )
944943

945-
self.configurator = configurator.Configurator(self, show_on_update=(backend != "vtk") )
944+
self.configurator = None
946945

947946
## Initial.attributes is being called in main.c, so it is not needed here!
948947
## Actually it is for taylordiagram graphic methods....
@@ -967,12 +966,27 @@ def __init__(self, gui = 0, mode = 1, pause_time=0, call_from_gui=0, size=None,
967966
else:
968967
shutil.copy2(os.path.join(*pth),user_init)
969968

970-
called_initial_attributes_flg = 1
969+
called_initial_attributes_flg = 1
971970
self.canvas_template_editor=None
972971
self.ratio=0
973972
self._user_actions_names=['Clear Canvas','Close Canvas','Show arguments passsed to user action']
974973
self._user_actions = [self.clear, self.close, self.dummy_user_action]
975974

975+
def configure(self):
976+
for display in self.display_names:
977+
d = vcs.elements["display"][display]
978+
if "3d" in d.g_type.lower():
979+
return
980+
if self.configurator is None:
981+
self.configurator = configurator.Configurator(self)
982+
self.configurator.update()
983+
self.configurator.show()
984+
985+
def endconfigure(self):
986+
if self.configurator is not None:
987+
self.configurator.detach()
988+
self.configurator = None
989+
976990
def processParameterChange( self, args ):
977991
self.ParameterChanged( args )
978992

@@ -2426,7 +2440,7 @@ def drawtextcombined(self, Tt_name=None, To_name=None, string=None,
24262440
'xbounds','ybounds','xname','yname','xunits','yunits','xweights','yweights',
24272441
'comment1','comment2','comment3','comment4','hms','long_name','zaxis',
24282442
'zarray','zname','zunits','taxis','tarray','tname','tunits','waxis','warray',
2429-
'wname','wunits','bg','ratio','donotstoredisplay']
2443+
'wname','wunits','bg','ratio','donotstoredisplay', 'render']
24302444

24312445

24322446

@@ -2643,6 +2657,7 @@ def plot_filledcontinents(self,slab,template_name,g_type,g_name,bg,ratio):
26432657
print err
26442658

26452659
def __plot (self, arglist, keyargs):
2660+
26462661
# This routine has five arguments in arglist from _determine_arg_list
26472662
# It adds one for bg and passes those on to Canvas.plot as its sixth arguments.
26482663

@@ -2660,6 +2675,10 @@ def __plot (self, arglist, keyargs):
26602675
if not isinstance(arglist[3],vcsaddons.core.VCSaddon): assert isinstance(arglist[3],str)
26612676
assert isinstance(arglist[4],str)
26622677

2678+
if self.animate.is_playing():
2679+
self.animate.stop()
2680+
while self.animate.is_playing():
2681+
pass
26632682
##reset animation
26642683
self.animate.create_flg = 0
26652684

@@ -3734,8 +3753,7 @@ def set_convert_labels(copy_mthd,test=0):
37343753
if dn is not None:
37353754
self.display_names.append(result.name)
37363755
if result.g_type in ("3d_scalar", "3d_vector") and self.configurator is not None:
3737-
self.configurator.detach()
3738-
self.configurator = None
3756+
self.endconfigure()
37393757
if self.backend.bg == False and self.configurator is not None:
37403758
self.configurator.update()
37413759

0 commit comments

Comments
 (0)