def __init__ (self, **attr): Element.__init__ (self, name='path', **attr) if attr.has_key ('data'): self.data = attr['data'] else: self.data = None if attr.has_key ('transform'): self.postTransform = attr['transform'] else: self.postTransform = None
def __init__(self, **attr): Element.__init__(self, name='path', **attr) if attr.has_key('data'): self.data = attr['data'] else: self.data = None if attr.has_key('transform'): self.postTransform = attr['transform'] else: self.postTransform = None
def setSVG (self): attr = Element.setSVG (self) elements = deepcopy (self.elements) self.applyTransform (*elements) strings = map (str, elements) if self.closed: strings.append (str (CloseElement ())) attr.update ([('d', ' '.join (strings)), ('transform', self.postTransform)]) return attr
def setSVG(self): attr = Element.setSVG(self) elements = deepcopy(self.elements) self.applyTransform(*elements) strings = map(str, elements) if self.closed: strings.append(str(CloseElement())) attr.update([('d', ' '.join(strings)), ('transform', self.postTransform)]) return attr
def SVG(self, indent): attr = self.setSVG() nextIndent = indent + ' ' if len(self) > 0: output = indent + '<' + self.name attributes = attributesToSVG(attr) if attributes != '': output += ' ' + attributes output += '>\n' output += self.childrenSVG(nextIndent) output += indent + '</' + self.name + '>\n' else: output = Element.SVG(self, indent) return output
def onCursorLose(self, cursor): Element.onCursorLose(self, cursor) if not self.released: self.pressed = False
def onCursorGain(self, cursor): Element.onCursorGain(self, cursor) if not self.released: self.pressed = True
def __init__(self, *args, **kwargs): Element.__init__(self, *args, **kwargs) self._pressed = False self.released = True
def onButtonDown(self, cursor, button): Element.onButtonDown(self, cursor, button) if button == cursor.buttonPrimary: self.onState()
def __init__(self, states, *args, **kwargs): Element.__init__(self, *args, **kwargs) self.command = doNothing self.states = cycle(states) self.onState()
def __init__(self, **attr): Element.__init__(self, **attr) self.transform = identity(3) self.children = [] """if hasattr (self, 'x'):
def __init__(self, text='', **kwargs): Element.__init__(self) self.kwargs = kwargs self.set_text(text)
def setSVG(self): attr = Element.setSVG(self) attr.update([('d', self.data), ('transform', self.postTransform)]) return attr
def setSVG (self): attr = Element.setSVG (self) attr.update ([('d', self.data), ('transform', self.postTransform)]) return attr
def __init__ (self, **attr): Element.__init__ (self, **attr) self.transform = identity (3) self.children = [] """if hasattr (self, 'x'):
def onButtonDown(self, cursor, button): Element.onButtonDown(self, cursor, button) if button == cursor.buttonPrimary: self.pressed = True self.released = False
def onButtonUp(self, cursor, button): Element.onButtonUp(self, cursor, button) if (button == cursor.buttonPrimary): self.released = True if self.pressed: self.pressed = False
def __init__ (self, **attr): Element.__init__ (self, **attr) self.children = [] self.transform = identity (3)