def load( manipulator, filename ): try: dom = minidom.parse( filename ) except IOError: print "Error. Can't read", filename return False manipulator.items = [] for item in dom.getElementsByTagName('item'): i = None if item.hasAttribute('figure'): i = Figure( item.getAttribute('figure').encode() ) elif item.hasAttribute('text'): i = TextItem( item.getAttribute('text').encode() ) pos = item.getAttribute('pos').encode().split(',') pos = map( float, pos ) i.position.setTranspose( pos[0],pos[1], 1 ) i.refreshTransform() manipulator.items.append( i ) dom.unlink() refnames.reset() debug('save', 'loaded from', filename ) return True
def eventAddVariable( self ): fig = Figure( let.Variable() ) # Set position to center of view v = self.centerOfView() fig.position.setTranspose( v[0],v[1], 1 ) fig.refreshTransform() self.items.insert( 0, fig ) self.invalidate()
def eventAddVariable(self): fig = Figure(let.Variable()) # Set position to center of view v = self.centerOfView() fig.position.setTranspose(v[0], v[1], 1) fig.refreshTransform() self.items.insert(0, fig) self.invalidate()