本文整理汇总了Python中harpia.model.plugin.Plugin.id方法的典型用法代码示例。如果您正苦于以下问题:Python Plugin.id方法的具体用法?Python Plugin.id怎么用?Python Plugin.id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类harpia.model.plugin.Plugin
的用法示例。
在下文中一共展示了Plugin.id方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: paste
# 需要导入模块: from harpia.model.plugin import Plugin [as 别名]
# 或者: from harpia.model.plugin.Plugin import id [as 别名]
def paste(self):
"""
This method paste a block.
"""
replace = {}
self.current_widgets = []
# interact into blocks, add blocks and change their id
clipboard = self.main_window.main_control.get_clipboard()
for widget in clipboard:
if not isinstance(widget, Block):
continue
plugin = Plugin(widget)
plugin.x += 20
plugin.y += 20
plugin.id = -1
if not self.main_window.main_control.add_block(plugin):
return
replace[widget.id] = plugin
self.current_widgets.append(plugin)
# interact into connections changing block ids
for widget in clipboard:
if not isinstance(widget, Connector):
continue
# if a connector is copied without blocks
if widget.source.id not in replace or widget.sink.id \
not in replace:
continue
print _("continuing...")
source = replace[widget.source.id]
source_port = widget.source_port
sink = replace[widget.sink.id]
sink_port = widget.sink_port
self.start_connection(source, source_port)
self.current_widgets.append(self.curr_connector)
self.end_connection(sink, sink_port)
self.update_flows()