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()
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()
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()
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())
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)
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)