Skip to content

Commit df355f9

Browse files
committed
Merge pull request #1262 from UV-CDAT/update_master
Update master
2 parents 54259b8 + cdf05a4 commit df355f9

File tree

14 files changed

+167
-10
lines changed

14 files changed

+167
-10
lines changed

Packages/cdms2/Src/Cdunifmodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1158,7 +1158,7 @@ PyCdunifFile_Open(char *filename, char *mode)
11581158
if (mode[0] == 'w') {
11591159
Py_BEGIN_ALLOW_THREADS;
11601160
acquire_Cdunif_lock();
1161-
ncmode = NC_CLOBBER;
1161+
ncmode = NC_CLOBBER|NC_64BIT_OFFSET;
11621162
#ifndef NONC4
11631163
if ((cdms_shuffle!=0) || (cdms_deflate!=0)) {
11641164
ncmode = NC_CLOBBER|NC_NETCDF4;

Packages/vcs/Lib/VTKPlots.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1032,6 +1032,10 @@ def plot2D(self,data1,data2,tmpl,gm,vtk_backend_grid=None,vtk_backend_geo=None):
10321032
mapper.SetScalarModeToUseCellData()
10331033
mappers.append([mapper,])
10341034
else:
1035+
if isinstance(gm,vcs.meshfill.Gfm):
1036+
doCellPointForScalar = True
1037+
else:
1038+
doCellPointForScalar = False
10351039
for j,color in enumerate(COLS[i]):
10361040
mapper = vtk.vtkPolyDataMapper()
10371041
lut = vtk.vtkLookupTable()
@@ -1047,7 +1051,7 @@ def plot2D(self,data1,data2,tmpl,gm,vtk_backend_grid=None,vtk_backend_geo=None):
10471051
lut.SetTableValue(0,r/100.,g/100.,b/100.)
10481052
mapper.SetLookupTable(lut)
10491053
mapper.SetScalarRange(l[j],l[j+1])
1050-
luts.append([lut,[l[j],l[j+1],False]])
1054+
luts.append([lut,[l[j],l[j+1],doCellPointForScalar]])
10511055
## Store the mapper only if it's worth it?
10521056
## Need to do it with the whole slab min/max for animation purposes
10531057
if not(l[j+1]<wmn or l[j]>wmx):

Packages/vcs/Lib/editors/marker.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -202,10 +202,6 @@ def detach(self):
202202
self.tooltip.detach()
203203

204204
def delete(self):
205-
del self.marker.x[self.index]
206-
del self.marker.y[self.index]
207-
del self.marker.type[self.index]
208-
del self.marker.color[self.index]
209205
self.actor.SetVisibility(0)
210206
self.configurator.deactivate(self)
211207

Packages/vcs/Lib/vtk_ui/manager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ def add_widget(self, widget):
103103
def remove_widget(self, widget):
104104
if widget in self.widgets:
105105
self.widgets.remove(widget)
106-
del widget.manager
106+
widget.manager = None
107107
if len(self.widgets) == 0:
108108
del ui_managers[self.interactor]
109109
self.detach()

Packages/vcs/Lib/vtk_ui/text.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,8 @@ def place(self):
354354
pass
355355

356356
def render(self):
357-
self.manager.queue_render()
357+
if self.manager:
358+
self.manager.queue_render()
358359

359360
def in_bounds(self, x, y):
360361
if x < 1 and y < 1:

Packages/vcs/Lib/vtk_ui/textbox.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -374,8 +374,10 @@ def stop_editing(self):
374374
self.cursor.hide()
375375
if self.blank:
376376
self.text = ""
377-
self.on_editing_end(self)
378-
self.text = " "
377+
if self.on_editing_end:
378+
self.on_editing_end(self)
379+
if self.blank:
380+
self.text = " "
379381

380382
def place(self):
381383
super(Textbox, self).place()

Packages/vcs/Lib/vtk_ui/widget.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ def __init__(self, interactor, widget):
77
self.widget = widget
88
self.widget.SetInteractor(interactor)
99
self.repr = widget.GetRepresentation()
10+
# By default, VTK will map the 'i' key to activating a widget.
11+
# This was doing weird things and making buttons disappear.
12+
self.widget.SetKeyPressActivation(False)
1013
self.subscriptions = {}
1114
self.manager = get_manager(interactor)
1215
self.manager.add_widget(self)
@@ -98,6 +101,9 @@ def GetRenderer(self):
98101
def GetCurrentRenderer(self):
99102
return self._ren
100103

104+
def SetKeyPressActivation(self, value):
105+
pass
106+
101107
def SetCurrentRenderer(self, renderer):
102108
"""
103109
The main cause of all this hubbub; need to use the actor_renderer.

testing/vcs/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -581,6 +581,11 @@ cdat_add_test(vcs_test_taylor_2_quads
581581
${BASELINE_DIR}/test_vcs_issue_960_labels_1.png
582582
${BASELINE_DIR}/test_vcs_issue_960_labels_2.png
583583
)
584+
cdat_add_test(vcs_test_animate_meshfill
585+
"${PYTHON_EXECUTABLE}"
586+
${cdat_SOURCE_DIR}/testing/vcs/test_animate_meshfill.py
587+
${BASELINE_DIR}
588+
)
584589
cdat_add_test(vcs_test_animate_isofill
585590
"${PYTHON_EXECUTABLE}"
586591
${cdat_SOURCE_DIR}/testing/vcs/test_animate_isofill.py
@@ -636,3 +641,4 @@ cdat_add_test(vcs_test_colorpicker_appearance
636641
${BASELINE_DIR}/test_vcs_colorpicker_appearance.png
637642
)
638643
add_subdirectory(vtk_ui)
644+
add_subdirectory(editors)

testing/vcs/editors/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
set(BASELINE_DIR "${UVCDAT_GIT_TESTDATA_DIR}/baselines/vcs/editors")
2+
set(TEST_DIR "${cdat_SOURCE_DIR}/testing/vcs/editors")
3+
4+
cdat_add_test(vcs_test_editor_marker_delete
5+
"${PYTHON_EXECUTABLE}"
6+
${TEST_DIR}/test_vcs_editor_marker_delete.py
7+
)
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
import vcs
2+
import sys
3+
4+
x = vcs.init()
5+
x.open()
6+
7+
m = x.createmarker()
8+
m.x = .1,
9+
m.y = .1,
10+
11+
# enable the configurator
12+
x.configure()
13+
14+
# plot in the background
15+
dp = x.plot(m)
16+
17+
# Grab the initialized configurator
18+
c = x.configurator
19+
20+
# Make sure the displays are current
21+
c.update()
22+
23+
w, h = x.bgX, x.bgY
24+
25+
# Retrieve the actor at the specified point
26+
c.interactor.SetEventInformation(int(.1 * w), int(.1 * h))
27+
c.click(None, None)
28+
c.release(None, None)
29+
30+
# Make sure we've got the correct editor
31+
editor = c.target
32+
if editor is None:
33+
print "Did not activate an editor"
34+
sys.exit(1)
35+
print "Editor activated"
36+
if type(editor) != vcs.editors.marker.MarkerEditor:
37+
print "Did not activate a marker editor"
38+
sys.exit(1)
39+
print "Editor is a marker editor"
40+
if editor.marker != m:
41+
print "Did not activate the correct marker editor, expected", m.name, "received", editor.marker.name
42+
sys.exit(1)
43+
print "Marker editor is editing the correct marker"
44+
45+
# Simulate a right click on the marker
46+
editor.right_release()
47+
48+
# Make sure the editor has been deactivated
49+
if c.target == editor:
50+
print "Did not deactivate editor"
51+
sys.exit(1)
52+
print "Marker editor deactivated"
53+
# Make sure the marker was deleted
54+
if len(m.x) != len(m.y) != len(m.type) != len(m.color) != 0:
55+
print "Did not delete all attributes on marker"
56+
sys.exit(1)
57+
print "Deleted all attributes on marker"

0 commit comments

Comments
 (0)