10 from PyQt6.QtCore import pyqtSignal, Qt, QUrl, QCoreApplication |
10 from PyQt6.QtCore import pyqtSignal, Qt, QUrl, QCoreApplication |
11 from PyQt6.QtGui import QCursor |
11 from PyQt6.QtGui import QCursor |
12 from PyQt6.QtWidgets import QMenu |
12 from PyQt6.QtWidgets import QMenu |
13 from PyQt6.QtWebEngineWidgets import QWebEnginePage |
13 from PyQt6.QtWebEngineWidgets import QWebEnginePage |
14 |
14 |
15 from E5Gui.E5ModelToolBar import E5ModelToolBar |
15 from E5Gui.EricModelToolBar import EricModelToolBar |
16 |
16 |
17 from .BookmarksModel import BookmarksModel |
17 from .BookmarksModel import BookmarksModel |
18 |
18 |
19 |
19 |
20 class BookmarksToolBar(E5ModelToolBar): |
20 class BookmarksToolBar(EricModelToolBar): |
21 """ |
21 """ |
22 Class implementing a tool bar showing bookmarks. |
22 Class implementing a tool bar showing bookmarks. |
23 |
23 |
24 @signal openUrl(QUrl, str) emitted to open a URL in the current tab |
24 @signal openUrl(QUrl, str) emitted to open a URL in the current tab |
25 @signal newTab(QUrl, str) emitted to open a URL in a new tab |
25 @signal newTab(QUrl, str) emitted to open a URL in a new tab |
35 |
35 |
36 @param mainWindow reference to the main window (WebBrowserWindow) |
36 @param mainWindow reference to the main window (WebBrowserWindow) |
37 @param model reference to the bookmarks model (BookmarksModel) |
37 @param model reference to the bookmarks model (BookmarksModel) |
38 @param parent reference to the parent widget (QWidget) |
38 @param parent reference to the parent widget (QWidget) |
39 """ |
39 """ |
40 E5ModelToolBar.__init__( |
40 EricModelToolBar.__init__( |
41 self, QCoreApplication.translate("BookmarksToolBar", "Bookmarks"), |
41 self, QCoreApplication.translate("BookmarksToolBar", "Bookmarks"), |
42 parent) |
42 parent) |
43 |
43 |
44 self.__mw = mainWindow |
44 self.__mw = mainWindow |
45 self.__bookmarksModel = model |
45 self.__bookmarksModel = model |
251 |
251 |
252 def _createMenu(self): |
252 def _createMenu(self): |
253 """ |
253 """ |
254 Protected method to create the menu for a tool bar action. |
254 Protected method to create the menu for a tool bar action. |
255 |
255 |
256 @return menu for a tool bar action (E5ModelMenu) |
256 @return menu for a tool bar action (EricModelMenu) |
257 """ |
257 """ |
258 from .BookmarksMenu import BookmarksMenu |
258 from .BookmarksMenu import BookmarksMenu |
259 menu = BookmarksMenu(self) |
259 menu = BookmarksMenu(self) |
260 menu.openUrl.connect(self.openUrl) |
260 menu.openUrl.connect(self.openUrl) |
261 menu.newTab.connect(self.newTab) |
261 menu.newTab.connect(self.newTab) |