Skip to content

Commit 522490f

Browse files
author
Raven
committed
Update Windows Check to give a warning before running Talon
1 parent 8f5e3c0 commit 522490f

1 file changed

Lines changed: 31 additions & 18 deletions

File tree

windows_check.py

Lines changed: 31 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,58 @@
11
""" Import necessary modules for the program to work """
22
import sys
33
import platform
4-
import ctypes
54
import os
65
import time
7-
import winreg
8-
from datetime import datetime
9-
from PyQt5.QtWidgets import QApplication, QMessageBox
6+
from PyQt5.QtWidgets import QApplication, QMessageBox, QPushButton
7+
from PyQt5.QtCore import Qt, QTimer
108

119

1210

13-
""" Utility function to check if the system is Windows 10 """
11+
""" Utility function to check if the system is Windows 11 """
1412
def is_windows_11():
1513
version = platform.version()
1614
return version.startswith("10.0") and int(platform.release()) >= 10
1715

1816

1917

20-
""" Utility function to display a UI error popout """
21-
def show_error(message):
18+
""" Utility function to display a UI pop-up """
19+
def show_popup(title, message, is_error=False, delay_ok=False):
2220
app = QApplication(sys.argv)
2321
msg_box = QMessageBox()
24-
msg_box.setIcon(QMessageBox.Critical)
25-
msg_box.setWindowTitle("Talon")
26-
msg_box.setText(message)
22+
msg_box.setWindowTitle(title)
23+
msg_box.setTextFormat(Qt.RichText)
24+
msg_box.setText(f"<span style='font-size:12pt;'>{message}</span>")
25+
if is_error:
26+
msg_box.setIcon(QMessageBox.Critical)
27+
else:
28+
msg_box.setIcon(QMessageBox.Warning)
29+
ok_button = msg_box.addButton(QMessageBox.Ok)
30+
if delay_ok:
31+
ok_button.setEnabled(False)
32+
QTimer.singleShot(3000, lambda: ok_button.setEnabled(True))
2733
msg_box.exec_()
28-
os._exit(1)
34+
if is_error:
35+
os._exit(1)
2936

3037

3138

32-
""" Check the system for if it is running Windows 10 or older """
39+
""" Check if the system is Windows 11 """
3340
def check_system():
3441
if not is_windows_11():
35-
show_error("You are currently on Windows 10 or older. Talon is designed to only work on freshly installed Windows 11 systems. Please update to a fresh installation of Windows 11 before attempting to use Talon again.")
36-
37-
install_date = get_installation_date()
38-
if install_date is None:
39-
show_error("Could not determine Windows installation date. Please ensure your system is properly configured.")
42+
show_popup("Talon Installation Failure",
43+
"You are currently on Windows 10 or older. <b>Talon is designed to only work on freshly installed Windows 11 systems</b>. Please update to a fresh installation of Windows 11 before attempting to use Talon again.",
44+
is_error=True)
45+
show_popup("Talon Installation Warning",
46+
"""
47+
Talon is designed to be used on <b>freshly installed Windows 11 systems</b>. Running this program on an already in-use system could result in data loss, apps stopping working, or even corruption.<br><br>
48+
49+
<b>For the best results, please ensure you are on a fresh installation of the latest version of Windows 11 Home or Professional.<b>
50+
""",
51+
is_error=False,
52+
delay_ok=True)
4053

4154

4255

4356
""" Start the program """
4457
if __name__ == "__main__":
45-
check_system()
58+
check_system()

0 commit comments

Comments
 (0)