|
1 <!DOCTYPE html> |
|
2 <html><head> |
|
3 <title>eric6.Toolbox.SingleApplication</title> |
|
4 <meta charset="UTF-8"> |
|
5 <style> |
|
6 body { |
|
7 background: #EDECE6; |
|
8 margin: 0em 1em 10em 1em; |
|
9 color: black; |
|
10 } |
|
11 |
|
12 h1 { color: white; background: #85774A; } |
|
13 h2 { color: white; background: #85774A; } |
|
14 h3 { color: white; background: #9D936E; } |
|
15 h4 { color: white; background: #9D936E; } |
|
16 |
|
17 a { color: #BA6D36; } |
|
18 |
|
19 </style> |
|
20 </head> |
|
21 <body><a NAME="top" ID="top"></a> |
|
22 <h1>eric6.Toolbox.SingleApplication</h1> |
|
23 <p> |
|
24 Module implementing the single application server and client. |
|
25 </p> |
|
26 <h3>Global Attributes</h3> |
|
27 <table> |
|
28 <tr><td>None</td></tr> |
|
29 </table> |
|
30 <h3>Classes</h3> |
|
31 <table> |
|
32 <tr> |
|
33 <td><a href="#SingleApplicationClient">SingleApplicationClient</a></td> |
|
34 <td>Class implementing the single application client base class.</td> |
|
35 </tr><tr> |
|
36 <td><a href="#SingleApplicationServer">SingleApplicationServer</a></td> |
|
37 <td>Class implementing the single application server base class.</td> |
|
38 </tr> |
|
39 </table> |
|
40 <h3>Functions</h3> |
|
41 <table> |
|
42 <tr><td>None</td></tr> |
|
43 </table> |
|
44 <hr /><hr /> |
|
45 <a NAME="SingleApplicationClient" ID="SingleApplicationClient"></a> |
|
46 <h2>SingleApplicationClient</h2> |
|
47 <p> |
|
48 Class implementing the single application client base class. |
|
49 </p> |
|
50 <h3>Derived from</h3> |
|
51 object |
|
52 <h3>Class Attributes</h3> |
|
53 <table> |
|
54 <tr><td>None</td></tr> |
|
55 </table> |
|
56 <h3>Class Methods</h3> |
|
57 <table> |
|
58 <tr><td>None</td></tr> |
|
59 </table> |
|
60 <h3>Methods</h3> |
|
61 <table> |
|
62 <tr> |
|
63 <td><a href="#SingleApplicationClient.__init__">SingleApplicationClient</a></td> |
|
64 <td>Constructor</td> |
|
65 </tr><tr> |
|
66 <td><a href="#SingleApplicationClient.connect">connect</a></td> |
|
67 <td>Public method to connect the single application client to its server.</td> |
|
68 </tr><tr> |
|
69 <td><a href="#SingleApplicationClient.disconnect">disconnect</a></td> |
|
70 <td>Public method to disconnect from the Single Appliocation server.</td> |
|
71 </tr><tr> |
|
72 <td><a href="#SingleApplicationClient.errstr">errstr</a></td> |
|
73 <td>Public method to return a meaningful error string for the last error.</td> |
|
74 </tr><tr> |
|
75 <td><a href="#SingleApplicationClient.processArgs">processArgs</a></td> |
|
76 <td>Public method to process the command line args passed to the UI.</td> |
|
77 </tr><tr> |
|
78 <td><a href="#SingleApplicationClient.sendCommand">sendCommand</a></td> |
|
79 <td>Public method to send the command to the application server.</td> |
|
80 </tr> |
|
81 </table> |
|
82 <h3>Static Methods</h3> |
|
83 <table> |
|
84 <tr><td>None</td></tr> |
|
85 </table> |
|
86 <a NAME="SingleApplicationClient.__init__" ID="SingleApplicationClient.__init__"></a> |
|
87 <h4>SingleApplicationClient (Constructor)</h4> |
|
88 <b>SingleApplicationClient</b>(<i>name</i>) |
|
89 <p> |
|
90 Constructor |
|
91 </p><dl> |
|
92 <dt><i>name</i></dt> |
|
93 <dd> |
|
94 name of the local server to connect to (string) |
|
95 </dd> |
|
96 </dl><a NAME="SingleApplicationClient.connect" ID="SingleApplicationClient.connect"></a> |
|
97 <h4>SingleApplicationClient.connect</h4> |
|
98 <b>connect</b>(<i>timeout=10000</i>) |
|
99 <p> |
|
100 Public method to connect the single application client to its server. |
|
101 </p><dl> |
|
102 <dt><i>timeout</i> (int)</dt> |
|
103 <dd> |
|
104 connection timeout value in milliseconds |
|
105 </dd> |
|
106 </dl><dl> |
|
107 <dt>Returns:</dt> |
|
108 <dd> |
|
109 value indicating success or an error number. Value is one of: |
|
110 <table> |
|
111 <tr><td>0</td><td>No application is running</td></tr> |
|
112 <tr><td>1</td><td>Application is already running</td></tr> |
|
113 </table> |
|
114 </dd> |
|
115 </dl><a NAME="SingleApplicationClient.disconnect" ID="SingleApplicationClient.disconnect"></a> |
|
116 <h4>SingleApplicationClient.disconnect</h4> |
|
117 <b>disconnect</b>(<i></i>) |
|
118 <p> |
|
119 Public method to disconnect from the Single Appliocation server. |
|
120 </p><a NAME="SingleApplicationClient.errstr" ID="SingleApplicationClient.errstr"></a> |
|
121 <h4>SingleApplicationClient.errstr</h4> |
|
122 <b>errstr</b>(<i></i>) |
|
123 <p> |
|
124 Public method to return a meaningful error string for the last error. |
|
125 </p><dl> |
|
126 <dt>Returns:</dt> |
|
127 <dd> |
|
128 error string for the last error (string) |
|
129 </dd> |
|
130 </dl><a NAME="SingleApplicationClient.processArgs" ID="SingleApplicationClient.processArgs"></a> |
|
131 <h4>SingleApplicationClient.processArgs</h4> |
|
132 <b>processArgs</b>(<i>args</i>) |
|
133 <p> |
|
134 Public method to process the command line args passed to the UI. |
|
135 </p><p> |
|
136 <b>Note</b>: This method must be overridden by subclasses. |
|
137 </p><dl> |
|
138 <dt><i>args</i></dt> |
|
139 <dd> |
|
140 command line args (list of strings) |
|
141 </dd> |
|
142 </dl><dl> |
|
143 <dt>Raises <b>RuntimeError</b>:</dt> |
|
144 <dd> |
|
145 raised to indicate that this method must be |
|
146 implemented by a subclass |
|
147 </dd> |
|
148 </dl><a NAME="SingleApplicationClient.sendCommand" ID="SingleApplicationClient.sendCommand"></a> |
|
149 <h4>SingleApplicationClient.sendCommand</h4> |
|
150 <b>sendCommand</b>(<i>command, arguments</i>) |
|
151 <p> |
|
152 Public method to send the command to the application server. |
|
153 </p><dl> |
|
154 <dt><i>command</i> (str)</dt> |
|
155 <dd> |
|
156 command to be sent to the server |
|
157 </dd><dt><i>arguments</i> (list of str)</dt> |
|
158 <dd> |
|
159 list of command arguments |
|
160 </dd> |
|
161 </dl> |
|
162 <div align="right"><a href="#top">Up</a></div> |
|
163 <hr /><hr /> |
|
164 <a NAME="SingleApplicationServer" ID="SingleApplicationServer"></a> |
|
165 <h2>SingleApplicationServer</h2> |
|
166 <p> |
|
167 Class implementing the single application server base class. |
|
168 </p> |
|
169 <h3>Derived from</h3> |
|
170 QLocalServer |
|
171 <h3>Class Attributes</h3> |
|
172 <table> |
|
173 <tr><td>None</td></tr> |
|
174 </table> |
|
175 <h3>Class Methods</h3> |
|
176 <table> |
|
177 <tr><td>None</td></tr> |
|
178 </table> |
|
179 <h3>Methods</h3> |
|
180 <table> |
|
181 <tr> |
|
182 <td><a href="#SingleApplicationServer.__init__">SingleApplicationServer</a></td> |
|
183 <td>Constructor</td> |
|
184 </tr><tr> |
|
185 <td><a href="#SingleApplicationServer.__disconnected">__disconnected</a></td> |
|
186 <td>Private method to handle the closure of the socket.</td> |
|
187 </tr><tr> |
|
188 <td><a href="#SingleApplicationServer.__newConnection">__newConnection</a></td> |
|
189 <td>Private slot to handle a new connection.</td> |
|
190 </tr><tr> |
|
191 <td><a href="#SingleApplicationServer.__receiveJson">__receiveJson</a></td> |
|
192 <td>Private method to receive the data from the client.</td> |
|
193 </tr><tr> |
|
194 <td><a href="#SingleApplicationServer.handleCommand">handleCommand</a></td> |
|
195 <td>Public slot to handle the command sent by the client.</td> |
|
196 </tr><tr> |
|
197 <td><a href="#SingleApplicationServer.shutdown">shutdown</a></td> |
|
198 <td>Public method used to shut down the server.</td> |
|
199 </tr> |
|
200 </table> |
|
201 <h3>Static Methods</h3> |
|
202 <table> |
|
203 <tr><td>None</td></tr> |
|
204 </table> |
|
205 <a NAME="SingleApplicationServer.__init__" ID="SingleApplicationServer.__init__"></a> |
|
206 <h4>SingleApplicationServer (Constructor)</h4> |
|
207 <b>SingleApplicationServer</b>(<i>name</i>) |
|
208 <p> |
|
209 Constructor |
|
210 </p><dl> |
|
211 <dt><i>name</i></dt> |
|
212 <dd> |
|
213 name this server is listening to (string) |
|
214 </dd> |
|
215 </dl><a NAME="SingleApplicationServer.__disconnected" ID="SingleApplicationServer.__disconnected"></a> |
|
216 <h4>SingleApplicationServer.__disconnected</h4> |
|
217 <b>__disconnected</b>(<i></i>) |
|
218 <p> |
|
219 Private method to handle the closure of the socket. |
|
220 </p><a NAME="SingleApplicationServer.__newConnection" ID="SingleApplicationServer.__newConnection"></a> |
|
221 <h4>SingleApplicationServer.__newConnection</h4> |
|
222 <b>__newConnection</b>(<i></i>) |
|
223 <p> |
|
224 Private slot to handle a new connection. |
|
225 </p><a NAME="SingleApplicationServer.__receiveJson" ID="SingleApplicationServer.__receiveJson"></a> |
|
226 <h4>SingleApplicationServer.__receiveJson</h4> |
|
227 <b>__receiveJson</b>(<i></i>) |
|
228 <p> |
|
229 Private method to receive the data from the client. |
|
230 </p><a NAME="SingleApplicationServer.handleCommand" ID="SingleApplicationServer.handleCommand"></a> |
|
231 <h4>SingleApplicationServer.handleCommand</h4> |
|
232 <b>handleCommand</b>(<i>command, arguments</i>) |
|
233 <p> |
|
234 Public slot to handle the command sent by the client. |
|
235 </p><p> |
|
236 <b>Note</b>: This method must be overridden by subclasses. |
|
237 </p><dl> |
|
238 <dt><i>command</i> (str)</dt> |
|
239 <dd> |
|
240 command sent by the client |
|
241 </dd><dt><i>arguments</i> (list of str)</dt> |
|
242 <dd> |
|
243 list of command arguments |
|
244 </dd> |
|
245 </dl><dl> |
|
246 <dt>Raises <b>RuntimeError</b>:</dt> |
|
247 <dd> |
|
248 raised to indicate that this method must be |
|
249 implemented by a subclass |
|
250 </dd> |
|
251 </dl><a NAME="SingleApplicationServer.shutdown" ID="SingleApplicationServer.shutdown"></a> |
|
252 <h4>SingleApplicationServer.shutdown</h4> |
|
253 <b>shutdown</b>(<i></i>) |
|
254 <p> |
|
255 Public method used to shut down the server. |
|
256 </p> |
|
257 <div align="right"><a href="#top">Up</a></div> |
|
258 <hr /> |
|
259 </body></html> |