Exemplo n.º 1
0
 def from_json(cls, name, json):
     result = StringProperty(name)
     result.is_display = read_key_optional(json, "display", False)
     result.is_fallback_display = read_key_optional(json,
                                                    "fallback_display",
                                                    False)
     return result
Exemplo n.º 2
0
 def from_json(cls, name, json):
     target_module = json["target_module"]
     target_property = json["target_property"]
     result = ReferenceProperty(name, target_module, target_property)
     result.is_display = read_key_optional(json, "display", False)
     result.is_fallback_display = read_key_optional(json,
                                                    "fallback_display",
                                                    False)
     return result
Exemplo n.º 3
0
    def __init__(self, js):
        self.name = js["name"]
        self.unique = read_key_optional(js, "unique", False)
        if self.unique:
            self.file = js["file"]
        else:
            self.file = None
        self.type = js["type"]
        self.location_strategy = location_strategy_from_json(js["location"])
        self.archive = None

        self.element_template: Dict[str:AbstractProperty] = {}
        module_properties = js["properties"]
        for key in module_properties:
            logging.info("Parsing property " + key + ".")
            property_config = module_properties[key]
            property_type = PROPERTIES[property_config["type"]]
            prop = property_type.from_json(key, property_config)
            if property_type is PointerProperty:
                prop.module = self
            self.element_template[key] = prop

        self.display_property = None
        self.fallback_display_property = None
        for (key, prop) in self.element_template.items():
            if prop.is_display:
                self.display_property = key
            elif prop.is_fallback_display:
                self.fallback_display_property = key
Exemplo n.º 4
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, 65535, hex)
     elif editor_type == "combobox":
         data_type = json["data"]
         prop.editor_factory = lambda: DataComboBox(prop.name, data_type, int)
Exemplo n.º 5
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)
Exemplo n.º 6
0
 def from_json(cls, name, json):
     target_message_archive = json["file"]
     result = MessageProperty(name, target_message_archive)
     result.is_display = read_key_optional(json, "display", False)
     result.is_fallback_display = read_key_optional(json, "fallback_display", False)
     return result
Exemplo n.º 7
0
 def __init__(self, js):
     self.mapped_value = js["mapped_value"]
     self.offset = read_key_optional(js, "offset", 0)
Exemplo n.º 8
0
 def __init__(self, js):
     self.offset_to_pointer = js["offset_to_pointer"]
     self.offset = read_key_optional(js, "offset", 0)
Exemplo n.º 9
0
 def __init__(self, js):
     self.offset = read_key_optional(js, "offset", 0)
Exemplo n.º 10
0
 def __init__(self, js):
     super().__init__()
     self.address = js["address"]
     self.offset = read_key_optional(js, "offset", 0)