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

changeset 6942
2602857055c5
parent 6123
39cd368143db
child 7273
391d6b7b1eff
equal deleted inserted replaced
6941:f99d60d6b59b 6942:2602857055c5
1 <!DOCTYPE html>
2 <html><head>
3 <title>eric6.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><a NAME="top" ID="top"></a>
22 <h1>eric6.WebBrowser.Session.SessionManager</h1>
23 <p>
24 Module implementing the session manager.
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="#SessionManager">SessionManager</a></td>
34 <td>Class implementing the session manager.</td>
35 </tr><tr>
36 <td><a href="#SessionMetaData">SessionMetaData</a></td>
37 <td>Class implementing a data structure to store meta data for a session.</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="SessionManager" ID="SessionManager"></a>
46 <h2>SessionManager</h2>
47 <p>
48 Class implementing the session manager.
49 </p><h3>Signals</h3>
50 <dl>
51 <dt>sessionsMetaDataChanged()</dt>
52 <dd>
53 emitted to indicate a change of the
54 list of session meta data
55 </dd>
56 </dl>
57 <h3>Derived from</h3>
58 QObject
59 <h3>Class Attributes</h3>
60 <table>
61 <tr><td>CloneSession</td></tr><tr><td>ReplaceSession</td></tr><tr><td>RestoreSession</td></tr><tr><td>SwitchSession</td></tr>
62 </table>
63 <h3>Class Methods</h3>
64 <table>
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><tr>
69 <td><a href="#SessionManager.readSessionFromFile">readSessionFromFile</a></td>
70 <td>Class method to read the session data from a file.</td>
71 </tr><tr>
72 <td><a href="#SessionManager.restoreSessionFromData">restoreSessionFromData</a></td>
73 <td>Class method to restore a session from a session data dictionary.</td>
74 </tr>
75 </table>
76 <h3>Methods</h3>
77 <table>
78 <tr>
79 <td><a href="#SessionManager.__init__">SessionManager</a></td>
80 <td>Constructor</td>
81 </tr><tr>
82 <td><a href="#SessionManager.__autoSaveSession">__autoSaveSession</a></td>
83 <td>Private slot to save the current session state.</td>
84 </tr><tr>
85 <td><a href="#SessionManager.__backupSavedSession">__backupSavedSession</a></td>
86 <td>Private method to backup the most recently saved session.</td>
87 </tr><tr>
88 <td><a href="#SessionManager.__fillMetaDataList">__fillMetaDataList</a></td>
89 <td>Private method to fill the sessions meta data list.</td>
90 </tr><tr>
91 <td><a href="#SessionManager.__initSessionSaveTimer">__initSessionSaveTimer</a></td>
92 <td>Private slot to initialize the auto save timer.</td>
93 </tr><tr>
94 <td><a href="#SessionManager.__isActive">__isActive</a></td>
95 <td>Private method to check, if a given file is the active one.</td>
96 </tr><tr>
97 <td><a href="#SessionManager.__sessionActTriggered">__sessionActTriggered</a></td>
98 <td>Private slot to handle the menu selection of a session.</td>
99 </tr><tr>
100 <td><a href="#SessionManager.__sessionDirectoryChanged">__sessionDirectoryChanged</a></td>
101 <td>Private slot handling changes of the sessions directory.</td>
102 </tr><tr>
103 <td><a href="#SessionManager.aboutToShowSessionsMenu">aboutToShowSessionsMenu</a></td>
104 <td>Public slot to populate the sessions selection menu.</td>
105 </tr><tr>
106 <td><a href="#SessionManager.activateTimer">activateTimer</a></td>
107 <td>Public method to activate the session save timer.</td>
108 </tr><tr>
109 <td><a href="#SessionManager.autoSaveSession">autoSaveSession</a></td>
110 <td>Public method to save the current session state.</td>
111 </tr><tr>
112 <td><a href="#SessionManager.cloneSession">cloneSession</a></td>
113 <td>Public method to clone a session.</td>
114 </tr><tr>
115 <td><a href="#SessionManager.defaultSessionFile">defaultSessionFile</a></td>
116 <td>Public method to get the name of the default session file.</td>
117 </tr><tr>
118 <td><a href="#SessionManager.deleteSession">deleteSession</a></td>
119 <td>Public method to delete a session.</td>
120 </tr><tr>
121 <td><a href="#SessionManager.getSessionsDirectory">getSessionsDirectory</a></td>
122 <td>Public method to get the directory sessions are stored in.</td>
123 </tr><tr>
124 <td><a href="#SessionManager.lastActiveSessionFile">lastActiveSessionFile</a></td>
125 <td>Public method to get the name of the last active session file.</td>
126 </tr><tr>
127 <td><a href="#SessionManager.newSession">newSession</a></td>
128 <td>Public method to start a new session.</td>
129 </tr><tr>
130 <td><a href="#SessionManager.openSession">openSession</a></td>
131 <td>Public method to open a session from a given session file.</td>
132 </tr><tr>
133 <td><a href="#SessionManager.preferencesChanged">preferencesChanged</a></td>
134 <td>Public slot to react upon changes of the settings.</td>
135 </tr><tr>
136 <td><a href="#SessionManager.renameSession">renameSession</a></td>
137 <td>Public method to rename or clone a session.</td>
138 </tr><tr>
139 <td><a href="#SessionManager.replaceSession">replaceSession</a></td>
140 <td>Public method to replace the current session with the given one.</td>
141 </tr><tr>
142 <td><a href="#SessionManager.saveSession">saveSession</a></td>
143 <td>Public method to save the current session.</td>
144 </tr><tr>
145 <td><a href="#SessionManager.selectSession">selectSession</a></td>
146 <td>Public method to select a session to be restored.</td>
147 </tr><tr>
148 <td><a href="#SessionManager.sessionMetaData">sessionMetaData</a></td>
149 <td>Public method to get the sessions meta data.</td>
150 </tr><tr>
151 <td><a href="#SessionManager.showSessionManagerDialog">showSessionManagerDialog</a></td>
152 <td>Public method to show the session manager dialog.</td>
153 </tr><tr>
154 <td><a href="#SessionManager.shutdown">shutdown</a></td>
155 <td>Public method to perform any shutdown actions.</td>
156 </tr><tr>
157 <td><a href="#SessionManager.switchToSession">switchToSession</a></td>
158 <td>Public method to switch the current session to the given one.</td>
159 </tr><tr>
160 <td><a href="#SessionManager.writeCurrentSession">writeCurrentSession</a></td>
161 <td>Public method to write the current session to the given file name.</td>
162 </tr>
163 </table>
164 <h3>Static Methods</h3>
165 <table>
166 <tr><td>None</td></tr>
167 </table>
168 <a NAME="SessionManager.isValidSession" ID="SessionManager.isValidSession"></a>
169 <h4>SessionManager.isValidSession (class method)</h4>
170 <b>isValidSession</b>(<i>session</i>)
171 <p>
172 Class method to check the validity of a session.
173 </p><dl>
174 <dt><i>session</i> (dict)</dt>
175 <dd>
176 dictionary containing the session data
177 </dd>
178 </dl><dl>
179 <dt>Returns:</dt>
180 <dd>
181 flag indicating validity
182 </dd>
183 </dl><dl>
184 <dt>Return Type:</dt>
185 <dd>
186 bool
187 </dd>
188 </dl><a NAME="SessionManager.readSessionFromFile" ID="SessionManager.readSessionFromFile"></a>
189 <h4>SessionManager.readSessionFromFile (class method)</h4>
190 <b>readSessionFromFile</b>(<i>sessionFileName</i>)
191 <p>
192 Class method to read the session data from a file.
193 </p><dl>
194 <dt><i>sessionFileName</i> (str)</dt>
195 <dd>
196 file name of the session file
197 </dd>
198 </dl><dl>
199 <dt>Returns:</dt>
200 <dd>
201 dictionary containing the session data
202 </dd>
203 </dl><dl>
204 <dt>Return Type:</dt>
205 <dd>
206 dict
207 </dd>
208 </dl><a NAME="SessionManager.restoreSessionFromData" ID="SessionManager.restoreSessionFromData"></a>
209 <h4>SessionManager.restoreSessionFromData (class method)</h4>
210 <b>restoreSessionFromData</b>(<i>window=None, sessionData=None</i>)
211 <p>
212 Class method to restore a session from a session data dictionary.
213 </p><dl>
214 <dt><i>window</i> (WebBrowserWindow)</dt>
215 <dd>
216 reference to main window to restore to
217 </dd><dt><i>sessionData</i></dt>
218 <dd>
219 dictionary containing the session data
220 </dd>
221 </dl><a NAME="SessionManager.__init__" ID="SessionManager.__init__"></a>
222 <h4>SessionManager (Constructor)</h4>
223 <b>SessionManager</b>(<i>parent=None</i>)
224 <p>
225 Constructor
226 </p><dl>
227 <dt><i>parent</i> (QObject)</dt>
228 <dd>
229 reference to the parent object
230 </dd>
231 </dl><a NAME="SessionManager.__autoSaveSession" ID="SessionManager.__autoSaveSession"></a>
232 <h4>SessionManager.__autoSaveSession</h4>
233 <b>__autoSaveSession</b>(<i>startTimer=True</i>)
234 <p>
235 Private slot to save the current session state.
236 </p><dl>
237 <dt><i>startTimer</i> (bool)</dt>
238 <dd>
239 flag indicating to restart the timer
240 </dd>
241 </dl><a NAME="SessionManager.__backupSavedSession" ID="SessionManager.__backupSavedSession"></a>
242 <h4>SessionManager.__backupSavedSession</h4>
243 <b>__backupSavedSession</b>(<i></i>)
244 <p>
245 Private method to backup the most recently saved session.
246 </p><a NAME="SessionManager.__fillMetaDataList" ID="SessionManager.__fillMetaDataList"></a>
247 <h4>SessionManager.__fillMetaDataList</h4>
248 <b>__fillMetaDataList</b>(<i></i>)
249 <p>
250 Private method to fill the sessions meta data list.
251 </p><p>
252 The sessions meta data list is only populated, if the variable holding
253 it is empty (i.e. it is populated on demand).
254 </p><a NAME="SessionManager.__initSessionSaveTimer" ID="SessionManager.__initSessionSaveTimer"></a>
255 <h4>SessionManager.__initSessionSaveTimer</h4>
256 <b>__initSessionSaveTimer</b>(<i></i>)
257 <p>
258 Private slot to initialize the auto save timer.
259 </p><a NAME="SessionManager.__isActive" ID="SessionManager.__isActive"></a>
260 <h4>SessionManager.__isActive</h4>
261 <b>__isActive</b>(<i>filePath</i>)
262 <p>
263 Private method to check, if a given file is the active one.
264 </p><dl>
265 <dt><i>filePath</i> (str or QFileInfo)</dt>
266 <dd>
267 path of the session file to be checked
268 </dd>
269 </dl><dl>
270 <dt>Returns:</dt>
271 <dd>
272 flag indicating the active file
273 </dd>
274 </dl><dl>
275 <dt>Return Type:</dt>
276 <dd>
277 bool
278 </dd>
279 </dl><a NAME="SessionManager.__sessionActTriggered" ID="SessionManager.__sessionActTriggered"></a>
280 <h4>SessionManager.__sessionActTriggered</h4>
281 <b>__sessionActTriggered</b>(<i>act</i>)
282 <p>
283 Private slot to handle the menu selection of a session.
284 </p><dl>
285 <dt><i>act</i> (QAction)</dt>
286 <dd>
287 reference to the action that triggered
288 </dd>
289 </dl><a NAME="SessionManager.__sessionDirectoryChanged" ID="SessionManager.__sessionDirectoryChanged"></a>
290 <h4>SessionManager.__sessionDirectoryChanged</h4>
291 <b>__sessionDirectoryChanged</b>(<i></i>)
292 <p>
293 Private slot handling changes of the sessions directory.
294 </p><a NAME="SessionManager.aboutToShowSessionsMenu" ID="SessionManager.aboutToShowSessionsMenu"></a>
295 <h4>SessionManager.aboutToShowSessionsMenu</h4>
296 <b>aboutToShowSessionsMenu</b>(<i>menu</i>)
297 <p>
298 Public slot to populate the sessions selection menu.
299 </p><dl>
300 <dt><i>menu</i> (QMenu)</dt>
301 <dd>
302 reference to the menu about to be shown
303 </dd>
304 </dl><a NAME="SessionManager.activateTimer" ID="SessionManager.activateTimer"></a>
305 <h4>SessionManager.activateTimer</h4>
306 <b>activateTimer</b>(<i></i>)
307 <p>
308 Public method to activate the session save timer.
309 </p><a NAME="SessionManager.autoSaveSession" ID="SessionManager.autoSaveSession"></a>
310 <h4>SessionManager.autoSaveSession</h4>
311 <b>autoSaveSession</b>(<i></i>)
312 <p>
313 Public method to save the current session state.
314 </p><a NAME="SessionManager.cloneSession" ID="SessionManager.cloneSession"></a>
315 <h4>SessionManager.cloneSession</h4>
316 <b>cloneSession</b>(<i>sessionFilePath</i>)
317 <p>
318 Public method to clone a session.
319 </p><dl>
320 <dt><i>sessionFilePath</i> (str)</dt>
321 <dd>
322 file name of the session file to be cloned
323 </dd>
324 </dl><a NAME="SessionManager.defaultSessionFile" ID="SessionManager.defaultSessionFile"></a>
325 <h4>SessionManager.defaultSessionFile</h4>
326 <b>defaultSessionFile</b>(<i></i>)
327 <p>
328 Public method to get the name of the default session file.
329 </p><dl>
330 <dt>Returns:</dt>
331 <dd>
332 name of the default session file
333 </dd>
334 </dl><dl>
335 <dt>Return Type:</dt>
336 <dd>
337 str
338 </dd>
339 </dl><a NAME="SessionManager.deleteSession" ID="SessionManager.deleteSession"></a>
340 <h4>SessionManager.deleteSession</h4>
341 <b>deleteSession</b>(<i>sessionFilePath</i>)
342 <p>
343 Public method to delete a session.
344 </p><dl>
345 <dt><i>sessionFilePath</i> (str)</dt>
346 <dd>
347 file name of the session file to be deleted
348 </dd>
349 </dl><a NAME="SessionManager.getSessionsDirectory" ID="SessionManager.getSessionsDirectory"></a>
350 <h4>SessionManager.getSessionsDirectory</h4>
351 <b>getSessionsDirectory</b>(<i></i>)
352 <p>
353 Public method to get the directory sessions are stored in.
354 </p><dl>
355 <dt>Returns:</dt>
356 <dd>
357 name of the sessions directory
358 </dd>
359 </dl><dl>
360 <dt>Return Type:</dt>
361 <dd>
362 str
363 </dd>
364 </dl><a NAME="SessionManager.lastActiveSessionFile" ID="SessionManager.lastActiveSessionFile"></a>
365 <h4>SessionManager.lastActiveSessionFile</h4>
366 <b>lastActiveSessionFile</b>(<i></i>)
367 <p>
368 Public method to get the name of the last active session file.
369 </p><dl>
370 <dt>Returns:</dt>
371 <dd>
372 name of the last active session file
373 </dd>
374 </dl><dl>
375 <dt>Return Type:</dt>
376 <dd>
377 str
378 </dd>
379 </dl><a NAME="SessionManager.newSession" ID="SessionManager.newSession"></a>
380 <h4>SessionManager.newSession</h4>
381 <b>newSession</b>(<i></i>)
382 <p>
383 Public method to start a new session.
384 </p><a NAME="SessionManager.openSession" ID="SessionManager.openSession"></a>
385 <h4>SessionManager.openSession</h4>
386 <b>openSession</b>(<i>sessionFilePath, flags=0</i>)
387 <p>
388 Public method to open a session from a given session file.
389 </p><dl>
390 <dt><i>sessionFilePath</i> (str)</dt>
391 <dd>
392 name of the session file to get session from
393 </dd><dt><i>flags</i> (int)</dt>
394 <dd>
395 flags determining the open mode
396 </dd>
397 </dl><a NAME="SessionManager.preferencesChanged" ID="SessionManager.preferencesChanged"></a>
398 <h4>SessionManager.preferencesChanged</h4>
399 <b>preferencesChanged</b>(<i></i>)
400 <p>
401 Public slot to react upon changes of the settings.
402 </p><a NAME="SessionManager.renameSession" ID="SessionManager.renameSession"></a>
403 <h4>SessionManager.renameSession</h4>
404 <b>renameSession</b>(<i>sessionFilePath, flags=0</i>)
405 <p>
406 Public method to rename or clone a session.
407 </p><dl>
408 <dt><i>sessionFilePath</i> (str)</dt>
409 <dd>
410 name of the session file
411 </dd><dt><i>flags</i> (int)</dt>
412 <dd>
413 flags determining a rename or clone operation
414 </dd>
415 </dl><a NAME="SessionManager.replaceSession" ID="SessionManager.replaceSession"></a>
416 <h4>SessionManager.replaceSession</h4>
417 <b>replaceSession</b>(<i>sessionFilePath</i>)
418 <p>
419 Public method to replace the current session with the given one.
420 </p><dl>
421 <dt><i>sessionFilePath</i> (str)</dt>
422 <dd>
423 file name of the session file to replace with
424 </dd>
425 </dl><dl>
426 <dt>Returns:</dt>
427 <dd>
428 flag indicating success
429 </dd>
430 </dl><dl>
431 <dt>Return Type:</dt>
432 <dd>
433 bool
434 </dd>
435 </dl><a NAME="SessionManager.saveSession" ID="SessionManager.saveSession"></a>
436 <h4>SessionManager.saveSession</h4>
437 <b>saveSession</b>(<i></i>)
438 <p>
439 Public method to save the current session.
440 </p><a NAME="SessionManager.selectSession" ID="SessionManager.selectSession"></a>
441 <h4>SessionManager.selectSession</h4>
442 <b>selectSession</b>(<i></i>)
443 <p>
444 Public method to select a session to be restored.
445 </p><dl>
446 <dt>Returns:</dt>
447 <dd>
448 name of the session file to be restored
449 </dd>
450 </dl><dl>
451 <dt>Return Type:</dt>
452 <dd>
453 str
454 </dd>
455 </dl><a NAME="SessionManager.sessionMetaData" ID="SessionManager.sessionMetaData"></a>
456 <h4>SessionManager.sessionMetaData</h4>
457 <b>sessionMetaData</b>(<i>includeBackups=False</i>)
458 <p>
459 Public method to get the sessions meta data.
460 </p><dl>
461 <dt><i>includeBackups</i> (bool)</dt>
462 <dd>
463 flag indicating to include backup sessions
464 </dd>
465 </dl><dl>
466 <dt>Returns:</dt>
467 <dd>
468 list of session meta data
469 </dd>
470 </dl><dl>
471 <dt>Return Type:</dt>
472 <dd>
473 list of SessionMetaData
474 </dd>
475 </dl><a NAME="SessionManager.showSessionManagerDialog" ID="SessionManager.showSessionManagerDialog"></a>
476 <h4>SessionManager.showSessionManagerDialog</h4>
477 <b>showSessionManagerDialog</b>(<i></i>)
478 <p>
479 Public method to show the session manager dialog.
480 </p><a NAME="SessionManager.shutdown" ID="SessionManager.shutdown"></a>
481 <h4>SessionManager.shutdown</h4>
482 <b>shutdown</b>(<i></i>)
483 <p>
484 Public method to perform any shutdown actions.
485 </p><a NAME="SessionManager.switchToSession" ID="SessionManager.switchToSession"></a>
486 <h4>SessionManager.switchToSession</h4>
487 <b>switchToSession</b>(<i>sessionFilePath</i>)
488 <p>
489 Public method to switch the current session to the given one.
490 </p><dl>
491 <dt><i>sessionFilePath</i> (str)</dt>
492 <dd>
493 file name of the session file to switch to
494 </dd>
495 </dl><dl>
496 <dt>Returns:</dt>
497 <dd>
498 flag indicating success
499 </dd>
500 </dl><dl>
501 <dt>Return Type:</dt>
502 <dd>
503 bool
504 </dd>
505 </dl><a NAME="SessionManager.writeCurrentSession" ID="SessionManager.writeCurrentSession"></a>
506 <h4>SessionManager.writeCurrentSession</h4>
507 <b>writeCurrentSession</b>(<i>sessionFileName</i>)
508 <p>
509 Public method to write the current session to the given file name.
510 </p><dl>
511 <dt><i>sessionFileName</i> (str)</dt>
512 <dd>
513 file name of the session
514 </dd>
515 </dl>
516 <div align="right"><a href="#top">Up</a></div>
517 <hr /><hr />
518 <a NAME="SessionMetaData" ID="SessionMetaData"></a>
519 <h2>SessionMetaData</h2>
520 <p>
521 Class implementing a data structure to store meta data for a session.
522 </p>
523 <h3>Derived from</h3>
524 object
525 <h3>Class Attributes</h3>
526 <table>
527 <tr><td>None</td></tr>
528 </table>
529 <h3>Class Methods</h3>
530 <table>
531 <tr><td>None</td></tr>
532 </table>
533 <h3>Methods</h3>
534 <table>
535 <tr>
536 <td><a href="#SessionMetaData.__init__">SessionMetaData</a></td>
537 <td>Constructor</td>
538 </tr>
539 </table>
540 <h3>Static Methods</h3>
541 <table>
542 <tr><td>None</td></tr>
543 </table>
544 <a NAME="SessionMetaData.__init__" ID="SessionMetaData.__init__"></a>
545 <h4>SessionMetaData (Constructor)</h4>
546 <b>SessionMetaData</b>(<i></i>)
547 <p>
548 Constructor
549 </p>
550 <div align="right"><a href="#top">Up</a></div>
551 <hr />
552 </body></html>

eric ide

mercurial