当前位置: 首页>>代码示例>>Python>>正文


Python QVTKRenderWindowInteractor.hide方法代码示例

本文整理汇总了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())
#.........这里部分代码省略.........
开发者ID:sampsonbryce,项目名称:cdatgui,代码行数:103,代码来源:vtk_classes.py


注:本文中的vtk.qt4.QVTKRenderWindowInteractor.QVTKRenderWindowInteractor.hide方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。