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