diff --git a/Packages/vcs/Lib/VTKPlots.py b/Packages/vcs/Lib/VTKPlots.py index 6dabcec49c..c0586134b3 100644 --- a/Packages/vcs/Lib/VTKPlots.py +++ b/Packages/vcs/Lib/VTKPlots.py @@ -57,8 +57,14 @@ def setAnimationStepper( self, stepper ): plot.setAnimationStepper( stepper ) def interact(self,*args,**kargs): - warnings.warn("Press 'Q' to exit interactive mode and continue script execution") + if self.renWin is None: + warnings.warn("Cannot interact if you did not open the canvas yet") + return interactor = self.renWin.GetInteractor() + if interactor is None: + warnings.warn("Cannot start interaction. Blank plot?") + return + warnings.warn("Press 'Q' to exit interactive mode and continue script execution") interactor.Start() def leftButtonPressEvent(self,obj,event): diff --git a/testing/vcs/CMakeLists.txt b/testing/vcs/CMakeLists.txt index 728f04c349..5432228fb8 100644 --- a/testing/vcs/CMakeLists.txt +++ b/testing/vcs/CMakeLists.txt @@ -33,6 +33,14 @@ add_test(vcs_test_clear_empy_canvas ${CMAKE_INSTALL_PREFIX}/bin/python ${cdat_SOURCE_DIR}/testing/vcs/test_clear_empty_canvas.py ) +add_test(vcs_test_interact_no_open + ${CMAKE_INSTALL_PREFIX}/bin/python + ${cdat_SOURCE_DIR}/testing/vcs/test_vcs_interact_no_open.py + ) +add_test(vcs_test_interact_no_plot + ${CMAKE_INSTALL_PREFIX}/bin/python + ${cdat_SOURCE_DIR}/testing/vcs/test_vcs_interact_no_plot.py + ) add_test(vcs_test_colorcells ${CMAKE_INSTALL_PREFIX}/bin/python diff --git a/testing/vcs/test_vcs_interact_no_open.py b/testing/vcs/test_vcs_interact_no_open.py new file mode 100644 index 0000000000..0f592eb238 --- /dev/null +++ b/testing/vcs/test_vcs_interact_no_open.py @@ -0,0 +1,3 @@ +import vcs +x=vcs.init() +x.interact() diff --git a/testing/vcs/test_vcs_interact_no_plot.py b/testing/vcs/test_vcs_interact_no_plot.py new file mode 100644 index 0000000000..792bb9985f --- /dev/null +++ b/testing/vcs/test_vcs_interact_no_plot.py @@ -0,0 +1,4 @@ +import vcs +x=vcs.init() +x.open() +x.interact()