src/eric7/WebBrowser/StatusBar/StatusBarIcon.py

branch
eric7
changeset 9221
bf71ee032bb4
parent 9209
b99e7fd55fd3
child 9273
5c6a9210d291
equal deleted inserted replaced
9220:e9e7eca7efee 9221:bf71ee032bb4
17 17
18 class StatusBarIcon(EricClickableLabel): 18 class StatusBarIcon(EricClickableLabel):
19 """ 19 """
20 Class implementing common methods for all status bar icons. 20 Class implementing common methods for all status bar icons.
21 """ 21 """
22
22 def __init__(self, window): 23 def __init__(self, window):
23 """ 24 """
24 Constructor 25 Constructor
25 26
26 @param window reference to the web browser window 27 @param window reference to the web browser window
27 @type WebBrowserWindow 28 @type WebBrowserWindow
28 """ 29 """
29 super().__init__(window) 30 super().__init__(window)
30 31
31 self._window = window 32 self._window = window
32 33
33 def _testCurrentPageWebAttribute(self, attr): 34 def _testCurrentPageWebAttribute(self, attr):
34 """ 35 """
35 Protected method to test a web attribute on the current page. 36 Protected method to test a web attribute on the current page.
36 37
37 @param attr attribute to test 38 @param attr attribute to test
38 @type QWebEngineSettings.WebAttribute 39 @type QWebEngineSettings.WebAttribute
39 @return flag indicating the attribute is set 40 @return flag indicating the attribute is set
40 @rtype bool 41 @rtype bool
41 """ 42 """
42 settings = self._currentPageSettings() 43 settings = self._currentPageSettings()
43 return settings is not None and settings.testAttribute(attr) 44 return settings is not None and settings.testAttribute(attr)
44 45
45 def _setCurrentPageWebAttribute(self, attr, val): 46 def _setCurrentPageWebAttribute(self, attr, val):
46 """ 47 """
47 Protected method to set a web attribute on the current page. 48 Protected method to set a web attribute on the current page.
48 49
49 @param attr attribute to sett 50 @param attr attribute to sett
50 @type QWebEngineSettings.WebAttribute 51 @type QWebEngineSettings.WebAttribute
51 @param val value to be set 52 @param val value to be set
52 @type bool 53 @type bool
53 """ 54 """
54 settings = self._currentPageSettings() 55 settings = self._currentPageSettings()
55 if settings is not None: 56 if settings is not None:
56 settings.setAttribute(attr, val) 57 settings.setAttribute(attr, val)
57 58
58 def _currentPageSettings(self): 59 def _currentPageSettings(self):
59 """ 60 """
60 Protected method to get a reference to the web settings of the 61 Protected method to get a reference to the web settings of the
61 current page. 62 current page.
62 63
63 @return reference to the web settings object 64 @return reference to the web settings object
64 @rtype QWebEngineSettings 65 @rtype QWebEngineSettings
65 """ 66 """
66 view = self._window.currentBrowser() 67 view = self._window.currentBrowser()
67 if view is None: 68 if view is None:
68 return None 69 return None
69 70
70 return view.page().settings() 71 return view.page().settings()
71 72
72 def _currentPage(self): 73 def _currentPage(self):
73 """ 74 """
74 Protected method to get a reference to the current page. 75 Protected method to get a reference to the current page.
75 76
76 @return reference to the current page 77 @return reference to the current page
77 @rtype WebBrowserPage 78 @rtype WebBrowserPage
78 """ 79 """
79 view = self._window.currentBrowser() 80 view = self._window.currentBrowser()
80 if view is None: 81 if view is None:
81 return None 82 return None
82 83
83 return view.page() 84 return view.page()
84 85
85 def preferencesChanged(self): 86 def preferencesChanged(self):
86 """ 87 """
87 Public method to handle changes of the settings. 88 Public method to handle changes of the settings.
88 """ 89 """
89 # do nothing 90 # do nothing

eric ide

mercurial