-
Notifications
You must be signed in to change notification settings - Fork 0
/
System.py
59 lines (42 loc) · 1.57 KB
/
System.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
53
54
55
56
57
58
59
import sys
from PySide6.QtWidgets import (
QWidget,
QGridLayout,
QPushButton
)
from setup_logger import logging
from Screensaver import Screensaver
class System:
def __init__(self):
super().__init__()
def exitGUI(self):
logging.info("Exit GUI")
sys.exit()
def shutdown(self):
logging.info("Shutting down...")
class SystemTab(QWidget):
def __init__(self, parent: QWidget):
super().__init__(parent)
self.app =self.parent().app
self.disp_width = self.app.primaryScreen().size().width()
self.disp_height = self.app.primaryScreen().size().height()
btn_size = self.disp_width/5
layout = QGridLayout()
button_screensaver = QPushButton("Start Screensaver")
button_screensaver.clicked.connect(self.startScreenSaver)
button_screensaver.setFixedSize(btn_size, btn_size)
button_exit = QPushButton("Exit GUI")
button_exit.clicked.connect(System.exitGUI)
button_exit.setFixedSize(btn_size, btn_size)
button_shutdown = QPushButton("Shutdown")
button_shutdown.clicked.connect(System.shutdown)
button_shutdown.setFixedSize(btn_size, btn_size)
layout.addWidget(button_screensaver, 0, 0)
layout.addWidget(button_exit, 1, 0)
layout.addWidget(button_shutdown, 1, 1)
self.setLayout(layout)
def startScreenSaver(self):
logging.info("Starting Screensaver")
self.screensaver = Screensaver(self.app)
self.screensaver.running = True
self.screensaver.showFullScreen()