本文整理汇总了Python中openalea.core.pkgmanager.PackageManager.find_and_register_packages方法的典型用法代码示例。如果您正苦于以下问题:Python PackageManager.find_and_register_packages方法的具体用法?Python PackageManager.find_and_register_packages怎么用?Python PackageManager.find_and_register_packages使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类openalea.core.pkgmanager.PackageManager
的用法示例。
在下文中一共展示了PackageManager.find_and_register_packages方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_category
# 需要导入模块: from openalea.core.pkgmanager import PackageManager [as 别名]
# 或者: from openalea.core.pkgmanager.PackageManager import find_and_register_packages [as 别名]
def test_category():
pkgman = PackageManager()
pkgman.init()
pkgman.find_and_register_packages()
# test if factory are dedoubled
for cat in pkgman.category.values():
s = set()
for factory in cat:
assert not factory in s
s.add(factory)
示例2: Session
# 需要导入模块: from openalea.core.pkgmanager import PackageManager [as 别名]
# 或者: from openalea.core.pkgmanager.PackageManager import find_and_register_packages [as 别名]
class Session(Observed):
"""
A session is composed by different workspaces, and an user package.
A workspace is an open node
A session can be saved on disk.
"""
USR_PKG_NAME = "__my package__"
def __init__(self):
Observed.__init__(self)
self.workspaces = []
self.cworkspace = -1 # current workspace
self.graphViews = weakref.WeakKeyDictionary()
self.datapool = DataPool()
# Use dictionary
self.use_by_name = {}
self.use_by_interface = {}
self.pkgmanager = PackageManager()
self.empty_cnode_factory = CompositeNodeFactory("Workspace")
self.clipboard = CompositeNodeFactory("Clipboard")
self.init()
# gengraph
def simulate_workspace_addition(self):
for ws in self.workspaces:
self.notify_listeners(("workspace_added", ws))
#/gengraph
def get_current_workspace(self, ):
""" Return the current workspace object """
return self.workspaces[self.cworkspace]
ws = property(get_current_workspace)
def get_graph_views(self):
return self.graphViews.keys()
def add_graph_view(self, view):
self.graphViews[view] = None
def add_workspace(self, compositenode=None, notify=True):
"""
Open a new workspace in the session
if compositenode = None, create a new empty compositenode
"""
if compositenode is None:
compositenode = self.empty_cnode_factory.instantiate()
compositenode.set_caption("")
self.workspaces.append(compositenode)
elif(compositenode not in self.workspaces):
self.workspaces.append(compositenode)
else:
return compositenode
if(notify):
self.notify_listeners(("workspace_added", compositenode))
return compositenode
def close_workspace(self, index, notify=True):
""" Close workspace at index """
del self.workspaces[index]
if(notify):
self.notify_listeners()
def init(self, create_workspace=True):
""" Init the Session """
self.session_filename = None
#self.workspaces = []
# init pkgmanager
self.pkgmanager.find_and_register_packages()
# Create user package if needed
if (not self.pkgmanager.has_key(self.USR_PKG_NAME)):
try:
self.pkgmanager.create_user_package(self.USR_PKG_NAME, {})
except:
pass
if (create_workspace):
self.add_workspace()
self.cworkspace = 0
load_interfaces()
self.notify_listeners()
def clear(self, create_workspace=True):
#.........这里部分代码省略.........