|
1 <?xml version="1.0" encoding="utf-8"?> |
|
2 <!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN' |
|
3 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'> |
|
4 <html><head> |
|
5 <title>eric4.Utilities.SingleApplication</title> |
|
6 <style> |
|
7 body { |
|
8 background:white; |
|
9 margin: 0em 1em 10em 1em; |
|
10 color: black; |
|
11 } |
|
12 |
|
13 h1 { color: white; background: #4FA4FF; } |
|
14 h2 { color: white; background: #4FA4FF; } |
|
15 h3 { color: white; background: #00557F; } |
|
16 h4 { color: white; background: #00557F; } |
|
17 |
|
18 a { color: #AA5500; } |
|
19 |
|
20 </style> |
|
21 </head> |
|
22 <body><a NAME="top" ID="top"></a> |
|
23 <h1>eric4.Utilities.SingleApplication</h1> |
|
24 <p> |
|
25 Module implementing the single application server and client. |
|
26 </p> |
|
27 <h3>Global Attributes</h3> |
|
28 <table> |
|
29 <tr><td>None</td></tr> |
|
30 </table> |
|
31 <h3>Classes</h3> |
|
32 <table> |
|
33 <tr> |
|
34 <td><a href="#SingleApplicationClient">SingleApplicationClient</a></td> |
|
35 <td>Class implementing the single application client base class.</td> |
|
36 </tr><tr> |
|
37 <td><a href="#SingleApplicationServer">SingleApplicationServer</a></td> |
|
38 <td>Class implementing the single application server base class.</td> |
|
39 </tr> |
|
40 </table> |
|
41 <h3>Functions</h3> |
|
42 <table> |
|
43 <tr><td>None</td></tr> |
|
44 </table> |
|
45 <hr /><hr /> |
|
46 <a NAME="SingleApplicationClient" ID="SingleApplicationClient"></a> |
|
47 <h2>SingleApplicationClient</h2> |
|
48 <p> |
|
49 Class implementing the single application client base class. |
|
50 </p> |
|
51 <h3>Derived from</h3> |
|
52 object |
|
53 <h3>Class Attributes</h3> |
|
54 <table> |
|
55 <tr><td>None</td></tr> |
|
56 </table> |
|
57 <h3>Methods</h3> |
|
58 <table> |
|
59 <tr> |
|
60 <td><a href="#SingleApplicationClient.__init__">SingleApplicationClient</a></td> |
|
61 <td>Constructor</td> |
|
62 </tr><tr> |
|
63 <td><a href="#SingleApplicationClient.connect">connect</a></td> |
|
64 <td>Public method to connect the single application client to its server.</td> |
|
65 </tr><tr> |
|
66 <td><a href="#SingleApplicationClient.disconnect">disconnect</a></td> |
|
67 <td>Public method to disconnect from the Single Appliocation server.</td> |
|
68 </tr><tr> |
|
69 <td><a href="#SingleApplicationClient.errstr">errstr</a></td> |
|
70 <td>Public method to return a meaningful error string for the last error.</td> |
|
71 </tr><tr> |
|
72 <td><a href="#SingleApplicationClient.processArgs">processArgs</a></td> |
|
73 <td>Public method to process the command line args passed to the UI.</td> |
|
74 </tr><tr> |
|
75 <td><a href="#SingleApplicationClient.sendCommand">sendCommand</a></td> |
|
76 <td>Public method to send the command to the application server.</td> |
|
77 </tr> |
|
78 </table> |
|
79 <a NAME="SingleApplicationClient.__init__" ID="SingleApplicationClient.__init__"></a> |
|
80 <h4>SingleApplicationClient (Constructor)</h4> |
|
81 <b>SingleApplicationClient</b>(<i>name</i>) |
|
82 <p> |
|
83 Constructor |
|
84 </p><dl> |
|
85 <dt><i>name</i></dt> |
|
86 <dd> |
|
87 name of the local server to connect to (string) |
|
88 </dd> |
|
89 </dl><a NAME="SingleApplicationClient.connect" ID="SingleApplicationClient.connect"></a> |
|
90 <h4>SingleApplicationClient.connect</h4> |
|
91 <b>connect</b>(<i></i>) |
|
92 <p> |
|
93 Public method to connect the single application client to its server. |
|
94 </p><dl> |
|
95 <dt>Returns:</dt> |
|
96 <dd> |
|
97 value indicating success or an error number. Value is one of: |
|
98 <table> |
|
99 <tr><td>0</td><td>No application is running</td></tr> |
|
100 <tr><td>1</td><td>Application is already running</td></tr> |
|
101 </table> |
|
102 </dd> |
|
103 </dl><a NAME="SingleApplicationClient.disconnect" ID="SingleApplicationClient.disconnect"></a> |
|
104 <h4>SingleApplicationClient.disconnect</h4> |
|
105 <b>disconnect</b>(<i></i>) |
|
106 <p> |
|
107 Public method to disconnect from the Single Appliocation server. |
|
108 </p><a NAME="SingleApplicationClient.errstr" ID="SingleApplicationClient.errstr"></a> |
|
109 <h4>SingleApplicationClient.errstr</h4> |
|
110 <b>errstr</b>(<i></i>) |
|
111 <p> |
|
112 Public method to return a meaningful error string for the last error. |
|
113 </p><dl> |
|
114 <dt>Returns:</dt> |
|
115 <dd> |
|
116 error string for the last error (string) |
|
117 </dd> |
|
118 </dl><a NAME="SingleApplicationClient.processArgs" ID="SingleApplicationClient.processArgs"></a> |
|
119 <h4>SingleApplicationClient.processArgs</h4> |
|
120 <b>processArgs</b>(<i>args</i>) |
|
121 <p> |
|
122 Public method to process the command line args passed to the UI. |
|
123 </p><p> |
|
124 <b>Note</b>: This method must be overridden by subclasses. |
|
125 </p><dl> |
|
126 <dt><i>args</i></dt> |
|
127 <dd> |
|
128 command line args (list of strings) |
|
129 </dd> |
|
130 </dl><a NAME="SingleApplicationClient.sendCommand" ID="SingleApplicationClient.sendCommand"></a> |
|
131 <h4>SingleApplicationClient.sendCommand</h4> |
|
132 <b>sendCommand</b>(<i>cmd</i>) |
|
133 <p> |
|
134 Public method to send the command to the application server. |
|
135 </p><dl> |
|
136 <dt><i>cmd</i></dt> |
|
137 <dd> |
|
138 command to be sent (string) |
|
139 </dd> |
|
140 </dl> |
|
141 <div align="right"><a href="#top">Up</a></div> |
|
142 <hr /><hr /> |
|
143 <a NAME="SingleApplicationServer" ID="SingleApplicationServer"></a> |
|
144 <h2>SingleApplicationServer</h2> |
|
145 <p> |
|
146 Class implementing the single application server base class. |
|
147 </p> |
|
148 <h3>Derived from</h3> |
|
149 QLocalServer |
|
150 <h3>Class Attributes</h3> |
|
151 <table> |
|
152 <tr><td>None</td></tr> |
|
153 </table> |
|
154 <h3>Methods</h3> |
|
155 <table> |
|
156 <tr> |
|
157 <td><a href="#SingleApplicationServer.__init__">SingleApplicationServer</a></td> |
|
158 <td>Constructor</td> |
|
159 </tr><tr> |
|
160 <td><a href="#SingleApplicationServer.__disconnected">__disconnected</a></td> |
|
161 <td>Private method to handle the closure of the socket.</td> |
|
162 </tr><tr> |
|
163 <td><a href="#SingleApplicationServer.__newConnection">__newConnection</a></td> |
|
164 <td>Private slot to handle a new connection.</td> |
|
165 </tr><tr> |
|
166 <td><a href="#SingleApplicationServer.__parseLine">__parseLine</a></td> |
|
167 <td>Private method to handle data from the client.</td> |
|
168 </tr><tr> |
|
169 <td><a href="#SingleApplicationServer.handleCommand">handleCommand</a></td> |
|
170 <td>Public slot to handle the command sent by the client.</td> |
|
171 </tr><tr> |
|
172 <td><a href="#SingleApplicationServer.shutdown">shutdown</a></td> |
|
173 <td>Public method used to shut down the server.</td> |
|
174 </tr> |
|
175 </table> |
|
176 <a NAME="SingleApplicationServer.__init__" ID="SingleApplicationServer.__init__"></a> |
|
177 <h4>SingleApplicationServer (Constructor)</h4> |
|
178 <b>SingleApplicationServer</b>(<i>name</i>) |
|
179 <p> |
|
180 Constructor |
|
181 </p><dl> |
|
182 <dt><i>name</i></dt> |
|
183 <dd> |
|
184 name this server is listening to (string) |
|
185 </dd> |
|
186 </dl><a NAME="SingleApplicationServer.__disconnected" ID="SingleApplicationServer.__disconnected"></a> |
|
187 <h4>SingleApplicationServer.__disconnected</h4> |
|
188 <b>__disconnected</b>(<i></i>) |
|
189 <p> |
|
190 Private method to handle the closure of the socket. |
|
191 </p><a NAME="SingleApplicationServer.__newConnection" ID="SingleApplicationServer.__newConnection"></a> |
|
192 <h4>SingleApplicationServer.__newConnection</h4> |
|
193 <b>__newConnection</b>(<i></i>) |
|
194 <p> |
|
195 Private slot to handle a new connection. |
|
196 </p><a NAME="SingleApplicationServer.__parseLine" ID="SingleApplicationServer.__parseLine"></a> |
|
197 <h4>SingleApplicationServer.__parseLine</h4> |
|
198 <b>__parseLine</b>(<i></i>) |
|
199 <p> |
|
200 Private method to handle data from the client. |
|
201 </p><a NAME="SingleApplicationServer.handleCommand" ID="SingleApplicationServer.handleCommand"></a> |
|
202 <h4>SingleApplicationServer.handleCommand</h4> |
|
203 <b>handleCommand</b>(<i>cmd, params</i>) |
|
204 <p> |
|
205 Public slot to handle the command sent by the client. |
|
206 </p><p> |
|
207 <b>Note</b>: This method must be overridden by subclasses. |
|
208 </p><dl> |
|
209 <dt><i>cmd</i></dt> |
|
210 <dd> |
|
211 commandstring (string) |
|
212 </dd><dt><i>params</i></dt> |
|
213 <dd> |
|
214 parameterstring (string) |
|
215 </dd> |
|
216 </dl><a NAME="SingleApplicationServer.shutdown" ID="SingleApplicationServer.shutdown"></a> |
|
217 <h4>SingleApplicationServer.shutdown</h4> |
|
218 <b>shutdown</b>(<i></i>) |
|
219 <p> |
|
220 Public method used to shut down the server. |
|
221 </p> |
|
222 <div align="right"><a href="#top">Up</a></div> |
|
223 <hr /> |
|
224 </body></html> |