From 7179530fdbf74df4e94814686dd11c013cf90dca Mon Sep 17 00:00:00 2001 From: Sam Fries Date: Wed, 8 Apr 2015 13:57:30 -0700 Subject: [PATCH 1/5] Canvas will call endconfigure when being killed by GUI --- Packages/vcs/Lib/Canvas.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Packages/vcs/Lib/Canvas.py b/Packages/vcs/Lib/Canvas.py index c5e893f505..eb1cd09c9b 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) From f1604a855b4edad57bad6579902c957695cfb14c Mon Sep 17 00:00:00 2001 From: Sam Fries Date: Wed, 8 Apr 2015 14:21:26 -0700 Subject: [PATCH 2/5] Made closing from command line also endconfigure --- Packages/vcs/Lib/Canvas.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Packages/vcs/Lib/Canvas.py b/Packages/vcs/Lib/Canvas.py index eb1cd09c9b..5ff666b2a8 100644 --- a/Packages/vcs/Lib/Canvas.py +++ b/Packages/vcs/Lib/Canvas.py @@ -3883,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) From 57cdbd86b1164a2dcbd2fa68a83dd5deb29de80e Mon Sep 17 00:00:00 2001 From: Sam Fries Date: Wed, 8 Apr 2015 15:08:06 -0700 Subject: [PATCH 3/5] Made configurator handle detaching when not initialized --- Packages/vcs/Lib/configurator.py | 3 +++ 1 file changed, 3 insertions(+) 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() From f29d940a1115d3efd8014aad283868273366b722 Mon Sep 17 00:00:00 2001 From: Sam Fries Date: Wed, 8 Apr 2015 15:14:45 -0700 Subject: [PATCH 4/5] Added test to make sure configurator gets cleaned up when canvas dies --- testing/vcs/test_vcs_endconfigure.py | 37 ++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 testing/vcs/test_vcs_endconfigure.py 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 From 73fa9b866bada01140f76223579553ff7b9806eb Mon Sep 17 00:00:00 2001 From: Sam Fries Date: Wed, 8 Apr 2015 15:17:12 -0700 Subject: [PATCH 5/5] Added test to CMakeLists --- testing/vcs/CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) 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)