Mercurial > MadButterfly
comparison inkscape/firefox/MBServer.py @ 381:29145d2affdb
Add function to change the name of the symbol
author | wycc |
---|---|
date | Sun, 05 Apr 2009 12:28:36 +0800 |
parents | 7d244a85dd68 |
children |
comparison
equal
deleted
inserted
replaced
380:9c70de05a0b6 | 381:29145d2affdb |
---|---|
239 if nth >= layer.scene[i].start and nth < layer.scene[i+1].start: | 239 if nth >= layer.scene[i].start and nth < layer.scene[i+1].start: |
240 layer.scene[i].end = nth | 240 layer.scene[i].end = nth |
241 return | 241 return |
242 if len(layer.scene) > 0 and nth > layer.scene[len(layer.scene)-1].end: | 242 if len(layer.scene) > 0 and nth > layer.scene[len(layer.scene)-1].end: |
243 layer.scene[len(layer.scene)-1].end = nth | 243 layer.scene[len(layer.scene)-1].end = nth |
244 | |
245 def findNodeById(self,root,id): | |
246 for n in root: | |
247 if n.attrib.get('id') == id: | |
248 return n | |
249 nn = self.findNodeById(n,id) | |
250 if nn is not None: | |
251 return nn | |
252 return None | |
253 def changeSymbol(self,id,newname): | |
254 node = self.findNodeById(self.document.getroot(),id) | |
255 if node is not None: | |
256 node.set('mbname',newname); | |
257 | |
244 | 258 |
245 def setCurrentScene(self,nth): | 259 def setCurrentScene(self,nth): |
246 self.current = nth | 260 self.current = nth |
247 for layer in self.layer: | 261 for layer in self.layer: |
248 for s in layer.scene: | 262 for s in layer.scene: |
479 select.set('ref', id) | 493 select.set('ref', id) |
480 root.append(select) | 494 root.append(select) |
481 return etree.tostring(newdoc) | 495 return etree.tostring(newdoc) |
482 except: | 496 except: |
483 return traceback.format_exc() | 497 return traceback.format_exc() |
498 def soap_CHANGESYMBOL(self,id,newname): | |
499 try: | |
500 self.target.changeSymbol(id,newname) | |
501 return "OK" | |
502 except: | |
503 return traceback.format_exc() | |
484 import os | 504 import os |
485 os.chdir('/usr/local/share/inkscape/extensions') | 505 os.chdir('/usr/local/share/inkscape/extensions') |
486 | 506 |
487 A = MBScene() | 507 A = MBScene() |
488 A.affect() | 508 A.affect() |