def _make_child_controller(self, parts, mri): # Add some extra parts to determine the dataset name and type for # any CAPTURE field part new_parts = [] for existing_part in parts: new_parts.append(existing_part) if hasattr(existing_part, "field_name") and \ existing_part.field_name.endswith(".CAPTURE"): # Add capture dataset name and type part_name = existing_part.field_name.replace( ".CAPTURE", ".DATASET_NAME") attr_name = snake_to_camel(part_name.replace(".", "_")) new_parts.append( StringPart( name=attr_name, description="Name of the captured dataset in HDF file", writeable=True)) # Make a choice part to hold the type of the dataset part_name = existing_part.field_name.replace( ".CAPTURE", ".DATASET_TYPE") attr_name = snake_to_camel(part_name.replace(".", "_")) if "INENC" in mri: initial = "position" else: initial = "monitor" new_parts.append( ChoicePart( name=attr_name, description="Type of the captured dataset in HDF file", writeable=True, choices=list(AttributeDatasetType), value=initial)) if mri.endswith("PCAP"): cs, ps = adbase_parts(prefix=self.prefix) controller = StatefulController(mri=mri) for p in new_parts + ps: controller.add_part(p) for c in cs: self.process.add_controller(c) else: controller = super(PandABlocksRunnableController, self).\ _make_child_controller(new_parts, mri) return controller
def child_block(): controllers, parts = adbase_parts(prefix="prefix") controller = StatefulController("WINDOWS:DETECTOR") for part in parts: controller.add_part(part) return controllers + [controller]