def add_operation(self, op_id): # first, find the matching plugin plugin = next((x for x in self.op_plugins if x.id == op_id)) # next, get an operation op = plugin.get_operation() # make a new workflow item wi = WorkflowItem(operation = op, deletable = (op_id != 'edu.mit.synbio.cytoflowgui.op_plugins.import')) # if the op has a default view, add it to the wi try: wi.default_view = op.default_view() wi.views.append(wi.default_view) wi.current_view = wi.default_view except AttributeError: pass # figure out where to add it if self.model.selected: idx = self.model.workflow.index(self.model.selected) + 1 else: idx = len(self.model.workflow) # the add_remove_items handler takes care of updating the linked list self.model.workflow.insert(idx, wi) # and make sure to actually select the new wi self.model.selected = wi
def add_operation(self, op_id): # first, find the matching plugin plugin = next((x for x in self.op_plugins if x.id == op_id)) # default to inserting at the end of the list if none selected after = self.model.selected if after is None: after = self.model.workflow[-1] idx = self.model.workflow.index(after) wi = WorkflowItem(task = self) wi.operation = plugin.get_operation() wi.next = after.next after.next = wi wi.previous = after if wi.next: wi.next.previous = wi self.model.workflow.insert(idx+1, wi) # set up the default view wi.default_view = plugin.get_default_view(wi.operation) if wi.default_view is not None: wi.default_view.handler = \ wi.default_view.handler_factory(model = wi.default_view, wi = wi.previous) wi.views.append(wi.default_view) # select (open) the new workflow item self.model.selected = wi if wi.default_view: wi.current_view = wi.default_view # invalidate everything following self.operation_parameters_updated()
def add_operation(self, operation): # add the new operation after the selected workflow item or at the end # of the workflow if no wi is selected # make a new workflow item wi = WorkflowItem(operation = operation, deletable = (operation.id != "edu.mit.synbio.cytoflow.operations.import")) # they say in Python you should ask for forgiveness instead of permission try: wi.default_view = operation.default_view() wi.views.append(wi.default_view) except AttributeError: pass if self.workflow and self.selected: idx = self.workflow.index(self.selected) + 1 elif self.workflow: idx = len(self.workflow) else: idx = 0 # the add_remove_items handler takes care of updating the linked list self.workflow.insert(idx, wi) # select (open) the new workflow item self.selected = wi if wi.default_view: wi.current_view = wi.default_view
def setUp(self): ImportedDataTest.setUp(self) plugin = ChannelStatisticPlugin() op = plugin.get_operation() op.name = "MeanByDox" op.channel = "Y2-A" op.statistic_name = "Geom.SD" op.by = ['Dox'] wi = WorkflowItem(operation=op) self.workflow.workflow.append(wi) op = plugin.get_operation() op.name = "MeanByDoxAndWell" op.channel = "Y2-A" op.statistic_name = "Geom.SD" op.by = ['Dox', 'Well'] wi = WorkflowItem(operation=op) self.workflow.workflow.append(wi) op = plugin.get_operation() op.name = "MeanByDox" op.channel = "Y2-A" op.statistic_name = "Geom.Mean" op.by = ['Dox'] self.wi = wi = WorkflowItem(operation=op) self.workflow.workflow.append(wi) op = plugin.get_operation() op.name = "MeanByDoxAndWell" op.channel = "Y2-A" op.statistic_name = "Geom.Mean" op.by = ['Dox', 'Well'] self.wi = wi = WorkflowItem(operation=op) self.workflow.workflow.append(wi) self.workflow.selected = wi self.assertTrue(wait_for(wi, 'status', lambda v: v == 'valid', 10)) plugin = TablePlugin() self.view = view = plugin.get_view() view.statistic = ("MeanByDox", "Geom.Mean") view.row_facet = "Dox" self.workflow.remote_exec("self.workflow[-1].view_error = 'waiting'") self.assertTrue( wait_for(self.wi, 'view_error', lambda v: v == "waiting", 30)) wi.views.append(view) wi.current_view = view self.workflow.selected = wi self.assertTrue(wait_for(self.wi, 'view_error', lambda v: v == "", 30))
def activated(self): self.model.backup_workflow = self.model.workflow self.model.workflow = [] self.model.modified = False # add the op self.op = TasbeCalibrationOp() # make a new workflow item wi = WorkflowItem(operation=self.op, deletable=False) wi.default_view = self.op.default_view() wi.views.append(wi.default_view) wi.current_view = wi.default_view self.model.workflow.append(wi) self.model.selected = wi self.help_pane.html = self.op.get_help()
def setUp(self): ImportedDataTest.setUp(self) plugin = ChannelStatisticPlugin() op = plugin.get_operation() op.name = "MeanByDox" op.channel = "Y2-A" op.statistic_name = "Geom.SD" op.by = ['Dox', 'Well'] wi = WorkflowItem(operation=op) self.workflow.workflow.append(wi) op = plugin.get_operation() op.name = "MeanByDox" op.channel = "Y2-A" op.statistic_name = "Geom.Mean" op.by = ['Dox', 'Well'] op.subset_list.append(CategorySubset(name="Well", values=["A", "B"])) self.wi = wi = WorkflowItem(operation=op) self.workflow.workflow.append(wi) self.workflow.selected = wi self.assertTrue(wait_for(wi, 'status', lambda v: v == 'valid', 10)) plugin = Stats1DPlugin() self.view = view = plugin.get_view() view.statistic = ("MeanByDox", "Geom.Mean") view.variable = "Dox" view.huefacet = "Well" self.workflow.remote_exec("self.workflow[-1].view_error = 'waiting'") self.assertTrue( wait_for(self.wi, 'view_error', lambda v: v == "waiting", 5)) wi.views.append(view) wi.current_view = view self.workflow.selected = wi self.assertTrue(wait_for(self.wi, 'view_error', lambda v: v == "", 5))
def add_operation(self, op_id): # first, find the matching plugin plugin = next((x for x in self.op_plugins if x.id == op_id)) # default to inserting at the end of the list if none selected after = self.model.selected if after is None: after = self.model.workflow[-1] idx = self.model.workflow.index(after) wi = WorkflowItem(task=self) wi.operation = plugin.get_operation() wi.next = after.next after.next = wi wi.previous = after if wi.next: wi.next.previous = wi self.model.workflow.insert(idx + 1, wi) # set up the default view wi.default_view = plugin.get_default_view() if wi.default_view is not None: wi.default_view.op = wi.operation wi.default_view.handler = \ wi.default_view.handler_factory(model = wi.default_view, wi = wi.previous) wi.views.append(wi.default_view) # select (open) the new workflow item self.model.selected = wi if wi.default_view: wi.current_view = wi.default_view # invalidate everything following self.operation_parameters_updated()
def setUp(self): super().setUp() plugin = ChannelStatisticPlugin() op = plugin.get_operation() op.name = "MeanByDox" op.channel = "Y2-A" op.statistic_name = "Geom.SD" op.by = ['Dox'] wi = WorkflowItem(operation = op, status = 'waiting', view_error = "Not yet plotted") self.workflow.workflow.append(wi) op = plugin.get_operation() op.name = "MeanByDoxAndWell" op.channel = "Y2-A" op.statistic_name = "Geom.SD" op.by = ['Dox', 'Well'] wi = WorkflowItem(operation = op, status = 'waiting', view_error = "Not yet plotted") self.workflow.workflow.append(wi) op = plugin.get_operation() op.name = "MeanByDox" op.channel = "Y2-A" op.statistic_name = "Geom.Mean" op.by = ['Dox'] wi = WorkflowItem(operation = op, status = 'waiting', view_error = "Not yet plotted") self.workflow.workflow.append(wi) op = plugin.get_operation() op.name = "MeanByDoxAndWell" op.channel = "Y2-A" op.statistic_name = "Geom.Mean" op.by = ['Dox', 'Well'] self.wi = wi = WorkflowItem(operation = op, status = 'waiting', view_error = "Not yet plotted") self.workflow.workflow.append(wi) self.workflow.selected = wi self.workflow.wi_waitfor(wi, 'status', "valid") plugin = TablePlugin() self.view = view = plugin.get_view() view.statistic = ("MeanByDox", "Geom.Mean") view.row_facet = "Dox" self.workflow.wi_sync(self.wi, 'view_error', 'waiting') wi.views.append(view) wi.current_view = view self.workflow.selected = wi self.workflow.wi_waitfor(self.wi, 'view_error', '')