Helpviewer/FlashCookieManager/FlashCookieNotification.py

changeset 4359
ac1dda9f3f19
child 4370
54dbb658f9e6
equal deleted inserted replaced
4357:815d1f3116ff 4359:ac1dda9f3f19
1 # -*- coding: utf-8 -*-
2
3 # Copyright (c) 2015 Detlev Offenbach <detlev@die-offenbachs.de>
4 #
5
6 """
7 Module implementing the feature permission bar widget.
8 """
9
10 from __future__ import unicode_literals
11
12 from PyQt5.QtWidgets import QLabel, QHBoxLayout, QPushButton
13
14 from E5Gui.E5AnimatedWidget import E5AnimatedWidget
15
16 import UI.PixmapCache
17
18
19 class FlashCookieNotification(E5AnimatedWidget):
20 """
21 Class implementing the feature permission bar widget.
22 """
23 DefaultHeight = 30
24
25 def __init__(self, view, manager, noCookies):
26 """
27 Constructor
28
29 @param view reference to the web view
30 @type QWebView
31 @param reference to the Flash cookie manager object
32 @type FlashCookieManager
33 @param noCookies number of newly detected Flash cookies
34 @type int
35 """
36 super(FlashCookieNotification, self).__init__(parent=view)
37
38 self.__manager = manager
39
40 if noCookies == 1:
41 msg = self.tr("A new flash cookie was detected.")
42 else:
43 msg = self.tr("{0} new flash cookies were detected.")\
44 .format(noCookies)
45 self.setAutoFillBackground(True)
46 self.__layout = QHBoxLayout()
47 self.setLayout(self.__layout)
48 self.__layout.setContentsMargins(9, 0, 0, 0)
49 self.__iconLabel = QLabel(self)
50 self.__iconLabel.setPixmap(UI.PixmapCache.getPixmap("flashCookie.png"))
51 self.__layout.addWidget(self.__iconLabel)
52 self.__messageLabel = QLabel(msg, self)
53 self.__layout.addWidget(self.__messageLabel)
54 self.__viewButton = QPushButton(self.tr("View"), self)
55 self.__layout.addWidget(self.__viewButton)
56 self.__layout.addStretch()
57 self.__discardButton = QPushButton(UI.PixmapCache.getIcon("close.png"),
58 "", self)
59 self.__layout.addWidget(self.__discardButton)
60
61 self.__viewButton.clicked.connect(manager.showFlashCookieManagerDialog)
62 self.__viewButton.clicked.connect(self.hide)
63 self.__discardButton.clicked.connect(self.hide)
64
65 self.resize(view.width(), self.height())
66 self.startAnimation()

eric ide

mercurial