33 |
33 |
34 def __init__(self, mainWindow, model, parent=None): |
34 def __init__(self, mainWindow, model, parent=None): |
35 """ |
35 """ |
36 Constructor |
36 Constructor |
37 |
37 |
38 @param mainWindow reference to the main window (WebBrowserWindow) |
38 @param mainWindow reference to the main window |
39 @param model reference to the bookmarks model (BookmarksModel) |
39 @type WebBrowserWindow |
40 @param parent reference to the parent widget (QWidget) |
40 @param model reference to the bookmarks model |
|
41 @type BookmarksModel |
|
42 @param parent reference to the parent widget |
|
43 @type QWidget |
41 """ |
44 """ |
42 EricModelToolBar.__init__( |
45 EricModelToolBar.__init__( |
43 self, QCoreApplication.translate("BookmarksToolBar", "Bookmarks"), parent |
46 self, QCoreApplication.translate("BookmarksToolBar", "Bookmarks"), parent |
44 ) |
47 ) |
45 |
48 |
115 |
119 |
116 def __updateVisitCount(self, idx): |
120 def __updateVisitCount(self, idx): |
117 """ |
121 """ |
118 Private method to update the visit count of a bookmark. |
122 Private method to update the visit count of a bookmark. |
119 |
123 |
120 @param idx index of the bookmark item (QModelIndex) |
124 @param idx index of the bookmark item |
|
125 @type QModelIndex |
121 """ |
126 """ |
122 from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow |
127 from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow |
123 |
128 |
124 bookmarkNode = self.model().node(idx) |
129 bookmarkNode = self.model().node(idx) |
125 manager = WebBrowserWindow.bookmarksManager() |
130 manager = WebBrowserWindow.bookmarksManager() |
127 |
132 |
128 def __bookmarkActivated(self, idx): |
133 def __bookmarkActivated(self, idx): |
129 """ |
134 """ |
130 Private slot handling the activation of a bookmark. |
135 Private slot handling the activation of a bookmark. |
131 |
136 |
132 @param idx index of the activated bookmark (QModelIndex) |
137 @param idx index of the activated bookmark |
|
138 @type QModelIndex |
133 """ |
139 """ |
134 if idx.isValid(): |
140 if idx.isValid(): |
135 if self._mouseButton == Qt.MouseButton.XButton1: |
141 if self._mouseButton == Qt.MouseButton.XButton1: |
136 self.__mw.currentBrowser().triggerPageAction( |
142 self.__mw.currentBrowser().triggerPageAction( |
137 QWebEnginePage.WebAction.Back |
143 QWebEnginePage.WebAction.Back |
247 |
253 |
248 def _createMenu(self): |
254 def _createMenu(self): |
249 """ |
255 """ |
250 Protected method to create the menu for a tool bar action. |
256 Protected method to create the menu for a tool bar action. |
251 |
257 |
252 @return menu for a tool bar action (EricModelMenu) |
258 @return menu for a tool bar action |
|
259 @rtype EricModelMenu |
253 """ |
260 """ |
254 from .BookmarksMenu import BookmarksMenu |
261 from .BookmarksMenu import BookmarksMenu |
255 |
262 |
256 menu = BookmarksMenu(self) |
263 menu = BookmarksMenu(self) |
257 menu.openUrl.connect(self.openUrl) |
264 menu.openUrl.connect(self.openUrl) |