Compare commits

...

2 Commits

Author SHA1 Message Date
github-actions[bot]
0c151b058e Update version.json with commit count
Some checks failed
Bleeding Update version / update-version (push) Has been cancelled
Version Change Action / version-release (push) Has been cancelled
2025-02-12 19:13:11 +00:00
Nix
fc7f47d273
put the loading theme background in a separate function 2025-02-12 16:12:59 -03:00
2 changed files with 47 additions and 40 deletions

View File

@ -210,26 +210,17 @@ class PicomcVersionSelector(QWidget):
self.movie_label.setGeometry(0, 0, 400, 320)
event.accept() # Accept the resize event
def load_theme_background(self):
"""Load and set the theme background image from base64 data in the theme configuration."""
if not self.config.get("ThemeBackground", False): # Default to False if ThemeBackground is missing
return
def init_ui(self):
self.setWindowTitle('PicoDulce Launcher') # Change window title
current_date = datetime.now()
if (current_date.month == 12 and current_date.day >= 8) or (current_date.month == 1 and current_date.day <= 1):
self.setWindowIcon(QIcon('holiday.ico')) # Set holiday icon
else:
self.setWindowIcon(QIcon('launcher_icon.ico')) # Set regular icon
self.setGeometry(100, 100, 400, 250)
# Set application style and theme
QApplication.setStyle("Fusion")
with open("config.json", "r") as config_file:
config = json.load(config_file)
if self.config.get("ThemeBackground", False): # Default to False if ThemeBackground is missing
# Get the base64 string for the background image from the theme file
theme_background_base64 = self.theme.get("background_image_base64", "")
if theme_background_base64:
if not theme_background_base64:
print("No background GIF base64 string found in the theme file.")
return
try:
# Decode the base64 string to get the binary data
background_image_data = QByteArray.fromBase64(theme_background_base64.encode())
@ -262,8 +253,24 @@ class PicomcVersionSelector(QWidget):
print("Error: Failed to load background GIF from base64 string.")
except Exception as e:
print(f"Error: Failed to decode and set background GIF. {e}")
def init_ui(self):
self.setWindowTitle('PicoDulce Launcher') # Change window title
current_date = datetime.now()
if (current_date.month == 12 and current_date.day >= 8) or (current_date.month == 1 and current_date.day <= 1):
self.setWindowIcon(QIcon('holiday.ico')) # Set holiday icon
else:
print("No background GIF base64 string found in the theme file.")
self.setWindowIcon(QIcon('launcher_icon.ico')) # Set regular icon
self.setGeometry(100, 100, 400, 250)
# Set application style and theme
QApplication.setStyle("Fusion")
with open("config.json", "r") as config_file:
config = json.load(config_file)
# Load theme background
self.load_theme_background()
# Create title label
title_label = QLabel('PicoDulce Launcher') # Change label text

View File

@ -9,5 +9,5 @@
"https://raw.githubusercontent.com/nixietab/picodulce/main/holiday.ico",
"https://raw.githubusercontent.com/nixietab/picodulce/main/authser.py"
],
"versionBleeding": "0.12-168"
"versionBleeding": "0.12-170"
}