Skip to content

Commit 21e26d0

Browse files
committed
Merge pull request #1456 from UV-CDAT/bugfixes
Bugfixes
2 parents 71d32dd + 9b27735 commit 21e26d0

File tree

14 files changed

+198
-113
lines changed

14 files changed

+198
-113
lines changed

CMake/cdat_modules/vtk_external.cmake

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,53 @@ set(vtk_install "${cdat_EXTERNALS}")
44

55
set(GIT_CMD_STR GIT_REPOSITORY "${VTK_SOURCE}")
66

7-
set(_vtk_modules "vtkRenderingImage;vtkRenderingVolume;vtkRenderingLabel;vtkRenderingFreeType;vtkRenderingFreeTypeOpenGL;vtkRenderingVolumeOpenGL;vtkRenderingCore;vtkRenderingOpenGL;vtkGeovisCore;vtkViewsCore;vtkViewsGeovis;vtkInteractionImage;vtkInteractionStyle;vtkInteractionWidgets;vtkCommonTransforms;vtkCommonCore;vtkCommonComputationalGeometry;vtkCommonExecutionModel;vtkCommonSystem;vtkCommonMisc;vtkFiltersFlowPaths;vtkFiltersStatistics;vtkFiltersAMR;vtkFiltersGeneric;vtkFiltersSources;vtkFiltersModeling;vtkFiltersExtraction;vtkFiltersSelection;vtkFiltersSMP;vtkFiltersCore;vtkFiltersHybrid;vtkFiltersTexture;vtkFiltersGeneral;vtkFiltersImaging;vtkFiltersGeometry;vtkIOImage;vtkIOCore;vtkIOExport;vtkIOImport;vtkIOGeometry;vtkImagingColor;vtkImagingSources;vtkImagingCore;vtkImagingGeneral;vtkImagingMath")
7+
set(_vtk_modules
8+
vtkRenderingImage
9+
vtkRenderingVolume
10+
vtkRenderingLabel
11+
vtkRenderingFreeType
12+
vtkRenderingFreeTypeOpenGL
13+
vtkRenderingVolumeOpenGL
14+
vtkRenderingCore
15+
vtkRenderingOpenGL
16+
vtkGeovisCore
17+
vtkViewsCore
18+
vtkViewsGeovis
19+
vtkInteractionImage
20+
vtkInteractionStyle
21+
vtkInteractionWidgets
22+
vtkCommonTransforms
23+
vtkCommonCore
24+
vtkCommonComputationalGeometry
25+
vtkCommonExecutionModel
26+
vtkCommonSystem
27+
vtkCommonMisc
28+
vtkFiltersFlowPaths
29+
vtkFiltersStatistics
30+
vtkFiltersAMR
31+
vtkFiltersGeneric
32+
vtkFiltersSources
33+
vtkFiltersModeling
34+
vtkFiltersExtraction
35+
vtkFiltersSelection
36+
vtkFiltersSMP
37+
vtkFiltersCore
38+
vtkFiltersHybrid
39+
vtkFiltersTexture
40+
vtkFiltersGeneral
41+
vtkFiltersImaging
42+
vtkFiltersGeometry
43+
vtkIOImage
44+
vtkIOCore
45+
vtkIOExport
46+
vtkIOImport
47+
vtkIOGeometry
48+
vtkImagingColor
49+
vtkImagingSources
50+
vtkImagingCore
51+
vtkImagingGeneral
52+
vtkImagingMath
53+
)
854

955
if(NOT CDAT_BUILD_LEAN)
1056
list(APPEND _vtk_modules "vtkIOFFMPEG")

CMake/cdat_modules_extra/checkout_testdata.cmake

Lines changed: 54 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,12 @@
1919
# If the current HEAD is not a named branch, use master.
2020
# 5) Update the remote branches in the TESTDATA_DIR repo.
2121
# 6) Check if the desired branch exists in TESTDATA_DIR's origin remote.
22-
# If the desired remote branch does not exist, use master.
23-
# 7) Check out the desired branch in TESTDATA_DIR repo.
24-
# 8) Run 'git pull origin <branch>:<branch>' to update the repository.
22+
# 7) Check if the desired branch exists in TESTDATA_DIR as a local branch.
23+
# 8) If the neither the local or remote branch exist, use master.
24+
# 9) Check out the local <branch> in TESTDATA_DIR repo.
25+
# 10) If the remote branch exists, or we are using master, run
26+
# 'git pull origin <branch>:<branch>' to fetch/update the local branch from
27+
# the remote.
2528
#
2629
# Any failures are handled via non-fatal warnings. This is to allow the project
2730
# to build when access to the repo is not available.
@@ -154,37 +157,57 @@ execute_process(COMMAND
154157

155158
if(NOT RESULT EQUAL 0)
156159
message("Cannot update uvcdat-testdata checkout at \"${TESTDATA_DIR}\". "
157-
"Error updating remote branches with 'git fetch --update-shallow --depth=1':\n."
160+
"Error updating remote branches with "
161+
"'git fetch --update-shallow --depth=1':\n."
158162
"${OUTPUT}\n"
159163
"Baseline images may be out of date.")
160164
return()
161165
endif()
162166

163167
# 6) Check if the desired branch exists in TESTDATA_DIR's origin remote.
164-
# If the desired remote branch does not exist, use master.
165168
execute_process(COMMAND
166-
"${GIT_EXECUTABLE}" branch -r
169+
"${GIT_EXECUTABLE}" branch -a --list "*${BRANCH}"
167170
WORKING_DIRECTORY "${TESTDATA_DIR}"
168171
RESULT_VARIABLE RESULT
169172
ERROR_VARIABLE OUTPUT
170173
OUTPUT_VARIABLE OUTPUT)
171174

172175
if(NOT RESULT EQUAL 0)
173176
message("Cannot update uvcdat-testdata checkout at \"${TESTDATA_DIR}\". "
174-
"Error updating remote branches with 'git fetch --update-shallow --depth=1':\n."
175-
"${OUTPUT}\n"
177+
"Error obtaining full branch list:\n${OUTPUT}"
176178
"Baseline images may be out of date.")
177179
return()
178180
endif()
179181

180-
string(FIND "${OUTPUT}" "origin/${BRANCH}" POS)
181-
if(POS EQUAL -1)
182-
message("Remote branch 'origin/${BRANCH}' not found for repository at "
183-
"'${TESTDATA_DIR}'. Using current master instead.")
182+
message("Testing if remote branch 'origin/${BRANCH}' exists...")
183+
string(FIND "${OUTPUT}" " remotes/origin/${BRANCH}\n" POS)
184+
if(NOT POS EQUAL -1)
185+
message("Remote branch exists.")
186+
set(REMOTE_EXISTS "YES")
187+
else()
188+
message("Remote branch does not exist.")
189+
set(REMOTE_EXISTS "NO")
190+
endif()
191+
192+
# 7) Check if the desired branch exists locally:
193+
message("Testing if local branch '${BRANCH}' exists...")
194+
string(FIND "${OUTPUT}" " ${BRANCH}\n" POS) # Leading space in regex intended
195+
if(NOT POS EQUAL -1)
196+
message("Local branch exists.")
197+
set(LOCAL_EXISTS "YES")
198+
else()
199+
message("Local branch does not exist.")
200+
set(LOCAL_EXISTS "NO")
201+
endif()
202+
203+
# 8) If the neither the local or remote branch exist, use master.
204+
if(NOT REMOTE_EXISTS AND NOT LOCAL_EXISTS)
184205
set(BRANCH "master")
206+
set(REMOTE_EXISTS "YES")
207+
set(LOCAL_EXISTS "YES")
185208
endif()
186209

187-
# 7) Check out the desired branch in TESTDATA_DIR repo.
210+
# 9) Check out the desired branch in TESTDATA_DIR repo.
188211
message("Checking out branch '${BRANCH}' in repo '${TESTDATA_DIR}'.")
189212
execute_process(COMMAND
190213
"${GIT_EXECUTABLE}" checkout "${BRANCH}"
@@ -201,21 +224,25 @@ if(NOT RESULT EQUAL 0)
201224
return()
202225
endif()
203226

204-
# 8) Update the branch (in case it already existed during the checkout):
205-
message("Updating \"${TESTDATA_DIR}:${BRANCH}\" from "
206-
"\"${TESTDATA_URL}:${BRANCH}\"...")
207-
execute_process(COMMAND
208-
"${GIT_EXECUTABLE}" pull origin "${BRANCH}:${BRANCH}"
209-
WORKING_DIRECTORY "${TESTDATA_DIR}"
210-
RESULT_VARIABLE RESULT
211-
ERROR_VARIABLE OUTPUT
212-
OUTPUT_VARIABLE OUTPUT)
227+
# 10) If the remote branch exists, or we are using master, run
228+
# 'git pull origin <branch>:<branch>' to fetch/update the local branch from
229+
# the remote.
230+
if(REMOTE_EXISTS)
231+
message("Updating \"${TESTDATA_DIR}:${BRANCH}\" from "
232+
"\"${TESTDATA_URL}:${BRANCH}\"...")
233+
execute_process(COMMAND
234+
"${GIT_EXECUTABLE}" pull origin "${BRANCH}:${BRANCH}"
235+
WORKING_DIRECTORY "${TESTDATA_DIR}"
236+
RESULT_VARIABLE RESULT
237+
ERROR_VARIABLE OUTPUT
238+
OUTPUT_VARIABLE OUTPUT)
213239

214-
string(STRIP "${OUTPUT}" OUTPUT)
240+
string(STRIP "${OUTPUT}" OUTPUT)
215241

216-
message("${OUTPUT}")
242+
message("${OUTPUT}")
217243

218-
if(NOT RESULT EQUAL 0)
219-
message("Error updating testdata repo! "
220-
"Baseline images may be out of date.")
244+
if(NOT RESULT EQUAL 0)
245+
message("Error updating testdata repo! "
246+
"Baseline images may be out of date.")
247+
endif()
221248
endif()

Packages/vcs/Lib/Canvas.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4029,8 +4029,8 @@ def close(self, *args, **kargs):
40294029
"""
40304030
if self.configurator:
40314031
self.endconfigure()
4032-
# Close the VCS Canvas
40334032
a = self.backend.close(*args, **kargs)
4033+
self.animate_info = []
40344034

40354035
return a
40364036

Packages/vcs/Lib/VTKAnimate.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,6 @@ def __init__(self, vcs_self):
158158
self.renderers = []
159159
self.last_size = None
160160
self.modified_listener = None
161-
import atexit
162-
atexit.register(self.close)
163161

164162
def modified(self, obj, event):
165163
# Use this to sync canvas sizes and to prevent configureEvent from

Packages/vcs/Lib/VTKPlots.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,9 @@ def leftButtonReleaseEvent(self, obj, event):
200200
self.clickRenderer = None
201201

202202
def configureEvent(self, obj, ev):
203+
if not self.renWin:
204+
return
205+
203206
cursor = self.renWin.GetCurrentCursor()
204207
if sys.platform == "darwin" and ev == "ModifiedEvent" and cursor != self.oldCursor:
205208
self.oldCursor = cursor

Packages/vcs/Lib/animate_helper.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,7 @@ class AnimationController(animate_obj_old):
764764
def __init__(self, vcs_self):
765765
animate_obj_old.__init__(self, vcs_self)
766766
self.create_thread = None
767+
self.create_canvas = None
767768
self.playback_thread = None
768769

769770
self.animation_created = False
@@ -779,6 +780,13 @@ def __init__(self, vcs_self):
779780
self.AnimationPlayback = AnimationPlayback
780781
self._number_of_frames = None
781782

783+
def close(self, preserve_pngs=False):
784+
if self.create_canvas:
785+
self.create_canvas.close()
786+
self.create_canvas = None
787+
self.animate_info = []
788+
return super(AnimationController, self).close(preserve_pngs)
789+
782790
def set_signals(self, signals):
783791
self.signals = signals
784792

Packages/vcs/Lib/vcsvtk/boxfillpipeline.py

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ def _updateScalarData(self):
3131
if self._gm.boxfill_type == "log10":
3232
data = numpy.ma.log10(data)
3333

34-
self._data1 = self._context.trimData2D(data)
35-
self._data2 = self._context.trimData2D(self._originalData2)
34+
self._data1 = self._context().trimData2D(data)
35+
self._data2 = self._context().trimData2D(self._originalData2)
3636

3737
def _updateContourLevelsAndColors(self):
3838
"""Overrides baseclass implementation."""
@@ -174,7 +174,7 @@ def _plotInternal(self):
174174

175175
# create a new renderer for this mapper
176176
# (we need one for each mapper because of camera flips)
177-
self._context.fitToViewport(
177+
self._context().fitToViewport(
178178
act, [self._template.data.x1, self._template.data.x2,
179179
self._template.data.y1, self._template.data.y2],
180180
wc=[x1, x2, y1, y2], geo=self._vtkGeoTransform,
@@ -188,9 +188,9 @@ def _plotInternal(self):
188188
z = self._originalData1.getAxis(-3)
189189
else:
190190
z = None
191-
self._resultDict.update(self._context.renderTemplate(self._template,
192-
self._data1,
193-
self._gm, t, z))
191+
self._resultDict.update(self._context().renderTemplate(self._template,
192+
self._data1,
193+
self._gm, t, z))
194194

195195
if getattr(self._gm, "legend", None) is not None:
196196
self._contourLabels = self._gm.legend
@@ -217,17 +217,18 @@ def _plotInternal(self):
217217
self._contourLevels.append(1.e20)
218218

219219
self._resultDict.update(
220-
self._context.renderColorBar(self._template, self._contourLevels,
221-
self._contourColors,
222-
self._contourLabels,
223-
self._colorMap))
220+
self._context().renderColorBar(self._template, self._contourLevels,
221+
self._contourColors,
222+
self._contourLabels,
223+
self._colorMap))
224224

225-
if self._context.canvas._continents is None:
225+
if self._context().canvas._continents is None:
226226
self._useContinents = False
227227
if self._useContinents:
228228
projection = vcs.elements["projection"][self._gm.projection]
229-
self._context.plotContinents(x1, x2, y1, y2, projection,
230-
self._dataWrapModulo, self._template)
229+
self._context().plotContinents(x1, x2, y1, y2, projection,
230+
self._dataWrapModulo,
231+
self._template)
231232

232233
def _plotInternalBoxfill(self):
233234
"""Implements the logic to render a non-custom boxfill."""
@@ -330,7 +331,6 @@ def _plotInternalCustomBoxfill(self):
330331
tmpColors.append(C)
331332

332333
luts = []
333-
cots = []
334334
geos = []
335335
wholeDataMin, wholeDataMax = vcs.minmax(self._originalData1)
336336
for i, l in enumerate(tmpLevels):
@@ -362,7 +362,5 @@ def _plotInternalCustomBoxfill(self):
362362
self._mappers.append(mapper)
363363

364364
self._resultDict["vtk_backend_luts"] = luts
365-
if len(cots) > 0:
366-
self._resultDict["vtk_backend_contours"] = cots
367365
if len(geos) > 0:
368366
self._resultDict["vtk_backend_geofilters"] = geos

Packages/vcs/Lib/vcsvtk/isofillpipeline.py

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,6 @@ def _plotInternal(self):
133133

134134
luts = []
135135
cots = []
136-
geos = []
137136
mappers = []
138137
for i, l in enumerate(tmpLevels):
139138
# Ok here we are trying to group together levels can be, a join
@@ -164,8 +163,6 @@ def _plotInternal(self):
164163
self._resultDict["vtk_backend_luts"] = luts
165164
if len(cots) > 0:
166165
self._resultDict["vtk_backend_contours"] = cots
167-
if len(geos) > 0:
168-
self._resultDict["vtk_backend_geofilters"] = geos
169166

170167
numLevels = len(self._contourLevels)
171168
if mappers == []: # ok didn't need to have special banded contours
@@ -221,7 +218,7 @@ def _plotInternal(self):
221218

222219
# create a new renderer for this mapper
223220
# (we need one for each mapper because of cmaera flips)
224-
self._context.fitToViewport(
221+
self._context().fitToViewport(
225222
act, [self._template.data.x1, self._template.data.x2,
226223
self._template.data.y1, self._template.data.y2],
227224
wc=[x1, x2, y1, y2], geo=self._vtkGeoTransform,
@@ -236,9 +233,9 @@ def _plotInternal(self):
236233
else:
237234
z = None
238235

239-
self._resultDict.update(self._context.renderTemplate(self._template,
240-
self._data1,
241-
self._gm, t, z))
236+
self._resultDict.update(self._context().renderTemplate(self._template,
237+
self._data1,
238+
self._gm, t, z))
242239

243240
legend = getattr(self._gm, "legend", None)
244241

@@ -263,13 +260,14 @@ def _plotInternal(self):
263260
self._contourLevels.append(1.e20)
264261

265262
self._resultDict.update(
266-
self._context.renderColorBar(self._template, self._contourLevels,
267-
self._contourColors, legend,
268-
self._colorMap))
263+
self._context().renderColorBar(self._template, self._contourLevels,
264+
self._contourColors, legend,
265+
self._colorMap))
269266

270-
if self._context.canvas._continents is None:
267+
if self._context().canvas._continents is None:
271268
self._useContinents = False
272269
if self._useContinents:
273270
projection = vcs.elements["projection"][self._gm.projection]
274-
self._context.plotContinents(x1, x2, y1, y2, projection,
275-
self._dataWrapModulo, self._template)
271+
self._context().plotContinents(x1, x2, y1, y2, projection,
272+
self._dataWrapModulo,
273+
self._template)

0 commit comments

Comments
 (0)