def _parse_editor(prop, json): editor_type = json["type"] if editor_type == "spinbox": hex = read_key_optional(json, "hex", False) prop.editor_factory = lambda: IntegerPropertySpinBox(prop.name, 0, 65535, hex) elif editor_type == "combobox": data_type = json["data"] prop.editor_factory = lambda: DataComboBox(prop.name, data_type, int)
def _parse_editor(prop, json): editor_type = json["type"] if editor_type == "spinbox": hex = read_key_optional(json, "hex", False) prop.editor_factory = lambda: IntegerPropertySpinBox(prop.name, 0, 255, hex) elif editor_type == "combobox": data_type = json["data"] prop.editor_factory = lambda: DataComboBox(prop.name, data_type, int) elif editor_type == "bitflags": flags = json["flags"] if not type(flags) is list: raise TypeError prop.editor_factory = lambda: BitflagsEditor(prop.name, flags)
def __init__(self, name, value=0): super().__init__(name) self.editor_factory = lambda: IntegerPropertySpinBox( self.name, -128, 127) self.value = value