-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathhelpWindow.py
More file actions
92 lines (72 loc) · 3.03 KB
/
helpWindow.py
File metadata and controls
92 lines (72 loc) · 3.03 KB
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
import sys
from PyQt5.QtWidgets import QWidget, QLabel, QApplication, QDesktopWidget, QPushButton, QGridLayout, QSlider, QHBoxLayout, QVBoxLayout
from PyQt5.QtCore import pyqtSlot, Qt, QRect
class HelpWindow(QWidget):
def __init__(self, fontSize):
super().__init__()
self.fontSize = fontSize
self.title = 'Help'
self.left = 0
self.top = 0
pg = QDesktopWidget().availableGeometry()
self.width = pg.width()//4
self.height = pg.height()//4
self.setWindowFlags(Qt.WindowStaysOnTopHint)
self.initUI()
def getFontSize(self, scale) -> str:
return "font-size: {}px;".format(int(self.fontSize*scale))
def initUI(self):
self.setWindowTitle(self.title)
self.setGeometry(self.left, self.top, self.width, self.height)
self.resize(self.width, self.height)
self.label1 = QLabel(self)
self.label1.setText("""
Input mode Activate / Deactivate:
Lift your eyebrows for 3 seconds
""")
self.label1.setAlignment(Qt.AlignCenter)
self.label1.setStyleSheet(self.getFontSize(1.2))
self.label2 = QLabel(self)
self.label2.setText("""
Scroll Activate / Deactivate:
Lift your eyebrows for 1 second
""")
self.label2.setAlignment(Qt.AlignCenter)
self.label2.setStyleSheet(self.getFontSize(1.2))
self.label3 = QLabel(self)
self.label3.setText("Left click: Do a quick medium paced blink")
self.label3.setAlignment(Qt.AlignCenter)
self.label3.setStyleSheet(self.getFontSize(1.2))
self.label4 = QLabel(self)
self.label4.setText("Right click: Do a long blink")
self.label4.setAlignment(Qt.AlignCenter)
self.label4.setStyleSheet(self.getFontSize(1.2))
self.button = QPushButton("Close", self)
# self.button.resize(50,50)
self.button.clicked.connect(self.on_close_clicked)
self.button.setStyleSheet(self.getFontSize(1.2))
# rowLayout = QVBoxLayout
# Add widgets to the layout
# rowLayoutWrapper = QLabel()
# rowLayoutWrapper.setLayout(rowLayout)
self.layout = QGridLayout()
self.layout.addWidget(self.label1, 0, 0)
self.layout.addWidget(self.label2, 1, 0)
self.layout.addWidget(self.label3, 2, 0)
self.layout.addWidget(self.label4, 3, 0)
# self.layout.addWidget(rowLayoutWrapper, 2, 0)
self.layout.addWidget(self.button, 4, 0)
self.setLayout(self.layout)
self.location_on_the_screen()
self.show()
def on_close_clicked(self):
self.close()
# self.camwindow = CamWindow(self.cursorSensitivity)
# self.camwindow.show()
def location_on_the_screen(self):
ag = QDesktopWidget().availableGeometry()
sg = QDesktopWidget().screenGeometry()
widget = self.geometry()
x = ag.width() - widget.width()
y = 2 * ag.height() - sg.height() - widget.height()
self.move(x, y)