Skip to content

Commit e6aa63a

Browse files
committed
Merge pull request #1207 from chaosphere2112/fix_1197
Fix #1197
2 parents dd7c087 + 73fa9b8 commit e6aa63a

File tree

4 files changed

+50
-1
lines changed

4 files changed

+50
-1
lines changed

Packages/vcs/Lib/Canvas.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -541,6 +541,8 @@ def savecontinentstype(self,value):
541541
self._savedcontinentstype = value
542542

543543
def onClosing( self, cell ):
544+
if self.configurator:
545+
self.endconfigure()
544546
self.backend.onClosing( cell )
545547

546548
def _reconstruct_tv(self, arglist, keyargs):
@@ -3843,6 +3845,8 @@ def clear(self, *args, **kargs):
38433845
"""
38443846
if self.animate.created():
38453847
self.animate.close()
3848+
if self.configurator is not None:
3849+
self.configurator.stop_animating()
38463850
self.animate_info=[]
38473851
self.animate.update_animate_display_list( )
38483852
self.backend.clear(*args,**kargs)
@@ -3879,7 +3883,8 @@ def close(self, *args, **kargs):
38793883
#if (self.canvas_gui is not None):
38803884
# self.canvas_gui.dialog.dialog.withdraw() # just withdraw the GUI for later
38813885
# gui_canvas_closed = 0
3882-
3886+
if self.configurator:
3887+
self.endconfigure()
38833888
# Close the VCS Canvas
38843889
a = self.backend.close(*args,**kargs)
38853890

Packages/vcs/Lib/configurator.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,9 @@ def update(self):
227227
display._template_origin = new_template.name
228228

229229
def detach(self):
230+
if self.interactor is None:
231+
return
232+
230233
if self.animation_timer is not None:
231234
self.stop_animating()
232235

testing/vcs/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -511,4 +511,8 @@ cdat_add_test(vcs_test_taylor_2_quads
511511
)
512512
endif()
513513

514+
cdat_add_test(vcs_test_endconfigure
515+
"${PYTHON_EXECUTABLE}"
516+
${cdat_SOURCE_DIR}/testing/vcs/test_vcs_endconfigure.py
517+
)
514518
add_subdirectory(vtk_ui)
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import vcs, sys
2+
3+
class FakeConfigurator(object):
4+
def __init__(self):
5+
self.detached = False
6+
7+
def detach(self):
8+
self.detached = True
9+
10+
x = vcs.init()
11+
12+
fake = FakeConfigurator()
13+
14+
x.configurator = fake
15+
x.close()
16+
17+
if x.configurator is not None:
18+
print "x.close() did not end configuration"
19+
sys.exit(1)
20+
21+
if fake.detached == False:
22+
print "x.close() did not detach configurator"
23+
sys.exit(1)
24+
25+
fake = FakeConfigurator()
26+
x.configurator = fake
27+
x.onClosing(None)
28+
29+
if x.configurator is not None:
30+
print "x.onClosing did not end configuration"
31+
sys.exit(1)
32+
33+
if fake.detached == False:
34+
print "x.onClosing() did not detach configurator"
35+
sys.exit(1)
36+
37+
sys.exit(0)

0 commit comments

Comments
 (0)