darkmode autodetect added
This commit is contained in:
parent
8a78272238
commit
a02c6aa1cd
6 changed files with 34 additions and 12 deletions
|
@ -3,5 +3,6 @@ tkintertable
|
|||
customtkinter
|
||||
tqdm
|
||||
requests
|
||||
darkdetect
|
||||
nuitka
|
||||
pillow
|
|
@ -22,8 +22,8 @@ def download_from_sourceforge(api_url, file_path):
|
|||
else:
|
||||
print(f"Failed to download. Status code: {response.status_code}")
|
||||
|
||||
# Example usage with the provided link
|
||||
sourceforge_api_url = "https://downloads.sourceforge.net/project/sevenzip/7-Zip/19.00/7z1900-x64.exe"
|
||||
download_path = "7z1900-x64.exe"
|
||||
# # Example usage with the provided link
|
||||
# sourceforge_api_url = "https://downloads.sourceforge.net/project/sevenzip/7-Zip/19.00/7z1900-x64.exe"
|
||||
# download_path = "7z1900-x64.exe"
|
||||
|
||||
download_from_sourceforge(sourceforge_api_url, download_path)
|
||||
# download_from_sourceforge(sourceforge_api_url, download_path)
|
|
@ -6,6 +6,7 @@ import json
|
|||
import json_main
|
||||
from download_gitlab import download_and_update
|
||||
import download_github
|
||||
import donwload_sourceforge
|
||||
import install_main
|
||||
|
||||
# Global flag to check if the installation should be canceled
|
||||
|
@ -82,6 +83,11 @@ def download_all_packages(progress_bar, progress_label, download_location, insta
|
|||
tqdm,
|
||||
version
|
||||
)
|
||||
elif source_type == "sourceforge" or source_type == "raw":
|
||||
donwload_sourceforge.download_from_sourceforge(
|
||||
source_info["url"],
|
||||
os.path.join(download_folder,app_name)
|
||||
)
|
||||
# Add other source types as needed
|
||||
else:
|
||||
progress_label = f"Unsupported source type for {app_name}: {source_type}"
|
||||
|
|
|
@ -5,6 +5,8 @@ from PIL import Image, ImageTk
|
|||
|
||||
import download_main
|
||||
from gui_starfield import StarField
|
||||
import darkdetect
|
||||
from json_main import save_package
|
||||
|
||||
def run_installer(download_folder_tmp):
|
||||
global visible_widgets, tab_combobox # Declare tab_combobox as a global variable
|
||||
|
@ -16,12 +18,21 @@ def run_installer(download_folder_tmp):
|
|||
app.minsize(width=800, height=600)
|
||||
app.maxsize(width=800, height=600)
|
||||
|
||||
set_default_color_theme("dark-blue")
|
||||
set_appearance_mode("dark")
|
||||
app.isDark = darkdetect.isDark()
|
||||
|
||||
if app.isDark:
|
||||
set_default_color_theme("dark-blue")
|
||||
set_appearance_mode("dark")
|
||||
|
||||
app.resizable(False, False)
|
||||
|
||||
def print_ahoj():
|
||||
spitfire_source_info = {
|
||||
"url": "https://downloads.sourceforge.net/project/spitfire-browser/nightly/components/Browser/win-bin-nighty.zip",
|
||||
}
|
||||
|
||||
#(version, app, source_type, source_info, package_type)
|
||||
save_package("1.0", "Spitfire", "sourceforge", spitfire_source_info, "browser")
|
||||
print("ahoj")
|
||||
|
||||
def start_install():
|
||||
|
@ -37,7 +48,7 @@ def run_installer(download_folder_tmp):
|
|||
|
||||
def display_star_field(container):
|
||||
global star_field
|
||||
star_field = StarField(container, 400, 600)
|
||||
star_field = StarField(container, 400, 600, app.isDark)
|
||||
star_field.canvas.pack(side="left", fill="y")
|
||||
|
||||
def create_widgets_for_current_tab():
|
||||
|
@ -99,7 +110,7 @@ def run_installer(download_folder_tmp):
|
|||
"Tab1": [
|
||||
(CTkButton, {"text": "Next Tab", "command": switch_to_next_tab}),
|
||||
(CTkButton, {"text": "Previous Tab", "command": switch_to_previous_tab}),
|
||||
CTkCheckBox,
|
||||
(CTkButton, {"text": "Get Browser package", "command": print_ahoj}),
|
||||
CTkComboBox,
|
||||
CTkEntry,
|
||||
CTkProgressBar,
|
||||
|
|
|
@ -16,7 +16,7 @@ class Star:
|
|||
self.fill = 0
|
||||
|
||||
class StarField:
|
||||
def __init__(self, master, width, height, depth=32, num_stars=100):
|
||||
def __init__(self, master, width, height, isDark, depth=32, num_stars=100):
|
||||
self.master = master
|
||||
self.fov = 180 * math.pi / 180
|
||||
self.view_distance = 0
|
||||
|
@ -27,8 +27,12 @@ class StarField:
|
|||
self.center_x = width / 2
|
||||
self.center_y = height / 2
|
||||
self.circular_mask_radius = min(self.center_x, self.center_y) * 0.95
|
||||
self.canvas = Canvas(master, width=width, height=height, bg="#111111")
|
||||
self.canvas.pack()
|
||||
if isDark:
|
||||
self.canvas = Canvas(master, width=width, height=height, bg="#111111")
|
||||
self.canvas.pack()
|
||||
else:
|
||||
self.canvas = Canvas(master, width=width, height=height, bg="#FFFFFF")
|
||||
self.canvas.pack()
|
||||
|
||||
# Create a black circle as the background
|
||||
self.canvas.create_oval(self.center_x - self.circular_mask_radius,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import json
|
||||
import os
|
||||
|
||||
data_location = "./data/config.json"
|
||||
data_location = "./config.json"
|
||||
|
||||
def save_first_run(var):
|
||||
with open(data_location, "r") as json_file:
|
||||
|
|
Reference in a new issue