示例#1
0
 def testInstantiate(self):
     from pyphant.core.WorkerRegistry import WorkerRegistry
     wreg = WorkerRegistry.getInstance()
     workerInfos = [t for t in wreg.getToolBoxInfoList() \
                    if t.name == 'OSC'][0].workerInfos
     for wInfo in workerInfos:
         wInfo.createWorker()
示例#2
0
 def testInstantiate(self):
     from pyphant.core.WorkerRegistry import WorkerRegistry
     wreg = WorkerRegistry.getInstance()
     workerInfos = [t for t in wreg.getToolBoxInfoList() \
                    if t.name == 'tools'][0].workerInfos
     for wInfo in workerInfos:
         wInfo.createWorker()
示例#3
0
 def testInstantiate(self):
     from pyphant.core.WorkerRegistry import WorkerRegistry
     wreg = WorkerRegistry.getInstance()
     workerInfos = [t for t in wreg.getToolBoxInfoList() \
                    if t.name == 'Statistics'][0].workerInfos
     self.assertTrue(len(workerInfos) > 0)
     for wInfo in workerInfos:
         wInfo.createWorker()
示例#4
0
 def testInstantiate(self):
     from pyphant.core.WorkerRegistry import WorkerRegistry
     wreg = WorkerRegistry.getInstance()
     workerInfos = [t for t in wreg.getToolBoxInfoList() \
                    if t.name == 'Statistics'][0].workerInfos
     self.assertTrue(len(workerInfos) > 0)
     for wInfo in workerInfos:
         wInfo.createWorker()
示例#5
0
 def __init__(self, *args, **kargs):
     wx.TreeCtrl.__init__(self, *args, **kargs)
     tBIL = WorkerRegistry.getInstance().getToolBoxInfoList()
     rootId = self.AddRoot('toolboxes')
     for tBI in tBIL:
         toolBoxId = self.AppendItem(rootId, tBI.name)
         for workerInfo in tBI.workerInfos:
             wIId = self.AppendItem(toolBoxId, workerInfo.name)
             self.SetItemData(wIId, wx.TreeItemData(workerInfo))
     self.Bind(wx.EVT_TREE_BEGIN_DRAG, self.onDragInit, id=self.GetId())
示例#6
0
 def __init__(self, *args, **kargs):
     wx.TreeCtrl.__init__(self, *args, **kargs)
     tBIL = WorkerRegistry.getInstance().getToolBoxInfoList()
     rootId = self.AddRoot('toolboxes')
     for tBI in tBIL:
         toolBoxId = self.AppendItem(rootId, tBI.name)
         for workerInfo in tBI.workerInfos:
             wIId = self.AppendItem(toolBoxId, workerInfo.name)
             self.SetItemData(wIId, wx.TreeItemData(workerInfo))
     self.Bind(wx.EVT_TREE_BEGIN_DRAG,
               self.onDragInit, id=self.GetId())
示例#7
0
 def testSaveLoadRecipe(self):
     from pyphant.core.CompositeWorker import CompositeWorker
     from pyphant.core.WorkerRegistry import WorkerRegistry
     from itertools import chain
     recipe = CompositeWorker(annotations={'foo': 42.0, 'bar': u'Hääh?'})
     wreg = WorkerRegistry.getInstance()
     workerInfos = [t.workerInfos for t in wreg.getToolBoxInfoList()]
     for wInfo in chain(*workerInfos):
         worker = wInfo.createWorker()
         recipe.addWorker(worker)
     with H5FH(self.path, 'w') as handler:
         handler.saveRecipe(recipe)
     with H5FH(self.path, 'r') as handler:
         loadedRecipe = handler.loadRecipe()
     loadedWorkers = loadedRecipe.getWorkers()
     workers = recipe.getWorkers()
     self.assertEqual(len(loadedWorkers), len(workers))
     workerNames = [w.name for w in workers]
     loadedWorkerNames = [w.name for w in loadedWorkers]
     for name in loadedWorkerNames:
         self.assertTrue(name in workerNames)
     self.assertEqual(recipe._annotations, loadedRecipe._annotations)
示例#8
0
 def testSaveLoadRecipe(self):
     from pyphant.core.CompositeWorker import CompositeWorker
     from pyphant.core.WorkerRegistry import WorkerRegistry
     from itertools import chain
     recipe = CompositeWorker(annotations={'foo':42.0, 'bar':u'Hääh?'})
     wreg = WorkerRegistry.getInstance()
     workerInfos = [t.workerInfos for t in wreg.getToolBoxInfoList()]
     for wInfo in chain(*workerInfos):
         worker = wInfo.createWorker()
         recipe.addWorker(worker)
     with H5FH(self.path, 'w') as handler:
         handler.saveRecipe(recipe)
     with H5FH(self.path, 'r') as handler:
         loadedRecipe = handler.loadRecipe()
     loadedWorkers = loadedRecipe.getWorkers()
     workers = recipe.getWorkers()
     self.assertEqual(len(loadedWorkers), len(workers))
     workerNames = [w.name for w in workers]
     loadedWorkerNames = [w.name for w in loadedWorkers]
     for name in loadedWorkerNames:
         self.assertTrue(name in workerNames)
     self.assertEqual(recipe._annotations, loadedRecipe._annotations)