コード例 #1
0
ファイル: u16_property.py プロジェクト: tom-overton/paragon
 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)
コード例 #2
0
 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)
コード例 #3
0
 def __init__(self, name, value=0):
     super().__init__(name)
     self.editor_factory = lambda: IntegerPropertySpinBox(
         self.name, -128, 127)
     self.value = value