From 024a6da8aa65d1bfbdc15e1ba616c2e0ab0ae4f3 Mon Sep 17 00:00:00 2001 From: Sam Fries Date: Fri, 1 May 2015 07:53:20 -0700 Subject: [PATCH 1/2] Fix issue where colorpicker couldn't pick colors --- Packages/vcs/Lib/colorpicker.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Packages/vcs/Lib/colorpicker.py b/Packages/vcs/Lib/colorpicker.py index 3ea7c0cbd3..d20ec11057 100644 --- a/Packages/vcs/Lib/colorpicker.py +++ b/Packages/vcs/Lib/colorpicker.py @@ -149,7 +149,7 @@ def clickEvent(self, obj, event): x, y = inter.GetEventPosition() - renderer = self.topRendererAtPoint(x, y) + renderer = self.color_renderer if renderer: picker = vtk.vtkCellPicker() From 7ae5bf785f81f7f1ee07200a49034c30540a26c8 Mon Sep 17 00:00:00 2001 From: Sam Fries Date: Fri, 1 May 2015 11:21:30 -0700 Subject: [PATCH 2/2] Colorpicker selection fixed, test added --- Packages/vcs/Lib/colorpicker.py | 2 +- testing/vcs/CMakeLists.txt | 5 +++++ testing/vcs/test_vcs_colorpicker_selection.py | 19 +++++++++++++++++++ 3 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 testing/vcs/test_vcs_colorpicker_selection.py diff --git a/Packages/vcs/Lib/colorpicker.py b/Packages/vcs/Lib/colorpicker.py index d20ec11057..a7d812f059 100644 --- a/Packages/vcs/Lib/colorpicker.py +++ b/Packages/vcs/Lib/colorpicker.py @@ -117,7 +117,7 @@ def cancel(self, state): self.close() def selectCell(self, cellId): - if cellId == -1: + if cellId in (None, -1): return ids = vtk.vtkIdTypeArray(); ids.SetNumberOfComponents(1); diff --git a/testing/vcs/CMakeLists.txt b/testing/vcs/CMakeLists.txt index 0ea777aa9c..6c9fde5093 100644 --- a/testing/vcs/CMakeLists.txt +++ b/testing/vcs/CMakeLists.txt @@ -618,6 +618,11 @@ cdat_add_test(vcs_test_endconfigure ${cdat_SOURCE_DIR}/testing/vcs/test_vcs_endconfigure.py ) +cdat_add_test(vcs_test_colorpicker_selection + "${PYTHON_EXECUTABLE}" + ${cdat_SOURCE_DIR}/testing/vcs/test_vcs_colorpicker_selection.py +) + cdat_add_test(vcs_test_configurator_click_text "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/vcs/test_vcs_configurator_click_text.py diff --git a/testing/vcs/test_vcs_colorpicker_selection.py b/testing/vcs/test_vcs_colorpicker_selection.py new file mode 100644 index 0000000000..83f1ff65ee --- /dev/null +++ b/testing/vcs/test_vcs_colorpicker_selection.py @@ -0,0 +1,19 @@ +import vcs, sys + +passing = False + + +def save_clicked(colormap, color): + if color == 135: + global passing + passing = True + + +picker = vcs.colorpicker.ColorPicker(500, 500, None, None, on_save=save_clicked) + +interactor = picker.render_window.GetInteractor() +interactor.SetEventInformation(250, 260) +picker.clickEvent(None, None) +picker.save(0) + +sys.exit(0 if passing else 1)