eric7/Documentation/Source/eric7.WebBrowser.Session.SessionManager.html

branch
eric7
changeset 8372
e0227a7c850e
child 8596
d64760b2da50
equal deleted inserted replaced
8371:d6062691d424 8372:e0227a7c850e
1 <!DOCTYPE html>
2 <html><head>
3 <title>eric7.WebBrowser.Session.SessionManager</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>
22 <a NAME="top" ID="top"></a>
23 <h1>eric7.WebBrowser.Session.SessionManager</h1>
24
25 <p>
26 Module implementing the session manager.
27 </p>
28 <h3>Global Attributes</h3>
29
30 <table>
31 <tr><td>None</td></tr>
32 </table>
33 <h3>Classes</h3>
34
35 <table>
36
37 <tr>
38 <td><a href="#SessionManager">SessionManager</a></td>
39 <td>Class implementing the session manager.</td>
40 </tr>
41 <tr>
42 <td><a href="#SessionMetaData">SessionMetaData</a></td>
43 <td>Class implementing a data structure to store meta data for a session.</td>
44 </tr>
45 </table>
46 <h3>Functions</h3>
47
48 <table>
49 <tr><td>None</td></tr>
50 </table>
51 <hr />
52 <hr />
53 <a NAME="SessionManager" ID="SessionManager"></a>
54 <h2>SessionManager</h2>
55
56 <p>
57 Class implementing the session manager.
58 </p>
59 <h3>Signals</h3>
60 <dl>
61
62 <dt>sessionsMetaDataChanged()</dt>
63 <dd>
64 emitted to indicate a change of the
65 list of session meta data
66 </dd>
67 </dl>
68 <h3>Derived from</h3>
69 QObject
70 <h3>Class Attributes</h3>
71
72 <table>
73 <tr><td>CloneSession</td></tr><tr><td>ReplaceSession</td></tr><tr><td>RestoreSession</td></tr><tr><td>SwitchSession</td></tr>
74 </table>
75 <h3>Class Methods</h3>
76
77 <table>
78
79 <tr>
80 <td><a href="#SessionManager.isValidSession">isValidSession</a></td>
81 <td>Class method to check the validity of a session.</td>
82 </tr>
83 <tr>
84 <td><a href="#SessionManager.readSessionFromFile">readSessionFromFile</a></td>
85 <td>Class method to read the session data from a file.</td>
86 </tr>
87 <tr>
88 <td><a href="#SessionManager.restoreSessionFromData">restoreSessionFromData</a></td>
89 <td>Class method to restore a session from a session data dictionary.</td>
90 </tr>
91 </table>
92 <h3>Methods</h3>
93
94 <table>
95
96 <tr>
97 <td><a href="#SessionManager.__init__">SessionManager</a></td>
98 <td>Constructor</td>
99 </tr>
100 <tr>
101 <td><a href="#SessionManager.__autoSaveSession">__autoSaveSession</a></td>
102 <td>Private slot to save the current session state.</td>
103 </tr>
104 <tr>
105 <td><a href="#SessionManager.__backupSavedSession">__backupSavedSession</a></td>
106 <td>Private method to backup the most recently saved session.</td>
107 </tr>
108 <tr>
109 <td><a href="#SessionManager.__fillMetaDataList">__fillMetaDataList</a></td>
110 <td>Private method to fill the sessions meta data list.</td>
111 </tr>
112 <tr>
113 <td><a href="#SessionManager.__initSessionSaveTimer">__initSessionSaveTimer</a></td>
114 <td>Private slot to initialize the auto save timer.</td>
115 </tr>
116 <tr>
117 <td><a href="#SessionManager.__isActive">__isActive</a></td>
118 <td>Private method to check, if a given file is the active one.</td>
119 </tr>
120 <tr>
121 <td><a href="#SessionManager.__sessionActTriggered">__sessionActTriggered</a></td>
122 <td>Private slot to handle the menu selection of a session.</td>
123 </tr>
124 <tr>
125 <td><a href="#SessionManager.__sessionDirectoryChanged">__sessionDirectoryChanged</a></td>
126 <td>Private slot handling changes of the sessions directory.</td>
127 </tr>
128 <tr>
129 <td><a href="#SessionManager.aboutToShowSessionsMenu">aboutToShowSessionsMenu</a></td>
130 <td>Public slot to populate the sessions selection menu.</td>
131 </tr>
132 <tr>
133 <td><a href="#SessionManager.activateTimer">activateTimer</a></td>
134 <td>Public method to activate the session save timer.</td>
135 </tr>
136 <tr>
137 <td><a href="#SessionManager.autoSaveSession">autoSaveSession</a></td>
138 <td>Public method to save the current session state.</td>
139 </tr>
140 <tr>
141 <td><a href="#SessionManager.cloneSession">cloneSession</a></td>
142 <td>Public method to clone a session.</td>
143 </tr>
144 <tr>
145 <td><a href="#SessionManager.defaultSessionFile">defaultSessionFile</a></td>
146 <td>Public method to get the name of the default session file.</td>
147 </tr>
148 <tr>
149 <td><a href="#SessionManager.deleteSession">deleteSession</a></td>
150 <td>Public method to delete a session.</td>
151 </tr>
152 <tr>
153 <td><a href="#SessionManager.getSessionsDirectory">getSessionsDirectory</a></td>
154 <td>Public method to get the directory sessions are stored in.</td>
155 </tr>
156 <tr>
157 <td><a href="#SessionManager.lastActiveSessionFile">lastActiveSessionFile</a></td>
158 <td>Public method to get the name of the last active session file.</td>
159 </tr>
160 <tr>
161 <td><a href="#SessionManager.newSession">newSession</a></td>
162 <td>Public method to start a new session.</td>
163 </tr>
164 <tr>
165 <td><a href="#SessionManager.openSession">openSession</a></td>
166 <td>Public method to open a session from a given session file.</td>
167 </tr>
168 <tr>
169 <td><a href="#SessionManager.preferencesChanged">preferencesChanged</a></td>
170 <td>Public slot to react upon changes of the settings.</td>
171 </tr>
172 <tr>
173 <td><a href="#SessionManager.renameSession">renameSession</a></td>
174 <td>Public method to rename or clone a session.</td>
175 </tr>
176 <tr>
177 <td><a href="#SessionManager.replaceSession">replaceSession</a></td>
178 <td>Public method to replace the current session with the given one.</td>
179 </tr>
180 <tr>
181 <td><a href="#SessionManager.saveSession">saveSession</a></td>
182 <td>Public method to save the current session.</td>
183 </tr>
184 <tr>
185 <td><a href="#SessionManager.selectSession">selectSession</a></td>
186 <td>Public method to select a session to be restored.</td>
187 </tr>
188 <tr>
189 <td><a href="#SessionManager.sessionMetaData">sessionMetaData</a></td>
190 <td>Public method to get the sessions meta data.</td>
191 </tr>
192 <tr>
193 <td><a href="#SessionManager.showSessionManagerDialog">showSessionManagerDialog</a></td>
194 <td>Public method to show the session manager dialog.</td>
195 </tr>
196 <tr>
197 <td><a href="#SessionManager.shutdown">shutdown</a></td>
198 <td>Public method to perform any shutdown actions.</td>
199 </tr>
200 <tr>
201 <td><a href="#SessionManager.switchToSession">switchToSession</a></td>
202 <td>Public method to switch the current session to the given one.</td>
203 </tr>
204 <tr>
205 <td><a href="#SessionManager.writeCurrentSession">writeCurrentSession</a></td>
206 <td>Public method to write the current session to the given file name.</td>
207 </tr>
208 </table>
209 <h3>Static Methods</h3>
210
211 <table>
212 <tr><td>None</td></tr>
213 </table>
214
215 <a NAME="SessionManager.isValidSession" ID="SessionManager.isValidSession"></a>
216 <h4>SessionManager.isValidSession (class method)</h4>
217 <b>isValidSession</b>(<i>session</i>)
218
219 <p>
220 Class method to check the validity of a session.
221 </p>
222 <dl>
223
224 <dt><i>session</i> (dict)</dt>
225 <dd>
226 dictionary containing the session data
227 </dd>
228 </dl>
229 <dl>
230 <dt>Return:</dt>
231 <dd>
232 flag indicating validity
233 </dd>
234 </dl>
235 <dl>
236 <dt>Return Type:</dt>
237 <dd>
238 bool
239 </dd>
240 </dl>
241 <a NAME="SessionManager.readSessionFromFile" ID="SessionManager.readSessionFromFile"></a>
242 <h4>SessionManager.readSessionFromFile (class method)</h4>
243 <b>readSessionFromFile</b>(<i>sessionFileName</i>)
244
245 <p>
246 Class method to read the session data from a file.
247 </p>
248 <dl>
249
250 <dt><i>sessionFileName</i> (str)</dt>
251 <dd>
252 file name of the session file
253 </dd>
254 </dl>
255 <dl>
256 <dt>Return:</dt>
257 <dd>
258 dictionary containing the session data
259 </dd>
260 </dl>
261 <dl>
262 <dt>Return Type:</dt>
263 <dd>
264 dict
265 </dd>
266 </dl>
267 <a NAME="SessionManager.restoreSessionFromData" ID="SessionManager.restoreSessionFromData"></a>
268 <h4>SessionManager.restoreSessionFromData (class method)</h4>
269 <b>restoreSessionFromData</b>(<i>window=None, sessionData=None</i>)
270
271 <p>
272 Class method to restore a session from a session data dictionary.
273 </p>
274 <dl>
275
276 <dt><i>window</i> (WebBrowserWindow)</dt>
277 <dd>
278 reference to main window to restore to
279 </dd>
280 <dt><i>sessionData</i></dt>
281 <dd>
282 dictionary containing the session data
283 </dd>
284 </dl>
285 <a NAME="SessionManager.__init__" ID="SessionManager.__init__"></a>
286 <h4>SessionManager (Constructor)</h4>
287 <b>SessionManager</b>(<i>parent=None</i>)
288
289 <p>
290 Constructor
291 </p>
292 <dl>
293
294 <dt><i>parent</i> (QObject)</dt>
295 <dd>
296 reference to the parent object
297 </dd>
298 </dl>
299 <a NAME="SessionManager.__autoSaveSession" ID="SessionManager.__autoSaveSession"></a>
300 <h4>SessionManager.__autoSaveSession</h4>
301 <b>__autoSaveSession</b>(<i>startTimer=True</i>)
302
303 <p>
304 Private slot to save the current session state.
305 </p>
306 <dl>
307
308 <dt><i>startTimer</i> (bool)</dt>
309 <dd>
310 flag indicating to restart the timer
311 </dd>
312 </dl>
313 <a NAME="SessionManager.__backupSavedSession" ID="SessionManager.__backupSavedSession"></a>
314 <h4>SessionManager.__backupSavedSession</h4>
315 <b>__backupSavedSession</b>(<i></i>)
316
317 <p>
318 Private method to backup the most recently saved session.
319 </p>
320 <a NAME="SessionManager.__fillMetaDataList" ID="SessionManager.__fillMetaDataList"></a>
321 <h4>SessionManager.__fillMetaDataList</h4>
322 <b>__fillMetaDataList</b>(<i></i>)
323
324 <p>
325 Private method to fill the sessions meta data list.
326 </p>
327 <p>
328 The sessions meta data list is only populated, if the variable holding
329 it is empty (i.e. it is populated on demand).
330 </p>
331 <a NAME="SessionManager.__initSessionSaveTimer" ID="SessionManager.__initSessionSaveTimer"></a>
332 <h4>SessionManager.__initSessionSaveTimer</h4>
333 <b>__initSessionSaveTimer</b>(<i></i>)
334
335 <p>
336 Private slot to initialize the auto save timer.
337 </p>
338 <a NAME="SessionManager.__isActive" ID="SessionManager.__isActive"></a>
339 <h4>SessionManager.__isActive</h4>
340 <b>__isActive</b>(<i>filePath</i>)
341
342 <p>
343 Private method to check, if a given file is the active one.
344 </p>
345 <dl>
346
347 <dt><i>filePath</i> (str or QFileInfo)</dt>
348 <dd>
349 path of the session file to be checked
350 </dd>
351 </dl>
352 <dl>
353 <dt>Return:</dt>
354 <dd>
355 flag indicating the active file
356 </dd>
357 </dl>
358 <dl>
359 <dt>Return Type:</dt>
360 <dd>
361 bool
362 </dd>
363 </dl>
364 <a NAME="SessionManager.__sessionActTriggered" ID="SessionManager.__sessionActTriggered"></a>
365 <h4>SessionManager.__sessionActTriggered</h4>
366 <b>__sessionActTriggered</b>(<i>act</i>)
367
368 <p>
369 Private slot to handle the menu selection of a session.
370 </p>
371 <dl>
372
373 <dt><i>act</i> (QAction)</dt>
374 <dd>
375 reference to the action that triggered
376 </dd>
377 </dl>
378 <a NAME="SessionManager.__sessionDirectoryChanged" ID="SessionManager.__sessionDirectoryChanged"></a>
379 <h4>SessionManager.__sessionDirectoryChanged</h4>
380 <b>__sessionDirectoryChanged</b>(<i></i>)
381
382 <p>
383 Private slot handling changes of the sessions directory.
384 </p>
385 <a NAME="SessionManager.aboutToShowSessionsMenu" ID="SessionManager.aboutToShowSessionsMenu"></a>
386 <h4>SessionManager.aboutToShowSessionsMenu</h4>
387 <b>aboutToShowSessionsMenu</b>(<i>menu</i>)
388
389 <p>
390 Public slot to populate the sessions selection menu.
391 </p>
392 <dl>
393
394 <dt><i>menu</i> (QMenu)</dt>
395 <dd>
396 reference to the menu about to be shown
397 </dd>
398 </dl>
399 <a NAME="SessionManager.activateTimer" ID="SessionManager.activateTimer"></a>
400 <h4>SessionManager.activateTimer</h4>
401 <b>activateTimer</b>(<i></i>)
402
403 <p>
404 Public method to activate the session save timer.
405 </p>
406 <a NAME="SessionManager.autoSaveSession" ID="SessionManager.autoSaveSession"></a>
407 <h4>SessionManager.autoSaveSession</h4>
408 <b>autoSaveSession</b>(<i></i>)
409
410 <p>
411 Public method to save the current session state.
412 </p>
413 <a NAME="SessionManager.cloneSession" ID="SessionManager.cloneSession"></a>
414 <h4>SessionManager.cloneSession</h4>
415 <b>cloneSession</b>(<i>sessionFilePath</i>)
416
417 <p>
418 Public method to clone a session.
419 </p>
420 <dl>
421
422 <dt><i>sessionFilePath</i> (str)</dt>
423 <dd>
424 file name of the session file to be cloned
425 </dd>
426 </dl>
427 <a NAME="SessionManager.defaultSessionFile" ID="SessionManager.defaultSessionFile"></a>
428 <h4>SessionManager.defaultSessionFile</h4>
429 <b>defaultSessionFile</b>(<i></i>)
430
431 <p>
432 Public method to get the name of the default session file.
433 </p>
434 <dl>
435 <dt>Return:</dt>
436 <dd>
437 name of the default session file
438 </dd>
439 </dl>
440 <dl>
441 <dt>Return Type:</dt>
442 <dd>
443 str
444 </dd>
445 </dl>
446 <a NAME="SessionManager.deleteSession" ID="SessionManager.deleteSession"></a>
447 <h4>SessionManager.deleteSession</h4>
448 <b>deleteSession</b>(<i>sessionFilePath</i>)
449
450 <p>
451 Public method to delete a session.
452 </p>
453 <dl>
454
455 <dt><i>sessionFilePath</i> (str)</dt>
456 <dd>
457 file name of the session file to be deleted
458 </dd>
459 </dl>
460 <a NAME="SessionManager.getSessionsDirectory" ID="SessionManager.getSessionsDirectory"></a>
461 <h4>SessionManager.getSessionsDirectory</h4>
462 <b>getSessionsDirectory</b>(<i></i>)
463
464 <p>
465 Public method to get the directory sessions are stored in.
466 </p>
467 <dl>
468 <dt>Return:</dt>
469 <dd>
470 name of the sessions directory
471 </dd>
472 </dl>
473 <dl>
474 <dt>Return Type:</dt>
475 <dd>
476 str
477 </dd>
478 </dl>
479 <a NAME="SessionManager.lastActiveSessionFile" ID="SessionManager.lastActiveSessionFile"></a>
480 <h4>SessionManager.lastActiveSessionFile</h4>
481 <b>lastActiveSessionFile</b>(<i></i>)
482
483 <p>
484 Public method to get the name of the last active session file.
485 </p>
486 <dl>
487 <dt>Return:</dt>
488 <dd>
489 name of the last active session file
490 </dd>
491 </dl>
492 <dl>
493 <dt>Return Type:</dt>
494 <dd>
495 str
496 </dd>
497 </dl>
498 <a NAME="SessionManager.newSession" ID="SessionManager.newSession"></a>
499 <h4>SessionManager.newSession</h4>
500 <b>newSession</b>(<i></i>)
501
502 <p>
503 Public method to start a new session.
504 </p>
505 <a NAME="SessionManager.openSession" ID="SessionManager.openSession"></a>
506 <h4>SessionManager.openSession</h4>
507 <b>openSession</b>(<i>sessionFilePath, flags=0</i>)
508
509 <p>
510 Public method to open a session from a given session file.
511 </p>
512 <dl>
513
514 <dt><i>sessionFilePath</i> (str)</dt>
515 <dd>
516 name of the session file to get session from
517 </dd>
518 <dt><i>flags</i> (int)</dt>
519 <dd>
520 flags determining the open mode
521 </dd>
522 </dl>
523 <a NAME="SessionManager.preferencesChanged" ID="SessionManager.preferencesChanged"></a>
524 <h4>SessionManager.preferencesChanged</h4>
525 <b>preferencesChanged</b>(<i></i>)
526
527 <p>
528 Public slot to react upon changes of the settings.
529 </p>
530 <a NAME="SessionManager.renameSession" ID="SessionManager.renameSession"></a>
531 <h4>SessionManager.renameSession</h4>
532 <b>renameSession</b>(<i>sessionFilePath, flags=0</i>)
533
534 <p>
535 Public method to rename or clone a session.
536 </p>
537 <dl>
538
539 <dt><i>sessionFilePath</i> (str)</dt>
540 <dd>
541 name of the session file
542 </dd>
543 <dt><i>flags</i> (int)</dt>
544 <dd>
545 flags determining a rename or clone operation
546 </dd>
547 </dl>
548 <a NAME="SessionManager.replaceSession" ID="SessionManager.replaceSession"></a>
549 <h4>SessionManager.replaceSession</h4>
550 <b>replaceSession</b>(<i>sessionFilePath</i>)
551
552 <p>
553 Public method to replace the current session with the given one.
554 </p>
555 <dl>
556
557 <dt><i>sessionFilePath</i> (str)</dt>
558 <dd>
559 file name of the session file to replace with
560 </dd>
561 </dl>
562 <dl>
563 <dt>Return:</dt>
564 <dd>
565 flag indicating success
566 </dd>
567 </dl>
568 <dl>
569 <dt>Return Type:</dt>
570 <dd>
571 bool
572 </dd>
573 </dl>
574 <a NAME="SessionManager.saveSession" ID="SessionManager.saveSession"></a>
575 <h4>SessionManager.saveSession</h4>
576 <b>saveSession</b>(<i></i>)
577
578 <p>
579 Public method to save the current session.
580 </p>
581 <a NAME="SessionManager.selectSession" ID="SessionManager.selectSession"></a>
582 <h4>SessionManager.selectSession</h4>
583 <b>selectSession</b>(<i></i>)
584
585 <p>
586 Public method to select a session to be restored.
587 </p>
588 <dl>
589 <dt>Return:</dt>
590 <dd>
591 name of the session file to be restored
592 </dd>
593 </dl>
594 <dl>
595 <dt>Return Type:</dt>
596 <dd>
597 str
598 </dd>
599 </dl>
600 <a NAME="SessionManager.sessionMetaData" ID="SessionManager.sessionMetaData"></a>
601 <h4>SessionManager.sessionMetaData</h4>
602 <b>sessionMetaData</b>(<i>includeBackups=False</i>)
603
604 <p>
605 Public method to get the sessions meta data.
606 </p>
607 <dl>
608
609 <dt><i>includeBackups</i> (bool)</dt>
610 <dd>
611 flag indicating to include backup sessions
612 </dd>
613 </dl>
614 <dl>
615 <dt>Return:</dt>
616 <dd>
617 list of session meta data
618 </dd>
619 </dl>
620 <dl>
621 <dt>Return Type:</dt>
622 <dd>
623 list of SessionMetaData
624 </dd>
625 </dl>
626 <a NAME="SessionManager.showSessionManagerDialog" ID="SessionManager.showSessionManagerDialog"></a>
627 <h4>SessionManager.showSessionManagerDialog</h4>
628 <b>showSessionManagerDialog</b>(<i></i>)
629
630 <p>
631 Public method to show the session manager dialog.
632 </p>
633 <a NAME="SessionManager.shutdown" ID="SessionManager.shutdown"></a>
634 <h4>SessionManager.shutdown</h4>
635 <b>shutdown</b>(<i></i>)
636
637 <p>
638 Public method to perform any shutdown actions.
639 </p>
640 <a NAME="SessionManager.switchToSession" ID="SessionManager.switchToSession"></a>
641 <h4>SessionManager.switchToSession</h4>
642 <b>switchToSession</b>(<i>sessionFilePath</i>)
643
644 <p>
645 Public method to switch the current session to the given one.
646 </p>
647 <dl>
648
649 <dt><i>sessionFilePath</i> (str)</dt>
650 <dd>
651 file name of the session file to switch to
652 </dd>
653 </dl>
654 <dl>
655 <dt>Return:</dt>
656 <dd>
657 flag indicating success
658 </dd>
659 </dl>
660 <dl>
661 <dt>Return Type:</dt>
662 <dd>
663 bool
664 </dd>
665 </dl>
666 <a NAME="SessionManager.writeCurrentSession" ID="SessionManager.writeCurrentSession"></a>
667 <h4>SessionManager.writeCurrentSession</h4>
668 <b>writeCurrentSession</b>(<i>sessionFileName</i>)
669
670 <p>
671 Public method to write the current session to the given file name.
672 </p>
673 <dl>
674
675 <dt><i>sessionFileName</i> (str)</dt>
676 <dd>
677 file name of the session
678 </dd>
679 </dl>
680 <div align="right"><a href="#top">Up</a></div>
681 <hr />
682 <hr />
683 <a NAME="SessionMetaData" ID="SessionMetaData"></a>
684 <h2>SessionMetaData</h2>
685
686 <p>
687 Class implementing a data structure to store meta data for a session.
688 </p>
689 <h3>Derived from</h3>
690 None
691 <h3>Class Attributes</h3>
692
693 <table>
694 <tr><td>None</td></tr>
695 </table>
696 <h3>Class Methods</h3>
697
698 <table>
699 <tr><td>None</td></tr>
700 </table>
701 <h3>Methods</h3>
702
703 <table>
704
705 <tr>
706 <td><a href="#SessionMetaData.__init__">SessionMetaData</a></td>
707 <td>Constructor</td>
708 </tr>
709 </table>
710 <h3>Static Methods</h3>
711
712 <table>
713 <tr><td>None</td></tr>
714 </table>
715
716 <a NAME="SessionMetaData.__init__" ID="SessionMetaData.__init__"></a>
717 <h4>SessionMetaData (Constructor)</h4>
718 <b>SessionMetaData</b>(<i></i>)
719
720 <p>
721 Constructor
722 </p>
723 <div align="right"><a href="#top">Up</a></div>
724 <hr />
725 </body></html>

eric ide

mercurial