annotate inkscape/firefox/helper_mb.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
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 #!/usr/bin/python
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.web import server, resource,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
3 from twisted.internet import reactor,defer
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 import os,time
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
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
6
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
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
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 class Server(soap.SOAPPublisher):
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 """
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 SOAP server for inkscape extension.
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 """
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
13 def soap_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
14 if self.client == None:
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
15 os.kill(self.pid,12)
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
16 time.sleep(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
17 self.client = Client()
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
18 d = defer.Deferred()
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 self.client.PUBLISH().addCallback(self.quit,d)
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 return d
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
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 def quit(self,result,d):
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 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
24 d.callback(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 self.client = None
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 def soap_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
27 if self.client == None:
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 os.kill(self.pid,12)
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 time.sleep(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
30 self.client = Client()
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 d = defer.Deferred()
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 self.client.SCENE(n).addCallback(self.generic_return,d)
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 return d
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 def generic_return(self,result,d):
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 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
37 d.callback(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
38 def soap_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
39 if self.client == None:
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
40 os.kill(self.pid,12)
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
41 time.sleep(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
42 self.client = Client()
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
43 return "OK"
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
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
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
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
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 class Client(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
49 def __init__(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
50 self.proxy = soap.Proxy('http://localhost:8080')
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 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
52 return self.proxy.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
53 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
54 return self.proxy.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
55 pid = os.fork()
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
56 if pid==0:
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
57 os.execvp("inkscape-mb",["inkscape-mb","scene.svg"])
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
58 s = Server()
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
59 s.client = None
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
60 s.pid = pid
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
61 site = server.Site(s)
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
62 reactor.listenTCP(19192,site)
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
63 reactor.run()
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
64
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
65