Example #1
0
 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
Example #2
0
 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
Example #3
0
 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
Example #4
0
 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
Example #5
0
 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
Example #6
0
 def onCursorLose(self, cursor):
     Element.onCursorLose(self, cursor)
     if not self.released:
         self.pressed = False
Example #7
0
 def onCursorGain(self, cursor):
     Element.onCursorGain(self, cursor)
     if not self.released:
         self.pressed = True
Example #8
0
 def __init__(self, *args, **kwargs):
     Element.__init__(self, *args, **kwargs)
     self._pressed = False
     self.released = True
Example #9
0
 def onButtonDown(self, cursor, button):
     Element.onButtonDown(self, cursor, button)
     if button == cursor.buttonPrimary:
         self.onState()
Example #10
0
 def __init__(self, states, *args, **kwargs):
     Element.__init__(self, *args, **kwargs)
     self.command = doNothing
     self.states = cycle(states)
     self.onState()
Example #11
0
 def __init__(self, **attr):
     Element.__init__(self, **attr)
     self.transform = identity(3)
     self.children = []
     """if hasattr (self, 'x'):
Example #12
0
 def __init__(self, text='', **kwargs):
     Element.__init__(self)
     self.kwargs = kwargs
     self.set_text(text)
Example #13
0
 def setSVG(self):
     attr = Element.setSVG(self)
     attr.update([('d', self.data), ('transform', self.postTransform)])
     return attr
Example #14
0
 def setSVG (self):
     attr = Element.setSVG (self)
     attr.update ([('d', self.data), ('transform', self.postTransform)])
     return attr
Example #15
0
 def __init__ (self, **attr):
     Element.__init__ (self, **attr)
     self.transform = identity (3)
     self.children = []
     """if hasattr (self, 'x'):
Example #16
0
 def onButtonDown(self, cursor, button):
     Element.onButtonDown(self, cursor, button)
     if button == cursor.buttonPrimary:
         self.pressed = True
         self.released = False
Example #17
0
 def onButtonUp(self, cursor, button):
     Element.onButtonUp(self, cursor, button)
     if (button == cursor.buttonPrimary):
         self.released = True
         if self.pressed:
             self.pressed = False
Example #18
0
 def __init__ (self, **attr):
     Element.__init__ (self, **attr)
     self.children = []
     self.transform = identity (3)