eric6/Helpviewer/UrlBar/BookmarkInfoDialog.py

branch
maintenance
changeset 7286
7eb04391adf7
parent 7226
babe80d84a3e
parent 7285
1ff497f33f31
child 7287
1c17f2191bdd
equal deleted inserted replaced
7226:babe80d84a3e 7286:7eb04391adf7
1 # -*- coding: utf-8 -*-
2
3 # Copyright (c) 2010 - 2019 Detlev Offenbach <detlev@die-offenbachs.de>
4 #
5
6 """
7 Module implementing a dialog to show some bookmark info.
8 """
9
10 from __future__ import unicode_literals
11
12 from PyQt5.QtCore import pyqtSlot
13 from PyQt5.QtGui import QFont
14 from PyQt5.QtWidgets import QDialog
15
16 from .Ui_BookmarkInfoDialog import Ui_BookmarkInfoDialog
17
18 import UI.PixmapCache
19
20
21 class BookmarkInfoDialog(QDialog, Ui_BookmarkInfoDialog):
22 """
23 Class implementing a dialog to show some bookmark info.
24 """
25 def __init__(self, bookmark, parent=None):
26 """
27 Constructor
28
29 @param bookmark reference to the bookmark to be shown (Bookmark)
30 @param parent reference to the parent widget (QWidget)
31 """
32 super(BookmarkInfoDialog, self).__init__(parent)
33 self.setupUi(self)
34
35 self.__bookmark = bookmark
36
37 self.icon.setPixmap(UI.PixmapCache.getPixmap("bookmark32.png"))
38
39 font = QFont()
40 font.setPointSize(font.pointSize() + 2)
41 self.title.setFont(font)
42
43 if bookmark is None:
44 self.titleEdit.setEnabled(False)
45 else:
46 self.titleEdit.setText(bookmark.title)
47 self.titleEdit.setFocus()
48
49 msh = self.minimumSizeHint()
50 self.resize(max(self.width(), msh.width()), msh.height())
51
52 @pyqtSlot()
53 def on_removeButton_clicked(self):
54 """
55 Private slot to remove the current bookmark.
56 """
57 import Helpviewer.HelpWindow
58 Helpviewer.HelpWindow.HelpWindow.bookmarksManager()\
59 .removeBookmark(self.__bookmark)
60 self.close()
61
62 def accept(self):
63 """
64 Public slot handling the acceptance of the dialog.
65 """
66 if self.__bookmark is not None and \
67 self.titleEdit.text() != self.__bookmark.title:
68 import Helpviewer.HelpWindow
69 Helpviewer.HelpWindow.HelpWindow.bookmarksManager()\
70 .setTitle(self.__bookmark, self.titleEdit.text())
71 self.close()

eric ide

mercurial