def __init__(self, element = None): SVGElement.__init__(self, element) TransformableElement.__init__(self) TextElementContainer.__init__(self) self.register_attribute_alias("xlink", "xlink:href") self.__dict__["container_map"]["tref"] = Tref self.__dict__["container_map"]["tspan"] = Tspan
def __init__(self, element = None): SVGElement.__init__(self, element) for special_element in ["shapes", "basic_shapes", "text_shapes", \ "containers", "rects", "circles", "ellipses", \ "lines", "polylines", "polygons", "paths", \ "texts", "text_paths", "groups"]: self.register_special_attribute(special_element) self.register_special_attribute("all_" + special_element)
def __init__(self, element = None, attributes = {}): SVGElement.__init__(self, element) DefinitionContainer.__init__(self) if not self.__dict__.has_key("container_map"): self.__dict__["container_map"] = {} self.__dict__["container_map"]["linear_gradient"] = LinearGradient self.__dict__["container_map"]["radial_gradient"] = RadialGradient self.__dict__["container_map"]["pattern"] = Pattern if element == None: handle_attributes(self, "defs", attributes)
def __init__(self, element = None): """ Initialize the gradient. @type element: xml.dom.Element @param element: An existing DOM element """ SVGElement.__init__(self, element) StopContainer.__init__(self) self.__dict__["container_map"] = {"stop" : Stop} self.register_attribute_alias("xlink", "xlink:href")
def __init__(self, attributes = {}, element = None, setdefaults = False): """ Initialize the stop. @type element: xml.dom.Element @param element: An existing DOM element """ SVGElement.__init__(self, element) if not element or setdefaults: if not attributes.has_key("color"): attributes["color"] = "#000000ff" if not attributes.has_key("offset"): attributes["offset"] = "0" handle_attributes(self, "stop", attributes)
def __init__(self, element = None): """ Initialize @type element: xml.dom.Element @param element: An existing XML DOM element object to encapsulate. """ SVGElement.__init__(self, element) FilledElement.__init__(self) StrokedElement.__init__(self) TransformableElement.__init__(self) self.__dict__["container_map"] = {}
def __setattr__(self, attribute, value): """ Set an attribute. See L{SVGElement.__setattr__} for more information, as this function passes on unresolved attributes to it. @type attribute: string @param attribute: The name of the attribute being set. @type value: string or number @param value: The value of the attribute being set. """ if attribute == "color": set_color(self, SVGElement, "stop-color", "stop-opacity", value) else: SVGElement.__setattr__(self, attribute, value)
def __init__(self, attributes = {}, element = None, setdefaults = False): SVGElement.__init__(self, element) StrokedElement.__init__(self) TransformableElement.__init__(self) if not element or setdefaults: if not attributes.has_key("start"): if not attributes.has_key("x1"): attributes["x1"] = 0 if not attributes.has_key("y1"): attributes["y1"] = 0 if not attributes.has_key("stop"): if not attributes.has_key("x2"): attributes["x2"] = 50 if not attributes.has_key("y2"): attributes["y2"] = 50 if not attributes.has_key("stroke"): attributes["stroke"] = "#000000ff" handle_attributes(self, "line", attributes)
def __setattr__(self, attribute, value): """ Set an attribute. See L{SVGElement.__setattr__} for more information, as this function passes on unresolved attributes to it. @type attribute: string @param attribute: The name of the attribute being set. @type value: string or number @param value: The value of the attribute being set. """ if attribute == "start": if len(value) != 2: raise ValueError, value SVGElement.__setattr__(self, "x1", value[0]) SVGElement.__setattr__(self, "y1", value[1]) elif attribute == "stop": if len(value) != 2: raise ValueError, value SVGElement.__setattr__(self, "x2", value[0]) SVGElement.__setattr__(self, "y2", value[1]) else: if not StrokedElement.__setattr__(self, attribute, value): SVGElement.__setattr__(self, attribute, value)
def __getattr__(self, attribute): """ Get an attribute. See L{SVGElement.__getattr__} for more information, as this function passes on unresolved attributes to it. @type attribute: string @param attribute: The attribute being requested. @rtype: string @return: The requested attribute. """ if attribute == "start": x1 = SVGElement.__getattr__(self, "x1") y1 = SVGElement.__getattr__(self, "y1") return [x1, y1] if attribute == "stop": x2 = SVGElement.__getattr__(self, "x2") y2 = SVGElement.__getattr__(self, "y2") return [x2, y2] try: return StrokedElement.__getattr__(self, attribute) except: return SVGElement.__getattr__(self, attribute)
def __getattr__(self, attribute): """ Get an attribute. See L{SVGElement.__getattr__} for more information, as this function passes on unresolved attributes to it. @type attribute: string @param attribute: The attribute being requested. @rtype: string @return: The requested attribute. """ if attribute == "color": color = get_color(self, SVGElement, "stop-color", "stop-opacity") if color: return color return SVGElement.__getattr__(self, attribute)