|
1 <!DOCTYPE html> |
|
2 <html><head> |
|
3 <title>eric7.Cooperation.SharedEditorController</title> |
|
4 <meta charset="UTF-8"> |
|
5 <link rel="stylesheet" href="styles.css"> |
|
6 </head> |
|
7 <body> |
|
8 <a NAME="top" ID="top"></a> |
|
9 <h1>eric7.Cooperation.SharedEditorController</h1> |
|
10 <p> |
|
11 Module implementing a controller for shared editing. |
|
12 </p> |
|
13 |
|
14 <h3>Global Attributes</h3> |
|
15 <table> |
|
16 <tr><td>None</td></tr> |
|
17 </table> |
|
18 |
|
19 <h3>Classes</h3> |
|
20 <table> |
|
21 <tr> |
|
22 <td><a href="#SharedEditorController">SharedEditorController</a></td> |
|
23 <td>Class implementing a controller for shared editing.</td> |
|
24 </tr> |
|
25 </table> |
|
26 |
|
27 <h3>Functions</h3> |
|
28 <table> |
|
29 <tr><td>None</td></tr> |
|
30 </table> |
|
31 |
|
32 <hr /> |
|
33 <hr /> |
|
34 <a NAME="SharedEditorController" ID="SharedEditorController"></a> |
|
35 <h2>SharedEditorController</h2> |
|
36 <p> |
|
37 Class implementing a controller for shared editing. |
|
38 </p> |
|
39 |
|
40 <h3>Derived from</h3> |
|
41 QObject |
|
42 <h3>Class Attributes</h3> |
|
43 <table> |
|
44 <tr><td>CancelEditToken</td></tr> |
|
45 <tr><td>EndEditToken</td></tr> |
|
46 <tr><td>RequestSyncToken</td></tr> |
|
47 <tr><td>Separator</td></tr> |
|
48 <tr><td>StartEditToken</td></tr> |
|
49 <tr><td>SyncToken</td></tr> |
|
50 </table> |
|
51 |
|
52 <h3>Class Methods</h3> |
|
53 <table> |
|
54 <tr><td>None</td></tr> |
|
55 </table> |
|
56 |
|
57 <h3>Methods</h3> |
|
58 <table> |
|
59 <tr> |
|
60 <td><a href="#SharedEditorController.__init__">SharedEditorController</a></td> |
|
61 <td>Constructor</td> |
|
62 </tr> |
|
63 <tr> |
|
64 <td><a href="#SharedEditorController.__calculateChanges">__calculateChanges</a></td> |
|
65 <td>Private method to determine change commands to convert old text into new text.</td> |
|
66 </tr> |
|
67 <tr> |
|
68 <td><a href="#SharedEditorController.__cancelSharedEdit">__cancelSharedEdit</a></td> |
|
69 <td>Private method to cancel a shared edit session for the editor.</td> |
|
70 </tr> |
|
71 <tr> |
|
72 <td><a href="#SharedEditorController.__dispatchCommand">__dispatchCommand</a></td> |
|
73 <td>Private method to dispatch received commands.</td> |
|
74 </tr> |
|
75 <tr> |
|
76 <td><a href="#SharedEditorController.__getSharedEditStatus">__getSharedEditStatus</a></td> |
|
77 <td>Private method to get the shared edit status object of a given editor.</td> |
|
78 </tr> |
|
79 <tr> |
|
80 <td><a href="#SharedEditorController.__processEndEditCommand">__processEndEditCommand</a></td> |
|
81 <td>Private method to process a remote EndEdit command.</td> |
|
82 </tr> |
|
83 <tr> |
|
84 <td><a href="#SharedEditorController.__processRequestSyncCommand">__processRequestSyncCommand</a></td> |
|
85 <td>Private method to process a remote RequestSync command.</td> |
|
86 </tr> |
|
87 <tr> |
|
88 <td><a href="#SharedEditorController.__processStartEditCommand">__processStartEditCommand</a></td> |
|
89 <td>Private method to process a remote StartEdit command.</td> |
|
90 </tr> |
|
91 <tr> |
|
92 <td><a href="#SharedEditorController.__processSyncCommand">__processSyncCommand</a></td> |
|
93 <td>Private method to process a remote Sync command.</td> |
|
94 </tr> |
|
95 <tr> |
|
96 <td><a href="#SharedEditorController.__send">__send</a></td> |
|
97 <td>Private method to send an editor command to remote editors.</td> |
|
98 </tr> |
|
99 <tr> |
|
100 <td><a href="#SharedEditorController.__sendSharedEdit">__sendSharedEdit</a></td> |
|
101 <td>Private method to end a shared edit session for the editor and send the changes.</td> |
|
102 </tr> |
|
103 <tr> |
|
104 <td><a href="#SharedEditorController.__shareConnected">__shareConnected</a></td> |
|
105 <td>Private method to handle a change of the connected state.</td> |
|
106 </tr> |
|
107 <tr> |
|
108 <td><a href="#SharedEditorController.__shareEditor">__shareEditor</a></td> |
|
109 <td>Private method to set the shared status of the editor.</td> |
|
110 </tr> |
|
111 <tr> |
|
112 <td><a href="#SharedEditorController.__startSharedEdit">__startSharedEdit</a></td> |
|
113 <td>Private method to start a shared edit session for the editor.</td> |
|
114 </tr> |
|
115 <tr> |
|
116 <td><a href="#SharedEditorController.cancelSharedEdit">cancelSharedEdit</a></td> |
|
117 <td>Public slot to cancel a shared edit session for the current editor.</td> |
|
118 </tr> |
|
119 <tr> |
|
120 <td><a href="#SharedEditorController.getSharingStatus">getSharingStatus</a></td> |
|
121 <td>Public method to get some share status info.</td> |
|
122 </tr> |
|
123 <tr> |
|
124 <td><a href="#SharedEditorController.receiveEditorCommand">receiveEditorCommand</a></td> |
|
125 <td>Public method to handle received editor commands.</td> |
|
126 </tr> |
|
127 <tr> |
|
128 <td><a href="#SharedEditorController.sendSharedEdit">sendSharedEdit</a></td> |
|
129 <td>Public slot to end a shared edit session for the current editor and send the changes.</td> |
|
130 </tr> |
|
131 <tr> |
|
132 <td><a href="#SharedEditorController.shareConnected">shareConnected</a></td> |
|
133 <td>Public slot to handle a change of the connected state.</td> |
|
134 </tr> |
|
135 <tr> |
|
136 <td><a href="#SharedEditorController.shareEditor">shareEditor</a></td> |
|
137 <td>Public slot to set the shared status of the current editor.</td> |
|
138 </tr> |
|
139 <tr> |
|
140 <td><a href="#SharedEditorController.startSharedEdit">startSharedEdit</a></td> |
|
141 <td>Public slot to start a shared edit session for the current editor.</td> |
|
142 </tr> |
|
143 </table> |
|
144 |
|
145 <h3>Static Methods</h3> |
|
146 <table> |
|
147 <tr><td>None</td></tr> |
|
148 </table> |
|
149 |
|
150 |
|
151 <a NAME="SharedEditorController.__init__" ID="SharedEditorController.__init__"></a> |
|
152 <h4>SharedEditorController (Constructor)</h4> |
|
153 <b>SharedEditorController</b>(<i>cooperationClient, chatWidget</i>) |
|
154 <p> |
|
155 Constructor |
|
156 </p> |
|
157 |
|
158 <dl> |
|
159 |
|
160 <dt><i>cooperationClient</i> (CooperationClient)</dt> |
|
161 <dd> |
|
162 reference to the cooperation client object |
|
163 </dd> |
|
164 <dt><i>chatWidget</i> (ChatWidget)</dt> |
|
165 <dd> |
|
166 reference to the main cooperation widget |
|
167 </dd> |
|
168 </dl> |
|
169 <a NAME="SharedEditorController.__calculateChanges" ID="SharedEditorController.__calculateChanges"></a> |
|
170 <h4>SharedEditorController.__calculateChanges</h4> |
|
171 <b>__calculateChanges</b>(<i>old, new</i>) |
|
172 <p> |
|
173 Private method to determine change commands to convert old text into |
|
174 new text. |
|
175 </p> |
|
176 |
|
177 <dl> |
|
178 |
|
179 <dt><i>old</i> (str)</dt> |
|
180 <dd> |
|
181 old text |
|
182 </dd> |
|
183 <dt><i>new</i> (str)</dt> |
|
184 <dd> |
|
185 new text |
|
186 </dd> |
|
187 </dl> |
|
188 <dl> |
|
189 <dt>Return:</dt> |
|
190 <dd> |
|
191 commands to change old into new |
|
192 </dd> |
|
193 </dl> |
|
194 <dl> |
|
195 <dt>Return Type:</dt> |
|
196 <dd> |
|
197 str |
|
198 </dd> |
|
199 </dl> |
|
200 <a NAME="SharedEditorController.__cancelSharedEdit" ID="SharedEditorController.__cancelSharedEdit"></a> |
|
201 <h4>SharedEditorController.__cancelSharedEdit</h4> |
|
202 <b>__cancelSharedEdit</b>(<i>editor, send=True</i>) |
|
203 <p> |
|
204 Private method to cancel a shared edit session for the editor. |
|
205 </p> |
|
206 |
|
207 <dl> |
|
208 |
|
209 <dt><i>editor</i> (Editor)</dt> |
|
210 <dd> |
|
211 reference to the editor object |
|
212 </dd> |
|
213 <dt><i>send</i> (bool)</dt> |
|
214 <dd> |
|
215 flag indicating to send the CancelEdit command |
|
216 </dd> |
|
217 </dl> |
|
218 <a NAME="SharedEditorController.__dispatchCommand" ID="SharedEditorController.__dispatchCommand"></a> |
|
219 <h4>SharedEditorController.__dispatchCommand</h4> |
|
220 <b>__dispatchCommand</b>(<i>editor, command</i>) |
|
221 <p> |
|
222 Private method to dispatch received commands. |
|
223 </p> |
|
224 |
|
225 <dl> |
|
226 |
|
227 <dt><i>editor</i> (Editor)</dt> |
|
228 <dd> |
|
229 reference to the edior object |
|
230 </dd> |
|
231 <dt><i>command</i> (str)</dt> |
|
232 <dd> |
|
233 command to be processed |
|
234 </dd> |
|
235 </dl> |
|
236 <a NAME="SharedEditorController.__getSharedEditStatus" ID="SharedEditorController.__getSharedEditStatus"></a> |
|
237 <h4>SharedEditorController.__getSharedEditStatus</h4> |
|
238 <b>__getSharedEditStatus</b>(<i>editor</i>) |
|
239 <p> |
|
240 Private method to get the shared edit status object of a given editor. |
|
241 </p> |
|
242 <p> |
|
243 If the editor does not have such an object, a default one is created and |
|
244 set for the editor. |
|
245 </p> |
|
246 |
|
247 <dl> |
|
248 |
|
249 <dt><i>editor</i> (Editor)</dt> |
|
250 <dd> |
|
251 reference to the editor object |
|
252 </dd> |
|
253 </dl> |
|
254 <dl> |
|
255 <dt>Return:</dt> |
|
256 <dd> |
|
257 reference to the shared edit status |
|
258 </dd> |
|
259 </dl> |
|
260 <dl> |
|
261 <dt>Return Type:</dt> |
|
262 <dd> |
|
263 SharedEditStatus |
|
264 </dd> |
|
265 </dl> |
|
266 <a NAME="SharedEditorController.__processEndEditCommand" ID="SharedEditorController.__processEndEditCommand"></a> |
|
267 <h4>SharedEditorController.__processEndEditCommand</h4> |
|
268 <b>__processEndEditCommand</b>(<i>editor, argsString</i>) |
|
269 <p> |
|
270 Private method to process a remote EndEdit command. |
|
271 </p> |
|
272 |
|
273 <dl> |
|
274 |
|
275 <dt><i>editor</i> (Editor)</dt> |
|
276 <dd> |
|
277 reference to the editor object |
|
278 </dd> |
|
279 <dt><i>argsString</i> (str)</dt> |
|
280 <dd> |
|
281 string containing the command parameters |
|
282 </dd> |
|
283 </dl> |
|
284 <a NAME="SharedEditorController.__processRequestSyncCommand" ID="SharedEditorController.__processRequestSyncCommand"></a> |
|
285 <h4>SharedEditorController.__processRequestSyncCommand</h4> |
|
286 <b>__processRequestSyncCommand</b>(<i>editor, argsString</i>) |
|
287 <p> |
|
288 Private method to process a remote RequestSync command. |
|
289 </p> |
|
290 |
|
291 <dl> |
|
292 |
|
293 <dt><i>editor</i> (Editor)</dt> |
|
294 <dd> |
|
295 reference to the editor object |
|
296 </dd> |
|
297 <dt><i>argsString</i> (str)</dt> |
|
298 <dd> |
|
299 string containing the command parameters |
|
300 </dd> |
|
301 </dl> |
|
302 <a NAME="SharedEditorController.__processStartEditCommand" ID="SharedEditorController.__processStartEditCommand"></a> |
|
303 <h4>SharedEditorController.__processStartEditCommand</h4> |
|
304 <b>__processStartEditCommand</b>(<i>editor, argsString</i>) |
|
305 <p> |
|
306 Private method to process a remote StartEdit command. |
|
307 </p> |
|
308 |
|
309 <dl> |
|
310 |
|
311 <dt><i>editor</i> (Editor)</dt> |
|
312 <dd> |
|
313 reference to the editor object |
|
314 </dd> |
|
315 <dt><i>argsString</i> (str)</dt> |
|
316 <dd> |
|
317 string containing the command parameters |
|
318 </dd> |
|
319 </dl> |
|
320 <a NAME="SharedEditorController.__processSyncCommand" ID="SharedEditorController.__processSyncCommand"></a> |
|
321 <h4>SharedEditorController.__processSyncCommand</h4> |
|
322 <b>__processSyncCommand</b>(<i>editor, argsString</i>) |
|
323 <p> |
|
324 Private method to process a remote Sync command. |
|
325 </p> |
|
326 |
|
327 <dl> |
|
328 |
|
329 <dt><i>editor</i> (Editor)</dt> |
|
330 <dd> |
|
331 reference to the editor object |
|
332 </dd> |
|
333 <dt><i>argsString</i> (str)</dt> |
|
334 <dd> |
|
335 string containing the command parameters |
|
336 </dd> |
|
337 </dl> |
|
338 <a NAME="SharedEditorController.__send" ID="SharedEditorController.__send"></a> |
|
339 <h4>SharedEditorController.__send</h4> |
|
340 <b>__send</b>(<i>editor, editToken, args=None</i>) |
|
341 <p> |
|
342 Private method to send an editor command to remote editors. |
|
343 </p> |
|
344 |
|
345 <dl> |
|
346 |
|
347 <dt><i>editor</i> (Editor)</dt> |
|
348 <dd> |
|
349 reference to the editor object |
|
350 </dd> |
|
351 <dt><i>editToken</i> (str)</dt> |
|
352 <dd> |
|
353 edit command token |
|
354 </dd> |
|
355 <dt><i>args</i> (str)</dt> |
|
356 <dd> |
|
357 arguments for the command |
|
358 </dd> |
|
359 </dl> |
|
360 <a NAME="SharedEditorController.__sendSharedEdit" ID="SharedEditorController.__sendSharedEdit"></a> |
|
361 <h4>SharedEditorController.__sendSharedEdit</h4> |
|
362 <b>__sendSharedEdit</b>(<i>editor</i>) |
|
363 <p> |
|
364 Private method to end a shared edit session for the editor and |
|
365 send the changes. |
|
366 </p> |
|
367 |
|
368 <dl> |
|
369 |
|
370 <dt><i>editor</i> (Editor)</dt> |
|
371 <dd> |
|
372 reference to the editor object |
|
373 </dd> |
|
374 </dl> |
|
375 <a NAME="SharedEditorController.__shareConnected" ID="SharedEditorController.__shareConnected"></a> |
|
376 <h4>SharedEditorController.__shareConnected</h4> |
|
377 <b>__shareConnected</b>(<i>editor, connected</i>) |
|
378 <p> |
|
379 Private method to handle a change of the connected state. |
|
380 </p> |
|
381 |
|
382 <dl> |
|
383 |
|
384 <dt><i>editor</i> (Editor)</dt> |
|
385 <dd> |
|
386 reference to the editor object |
|
387 </dd> |
|
388 <dt><i>connected</i> (bool)</dt> |
|
389 <dd> |
|
390 flag indicating the connected state |
|
391 </dd> |
|
392 </dl> |
|
393 <a NAME="SharedEditorController.__shareEditor" ID="SharedEditorController.__shareEditor"></a> |
|
394 <h4>SharedEditorController.__shareEditor</h4> |
|
395 <b>__shareEditor</b>(<i>editor, share</i>) |
|
396 <p> |
|
397 Private method to set the shared status of the editor. |
|
398 </p> |
|
399 |
|
400 <dl> |
|
401 |
|
402 <dt><i>editor</i> (Editor)</dt> |
|
403 <dd> |
|
404 reference to the editor object |
|
405 </dd> |
|
406 <dt><i>share</i> (bool)</dt> |
|
407 <dd> |
|
408 flag indicating the share status |
|
409 </dd> |
|
410 </dl> |
|
411 <a NAME="SharedEditorController.__startSharedEdit" ID="SharedEditorController.__startSharedEdit"></a> |
|
412 <h4>SharedEditorController.__startSharedEdit</h4> |
|
413 <b>__startSharedEdit</b>(<i>editor</i>) |
|
414 <p> |
|
415 Private method to start a shared edit session for the editor. |
|
416 </p> |
|
417 |
|
418 <dl> |
|
419 |
|
420 <dt><i>editor</i> (Editor)</dt> |
|
421 <dd> |
|
422 reference to the editor object |
|
423 </dd> |
|
424 </dl> |
|
425 <a NAME="SharedEditorController.cancelSharedEdit" ID="SharedEditorController.cancelSharedEdit"></a> |
|
426 <h4>SharedEditorController.cancelSharedEdit</h4> |
|
427 <b>cancelSharedEdit</b>(<i></i>) |
|
428 <p> |
|
429 Public slot to cancel a shared edit session for the current editor. |
|
430 </p> |
|
431 |
|
432 <a NAME="SharedEditorController.getSharingStatus" ID="SharedEditorController.getSharingStatus"></a> |
|
433 <h4>SharedEditorController.getSharingStatus</h4> |
|
434 <b>getSharingStatus</b>(<i>editor</i>) |
|
435 <p> |
|
436 Public method to get some share status info. |
|
437 </p> |
|
438 |
|
439 <dl> |
|
440 |
|
441 <dt><i>editor</i> (Editor)</dt> |
|
442 <dd> |
|
443 reference to the editor object |
|
444 </dd> |
|
445 </dl> |
|
446 <dl> |
|
447 <dt>Return:</dt> |
|
448 <dd> |
|
449 tuple indicating, if the editor is sharable, the sharing |
|
450 status, if it is inside a locally initiated shared edit session |
|
451 and if it is inside a remotely initiated shared edit session |
|
452 </dd> |
|
453 </dl> |
|
454 <dl> |
|
455 <dt>Return Type:</dt> |
|
456 <dd> |
|
457 tuple of (bool, bool, bool, bool) |
|
458 </dd> |
|
459 </dl> |
|
460 <a NAME="SharedEditorController.receiveEditorCommand" ID="SharedEditorController.receiveEditorCommand"></a> |
|
461 <h4>SharedEditorController.receiveEditorCommand</h4> |
|
462 <b>receiveEditorCommand</b>(<i>projectHash, fileName, command</i>) |
|
463 <p> |
|
464 Public method to handle received editor commands. |
|
465 </p> |
|
466 |
|
467 <dl> |
|
468 |
|
469 <dt><i>projectHash</i> (str)</dt> |
|
470 <dd> |
|
471 hash of the project |
|
472 </dd> |
|
473 <dt><i>fileName</i> (str)</dt> |
|
474 <dd> |
|
475 project relative file name of the editor |
|
476 </dd> |
|
477 <dt><i>command</i> (str)</dt> |
|
478 <dd> |
|
479 command string |
|
480 </dd> |
|
481 </dl> |
|
482 <a NAME="SharedEditorController.sendSharedEdit" ID="SharedEditorController.sendSharedEdit"></a> |
|
483 <h4>SharedEditorController.sendSharedEdit</h4> |
|
484 <b>sendSharedEdit</b>(<i></i>) |
|
485 <p> |
|
486 Public slot to end a shared edit session for the current editor and |
|
487 send the changes. |
|
488 </p> |
|
489 |
|
490 <a NAME="SharedEditorController.shareConnected" ID="SharedEditorController.shareConnected"></a> |
|
491 <h4>SharedEditorController.shareConnected</h4> |
|
492 <b>shareConnected</b>(<i>connected</i>) |
|
493 <p> |
|
494 Public slot to handle a change of the connected state. |
|
495 </p> |
|
496 |
|
497 <dl> |
|
498 |
|
499 <dt><i>connected</i> (bool)</dt> |
|
500 <dd> |
|
501 flag indicating the connected state |
|
502 </dd> |
|
503 </dl> |
|
504 <a NAME="SharedEditorController.shareEditor" ID="SharedEditorController.shareEditor"></a> |
|
505 <h4>SharedEditorController.shareEditor</h4> |
|
506 <b>shareEditor</b>(<i>share</i>) |
|
507 <p> |
|
508 Public slot to set the shared status of the current editor. |
|
509 </p> |
|
510 |
|
511 <dl> |
|
512 |
|
513 <dt><i>share</i> (bool)</dt> |
|
514 <dd> |
|
515 flag indicating the share status |
|
516 </dd> |
|
517 </dl> |
|
518 <a NAME="SharedEditorController.startSharedEdit" ID="SharedEditorController.startSharedEdit"></a> |
|
519 <h4>SharedEditorController.startSharedEdit</h4> |
|
520 <b>startSharedEdit</b>(<i></i>) |
|
521 <p> |
|
522 Public slot to start a shared edit session for the current editor. |
|
523 </p> |
|
524 |
|
525 <div align="right"><a href="#top">Up</a></div> |
|
526 <hr /> |
|
527 </body></html> |