annotate inkscape/firefox/testsoap.py @ 1460:75ca2a66c08d

Hint user current selected component and timeline
author Thinker K.F. Li <thinker@codemud.net>
date Sun, 17 Apr 2011 01:03:07 +0800
parents d5327265da1e
children
rev   line source
288
d5327265da1e Revert the firefox integration to 276
wycc
parents:
diff changeset
1 from twisted.web import soap
d5327265da1e Revert the firefox integration to 276
wycc
parents:
diff changeset
2 from twisted.internet import reactor
d5327265da1e Revert the firefox integration to 276
wycc
parents:
diff changeset
3 import sys,os
d5327265da1e Revert the firefox integration to 276
wycc
parents:
diff changeset
4 class Inkscape(object):
d5327265da1e Revert the firefox integration to 276
wycc
parents:
diff changeset
5 def __init__(self):
d5327265da1e Revert the firefox integration to 276
wycc
parents:
diff changeset
6 self.server = soap.Proxy('http://localhost:8080')
d5327265da1e Revert the firefox integration to 276
wycc
parents:
diff changeset
7 def PUBLISH(self):
d5327265da1e Revert the firefox integration to 276
wycc
parents:
diff changeset
8 return self.server.callRemote('PUBLISH')
d5327265da1e Revert the firefox integration to 276
wycc
parents:
diff changeset
9 def SCENE(self,n):
d5327265da1e Revert the firefox integration to 276
wycc
parents:
diff changeset
10 return self.server.callRemote('SCENE',n)
d5327265da1e Revert the firefox integration to 276
wycc
parents:
diff changeset
11 def START(self):
d5327265da1e Revert the firefox integration to 276
wycc
parents:
diff changeset
12 return self.server.callRemote('START')
d5327265da1e Revert the firefox integration to 276
wycc
parents:
diff changeset
13 def INSERTKEY(self,layer,n):
d5327265da1e Revert the firefox integration to 276
wycc
parents:
diff changeset
14 return self.server.callRemote('INSERTKEY',layer,n)
d5327265da1e Revert the firefox integration to 276
wycc
parents:
diff changeset
15 def EXTENDSCENE(self,layer,n):
d5327265da1e Revert the firefox integration to 276
wycc
parents:
diff changeset
16 return self.server.callRemote('EXTENDSCENE',layer,n)
d5327265da1e Revert the firefox integration to 276
wycc
parents:
diff changeset
17 def GETDOC(self):
d5327265da1e Revert the firefox integration to 276
wycc
parents:
diff changeset
18 return self.server.callRemote('GETDOC')
d5327265da1e Revert the firefox integration to 276
wycc
parents:
diff changeset
19
d5327265da1e Revert the firefox integration to 276
wycc
parents:
diff changeset
20
d5327265da1e Revert the firefox integration to 276
wycc
parents:
diff changeset
21 def quitSession(result):
d5327265da1e Revert the firefox integration to 276
wycc
parents:
diff changeset
22 print [result]
d5327265da1e Revert the firefox integration to 276
wycc
parents:
diff changeset
23 reactor.stop()
d5327265da1e Revert the firefox integration to 276
wycc
parents:
diff changeset
24 def quitError(result):
d5327265da1e Revert the firefox integration to 276
wycc
parents:
diff changeset
25 print "Error"
d5327265da1e Revert the firefox integration to 276
wycc
parents:
diff changeset
26 print[result]
d5327265da1e Revert the firefox integration to 276
wycc
parents:
diff changeset
27 reactor.stop()
d5327265da1e Revert the firefox integration to 276
wycc
parents:
diff changeset
28
d5327265da1e Revert the firefox integration to 276
wycc
parents:
diff changeset
29
d5327265da1e Revert the firefox integration to 276
wycc
parents:
diff changeset
30 ink = Inkscape()
d5327265da1e Revert the firefox integration to 276
wycc
parents:
diff changeset
31
d5327265da1e Revert the firefox integration to 276
wycc
parents:
diff changeset
32 if sys.argv[1] == 'PUBLISH':
d5327265da1e Revert the firefox integration to 276
wycc
parents:
diff changeset
33 d = ink.PUBLISH()
d5327265da1e Revert the firefox integration to 276
wycc
parents:
diff changeset
34 elif sys.argv[1] == 'SCENE':
d5327265da1e Revert the firefox integration to 276
wycc
parents:
diff changeset
35 d = ink.SCENE(sys.argv[2])
d5327265da1e Revert the firefox integration to 276
wycc
parents:
diff changeset
36 elif sys.argv[1] == 'START':
d5327265da1e Revert the firefox integration to 276
wycc
parents:
diff changeset
37 d = ink.START()
d5327265da1e Revert the firefox integration to 276
wycc
parents:
diff changeset
38 elif sys.argv[1] == 'INSERTKEY':
d5327265da1e Revert the firefox integration to 276
wycc
parents:
diff changeset
39 d = ink.INSERTKEY(sys.argv[2], sys.argv[3])
d5327265da1e Revert the firefox integration to 276
wycc
parents:
diff changeset
40 elif sys.argv[1] == 'GETDOC':
d5327265da1e Revert the firefox integration to 276
wycc
parents:
diff changeset
41 d = ink.GETDOC()
d5327265da1e Revert the firefox integration to 276
wycc
parents:
diff changeset
42 elif sys.argv[1] == 'EXTENDSCENE':
d5327265da1e Revert the firefox integration to 276
wycc
parents:
diff changeset
43 d = ink.EXTENDSCENE(sys.argv[2],sys.argv[3])
d5327265da1e Revert the firefox integration to 276
wycc
parents:
diff changeset
44 else:
d5327265da1e Revert the firefox integration to 276
wycc
parents:
diff changeset
45 print 'Unknown command %s' % sys.argv[1]
d5327265da1e Revert the firefox integration to 276
wycc
parents:
diff changeset
46 sys.exit(-1)
d5327265da1e Revert the firefox integration to 276
wycc
parents:
diff changeset
47 d.addCallback(quitSession)
d5327265da1e Revert the firefox integration to 276
wycc
parents:
diff changeset
48 d.addErrback(quitError)
d5327265da1e Revert the firefox integration to 276
wycc
parents:
diff changeset
49
d5327265da1e Revert the firefox integration to 276
wycc
parents:
diff changeset
50
d5327265da1e Revert the firefox integration to 276
wycc
parents:
diff changeset
51 reactor.run()