def __init__(self): self.workflow = Workflow() self.workfloweditor = WorkflowEditor( self.workflow, callback_slot=self.showResult, except_slot=lambda *_: self.workflow._pretty_print()) self.ensemble_model = EnsembleModel() data_selector_view = DataSelectorView() data_selector_view.setModel(self.ensemble_model) # Our results views' model (should only contain intents) intents_model = IntentsModel() intents_model.setSourceModel(self.ensemble_model) # Our results view widget container results_view = StackedCanvasView() results_view.setModel(intents_model) self.stages = { 'Testing': GUILayout(results_view, left=None, righttop=data_selector_view, right=self.workfloweditor), } super(WorkflowEditorPlugin, self).__init__()
def test_workflow_selector(simple_workflow: Workflow, custom_parameter_workflow: Workflow, square_op, qtbot): workflow_editor = WorkflowEditor(simple_workflow, workflows={ simple_workflow: 'Simple', custom_parameter_workflow: "Custom" }) simple_workflow.add_operation(square_op.clone()) workflow_editor.show() qtbot.addWidget(workflow_editor)
def custom_parameter_workflow(qfit): from xicam.core.execution.workflow import Workflow from xicam.core.execution.daskexecutor import DaskExecutor from xicam.plugins import manager manager.collect_plugins() executor = DaskExecutor() wf = Workflow() qfit = qfit() wf.add_operation(qfit) return wf
def __init__(self, *args, **kwargs): super(EnsembleGUIPlugin, self).__init__(*args, **kwargs) self._projectors = [] # List[Callable[[BlueskyRun], List[Intent]]] self.ensemble_model = EnsembleModel() self.intents_model = IntentsModel() self.intents_model.setSourceModel(self.ensemble_model) self.ensemble_view = DataSelectorView() self.ensemble_view.setModel(self.ensemble_model) self.canvases_view = StackedCanvasView() self.canvases_view.setModel(self.intents_model) self.canvases_view.sigInteractiveAction.connect(self.process_action) self.workflow_editor = WorkflowEditor(Workflow()) self.xi_help = HelpWidget() self.gui_layout_template = { "center": self.canvases_view, "right": self.ensemble_view, "rightbottom": self.workflow_editor, "leftbottom": self.xi_help }
def test_menu(qtbot): workflow_editor = WorkflowEditor(Workflow()) workflow_editor.show() qtbot.addWidget(workflow_editor) manager.qt_is_safe = True manager.initialize_types() manager.collect_plugins() qtbot.wait(10000)
class WorkflowEditorPlugin(GUIPlugin): name = 'WorkflowEditor' def __init__(self): self.workflow = Workflow() self.workfloweditor = WorkflowEditor( self.workflow, callback_slot=self.showResult, except_slot=lambda *_: self.workflow._pretty_print()) self.ensemble_model = EnsembleModel() data_selector_view = DataSelectorView() data_selector_view.setModel(self.ensemble_model) # Our results views' model (should only contain intents) intents_model = IntentsModel() intents_model.setSourceModel(self.ensemble_model) # Our results view widget container results_view = StackedCanvasView() results_view.setModel(intents_model) self.stages = { 'Testing': GUILayout(results_view, left=None, righttop=data_selector_view, right=self.workfloweditor), } super(WorkflowEditorPlugin, self).__init__() def showResult(self, *result): print('result:', result) ensemble = Ensemble() doc_generator = ingest_result_set(self.workflow, result) #### TODO: replace with Dan's push-based documents = list(doc_generator) catalog = BlueskyInMemoryCatalog() # TODO -- change upsert signature to put start and stop as kwargs # TODO -- ask about more convenient way to get a BlueskyRun from a document generator catalog.upsert(documents[0][1], documents[-1][1], ingest_result_set, [self.workflow, result], {}) catalog = catalog[-1] #### ensemble.append_catalog(catalog) self.ensemble_model.add_ensemble(ensemble, [project_intents])
def __init__(self): super(MapStage, self).__init__() self.canvases_view = StackedCanvasView() self.canvases_view.setModel(self.intents_model) self.preprocess_workflow = Workflow() self.preprocess_editor = WorkflowEditor( self.preprocess_workflow, callback_slot=self.append_result, # finished_slot=self.append_result, kwargs_callable=self.treatment_kwargs) self.stages["Map"] = GUILayout(self.catalog_viewer, right=self.preprocess_editor, bottom=self.canvases_view, righttop=self.data_selector_view)
def __init__(self, headermodel: QStandardItemModel, selectionmodel: QItemSelectionModel): super(CalibrationPanel, self).__init__() self.selectionmodel = selectionmodel self.headermodel = headermodel self.header().close() calibrants = dict( zip(calibrant.ALL_CALIBRANTS.keys(), calibrant.ALL_CALIBRANTS.values())) self.device = pTypes.ListParameter(name='Device', type='list', values=[], value='') self.calibrant = pTypes.ListParameter(name='Calibrant Material', values=calibrants, value=calibrants['AgBh']) self.autoCalibrateMethod = pTypes.ListParameter( name='Algorithm', values=self.algorithms.keys()) self.autoCalibrateAction = pTypes.ActionParameter( name='Auto Calibrate') self.autoCalibrateAction.sigActivated.connect(self.calibrate) self.calibratetext = pTypes.TextParameter(name='Instructions', value='', readonly=True, visible=False) self.parameter = pTypes.GroupParameter(name='Calibration', children=[ self.device, self.calibrant, self.autoCalibrateMethod, self.autoCalibrateAction, self.autoCalibrateAction, self.calibratetext ]) self.setParameters(self.parameter, showTop=False) from xicam.core.execution import Workflow self.workflow = Workflow()
def test_simple(simple_workflow: Workflow, square_op, qtbot): workflow_editor = WorkflowEditor(simple_workflow) simple_workflow.add_operation(square_op.clone()) workflow_editor.show() qtbot.addWidget(workflow_editor)
def simple_workflow(square_op, sum_op): from xicam.core.execution.workflow import Workflow from xicam.core.execution.daskexecutor import DaskExecutor executor = DaskExecutor() wf = Workflow() square = square_op() square2 = square_op() square2.filled_values['a'] = 2 my_sum = sum_op() wf.add_operation(square) wf.add_operation(square2) wf.add_operation(my_sum) wf.add_link(square, my_sum, 'square', 'a') wf.add_link(square2, my_sum, 'square', 'b') return wf