Utilities/SingleApplication.py

changeset 945
8cd4d08fa9f6
parent 791
9ec2ac20e54e
child 1131
7781e396c903
equal deleted inserted replaced
944:1b59c4ba121e 945:8cd4d08fa9f6
6 """ 6 """
7 Module implementing the single application server and client. 7 Module implementing the single application server and client.
8 """ 8 """
9 9
10 from PyQt4.QtNetwork import QLocalServer, QLocalSocket 10 from PyQt4.QtNetwork import QLocalServer, QLocalSocket
11
11 12
12 class SingleApplicationServer(QLocalServer): 13 class SingleApplicationServer(QLocalServer):
13 """ 14 """
14 Class implementing the single application server base class. 15 Class implementing the single application server base class.
15 """ 16 """
93 @param cmd commandstring (string) 94 @param cmd commandstring (string)
94 @param params parameterstring (string) 95 @param params parameterstring (string)
95 """ 96 """
96 raise RuntimeError("'handleCommand' must be overridden") 97 raise RuntimeError("'handleCommand' must be overridden")
97 98
99
98 class SingleApplicationClient(object): 100 class SingleApplicationClient(object):
99 """ 101 """
100 Class implementing the single application client base class. 102 Class implementing the single application client base class.
101 """ 103 """
102 def __init__(self, name): 104 def __init__(self, name):
126 else: 128 else:
127 err = self.sock.error() 129 err = self.sock.error()
128 if err == QLocalSocket.ServerNotFoundError: 130 if err == QLocalSocket.ServerNotFoundError:
129 return 0 131 return 0
130 else: 132 else:
131 return -err 133 return -err
132 134
133 def disconnect(self): 135 def disconnect(self):
134 """ 136 """
135 Public method to disconnect from the Single Appliocation server. 137 Public method to disconnect from the Single Appliocation server.
136 """ 138 """

eric ide

mercurial