eric6/Helpviewer/HelpInspector.py

branch
maintenance
changeset 7286
7eb04391adf7
parent 7226
babe80d84a3e
parent 7285
1ff497f33f31
child 7287
1c17f2191bdd
equal deleted inserted replaced
7226:babe80d84a3e 7286:7eb04391adf7
1 # -*- coding: utf-8 -*-
2
3 # Copyright (c) 2015 - 2019 Detlev Offenbach <detlev@die-offenbachs.de>
4 #
5
6 """
7 Module implementing a QWebInspector wrapper to save and restore the geometry.
8 """
9
10 from __future__ import unicode_literals
11
12 from PyQt5.QtCore import QSize
13 from PyQt5.QtWebKitWidgets import QWebInspector
14
15 import Preferences
16
17
18 class HelpInspector(QWebInspector):
19 """
20 Class implementing a QWebInspector wrapper to save and restore the
21 geometry.
22 """
23 def __init__(self, parent=None):
24 """
25 Constructor
26
27 @param parent reference to the parent widget
28 @type QWidget
29 """
30 super(HelpInspector, self).__init__(parent)
31 self.__reloadGeometry()
32
33 def closeEvent(self, evt):
34 """
35 Protected method to save the geometry when closed.
36
37 @param evt event object
38 @type QCloseEvent
39 """
40 Preferences.setGeometry("HelpInspectorGeometry", self.saveGeometry())
41 super(HelpInspector, self).closeEvent(evt)
42
43 def __reloadGeometry(self):
44 """
45 Private method to restore the geometry.
46 """
47 geom = Preferences.getGeometry("HelpInspectorGeometry")
48 if geom.isEmpty():
49 s = QSize(600, 600)
50 self.resize(s)
51 else:
52 self.restoreGeometry(geom)

eric ide

mercurial