本文整理汇总了Python中vtk.qt4.QVTKRenderWindowInteractor.QVTKRenderWindowInteractor.show方法的典型用法代码示例。如果您正苦于以下问题:Python QVTKRenderWindowInteractor.show方法的具体用法?Python QVTKRenderWindowInteractor.show怎么用?Python QVTKRenderWindowInteractor.show使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vtk.qt4.QVTKRenderWindowInteractor.QVTKRenderWindowInteractor
的用法示例。
在下文中一共展示了QVTKRenderWindowInteractor.show方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ExodusResultRenderWidget
# 需要导入模块: from vtk.qt4.QVTKRenderWindowInteractor import QVTKRenderWindowInteractor [as 别名]
# 或者: from vtk.qt4.QVTKRenderWindowInteractor.QVTKRenderWindowInteractor import show [as 别名]
class ExodusResultRenderWidget(QtGui.QWidget):
def __init__(self, input_file_widget, execution_widget, qt_app, application):
QtGui.QWidget.__init__(self)
self.input_file_widget = input_file_widget
self.qt_app = qt_app
self.application = application
self.plane = vtk.vtkPlane()
self.plane.SetOrigin(-1000, 0, 0)
self.plane.SetNormal(1, 0, 0)
self.exodus_result = None
# The multiple (from adaptivity)
self.exodus_results = []
self.timestep_to_exodus_result = {}
self.file_name = None
self.setupLuts()
# The multiple (from adaptivity) file names we know of
self.file_names = []
self.current_max_timestep = 0
# Whether or not there is new data to read
self.new_stuff_to_read = False
self.timer = QtCore.QTimer()
self.timer.stop()
self.timer.setInterval(100)
self.timer.timeout.connect(self._updateData)
self.execution_widget = execution_widget
self.execution_widget.run_started.connect(self._runStarted)
self.execution_widget.run_stopped.connect(self._runStopped)
self.execution_widget.timestep_begin.connect(self._timestepBegin)
self.execution_widget.timestep_end.connect(self._timestepEnd)
self.main_layout = QtGui.QHBoxLayout()
# self.main_layout.setSpacing(0)
self.right_layout = QtGui.QVBoxLayout()
self.left_layout = QtGui.QVBoxLayout()
self.left_widget = QtGui.QWidget()
self.left_widget.setMaximumWidth(1)
self.left_widget.setLayout(self.left_layout)
self.left_layout.setSizeConstraint(QtGui.QLayout.SetMinimumSize)
self.main_layout.addWidget(self.left_widget)
self.right_layout.setStretchFactor(self.left_layout, 0.01)
self.main_layout.addLayout(self.right_layout)
# self.setMinimumWidth(700)
self.setLayout(self.main_layout)
self.vtkwidget = QVTKRenderWindowInteractor(self)
# self.vtkwidget.setMinimumHeight(300)
# Create background, default to the gradient look
self.renderer = vtk.vtkRenderer()
self._showBlackBackgroundChanged(0)
self.renderer.ResetCamera()
self.right_layout.addWidget(self.vtkwidget)
self.right_layout.setStretchFactor(self.vtkwidget, 100)
self.vtkwidget.show()
self.vtkwidget.GetRenderWindow().AddRenderer(self.renderer)
self.vtkwidget.GetRenderWindow().GetInteractor().SetInteractorStyle(vtk.vtkInteractorStyleTrackballCamera())
self.vtkwidget.Initialize()
self.vtkwidget.Start()
self.first = True
self.exodus_result = None
self.has_displacements = False
self.current_displacement_magnitude = 1.0
self.current_scale_x_magnitude = 1.0
self.current_scale_y_magnitude = 1.0
self.current_scale_z_magnitude = 1.0
self.current_variable = None
self.current_component = None
# Holds a mapping of variable name to contour choices so they can be restored when variables are selected
self.contour_choices = {}
# If we are currently restoring contours then don't save the intermediate ones
self.currently_restoring_contours = False
self.setupControls()
self.modifyUI()
#.........这里部分代码省略.........
示例2: QCDATWidget
# 需要导入模块: from vtk.qt4.QVTKRenderWindowInteractor import QVTKRenderWindowInteractor [as 别名]
# 或者: from vtk.qt4.QVTKRenderWindowInteractor.QVTKRenderWindowInteractor import show [as 别名]
#.........这里部分代码省略.........
plot_vars = plot.manager.variables
if plot_vars is None:
continue
changed = False
new_vars = []
for v in plot_vars:
if v is None:
continue
if v.id == var.id:
changed = True
new_vars.append(var.var)
else:
new_vars.append(v)
if changed:
any_updated = True
plot.variables(new_vars)
if any_updated:
self.update()
def dropEvent(self, event):
dropped = event.source().model().get_dropped(event.mimeData())
target = self.plot_at_point(event.pos())
if cdms_mime in event.mimeData().formats():
event.accept()
target.variables(dropped)
if vcs_template_mime in event.mimeData().formats():
event.accept()
target.template(dropped)
if vcs_gm_mime in event.mimeData().formats():
event.accept()
target.graphics_method(dropped)
self.iren.show()
self.dragTarget.hide()
self.plotAdded.emit()
def dragEnterEvent(self, event):
accepted = set([cdms_mime, vcs_gm_mime, vcs_template_mime])
if set(event.mimeData().formats()) & accepted:
event.accept()
self.dragTarget.resize(self.size())
self.dragTarget.show()
self.iren.hide()
def dragLeaveEvent(self, event=None):
self.iren.show()
self.dragTarget.hide()
def loadPlot(self, dp):
self.plots[-1].load(dp)
def addedPlot(self):
"""Adds a new PlotInfo to the collection whenever one is made"""
new_widget = PlotInfo(lambda: self.canvas, self.row, self.col)
self.dragLayout.addWidget(new_widget)
self.plots.append(new_widget)
new_widget.initialized.connect(self.addedPlot)
new_widget.removed.connect(self.removeWidget)
def removeWidget(self, widget):
self.plots.remove(widget)
self.dragLayout.removeWidget(widget)
widget.deleteLater()
def manageCanvas(self, showing):