18 |
18 |
19 class BookmarkInfoDialog(QDialog, Ui_BookmarkInfoDialog): |
19 class BookmarkInfoDialog(QDialog, Ui_BookmarkInfoDialog): |
20 """ |
20 """ |
21 Class implementing a dialog to show some bookmark info. |
21 Class implementing a dialog to show some bookmark info. |
22 """ |
22 """ |
|
23 |
23 def __init__(self, bookmark, parent=None): |
24 def __init__(self, bookmark, parent=None): |
24 """ |
25 """ |
25 Constructor |
26 Constructor |
26 |
27 |
27 @param bookmark reference to the bookmark to be shown (Bookmark) |
28 @param bookmark reference to the bookmark to be shown (Bookmark) |
28 @param parent reference to the parent widget (QWidget) |
29 @param parent reference to the parent widget (QWidget) |
29 """ |
30 """ |
30 super().__init__(parent) |
31 super().__init__(parent) |
31 self.setupUi(self) |
32 self.setupUi(self) |
32 |
33 |
33 self.__bookmark = bookmark |
34 self.__bookmark = bookmark |
34 |
35 |
35 self.icon.setPixmap(UI.PixmapCache.getPixmap("bookmark32")) |
36 self.icon.setPixmap(UI.PixmapCache.getPixmap("bookmark32")) |
36 |
37 |
37 font = QFont() |
38 font = QFont() |
38 font.setPointSize(font.pointSize() + 2) |
39 font.setPointSize(font.pointSize() + 2) |
39 self.title.setFont(font) |
40 self.title.setFont(font) |
40 |
41 |
41 if bookmark is None: |
42 if bookmark is None: |
42 self.titleEdit.setEnabled(False) |
43 self.titleEdit.setEnabled(False) |
43 else: |
44 else: |
44 self.titleEdit.setText(bookmark.title) |
45 self.titleEdit.setText(bookmark.title) |
45 self.titleEdit.setFocus() |
46 self.titleEdit.setFocus() |
46 |
47 |
47 msh = self.minimumSizeHint() |
48 msh = self.minimumSizeHint() |
48 self.resize(max(self.width(), msh.width()), msh.height()) |
49 self.resize(max(self.width(), msh.width()), msh.height()) |
49 |
50 |
50 @pyqtSlot() |
51 @pyqtSlot() |
51 def on_removeButton_clicked(self): |
52 def on_removeButton_clicked(self): |
52 """ |
53 """ |
53 Private slot to remove the current bookmark. |
54 Private slot to remove the current bookmark. |
54 """ |
55 """ |
55 import WebBrowser.WebBrowserWindow |
56 import WebBrowser.WebBrowserWindow |
56 (WebBrowser.WebBrowserWindow.WebBrowserWindow.bookmarksManager() |
57 |
57 .removeBookmark(self.__bookmark)) |
58 bm = WebBrowser.WebBrowserWindow.WebBrowserWindow.bookmarksManager() |
|
59 bm.removeBookmark(self.__bookmark) |
58 self.close() |
60 self.close() |
59 |
61 |
60 def accept(self): |
62 def accept(self): |
61 """ |
63 """ |
62 Public slot handling the acceptance of the dialog. |
64 Public slot handling the acceptance of the dialog. |
63 """ |
65 """ |
64 if ( |
66 if ( |
65 self.__bookmark is not None and |
67 self.__bookmark is not None |
66 self.titleEdit.text() != self.__bookmark.title |
68 and self.titleEdit.text() != self.__bookmark.title |
67 ): |
69 ): |
68 import WebBrowser.WebBrowserWindow |
70 import WebBrowser.WebBrowserWindow |
69 (WebBrowser.WebBrowserWindow.WebBrowserWindow.bookmarksManager() |
71 |
70 .setTitle(self.__bookmark, self.titleEdit.text())) |
72 bm = WebBrowser.WebBrowserWindow.WebBrowserWindow.bookmarksManager() |
|
73 bm.setTitle(self.__bookmark, self.titleEdit.text()) |
71 self.close() |
74 self.close() |