diff --git a/Packages/vcs/Lib/Canvas.py b/Packages/vcs/Lib/Canvas.py index c5e893f505..5ff666b2a8 100644 --- a/Packages/vcs/Lib/Canvas.py +++ b/Packages/vcs/Lib/Canvas.py @@ -541,6 +541,8 @@ def savecontinentstype(self,value): self._savedcontinentstype = value def onClosing( self, cell ): + if self.configurator: + self.endconfigure() self.backend.onClosing( cell ) def _reconstruct_tv(self, arglist, keyargs): @@ -3843,6 +3845,8 @@ def clear(self, *args, **kargs): """ if self.animate.created(): self.animate.close() + if self.configurator is not None: + self.configurator.stop_animating() self.animate_info=[] self.animate.update_animate_display_list( ) self.backend.clear(*args,**kargs) @@ -3879,7 +3883,8 @@ def close(self, *args, **kargs): #if (self.canvas_gui is not None): # self.canvas_gui.dialog.dialog.withdraw() # just withdraw the GUI for later # gui_canvas_closed = 0 - + if self.configurator: + self.endconfigure() # Close the VCS Canvas a = self.backend.close(*args,**kargs) diff --git a/Packages/vcs/Lib/configurator.py b/Packages/vcs/Lib/configurator.py index c202c7d7ab..b2d49adbf4 100644 --- a/Packages/vcs/Lib/configurator.py +++ b/Packages/vcs/Lib/configurator.py @@ -227,6 +227,9 @@ def update(self): display._template_origin = new_template.name def detach(self): + if self.interactor is None: + return + if self.animation_timer is not None: self.stop_animating() diff --git a/testing/vcs/CMakeLists.txt b/testing/vcs/CMakeLists.txt index 248a30655c..bb67b433b0 100644 --- a/testing/vcs/CMakeLists.txt +++ b/testing/vcs/CMakeLists.txt @@ -511,4 +511,8 @@ cdat_add_test(vcs_test_taylor_2_quads ) endif() +cdat_add_test(vcs_test_endconfigure + "${PYTHON_EXECUTABLE}" + ${cdat_SOURCE_DIR}/testing/vcs/test_vcs_endconfigure.py +) add_subdirectory(vtk_ui) diff --git a/testing/vcs/test_vcs_endconfigure.py b/testing/vcs/test_vcs_endconfigure.py new file mode 100644 index 0000000000..9e8c878820 --- /dev/null +++ b/testing/vcs/test_vcs_endconfigure.py @@ -0,0 +1,37 @@ +import vcs, sys + +class FakeConfigurator(object): + def __init__(self): + self.detached = False + + def detach(self): + self.detached = True + +x = vcs.init() + +fake = FakeConfigurator() + +x.configurator = fake +x.close() + +if x.configurator is not None: + print "x.close() did not end configuration" + sys.exit(1) + +if fake.detached == False: + print "x.close() did not detach configurator" + sys.exit(1) + +fake = FakeConfigurator() +x.configurator = fake +x.onClosing(None) + +if x.configurator is not None: + print "x.onClosing did not end configuration" + sys.exit(1) + +if fake.detached == False: + print "x.onClosing() did not detach configurator" + sys.exit(1) + +sys.exit(0) \ No newline at end of file