本文整理汇总了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()