本文整理汇总了Python中Canvas.setAcceptDrops方法的典型用法代码示例。如果您正苦于以下问题:Python Canvas.setAcceptDrops方法的具体用法?Python Canvas.setAcceptDrops怎么用?Python Canvas.setAcceptDrops使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Canvas
的用法示例。
在下文中一共展示了Canvas.setAcceptDrops方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: MainWindow
# 需要导入模块: import Canvas [as 别名]
# 或者: from Canvas import setAcceptDrops [as 别名]
#.........这里部分代码省略.........
scene = self.canvas.scene()
items = scene.items()
if items:
if self.recovery:
self.recovery = False
elif options["autocompile"] and not self.compile():
return
else:
self.log.append("Please create or load a topology first!")
return
options["elasticMode"] = False
xmlFile = self.filename.replace(".gsav", ".xml")
if not os.access(xmlFile, os.F_OK):
self.log.append("Please compile the topology first!")
return
self.tm.show()
#self.progressBar.setValue(0)
self.client.process("file . " + xmlFile)
self.client.send("init " + self.project.split("/")[-1].strip(".gproj"))
self.client.send("canvas %d,%d" % (scene.width(), scene.height()))
for item in items:
if item.type == "Mobile" or item.type == "Wireless_access_point":
x = item.pos().x()
y = item.pos().y()
self.client.send("mobile %s %d,%d" % (item.getName(), x, y))
self.client.process("start " + xmlFile)
self.running = True
self.canvas.setAcceptDrops(False)
scene = self.canvas.scene()
scene.startRefresh()
scene.clearSelection()
self.properties.clear()
self.interfaces.clear()
self.routes.clear()
def stop(self):
"""
Stop the current running topology.
"""
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()
if self.recovery:
self.recovery = False
scene = self.canvas.scene()
activeDevices = False
from Core.Device import Device
for item in scene.items():
if not isinstance(item, Device):
continue
if item.type == "Router":
item.stop()
if item.status:
activeDevices = True