本文整理汇总了Python中vtk.qt4.QVTKRenderWindowInteractor.QVTKRenderWindowInteractor.hide方法的典型用法代码示例。如果您正苦于以下问题:Python QVTKRenderWindowInteractor.hide方法的具体用法?Python QVTKRenderWindowInteractor.hide怎么用?Python QVTKRenderWindowInteractor.hide使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vtk.qt4.QVTKRenderWindowInteractor.QVTKRenderWindowInteractor
的用法示例。
在下文中一共展示了QVTKRenderWindowInteractor.hide方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: QCDATWidget
# 需要导入模块: from vtk.qt4.QVTKRenderWindowInteractor import QVTKRenderWindowInteractor [as 别名]
# 或者: from vtk.qt4.QVTKRenderWindowInteractor.QVTKRenderWindowInteractor import hide [as 别名]
class QCDATWidget(QtGui.QFrame):
# TODO: Add a signal for addedPlots
plotAdded = QtCore.Signal()
visiblityChanged = QtCore.Signal(bool)
setVariables = QtCore.Signal(list)
setGraphicsMethod = QtCore.Signal(object)
setTemplate = QtCore.Signal(object)
emitAllPlots = QtCore.Signal()
save_formats = ["PNG file (*.png)",
"GIF file (*.gif)",
"PDF file (*.pdf)",
"Postscript file (*.ps)",
"SVG file (*.svg)"]
def __init__(self, row, col, parent=None):
super(QCDATWidget, self).__init__(parent=parent)
self.row = row
self.col = col
self.setAcceptDrops(True)
self.mRenWin = vtk.vtkRenderWindow()
self.iren = QVTKRenderWindowInteractor(parent=self, rw=self.mRenWin)
self.canvas = None
self.canvasLayout = QtGui.QVBoxLayout()
self.canvasLayout.addWidget(self.iren)
self.setLayout(self.canvasLayout)
self.becameVisible = partial(self.visiblityChanged.emit, True)
self.becameHidden = partial(self.visiblityChanged.emit, False)
self.setFocusPolicy(QtCore.Qt.StrongFocus)
self.setSizePolicy(QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding,
QtGui.QSizePolicy.Expanding))
self.visiblityChanged.connect(self.manageCanvas)
self.dragTarget = QtGui.QWidget(self)
self.dragTarget.hide()
self.dragLayout = QtGui.QHBoxLayout()
self.dragTarget.setLayout(self.dragLayout)
get_variables().dataChanged.connect(self.variablesChanged)
self.plots = []
# Creates and hooks up the initial PlotInfo widget
self.addedPlot()
# Just need a callable that returns something
self.toolBarType = lambda x: None
def plot_at_point(self, point):
for plot in self.plots:
r = plot.frameGeometry()
if r.contains(point):
return plot
return None
def load(self, displays):
for display in displays:
info = self.plots[-1]
info.load(display)
def dragMoveEvent(self, event):
plot = self.plot_at_point(event.pos())
if plot:
event.accept(plot.rect())
else:
event.ignore()
def variablesChanged(self, start, end):
vars = get_variables()
any_updated = False
for i in range(start.row(), end.row() + 1):
var = vars.get(i)
for plot in self.plots:
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())
#.........这里部分代码省略.........