Ejemplo n.º 1
0
 def FromXML(cls, doc, element):
     """Construct using an ElementTree-style element."""
     type = element.get("type", "relative")
     x = None
     y = None
     for subelem in element:
         tag = realtag(subelem)
         if tag == "x":
             x = NumberDef(subelem.text)
         elif tag == "y":
             y = NumberDef(subelem.text)
     return cls(type, x, y)
Ejemplo n.º 2
0
 def __setstate__(self, state):
     state = dict(state)
     fire = state["fire"]
     params = [NumberDef(param) for param in state.get("params", [])]
     self.__init__(fire, ParamList(params))
Ejemplo n.º 3
0
 def FromXML(cls, doc, element, default="absolute"):
     """Construct using an ElementTree-style element."""
     return cls(element.get("type", default), NumberDef(element.text))
Ejemplo n.º 4
0
 def __setstate__(self, state):
     state = dict(state)
     self.__init__(state["type"], NumberDef(state["value"]))
Ejemplo n.º 5
0
 def __setstate__(self, state):
     state = dict(state)
     x = NumberDef(state["x"]) if "x" in state else None
     y = NumberDef(state["y"]) if "y" in state else None
     self.__init__(state["type"], x, y)
Ejemplo n.º 6
0
 def __setstate__(self, state):
     state = dict(state)
     action = state["action"]
     params = [NumberDef(param) for param in state.get("params", [])]
     self.__init__(action, ParamList(params))
Ejemplo n.º 7
0
 def __setstate__(self, state):
     state = dict(state)
     bullet = state["bullet"]
     params = [NumberDef(param) for param in state.get("params", [])]
     self.__init__(bullet, ParamList(params))
Ejemplo n.º 8
0
 def FromXML(cls, doc, element):
     """Construct using an ElementTree-style element."""
     return cls([
         NumberDef(subelem.text) for subelem in element
         if realtag(subelem) == "param"
     ])
Ejemplo n.º 9
0
 def __setstate__(self, state):
     state = dict(state)
     self.__init__(INumberDef(state["frames"]),
                   Speed(state["type"], NumberDef(state["value"])))