2021-09-11 08:41:30 +12:00
|
|
|
from PyQt5.QtWidgets import QWidget, QVBoxLayout, QPushButton
|
|
|
|
|
2022-09-02 09:31:10 +12:00
|
|
|
from rare.shared import GlobalSignalsSingleton
|
2023-12-08 21:44:26 +13:00
|
|
|
from rare.utils.misc import ExitCodes
|
2022-09-02 09:31:10 +12:00
|
|
|
|
2021-09-11 08:41:30 +12:00
|
|
|
|
|
|
|
class DebugSettings(QWidget):
|
2023-02-06 20:19:31 +13:00
|
|
|
def __init__(self, parent=None):
|
|
|
|
super(DebugSettings, self).__init__(parent=parent)
|
2021-09-11 08:41:30 +12:00
|
|
|
|
2024-01-20 04:17:48 +13:00
|
|
|
self.raise_runtime_exception_button = QPushButton("Raise Exception", self)
|
2021-09-11 08:41:30 +12:00
|
|
|
self.raise_runtime_exception_button.clicked.connect(self.raise_exception)
|
2024-01-20 04:17:48 +13:00
|
|
|
self.restart_button = QPushButton("Restart", self)
|
2023-12-08 21:44:26 +13:00
|
|
|
self.restart_button.clicked.connect(
|
|
|
|
lambda: GlobalSignalsSingleton().application.quit.emit(ExitCodes.LOGOUT)
|
|
|
|
)
|
2024-01-20 04:17:48 +13:00
|
|
|
self.send_notification_button = QPushButton("Notify", self)
|
|
|
|
self.send_notification_button.clicked.connect(self.send_notification)
|
2021-09-11 08:41:30 +12:00
|
|
|
|
2023-12-08 21:44:26 +13:00
|
|
|
layout = QVBoxLayout(self)
|
|
|
|
layout.addWidget(self.raise_runtime_exception_button)
|
|
|
|
layout.addWidget(self.restart_button)
|
2024-01-20 04:17:48 +13:00
|
|
|
layout.addWidget(self.send_notification_button)
|
2023-02-22 02:26:19 +13:00
|
|
|
layout.addStretch(1)
|
2021-09-11 08:41:30 +12:00
|
|
|
|
|
|
|
def raise_exception(self):
|
|
|
|
raise RuntimeError("Debug Crash")
|
2024-01-20 04:17:48 +13:00
|
|
|
|
|
|
|
def send_notification(self):
|
|
|
|
GlobalSignalsSingleton().application.notify.emit("Debug", "Test notification")
|