Ejemplo n.º 1
0
    def change_field_type_of_label(self, label: ProtocolLabel, field_type: FieldType):
        if not isinstance(label, ProtocolLabel) and hasattr(label, "field_type"):
            # In case of SimulatorProtocolLabel
            label.field_type = field_type
            return

        is_crc_type = field_type is not None and field_type.function == FieldType.Function.CHECKSUM
        if is_crc_type != isinstance(label, ChecksumLabel):
            self[self.index(label)] = self.__create_label(label.name, label.start, label.end - 1,
                                                          label.color_index, label.auto_created, field_type)
        else:
            label.field_type = field_type
Ejemplo n.º 2
0
    def change_field_type_of_label(self, label: ProtocolLabel, field_type: FieldType):
        if not isinstance(label, ProtocolLabel) and hasattr(label, "field_type"):
            # In case of SimulatorProtocolLabel
            label.field_type = field_type
            return

        is_crc_type = field_type is not None and field_type.function == FieldType.Function.CHECKSUM
        if is_crc_type != isinstance(label, ChecksumLabel):
            self[self.index(label)] = self.__create_label(label.name, label.start, label.end - 1,
                                                          label.color_index, label.auto_created, field_type)
        else:
            label.field_type = field_type
Ejemplo n.º 3
0
 def change_field_type_of_label(self, label: ProtocolLabel,
                                field_type: FieldType):
     is_crc_type = field_type is not None and field_type.function == FieldType.Function.CHECKSUM
     if is_crc_type != isinstance(label, ChecksumLabel):
         self[self.index(label)] = self.__create_label(
             label.name, label.start, label.end - 1, label.color_index,
             label.auto_created, field_type)
     else:
         label.field_type = field_type