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


Python Canvas.scene方法代码示例

本文整理汇总了Python中Canvas.scene方法的典型用法代码示例。如果您正苦于以下问题:Python Canvas.scene方法的具体用法?Python Canvas.scene怎么用?Python Canvas.scene使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Canvas的用法示例。


在下文中一共展示了Canvas.scene方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: MainWindow

# 需要导入模块: import Canvas [as 别名]
# 或者: from Canvas import scene [as 别名]

#.........这里部分代码省略.........
            dock.setFeatures(dock.NoDockWidgetFeatures)

    def unlockDocks(self):
        """
        Unlock the dock windows.
        """
        self.tm.show()
        for dock in self.docks.values():
            dock.setFeatures(dock.DockWidgetClosable | dock.DockWidgetMovable | dock.DockWidgetFloatable)
                             
    def faq(self):
        """
        Open the FAQ in the default browser.
        """
        olddir = os.getcwd()
        os.chdir(environ["doc"])
        loadpath = os.getcwd()
        os.chdir(olddir)

        if environ["os"] == "Windows":
            url = QtCore.QUrl("file:///" + loadpath + "/FAQ.html")
        else:
            url = QtCore.QUrl("file://" + loadpath + "/FAQ.html")
        QtGui.QDesktopServices.openUrl(url)

    def closeTopology(self):
        """
        Close the current topology.
        """
        if self.running:
            self.log.append("You cannot close a topology when one is still running!")
            return False

        scene = self.canvas.scene()
        if scene and scene.items():
            reply = QtGui.QMessageBox.warning(self, self.tr(Core.globals.PROG_NAME), self.tr("Save before closing?"), QtGui.QMessageBox.Yes | QtGui.QMessageBox.No | QtGui.QMessageBox.Cancel)
            if reply == QtGui.QMessageBox.Yes:
                if not self.saveTopology():
                    return False
            elif reply == QtGui.QMessageBox.No:
                pass
            else:
                return False
        
        if isinstance(mainWidgets["canvas"], Tutorial):
            self.canvas = Canvas(self)
            mainWidgets["canvas"] = self.canvas
            self.tabWidget.removeTab(0)
            self.tabWidget.addTab(self.canvas, "Default Project")
            self.project = ""
            self.unlockDocks()
                
        self.filename = ""
        scene = Scene(self.canvas)
        scene.setItemIndexMethod(QtGui.QGraphicsScene.NoIndex)
        self.canvas.setScene(scene)
        self.expansions = 0
        
        for nodeType in nodeTypes.keys():
            itemTypes = nodeTypes[nodeType]
            itemTypes[nodeType] = 0

        self.properties.clear()
        self.interfaces.clear()
        self.routes.clear()
        
开发者ID:aallai,项目名称:gini,代码行数:69,代码来源:MainWindow.py


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