-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoverlay.py
52 lines (42 loc) · 1.63 KB
/
overlay.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
from PyQt5 import QtCore
from PyQt5.QtCore import pyqtSignal
from PyQt5.QtWidgets import QLabel, QMainWindow
class OverlayAction(object):
def __init__(self, sequence, position, size):
self.sequence = sequence
self.position = position
self.size = size
def create_label(self, parent):
label = QLabel(self.sequence, parent)
label.setStyleSheet("\n".join(["color: white;"
"border : 3px solid green;",
"border-top-left-radius : 35px;",
"border-top-right-radius : 20px; ",
"border-bottom-left-radius : 50px; ",
"border-bottom-right-radius : 10px"]))
# print('sequence: {} position: {} size: {}'.format(self.sequence, self.position, self.size))
# TODO(bkd): get taskbar height from?
label.move(self.position[0], self.position[1] - 26)
label.resize(self.size[0], self.size[1])
return label
class Overlay(QMainWindow):
def __init__(self, actions):
super().__init__()
self.setAttribute(QtCore.Qt.WA_TranslucentBackground)
self.setWindowFlags(
QtCore.Qt.Window |
QtCore.Qt.CustomizeWindowHint |
QtCore.Qt.FramelessWindowHint |
QtCore.Qt.WindowTitleHint |
QtCore.Qt.WindowStaysOnTopHint
# QtCore.Qt.X11BypassWindowManagerHint |
)
self.showMaximized()
self.actions = actions
self.labels = []
self.show_actions()
def show_actions(self):
for action in self.actions:
label = action.create_label(self)
self.labels.append(label)
label.show()