annotate inkscape/firefox/testsoap.py @ 276:892d86c1a409

Refactory the inkscape.as to be OOP-style.
author wycc
date Thu, 29 Jan 2009 23:57:59 +0800
parents 96aae15527c8
children
rev   line source
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
wycc@wycc-desktop
parents:
diff changeset
1 from twisted.web import soap
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
wycc@wycc-desktop
parents:
diff changeset
2 from twisted.internet import reactor
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
wycc@wycc-desktop
parents:
diff changeset
3 import sys,os
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
wycc@wycc-desktop
parents:
diff changeset
4 class Inkscape(object):
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
wycc@wycc-desktop
parents:
diff changeset
5 def __init__(self):
274
96aae15527c8 Port all basic scene editor from pyGtk to the firefox
wycc
parents: 262
diff changeset
6 self.server = soap.Proxy('http://localhost:8080')
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
wycc@wycc-desktop
parents:
diff changeset
7 def PUBLISH(self):
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
wycc@wycc-desktop
parents:
diff changeset
8 return self.server.callRemote('PUBLISH')
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
wycc@wycc-desktop
parents:
diff changeset
9 def SCENE(self,n):
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
wycc@wycc-desktop
parents:
diff changeset
10 return self.server.callRemote('SCENE',n)
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
wycc@wycc-desktop
parents:
diff changeset
11 def START(self):
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
wycc@wycc-desktop
parents:
diff changeset
12 return self.server.callRemote('START')
274
96aae15527c8 Port all basic scene editor from pyGtk to the firefox
wycc
parents: 262
diff changeset
13 def INSERTKEY(self,layer,n):
96aae15527c8 Port all basic scene editor from pyGtk to the firefox
wycc
parents: 262
diff changeset
14 return self.server.callRemote('INSERTKEY',layer,n)
96aae15527c8 Port all basic scene editor from pyGtk to the firefox
wycc
parents: 262
diff changeset
15 def EXTENDSCENE(self,layer,n):
96aae15527c8 Port all basic scene editor from pyGtk to the firefox
wycc
parents: 262
diff changeset
16 return self.server.callRemote('EXTENDSCENE',layer,n)
96aae15527c8 Port all basic scene editor from pyGtk to the firefox
wycc
parents: 262
diff changeset
17 def GETDOC(self):
96aae15527c8 Port all basic scene editor from pyGtk to the firefox
wycc
parents: 262
diff changeset
18 return self.server.callRemote('GETDOC')
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
wycc@wycc-desktop
parents:
diff changeset
19
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
wycc@wycc-desktop
parents:
diff changeset
20
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
wycc@wycc-desktop
parents:
diff changeset
21 def quitSession(result):
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
wycc@wycc-desktop
parents:
diff changeset
22 print [result]
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
wycc@wycc-desktop
parents:
diff changeset
23 reactor.stop()
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
wycc@wycc-desktop
parents:
diff changeset
24 def quitError(result):
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
wycc@wycc-desktop
parents:
diff changeset
25 print "Error"
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
wycc@wycc-desktop
parents:
diff changeset
26 print[result]
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
wycc@wycc-desktop
parents:
diff changeset
27 reactor.stop()
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
wycc@wycc-desktop
parents:
diff changeset
28
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
wycc@wycc-desktop
parents:
diff changeset
29
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
wycc@wycc-desktop
parents:
diff changeset
30 ink = Inkscape()
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
wycc@wycc-desktop
parents:
diff changeset
31
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
wycc@wycc-desktop
parents:
diff changeset
32 if sys.argv[1] == 'PUBLISH':
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
wycc@wycc-desktop
parents:
diff changeset
33 d = ink.PUBLISH()
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
wycc@wycc-desktop
parents:
diff changeset
34 elif sys.argv[1] == 'SCENE':
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
wycc@wycc-desktop
parents:
diff changeset
35 d = ink.SCENE(sys.argv[2])
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
wycc@wycc-desktop
parents:
diff changeset
36 elif sys.argv[1] == 'START':
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
wycc@wycc-desktop
parents:
diff changeset
37 d = ink.START()
274
96aae15527c8 Port all basic scene editor from pyGtk to the firefox
wycc
parents: 262
diff changeset
38 elif sys.argv[1] == 'INSERTKEY':
96aae15527c8 Port all basic scene editor from pyGtk to the firefox
wycc
parents: 262
diff changeset
39 d = ink.INSERTKEY(sys.argv[2], sys.argv[3])
96aae15527c8 Port all basic scene editor from pyGtk to the firefox
wycc
parents: 262
diff changeset
40 elif sys.argv[1] == 'GETDOC':
96aae15527c8 Port all basic scene editor from pyGtk to the firefox
wycc
parents: 262
diff changeset
41 d = ink.GETDOC()
96aae15527c8 Port all basic scene editor from pyGtk to the firefox
wycc
parents: 262
diff changeset
42 elif sys.argv[1] == 'EXTENDSCENE':
96aae15527c8 Port all basic scene editor from pyGtk to the firefox
wycc
parents: 262
diff changeset
43 d = ink.EXTENDSCENE(sys.argv[2],sys.argv[3])
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
wycc@wycc-desktop
parents:
diff changeset
44 else:
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
wycc@wycc-desktop
parents:
diff changeset
45 print 'Unknown command %s' % sys.argv[1]
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
wycc@wycc-desktop
parents:
diff changeset
46 sys.exit(-1)
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
wycc@wycc-desktop
parents:
diff changeset
47 d.addCallback(quitSession)
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
wycc@wycc-desktop
parents:
diff changeset
48 d.addErrback(quitError)
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
wycc@wycc-desktop
parents:
diff changeset
49
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
wycc@wycc-desktop
parents:
diff changeset
50
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
wycc@wycc-desktop
parents:
diff changeset
51 reactor.run()