6 """ |
6 """ |
7 Module implementing the label to show the web site icon. |
7 Module implementing the label to show the web site icon. |
8 """ |
8 """ |
9 |
9 |
10 from PyQt4.QtCore import Qt, QPoint, QUrl, QMimeData |
10 from PyQt4.QtCore import Qt, QPoint, QUrl, QMimeData |
11 from PyQt4.QtGui import QLabel, QApplication, QDrag |
11 from PyQt4.QtGui import QLabel, QApplication, QDrag, QPixmap |
12 |
12 |
13 import Helpviewer.HelpWindow |
13 import Helpviewer.HelpWindow |
14 |
14 |
15 class FavIconLabel(QLabel): |
15 class FavIconLabel(QLabel): |
16 """ |
16 """ |
44 url = self.__browser.url() |
44 url = self.__browser.url() |
45 self.setPixmap(Helpviewer.HelpWindow.HelpWindow.icon(url).pixmap(16, 16)) |
45 self.setPixmap(Helpviewer.HelpWindow.HelpWindow.icon(url).pixmap(16, 16)) |
46 except RuntimeError: |
46 except RuntimeError: |
47 pass |
47 pass |
48 |
48 |
|
49 def __clearIcon(self): |
|
50 """ |
|
51 Private slot to clear the icon. |
|
52 """ |
|
53 self.setPixmap(QPixmap()) |
|
54 |
49 def setBrowser(self, browser): |
55 def setBrowser(self, browser): |
50 """ |
56 """ |
51 Public method to set the browser connection. |
57 Public method to set the browser connection. |
52 |
58 |
53 @param browser reference to the browser widegt (HelpBrowser) |
59 @param browser reference to the browser widegt (HelpBrowser) |
54 """ |
60 """ |
55 self.__browser = browser |
61 self.__browser = browser |
56 self.__browser.loadFinished.connect(self.__browserIconChanged) |
62 self.__browser.loadFinished.connect(self.__browserIconChanged) |
57 self.__browser.iconChanged.connect(self.__browserIconChanged) |
63 self.__browser.iconChanged.connect(self.__browserIconChanged) |
|
64 self.__browser.loadStarted.connect(self.__clearIcon) |
58 |
65 |
59 def mousePressEvent(self, evt): |
66 def mousePressEvent(self, evt): |
60 """ |
67 """ |
61 Protected method to handle mouse press events. |
68 Protected method to handle mouse press events. |
62 |
69 |