Skip to content

Commit

Permalink
update mayavi call; leave choice of QT_API to user; use vtk
Browse files Browse the repository at this point in the history
  • Loading branch information
MuellerSeb committed Aug 22, 2019
1 parent 12f05d6 commit 33398ad
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
11 changes: 6 additions & 5 deletions ogs5py/fileclasses/msh/viewer.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
# -*- coding: utf-8 -*-
"""Viewer for an ogs5py mesh."""
from __future__ import division, print_function, absolute_import
import os

# import os
import tempfile
import numpy as np
from ogs5py.fileclasses.msh.msh_io import export_mesh

os.environ["QT_API"] = "pyqt"
os.environ["ETS_TOOLKIT"] = "qt4"
# os.environ["QT_API"] = "pyqt"
# os.environ["ETS_TOOLKIT"] = "qt4"

MAYA_AVAIL = True
try:
Expand Down Expand Up @@ -68,7 +69,7 @@ def show_mesh(
# stop if mayavi is not installed
if not MAYA_AVAIL:
print("Could not import 'mayavi'!")
return
return None

if show_cell_data is not None:
if not isinstance(show_cell_data, dict):
Expand All @@ -79,7 +80,7 @@ def show_mesh(
# new mayavi scenes
mlab.figure()
# create a temp-file which contains a vtk version of the mesh
vtkfile = tempfile.NamedTemporaryFile(suffix=".vtu")
vtkfile = tempfile.NamedTemporaryFile(suffix=".vtk")
# export the mesh to the temp vtk file
export_mesh(
vtkfile.name,
Expand Down
8 changes: 4 additions & 4 deletions ogs5py/tools/vtk_viewer.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# -*- coding: utf-8 -*-
"""Viewer for a vtk file."""
from __future__ import division, print_function, absolute_import
import os

os.environ["QT_API"] = "pyqt"
os.environ["ETS_TOOLKIT"] = "qt4"
# import os
# os.environ["QT_API"] = "pyqt"
# os.environ["ETS_TOOLKIT"] = "qt4"

MAYA_AVAIL = True
try:
Expand Down Expand Up @@ -33,7 +33,7 @@ def show_vtk(vtkfile, log_scale=False):
# stop if mayavi is not installed
if not MAYA_AVAIL:
print("Could not import 'mayavi'!")
return
return None
# new mayavi scenes
mlab.figure()
# load the vtk file to mayavi's mlab
Expand Down

0 comments on commit 33398ad

Please sign in to comment.