comparison inkscape/firefox/testsoap.py @ 274:96aae15527c8

Port all basic scene editor from pyGtk to the firefox
author wycc
date Thu, 29 Jan 2009 22:30:46 +0800
parents c39b24036a75
children
comparison
equal deleted inserted replaced
273:0cadeb9fdfc3 274:96aae15527c8
1 from twisted.web import soap 1 from twisted.web import soap
2 from twisted.internet import reactor 2 from twisted.internet import reactor
3 import sys,os 3 import sys,os
4 class Inkscape(object): 4 class Inkscape(object):
5 def __init__(self): 5 def __init__(self):
6 self.server = soap.Proxy('http://localhost:19192') 6 self.server = soap.Proxy('http://localhost:8080')
7 def PUBLISH(self): 7 def PUBLISH(self):
8 return self.server.callRemote('PUBLISH') 8 return self.server.callRemote('PUBLISH')
9 def SCENE(self,n): 9 def SCENE(self,n):
10 return self.server.callRemote('SCENE',n) 10 return self.server.callRemote('SCENE',n)
11 def START(self): 11 def START(self):
12 return self.server.callRemote('START') 12 return self.server.callRemote('START')
13 def INSERTKEY(self,layer,n):
14 return self.server.callRemote('INSERTKEY',layer,n)
15 def EXTENDSCENE(self,layer,n):
16 return self.server.callRemote('EXTENDSCENE',layer,n)
17 def GETDOC(self):
18 return self.server.callRemote('GETDOC')
13 19
14 20
15 def quitSession(result): 21 def quitSession(result):
16 print [result] 22 print [result]
17 reactor.stop() 23 reactor.stop()
27 d = ink.PUBLISH() 33 d = ink.PUBLISH()
28 elif sys.argv[1] == 'SCENE': 34 elif sys.argv[1] == 'SCENE':
29 d = ink.SCENE(sys.argv[2]) 35 d = ink.SCENE(sys.argv[2])
30 elif sys.argv[1] == 'START': 36 elif sys.argv[1] == 'START':
31 d = ink.START() 37 d = ink.START()
38 elif sys.argv[1] == 'INSERTKEY':
39 d = ink.INSERTKEY(sys.argv[2], sys.argv[3])
40 elif sys.argv[1] == 'GETDOC':
41 d = ink.GETDOC()
42 elif sys.argv[1] == 'EXTENDSCENE':
43 d = ink.EXTENDSCENE(sys.argv[2],sys.argv[3])
32 else: 44 else:
33 print 'Unknown command %s' % sys.argv[1] 45 print 'Unknown command %s' % sys.argv[1]
34 sys.exit(-1) 46 sys.exit(-1)
35 d.addCallback(quitSession) 47 d.addCallback(quitSession)
36 d.addErrback(quitError) 48 d.addErrback(quitError)