Skip to content

Commit

Permalink
Merge pull request #1258 from chaosphere2112/colorpicker_renderer_sel…
Browse files Browse the repository at this point in the history
…ection

Colorpicker renderer selection
  • Loading branch information
David Lonie committed May 4, 2015
2 parents c4c39c0 + 7ae5bf7 commit 32f3893
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Packages/vcs/Lib/colorpicker.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,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);
Expand Down Expand Up @@ -152,7 +152,7 @@ def clickEvent(self, obj, event):

x, y = inter.GetEventPosition()

renderer = self.topRendererAtPoint(x, y)
renderer = self.color_renderer

if renderer:
picker = vtk.vtkCellPicker()
Expand Down
5 changes: 5 additions & 0 deletions testing/vcs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -628,6 +628,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
Expand Down
19 changes: 19 additions & 0 deletions testing/vcs/test_vcs_colorpicker_selection.py
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit 32f3893

Please sign in to comment.