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 |
15 |
16 class FavIconLabel(QLabel): |
16 class FavIconLabel(QLabel): |
45 url = self.__browser.url() |
45 url = self.__browser.url() |
46 self.setPixmap(Helpviewer.HelpWindow.HelpWindow.icon(url).pixmap(16, 16)) |
46 self.setPixmap(Helpviewer.HelpWindow.HelpWindow.icon(url).pixmap(16, 16)) |
47 except RuntimeError: |
47 except RuntimeError: |
48 pass |
48 pass |
49 |
49 |
|
50 def __clearIcon(self): |
|
51 """ |
|
52 Private slot to clear the icon. |
|
53 """ |
|
54 self.setPixmap(QPixmap()) |
|
55 |
50 def setBrowser(self, browser): |
56 def setBrowser(self, browser): |
51 """ |
57 """ |
52 Public method to set the browser connection. |
58 Public method to set the browser connection. |
53 |
59 |
54 @param browser reference to the browser widegt (HelpBrowser) |
60 @param browser reference to the browser widegt (HelpBrowser) |
55 """ |
61 """ |
56 self.__browser = browser |
62 self.__browser = browser |
57 self.__browser.loadFinished.connect(self.__browserIconChanged) |
63 self.__browser.loadFinished.connect(self.__browserIconChanged) |
58 self.__browser.iconChanged.connect(self.__browserIconChanged) |
64 self.__browser.iconChanged.connect(self.__browserIconChanged) |
|
65 self.__browser.loadStarted.connect(self.__clearIcon) |
59 |
66 |
60 def mousePressEvent(self, evt): |
67 def mousePressEvent(self, evt): |
61 """ |
68 """ |
62 Protected method to handle mouse press events. |
69 Protected method to handle mouse press events. |
63 |
70 |