Skip to content

Commit 32f3893

Browse files
author
David Lonie
committed
Merge pull request #1258 from chaosphere2112/colorpicker_renderer_selection
Colorpicker renderer selection
2 parents c4c39c0 + 7ae5bf7 commit 32f3893

File tree

3 files changed

+26
-2
lines changed

3 files changed

+26
-2
lines changed

Packages/vcs/Lib/colorpicker.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ def cancel(self, state):
120120
self.close()
121121

122122
def selectCell(self, cellId):
123-
if cellId == -1:
123+
if cellId in (None, -1):
124124
return
125125
ids = vtk.vtkIdTypeArray();
126126
ids.SetNumberOfComponents(1);
@@ -152,7 +152,7 @@ def clickEvent(self, obj, event):
152152

153153
x, y = inter.GetEventPosition()
154154

155-
renderer = self.topRendererAtPoint(x, y)
155+
renderer = self.color_renderer
156156

157157
if renderer:
158158
picker = vtk.vtkCellPicker()

testing/vcs/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -628,6 +628,11 @@ cdat_add_test(vcs_test_endconfigure
628628
${cdat_SOURCE_DIR}/testing/vcs/test_vcs_endconfigure.py
629629
)
630630

631+
cdat_add_test(vcs_test_colorpicker_selection
632+
"${PYTHON_EXECUTABLE}"
633+
${cdat_SOURCE_DIR}/testing/vcs/test_vcs_colorpicker_selection.py
634+
)
635+
631636
cdat_add_test(vcs_test_configurator_click_text
632637
"${PYTHON_EXECUTABLE}"
633638
${cdat_SOURCE_DIR}/testing/vcs/test_vcs_configurator_click_text.py
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import vcs, sys
2+
3+
passing = False
4+
5+
6+
def save_clicked(colormap, color):
7+
if color == 135:
8+
global passing
9+
passing = True
10+
11+
12+
picker = vcs.colorpicker.ColorPicker(500, 500, None, None, on_save=save_clicked)
13+
14+
interactor = picker.render_window.GetInteractor()
15+
interactor.SetEventInformation(250, 260)
16+
picker.clickEvent(None, None)
17+
picker.save(0)
18+
19+
sys.exit(0 if passing else 1)

0 commit comments

Comments
 (0)