def GetActions(self) -> List[Structure]: """Get the device actions. :return: a list of structures with device action data """ return DeviceActionData.to_structure_list( self.implementation.get_actions())
def __init__(self, data, device_tree): super().__init__(data) self._device_tree = device_tree self._store = self.builder.get_object("actionStore") self._index = 1 # Get actions of the given device tree. self._actions = DeviceActionData.from_structure_list( device_tree.GetActions()) # Add actions to the dialog. for action in self._actions: self._add_action(action)
def _get_action_data(self, action): """Get the action data. :param action: an instance of DeviceAction :return: an instance of DeviceActionData """ data = DeviceActionData() data.action_type = action.type_string.lower() data.action_object = action.object_string.lower() data.device_name = action.device.name data.description = action.type_desc return data
def _get_action_data(self, action): """Get the action data. :param action: an instance of DeviceAction :return: an instance of DeviceActionData """ data = DeviceActionData() # Collect the action data. data.action_type = action.type_string.lower() data.action_description = action.type_desc # Collect the object data. data.object_type = action.object_string.lower() data.object_description = action.object_type_string # Collect the device data. device = action.device data.device_name = device.name if action.is_create or action.is_device or action.is_format: data.attrs["mount-point"] = self._get_attribute( action.format, "mountpoint") if getattr(device, "description", ""): data.attrs["serial"] = self._get_attribute(device, "serial") data.device_description = _( "{device_description} ({device_name})").format( device_description=device.description, device_name=device.name) elif getattr(device, "disk", None): data.attrs["serial"] = self._get_attribute(device.disk, "serial") data.device_description = _( "{device_name} on {container_name}").format( device_name=device.name, container_name=device.disk.description) else: data.attrs["serial"] = self._get_attribute(device, "serial") data.device_description = device.name # Prune the attributes. data.attrs = self._prune_attributes(data.attrs) return data
def GetActions(self) -> List[Structure]: """Get the device actions. :return: a list of structures with device action data """ return DeviceActionData.to_structure_list(self.implementation.get_actions())