Fri, 11 Mar 2011 16:51:57 +0100
Made code mostly PEP 8 compliant (except all whitespace and line length).
658
2856f7ea6780
Started implementing the SSL info display.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1 | # -*- coding: utf-8 -*- |
2856f7ea6780
Started implementing the SSL info display.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2 | |
791
9ec2ac20e54e
Updated copyright notice.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
658
diff
changeset
|
3 | # Copyright (c) 2010 - 2011 Detlev Offenbach <detlev@die-offenbachs.de> |
658
2856f7ea6780
Started implementing the SSL info display.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4 | # |
2856f7ea6780
Started implementing the SSL info display.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
5 | |
2856f7ea6780
Started implementing the SSL info display.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
6 | """ |
2856f7ea6780
Started implementing the SSL info display.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
7 | Module implementing the label to show some SSL info. |
2856f7ea6780
Started implementing the SSL info display.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
8 | """ |
2856f7ea6780
Started implementing the SSL info display.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
9 | |
2856f7ea6780
Started implementing the SSL info display.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
10 | from PyQt4.QtCore import Qt, pyqtSignal |
2856f7ea6780
Started implementing the SSL info display.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
11 | from PyQt4.QtGui import QLabel |
2856f7ea6780
Started implementing the SSL info display.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
12 | |
945
8cd4d08fa9f6
Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
791
diff
changeset
|
13 | |
658
2856f7ea6780
Started implementing the SSL info display.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
14 | class SslLabel(QLabel): |
2856f7ea6780
Started implementing the SSL info display.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
15 | """ |
2856f7ea6780
Started implementing the SSL info display.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
16 | Class implementing the label to show some SSL info. |
2856f7ea6780
Started implementing the SSL info display.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
17 | """ |
2856f7ea6780
Started implementing the SSL info display.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
18 | clicked = pyqtSignal() |
2856f7ea6780
Started implementing the SSL info display.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
19 | |
945
8cd4d08fa9f6
Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
791
diff
changeset
|
20 | def __init__(self, parent=None): |
658
2856f7ea6780
Started implementing the SSL info display.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
21 | """ |
2856f7ea6780
Started implementing the SSL info display.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
22 | Constructor |
2856f7ea6780
Started implementing the SSL info display.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
23 | |
2856f7ea6780
Started implementing the SSL info display.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
24 | @param parent reference to the parent widget (QWidget) |
2856f7ea6780
Started implementing the SSL info display.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
25 | """ |
2856f7ea6780
Started implementing the SSL info display.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
26 | QLabel.__init__(self, parent) |
2856f7ea6780
Started implementing the SSL info display.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
27 | |
2856f7ea6780
Started implementing the SSL info display.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
28 | self.setFocusPolicy(Qt.NoFocus) |
2856f7ea6780
Started implementing the SSL info display.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
29 | self.setCursor(Qt.ArrowCursor) |
2856f7ea6780
Started implementing the SSL info display.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
30 | |
2856f7ea6780
Started implementing the SSL info display.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
31 | def mouseReleaseEvent(self, evt): |
2856f7ea6780
Started implementing the SSL info display.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
32 | """ |
2856f7ea6780
Started implementing the SSL info display.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
33 | Protected method to handle mouse release events. |
2856f7ea6780
Started implementing the SSL info display.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
34 | |
2856f7ea6780
Started implementing the SSL info display.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
35 | @param evt reference to the mouse event (QMouseEvent) |
2856f7ea6780
Started implementing the SSL info display.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
36 | """ |
2856f7ea6780
Started implementing the SSL info display.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
37 | if evt.button() == Qt.LeftButton: |
2856f7ea6780
Started implementing the SSL info display.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
38 | self.clicked.emit() |
2856f7ea6780
Started implementing the SSL info display.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
39 | else: |
2856f7ea6780
Started implementing the SSL info display.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
40 | QLabel.mouseReleaseEvent(self, evt) |
2856f7ea6780
Started implementing the SSL info display.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
41 | |
2856f7ea6780
Started implementing the SSL info display.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
42 | def mouseDoubleClickEvent(self, evt): |
2856f7ea6780
Started implementing the SSL info display.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
43 | """ |
2856f7ea6780
Started implementing the SSL info display.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
44 | Protected method to handle mouse double click events. |
2856f7ea6780
Started implementing the SSL info display.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
45 | |
2856f7ea6780
Started implementing the SSL info display.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
46 | @param evt reference to the mouse event (QMouseEvent) |
2856f7ea6780
Started implementing the SSL info display.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
47 | """ |
2856f7ea6780
Started implementing the SSL info display.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
48 | if evt.button() == Qt.LeftButton: |
2856f7ea6780
Started implementing the SSL info display.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
49 | self.clicked.emit() |
2856f7ea6780
Started implementing the SSL info display.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
50 | else: |
2856f7ea6780
Started implementing the SSL info display.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
51 | QLabel.mouseDoubleClickEvent(self, evt) |