本文整理汇总了Python中Canvas.setScene方法的典型用法代码示例。如果您正苦于以下问题:Python Canvas.setScene方法的具体用法?Python Canvas.setScene怎么用?Python Canvas.setScene使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Canvas
的用法示例。
在下文中一共展示了Canvas.setScene方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: MainWindow
# 需要导入模块: import Canvas [as 别名]
# 或者: from Canvas import setScene [as 别名]
#.........这里部分代码省略.........
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()
return True
def sendFile(self):
"""
Start a process to select and send a file to the server.
"""
if not self.server or self.server.poll() != None:
self.log.append("Please start the server first!")
return
if not self.client or not self.client.isConnected():
self.startClient()
filename = self.loadFile("All Files (*.*)")
if not filename:
return
self.sendWindow.setFilename(filename)
self.sendWindow.show()
def newScene(self):
"""
Close the current topology and create a new one.