18 |
18 |
19 class DownloadManagerButton(EricToolButton): |
19 class DownloadManagerButton(EricToolButton): |
20 """ |
20 """ |
21 Class implementing a tool button for the download manager. |
21 Class implementing a tool button for the download manager. |
22 """ |
22 """ |
|
23 |
23 def __init__(self, parent=None): |
24 def __init__(self, parent=None): |
24 """ |
25 """ |
25 Constructor |
26 Constructor |
26 |
27 |
27 @param parent reference to the parent widget |
28 @param parent reference to the parent widget |
28 @type QWidget |
29 @type QWidget |
29 """ |
30 """ |
30 super().__init__(parent) |
31 super().__init__(parent) |
31 |
32 |
32 self.__manager = WebBrowserWindow.downloadManager() |
33 self.__manager = WebBrowserWindow.downloadManager() |
33 |
34 |
34 self.setObjectName("navigation_download_manager_button") |
35 self.setObjectName("navigation_download_manager_button") |
35 self.setIcon(UI.PixmapCache.getIcon("downloads")) |
36 self.setIcon(UI.PixmapCache.getIcon("downloads")) |
36 self.setToolTip(self.tr("Open Download Manager")) |
37 self.setToolTip(self.tr("Open Download Manager")) |
37 self.setToolButtonStyle(Qt.ToolButtonStyle.ToolButtonIconOnly) |
38 self.setToolButtonStyle(Qt.ToolButtonStyle.ToolButtonIconOnly) |
38 self.setFocusPolicy(Qt.FocusPolicy.NoFocus) |
39 self.setFocusPolicy(Qt.FocusPolicy.NoFocus) |
39 self.setAutoRaise(True) |
40 self.setAutoRaise(True) |
40 |
41 |
41 self.clicked.connect(self.__buttonClicked) |
42 self.clicked.connect(self.__buttonClicked) |
42 self.__manager.downloadsCountChanged.connect(self.__updateState) |
43 self.__manager.downloadsCountChanged.connect(self.__updateState) |
43 |
44 |
44 self.__updateState() |
45 self.__updateState() |
45 |
46 |
46 @pyqtSlot() |
47 @pyqtSlot() |
47 def __buttonClicked(self): |
48 def __buttonClicked(self): |
48 """ |
49 """ |
49 Private slot handling a user clicking the button. |
50 Private slot handling a user clicking the button. |
50 """ |
51 """ |
51 self.__manager.show() |
52 self.__manager.show() |
52 |
53 |
53 @pyqtSlot() |
54 @pyqtSlot() |
54 def __updateState(self): |
55 def __updateState(self): |
55 """ |
56 """ |
56 Private slot to update the button state. |
57 Private slot to update the button state. |
57 """ |
58 """ |