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

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

eric ide

mercurial