Add update system
All checks were successful
Build and Upload Release (Windows EXE) / Build Windows EXE (release) Successful in 37s

This commit is contained in:
2026-01-24 01:13:19 -05:00
parent ea6eb1fd5f
commit 44fe6245b9
7 changed files with 733 additions and 22 deletions

View File

@@ -12,6 +12,8 @@ from dotenv import load_dotenv
from PIL import Image, ImageTk, ImageDraw, ImageFilter
import time
import webbrowser
from update_checker import UpdateChecker
from update_config import get_update_config
# Load environment variables
load_dotenv()
@@ -1158,12 +1160,23 @@ class SteamWorkshopGUI:
self.log_to_output("🔍 Please provide a valid RimWorld installation path to continue.\n")
self.log_to_output(" The 'RimWorld Game Folder' label will stop blinking once a valid path is detected.\n\n")
# Initialize update checker
config = get_update_config()
self.update_checker = UpdateChecker(config["current_version"])
# Add update check functionality
self.add_update_check_button()
# Check initial state now that all GUI elements are created
self.on_rimworld_path_change()
# Start blinking animation for RimWorld label (with slight delay to ensure GUI is ready)
self.root.after(1000, self.start_rimworld_label_blink)
# Check for updates on startup if enabled
if config["check_on_startup"]:
self.root.after(config["startup_check_delay"], self.check_for_updates_on_startup)
def create_header_frame(self, parent):
"""Create header frame with progression logo"""
header_frame = tk.Frame(parent, bg='#2b2b2b', height=100)
@@ -1200,12 +1213,12 @@ class SteamWorkshopGUI:
def create_footer_frame(self, parent):
"""Create footer frame with HR Systems logo in bottom right"""
footer_frame = tk.Frame(parent, bg='#2b2b2b', height=100) # Increased height for better visibility
footer_frame.pack(fill='x', side=tk.BOTTOM, pady=(10, 0))
footer_frame.pack_propagate(False)
self.footer_frame = tk.Frame(parent, bg='#2b2b2b', height=100) # Increased height for better visibility
self.footer_frame.pack(fill='x', side=tk.BOTTOM, pady=(10, 0))
self.footer_frame.pack_propagate(False)
# Create clickable HR Systems logo in bottom right
self.create_hr_logo(footer_frame)
self.create_hr_logo(self.footer_frame)
def create_hr_logo(self, parent):
"""Create clickable HR Systems logo with radial glow hover effects"""
@@ -1479,6 +1492,16 @@ class SteamWorkshopGUI:
self.workshop_display.pack(fill='x', pady=(5, 0))
self.workshop_display.bind('<KeyRelease>', self.on_workshop_path_change)
# White line separator above ModsConfig section
separator_line = tk.Frame(parent, bg='#ffffff', height=1)
separator_line.pack(fill='x', pady=(15, 5))
# Warning text above ModsConfig section
warning_label = tk.Label(parent, text="Don't edit anything below unless you know what you are doing",
font=self.get_font(8), bg='#2b2b2b', fg='#ffaa00', # Orange warning color
anchor='w')
warning_label.pack(anchor='w', pady=(0, 10))
# ModsConfig.xml folder display
modsconfig_frame = tk.Frame(parent, bg='#2b2b2b')
modsconfig_frame.pack(fill='x', pady=(0, 15))
@@ -1494,16 +1517,6 @@ class SteamWorkshopGUI:
self.modsconfig_display.pack(fill='x', pady=(5, 0))
self.modsconfig_display.bind('<KeyRelease>', self.on_modsconfig_path_change)
# White line separator
separator_line = tk.Frame(modsconfig_frame, bg='#ffffff', height=1)
separator_line.pack(fill='x', pady=(10, 5))
# Warning text
warning_label = tk.Label(modsconfig_frame, text="Don't edit unless you know what you are doing",
font=self.get_font(8), bg='#2b2b2b', fg='#ffaa00', # Orange warning color
anchor='w')
warning_label.pack(anchor='w', pady=(0, 5))
# Initialize ModsConfig path
self.find_modsconfig_path()
@@ -1624,7 +1637,7 @@ class SteamWorkshopGUI:
self.disable_buttons()
self.workshop_var.set("Invalid RimWorld path")
self.log_to_output(f"✗ Invalid RimWorld installation at: {rimworld_path}\n")
self.log_to_output(" Please ensure the path contains RimWorld.exe and Data folder\n")
self.log_to_output(" Please ensure the path contains RimWorld.exe (or RimWorldWin64.exe) and Data folder\n")
else:
# Empty path - keep blinking and buttons disabled
self.is_rimworld_valid = False
@@ -1636,9 +1649,10 @@ class SteamWorkshopGUI:
if not path or not os.path.exists(path):
return False
# Check for RimWorld.exe
# Check for RimWorld executable (can be RimWorld.exe or RimWorldWin64.exe)
rimworld_exe = os.path.join(path, "RimWorld.exe")
if not os.path.exists(rimworld_exe):
rimworld_win64_exe = os.path.join(path, "RimWorldWin64.exe")
if not (os.path.exists(rimworld_exe) or os.path.exists(rimworld_win64_exe)):
return False
# Check for Data folder (contains core game data)
@@ -2573,6 +2587,39 @@ you must auto sort after this!"""
# Exit the entire application since main window is hidden
self.root.quit()
def add_update_check_button(self):
"""Add an update check button to the footer"""
try:
if hasattr(self, 'footer_frame'):
update_btn = tk.Button(self.footer_frame,
text="Check for Updates",
command=self.manual_update_check,
bg='#404040', fg='white',
font=('Arial', 10),
padx=15, pady=5,
cursor='hand2')
update_btn.pack(side='left', padx=10, pady=10)
except Exception as e:
print(f"Could not add update button: {e}")
def check_for_updates_on_startup(self):
"""Check for updates when the application starts"""
def update_callback(release_info, error):
if error or not release_info:
return # Silently fail on startup
latest_version = release_info['version']
if (self.update_checker.is_newer_version(latest_version) and
not self.update_checker.should_skip_version(latest_version)):
# Show update dialog
self.update_checker.show_update_dialog(self.root, release_info)
self.update_checker.check_for_updates_async(update_callback)
def manual_update_check(self):
"""Manually triggered update check"""
self.update_checker.manual_check_for_updates(self.root)
def main():
root = tk.Tk()