comparison inkscape/firefox/testsoap.py @ 262:c39b24036a75

Add proxy daemon and extention for the firefox integration. We need to implement javascript web client to repalce the unite test program testsoap.py
author wycc@wycc-desktop
date Fri, 23 Jan 2009 23:15:04 +0800
parents
children 96aae15527c8
comparison
equal deleted inserted replaced
261:11017576328c 262:c39b24036a75
1 from twisted.web import soap
2 from twisted.internet import reactor
3 import sys,os
4 class Inkscape(object):
5 def __init__(self):
6 self.server = soap.Proxy('http://localhost:19192')
7 def PUBLISH(self):
8 return self.server.callRemote('PUBLISH')
9 def SCENE(self,n):
10 return self.server.callRemote('SCENE',n)
11 def START(self):
12 return self.server.callRemote('START')
13
14
15 def quitSession(result):
16 print [result]
17 reactor.stop()
18 def quitError(result):
19 print "Error"
20 print[result]
21 reactor.stop()
22
23
24 ink = Inkscape()
25
26 if sys.argv[1] == 'PUBLISH':
27 d = ink.PUBLISH()
28 elif sys.argv[1] == 'SCENE':
29 d = ink.SCENE(sys.argv[2])
30 elif sys.argv[1] == 'START':
31 d = ink.START()
32 else:
33 print 'Unknown command %s' % sys.argv[1]
34 sys.exit(-1)
35 d.addCallback(quitSession)
36 d.addErrback(quitError)
37
38
39 reactor.run()