Skip to content

Commit f0d52a3

Browse files
author
Raven
committed
Add windows_check, selection box color, docstrings, more args to Raphi subprocess
1 parent a4e7b6d commit f0d52a3

9 files changed

Lines changed: 183 additions & 34 deletions

browser_install.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1+
""" Import necessary modules for the program to work """
12
import subprocess
23

4+
5+
6+
""" Install whichever browser the user selected from browser_select_screen """
37
def install_browser(selected_browser):
48
browser_map = {
59
"Chrome": "Google.Chrome",

browser_select_screen.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
""" Import necessary modules for the program to work """
12
from PyQt5.QtWidgets import (
23
QWidget, QVBoxLayout, QHBoxLayout, QPushButton, QLabel, QGraphicsDropShadowEffect, QSpacerItem, QSizePolicy
34
)
@@ -6,7 +7,12 @@
67
import os
78
import sys
89

10+
11+
12+
""" Create a class for the buttons in the UI """
913
class AnimatedButton(QPushButton):
14+
15+
""" Initialization """
1016
def __init__(self, text, color, hover_color=None, is_firefox=False):
1117
super().__init__(text)
1218
self.default_color = color
@@ -27,6 +33,7 @@ def __init__(self, text, color, hover_color=None, is_firefox=False):
2733
self.animation.setDuration(800)
2834
self.animation.setEasingCurve(QEasingCurve.InOutQuad)
2935

36+
""" Hover effect """
3037
def enterEvent(self, event):
3138
self.animation.stop()
3239
self.animation.setStartValue(self.shadow_effect.blurRadius())
@@ -36,6 +43,7 @@ def enterEvent(self, event):
3643
self.setStyleSheet(f"background-color: {self.hover_color.name()}; color: {text_color}; border: none;")
3744
super().enterEvent(event)
3845

46+
""" Unhover effect """
3947
def leaveEvent(self, event):
4048
self.animation.stop()
4149
self.animation.setStartValue(self.shadow_effect.blurRadius())
@@ -45,7 +53,12 @@ def leaveEvent(self, event):
4553
self.setStyleSheet(f"background-color: {self.default_color.name()}; color: {text_color.name()}; border: none;")
4654
super().leaveEvent(event)
4755

56+
57+
58+
""" Create a class for the browser selection UI """
4859
class BrowserSelectScreen(QWidget):
60+
61+
""" Initialization """
4962
def __init__(self):
5063
super().__init__()
5164
self.setWindowTitle("Browser Selector")
@@ -107,6 +120,7 @@ def __init__(self):
107120
layout.addLayout(button_layout)
108121
self.setLayout(layout)
109122

123+
""" Load the Chakra Petch font, which is used for the UI """
110124
def load_chakra_petch_font(self):
111125
try:
112126
if getattr(sys, 'frozen', False):
@@ -122,6 +136,7 @@ def load_chakra_petch_font(self):
122136
except Exception as e:
123137
print(f"Error loading font: {e}")
124138

139+
""" Return value of the selected browser """
125140
def select_browser(self, browser_name):
126141
self.selected_browser = browser_name
127142
print(f"Selected browser: {self.selected_browser}")

debloat_windows.py

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
""" Import necessary modules for the program to work """
12
import sys
23
import ctypes
34
import os
@@ -10,29 +11,44 @@
1011
import logging
1112
import json
1213

14+
15+
16+
""" Set up the log file """
1317
LOG_FILE = "talon.txt"
1418
logging.basicConfig(
1519
filename=LOG_FILE,
1620
level=logging.INFO,
1721
format="%(asctime)s - %(levelname)s - %(message)s",
1822
)
1923

24+
25+
26+
""" Utility function to log outputs """
2027
def log(message):
2128
logging.info(message)
2229
print(message)
2330

31+
32+
33+
""" Utility function to check if the program is running as administrator """
2434
def is_admin():
2535
try:
2636
return ctypes.windll.shell32.IsUserAnAdmin()
2737
except:
2838
return False
2939

40+
41+
42+
""" If the program is not running as administrator, attempt to elevate """
3043
if not is_admin():
3144
ctypes.windll.shell32.ShellExecuteW(
3245
None, "runas", sys.executable, " ".join(sys.argv), None, 1
3346
)
3447
sys.exit(0)
3548

49+
50+
51+
""" Apply modifications done via the Windows registry """
3652
def apply_registry_changes():
3753
log("Applying registry changes...")
3854
try:
@@ -51,6 +67,8 @@ def apply_registry_changes():
5167
(winreg.HKEY_CURRENT_USER, r"Control Panel\\Desktop\\WindowMetrics", "MinAnimate", winreg.REG_DWORD, 0),# Disable minimize/maximize animations
5268
(winreg.HKEY_CURRENT_USER, r"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced", "ExtendedUIHoverTime", winreg.REG_DWORD, 1),# Reduce hover time for tooltips and UI elements
5369
(winreg.HKEY_CURRENT_USER, r"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced", "HideFileExt", winreg.REG_DWORD, 0),# Show file extensions in Explorer (useful for security and organization)
70+
(winreg.HKEY_CURRENT_USER, r"Control Panel\\Colors", "Hilight", winreg.REG_SZ, "0 0 0"), # Sets highlight color to black
71+
(winreg.HKEY_CURRENT_USER, r"Control Panel\\Colors", "HotTrackingColor", winreg.REG_SZ, "0 0 0"), # Sets the click-and-drag box color to black
5472
]
5573
for root_key, key_path, value_name, value_type, value in registry_modifications:
5674
try:
@@ -69,6 +87,9 @@ def apply_registry_changes():
6987
except Exception as e:
7088
log(f"Error applying registry changes: {e}")
7189

90+
91+
92+
""" Run a script to remove Edge, and prevent reinstallation """
7293
def run_edge_vanisher():
7394
log("Starting Edge Vanisher script execution...")
7495
try:
@@ -116,6 +137,9 @@ def run_edge_vanisher():
116137
log(f"Unexpected error during Edge Vanisher execution: {str(e)}")
117138
run_oouninstall()
118139

140+
141+
142+
""" Run a script to remove OneDrive and Outlook """
119143
def run_oouninstall():
120144
log("Starting Office Online uninstallation process...")
121145
try:
@@ -155,6 +179,9 @@ def run_oouninstall():
155179
log(f"Unexpected error during OO uninstallation: {str(e)}")
156180
run_tweaks()
157181

182+
183+
184+
""" Run ChrisTitusTech's WinUtil to debloat the system (Thanks Chris, you're a legend!) """
158185
def run_tweaks():
159186
logging.basicConfig(
160187
level=logging.INFO,
@@ -226,6 +253,9 @@ def run_tweaks():
226253
run_applybackground()
227254
os._exit(1)
228255

256+
257+
258+
""" Run a program to set the background of the system """
229259
def run_applybackground():
230260
log("Starting ApplyBackground tweaks...")
231261
try:
@@ -280,6 +310,9 @@ def run_applybackground():
280310
log(f"Error in ApplyBackground: {str(e)}")
281311
run_winconfig()
282312

313+
314+
315+
""" Run Raphi's Win11Debloat script to further debloat the system (Thanks Raphire!) """
283316
def run_winconfig():
284317
log("Starting Windows configuration process...")
285318
try:
@@ -301,6 +334,8 @@ def run_winconfig():
301334
f"& '{script_path}' -Silent -RemoveApps -RemoveGamingApps -DisableTelemetry "
302335
f"-DisableBing -DisableSuggestions -DisableLockscreenTips -RevertContextMenu "
303336
f"-TaskbarAlignLeft -HideSearchTb -DisableWidgets -DisableCopilot -ExplorerToThisPC"
337+
f"-ClearStartAllUsers -DisableDVR -DisableStartRecommended -ExplorerToThisPC"
338+
f"-DisableMouseAcceleration"
304339
)
305340
log(f"Executing PowerShell command with parameters:")
306341
log(f"Command: {powershell_command}")
@@ -360,6 +395,9 @@ def run_winconfig():
360395
log(f"Failed to start UpdatePolicyChanger after unexpected error: {inner_e}")
361396
run_updatepolicychanger()
362397

398+
399+
400+
""" Run a script to establish an update policy which only accepts security updates """
363401
def run_updatepolicychanger():
364402
log("Starting UpdatePolicyChanger script execution...")
365403
log("Checking system state before UpdatePolicyChanger execution...")
@@ -443,6 +481,8 @@ def run_updatepolicychanger():
443481
finalize_installation()
444482

445483

484+
485+
""" Finalize installation by restarting """
446486
def finalize_installation():
447487
log("Installation complete. Restarting system...")
448488
try:
@@ -454,5 +494,8 @@ def finalize_installation():
454494
except Exception as e:
455495
log(f"Failed to restart system: {e}")
456496

497+
498+
499+
""" Run the program """
457500
if __name__ == "__main__":
458501
apply_registry_changes()

defender_check.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
""" Import necessary modules for the program to work """
12
import ctypes
23
import time
34
import threading
@@ -8,9 +9,13 @@
89
from PyQt5.QtCore import Qt, QTimer, pyqtSignal
910
import wmi
1011

12+
13+
14+
""" Create a class for the Defender check UI """
1115
class DefenderCheck(QWidget):
1216
defender_disabled_signal = pyqtSignal()
1317

18+
""" Initialization """
1419
def __init__(self, parent=None):
1520
super().__init__(parent)
1621
self.load_chakra_petch_font()
@@ -31,6 +36,7 @@ def __init__(self, parent=None):
3136
self.check_defender_status(immediate_check=True)
3237
self.setLayout(layout)
3338

39+
""" Load the Chakra Petch font, which is used for the UI """
3440
def load_chakra_petch_font(self):
3541
try:
3642
if getattr(sys, 'frozen', False):
@@ -48,6 +54,7 @@ def load_chakra_petch_font(self):
4854
except Exception as e:
4955
print(f"Error loading font: {e}")
5056

57+
""" Update the UI accordingly based on Windows Defender's status """
5158
def check_defender_status(self, immediate_check=False):
5259
if immediate_check:
5360
if not self.is_defender_enabled():
@@ -68,6 +75,7 @@ def check_defender_status(self, immediate_check=False):
6875
else:
6976
print("Defender is still enabled. Checking again in 3 seconds...")
7077

78+
""" Check if Windows Defender is enabled using WMI """
7179
def is_defender_enabled(self):
7280
try:
7381
w = wmi.WMI(namespace="root\\SecurityCenter2")

0 commit comments

Comments
 (0)