Fri, 01 May 2015 11:38:05 +0200
Prepared new eric6 release.
2190
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1 | # -*- coding: utf-8 -*- |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2 | |
4022
f5f42921717e
Updated copyright for 2015.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3656
diff
changeset
|
3 | # Copyright (c) 2012 - 2015 Detlev Offenbach <detlev@die-offenbachs.de> |
2190
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4 | # |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
5 | |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
6 | """ |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
7 | Module implementing a Notification widget. |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
8 | """ |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
9 | |
3145
a9de05d4a22f
# __IGNORE_WARNING__ added/ removed.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3060
diff
changeset
|
10 | from __future__ import unicode_literals |
2525
8b507a9a2d40
Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
2302
diff
changeset
|
11 | |
3656
441956d8fce5
Started porting eric5 to PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3484
diff
changeset
|
12 | from PyQt5.QtCore import Qt, QTimer, QPoint |
441956d8fce5
Started porting eric5 to PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3484
diff
changeset
|
13 | from PyQt5.QtGui import QPixmap |
441956d8fce5
Started porting eric5 to PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3484
diff
changeset
|
14 | from PyQt5.QtWidgets import QWidget |
2190
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
15 | |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
16 | from .Ui_NotificationWidget import Ui_NotificationWidget |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
17 | |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
18 | import Globals |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
19 | |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
20 | |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
21 | class NotificationWidget(QWidget, Ui_NotificationWidget): |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
22 | """ |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
23 | Class implementing a Notification widget. |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
24 | """ |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
25 | def __init__(self, parent=None, setPosition=False): |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
26 | """ |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
27 | Constructor |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
28 | |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
29 | @param parent reference to the parent widget (QWidget) |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
30 | @param setPosition flag indicating to set the display |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
31 | position interactively (boolean) |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
32 | """ |
2525
8b507a9a2d40
Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
2302
diff
changeset
|
33 | super(NotificationWidget, self).__init__(parent) |
2190
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
34 | self.setupUi(self) |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
35 | |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
36 | self.__timeout = 5000 |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
37 | self.__icon = QPixmap() |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
38 | self.__heading = "" |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
39 | self.__text = "" |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
40 | self.__dragPosition = QPoint() |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
41 | |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
42 | self.__settingPosition = setPosition |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
43 | |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
44 | flags = Qt.Tool | \ |
3039
8dd0165d805d
Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3012
diff
changeset
|
45 | Qt.FramelessWindowHint | \ |
8dd0165d805d
Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3012
diff
changeset
|
46 | Qt.WindowStaysOnTopHint | \ |
8dd0165d805d
Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3012
diff
changeset
|
47 | Qt.X11BypassWindowManagerHint |
2190
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
48 | if Globals.isWindowsPlatform(): |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
49 | flags |= Qt.ToolTip |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
50 | self.setWindowFlags(flags) |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
51 | |
3370
c8c6e31b9d41
Fixed a sizing issue with the notification widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3366
diff
changeset
|
52 | self.frame.layout().setAlignment( |
c8c6e31b9d41
Fixed a sizing issue with the notification widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3366
diff
changeset
|
53 | self.verticalLayout, Qt.AlignLeft | Qt.AlignVCenter) |
c8c6e31b9d41
Fixed a sizing issue with the notification widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3366
diff
changeset
|
54 | |
2190
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
55 | self.__timer = QTimer(self) |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
56 | self.__timer.setSingleShot(True) |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
57 | self.__timer.timeout.connect(self.close) |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
58 | |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
59 | if self.__settingPosition: |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
60 | self.setCursor(Qt.OpenHandCursor) |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
61 | |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
62 | def setPixmap(self, icon): |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
63 | """ |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
64 | Public method to set the icon for the notification. |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
65 | |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
66 | @param icon icon to be used (QPixmap) |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
67 | """ |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
68 | self.__icon = QPixmap(icon) |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
69 | |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
70 | def setHeading(self, heading): |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
71 | """ |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
72 | Public method to set the heading for the notification. |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
73 | |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
74 | @param heading heading to be used (string) |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
75 | """ |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
76 | self.__heading = heading |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
77 | |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
78 | def setText(self, text): |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
79 | """ |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
80 | Public method to set the text for the notification. |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
81 | |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
82 | @param text text to be used (string) |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
83 | """ |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
84 | self.__text = text |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
85 | |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
86 | def setTimeout(self, timeout): |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
87 | """ |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
88 | Public method to set the timeout for the notification. |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
89 | |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
90 | @param timeout timeout to be used in seconds (integer) |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
91 | """ |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
92 | self.__timeout = timeout * 1000 |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
93 | |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
94 | def show(self): |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
95 | """ |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
96 | Public method to show the notification. |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
97 | """ |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
98 | self.icon.setPixmap(self.__icon) |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
99 | self.heading.setText(self.__heading) |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
100 | self.text.setText(self.__text) |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
101 | |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
102 | if not self.__settingPosition: |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
103 | self.__timer.stop() |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
104 | self.__timer.setInterval(self.__timeout) |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
105 | self.__timer.start() |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
106 | |
2525
8b507a9a2d40
Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
2302
diff
changeset
|
107 | super(NotificationWidget, self).show() |
3366
6084bb3c3911
Made some changes to have a bunch of dialogs with correct sizes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3160
diff
changeset
|
108 | |
3383
2da1760fe787
Another fix of the notification widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3370
diff
changeset
|
109 | sh = self.sizeHint() |
2da1760fe787
Another fix of the notification widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3370
diff
changeset
|
110 | self.resize(max(self.width(), sh.width()), sh.height()) |
2190
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
111 | |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
112 | def mousePressEvent(self, evt): |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
113 | """ |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
114 | Protected method to handle presses of a mouse button. |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
115 | |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
116 | @param evt reference to the mouse event (QMouseEvent) |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
117 | """ |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
118 | if not self.__settingPosition: |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
119 | self.close() |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
120 | return |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
121 | |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
122 | if evt.button() == Qt.LeftButton: |
3012
d177226027e2
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
123 | self.__dragPosition = \ |
d177226027e2
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
124 | evt.globalPos() - self.frameGeometry().topLeft() |
2190
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
125 | self.setCursor(Qt.ClosedHandCursor) |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
126 | evt.accept() |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
127 | |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
128 | def mouseReleaseEvent(self, evt): |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
129 | """ |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
130 | Protected method to handle releases of a mouse button. |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
131 | |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
132 | @param evt reference to the mouse event (QMouseEvent) |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
133 | """ |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
134 | if self.__settingPosition and evt.button() == Qt.LeftButton: |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
135 | self.setCursor(Qt.OpenHandCursor) |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
136 | |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
137 | def mouseMoveEvent(self, evt): |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
138 | """ |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
139 | Protected method to handle dragging the window. |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
140 | |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
141 | @param evt reference to the mouse event (QMouseEvent) |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
142 | """ |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
143 | if evt.buttons() & Qt.LeftButton: |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
144 | self.move(evt.globalPos() - self.__dragPosition) |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
145 | evt.accept() |