mirror of
https://github.com/FAUSheppy/homelab_gamevault
synced 2025-12-06 06:51:36 +01:00
Compare commits
9 Commits
3912c66bb3
...
v1.0.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7f608019ed | ||
|
|
839efae1a3 | ||
|
|
36e5cc3842 | ||
|
|
5ab17e6f4c | ||
|
|
2e5676d5a6 | ||
|
|
a2702d7f70 | ||
|
|
344d32901e | ||
|
|
aefab57bb0 | ||
|
|
d3840c216c |
36
.github/workflows/release.yaml
vendored
Normal file
36
.github/workflows/release.yaml
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
name: Build and Release EXE
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- '*'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: windows-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.11'
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install pyinstaller
|
||||
pip install -r requirements.txt
|
||||
|
||||
- name: Build EXE
|
||||
run: pyinstaller -F client.py
|
||||
|
||||
- name: Archive EXE
|
||||
run: Compress-Archive -Path dist\ -DestinationPath release.zip
|
||||
|
||||
- name: Release
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: gh release create ${{ github.ref_name }} "release.zip" --generate-notes --title "release-${{ github.ref_name }}"
|
||||
13
client.py
13
client.py
@@ -191,13 +191,15 @@ def load_main():
|
||||
if not infowidget_window:
|
||||
infowidget_window = infowidget.ProgressBarApp(app, data_backend=db)
|
||||
|
||||
infowidget_window.root.grid(row=1, column=0, sticky="n")
|
||||
|
||||
# navbar should not expand when window is resized
|
||||
app.grid_rowconfigure(0, weight=0)
|
||||
# buttongrid (scrollable frame) should expand when window is resized
|
||||
app.grid_rowconfigure(1, weight=1)
|
||||
app.grid_columnconfigure(0, weight=1)
|
||||
app.grid_columnconfigure(1, weight=1)
|
||||
# place scrollable frame
|
||||
scrollable_frame.grid(row=1, column=0, sticky="nsew", columnspan=2)
|
||||
scrollable_frame.grid(row=1, column=1, sticky="nsew", columnspan=2)
|
||||
|
||||
|
||||
# create tiles from meta files #
|
||||
@@ -242,7 +244,7 @@ def load_details(app, software):
|
||||
global details_elements
|
||||
|
||||
app.title("Lan Vault: {}".format(software.title))
|
||||
details_elements = client_details.create_details_page(app, software, switch_to_main)
|
||||
details_elements = client_details.create_details_page(app, software, switch_to_main, infowidget_window)
|
||||
|
||||
def create_main_window_tile(software, parent):
|
||||
'''Create the main window tile'''
|
||||
@@ -294,7 +296,7 @@ def update_button_positions(event=None):
|
||||
scrollable_frame.configure(width=app.winfo_width(), height=app.winfo_height())
|
||||
|
||||
# Calculate the number of columns based on the current width of the window #
|
||||
num_columns = app.winfo_width() // 201 # Adjust 100 as needed for button width
|
||||
num_columns = app.winfo_width() // 301 # Adjust 100 as needed for button width
|
||||
|
||||
# window became too small #
|
||||
if num_columns == 0:
|
||||
@@ -312,7 +314,8 @@ def update_button_positions(event=None):
|
||||
continue
|
||||
else:
|
||||
DOWNSHIFT = 1 # FIXME make real navbar
|
||||
button.grid(row=(i // num_columns)+ DOWNSHIFT, column=i % num_columns, sticky="we")
|
||||
RIGHTSHIFT = 1 # first column for loading stuff
|
||||
button.grid(row=(i // num_columns)+ DOWNSHIFT, column=i % num_columns + RIGHTSHIFT, sticky="we")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
@@ -25,9 +25,11 @@ def show_large_picture(app, path):
|
||||
|
||||
large_image.place(x=30, y=30)
|
||||
|
||||
def create_details_page(app, software, backswitch_function):
|
||||
def create_details_page(app, software, backswitch_function, infowidget_window):
|
||||
'''Create the details page for a software and return its elements for later destruction'''
|
||||
|
||||
infowidget_window.root.grid(row=1, column=0, sticky="n")
|
||||
|
||||
elements = []
|
||||
|
||||
if software.get_thumbnail():
|
||||
@@ -42,7 +44,7 @@ def create_details_page(app, software, backswitch_function):
|
||||
|
||||
# navbar #
|
||||
navbar = customtkinter.CTkFrame(app, fg_color="transparent")
|
||||
navbar.grid(column=0, row=0, padx=10, pady=5, sticky="ew")
|
||||
navbar.grid(column=1, row=0, padx=10, pady=5, sticky="ew")
|
||||
|
||||
# back button
|
||||
back_button = customtkinter.CTkButton(navbar, text="Back", command=backswitch_function)
|
||||
@@ -65,7 +67,7 @@ def create_details_page(app, software, backswitch_function):
|
||||
thumbnail_image = customtkinter.CTkButton(app, text="", image=img, width=500, height=700,
|
||||
fg_color="transparent", hover_color="black", corner_radius=0,
|
||||
command=lambda path=path: show_large_picture(app, path))
|
||||
thumbnail_image.grid(column=0, row=1, padx=10)
|
||||
thumbnail_image.grid(column=1, row=1, padx=10)
|
||||
elements.append(thumbnail_image)
|
||||
|
||||
# fonts #
|
||||
@@ -74,7 +76,7 @@ def create_details_page(app, software, backswitch_function):
|
||||
|
||||
# info box #
|
||||
info_frame = customtkinter.CTkFrame(app, width=500)
|
||||
info_frame.grid(column=1, row=1, sticky="nswe", padx=10)
|
||||
info_frame.grid(column=2, row=1, sticky="nswe", padx=10)
|
||||
elements.append(info_frame)
|
||||
|
||||
# title #
|
||||
|
||||
@@ -168,7 +168,7 @@ class HTTP(DataBackend):
|
||||
r = requests.get(self._get_url(), params={"path": path, "as_string": True}, stream=True)
|
||||
r.raise_for_status()
|
||||
|
||||
if path.endswith(".reg") or path.endswith(".txt"):
|
||||
if path.endswith(".txt"):
|
||||
TYPE = "w"
|
||||
else:
|
||||
TYPE = "wb"
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
# update list and widget
|
||||
|
||||
# update list and widget
|
||||
import tkinter as tk
|
||||
import customtkinter as ctk
|
||||
from tkinter import ttk
|
||||
import threading
|
||||
import random
|
||||
@@ -22,13 +22,16 @@ class ProgressBarApp:
|
||||
|
||||
self.data_backend = data_backend
|
||||
self.parent = parent
|
||||
self.root = tk.Toplevel(parent)
|
||||
self.root.title("Dynamic Progress Bars")
|
||||
self.root = ctk.CTkFrame(parent)
|
||||
#self.root.title("Dynamic Progress Bars")
|
||||
|
||||
self.delete_all_button = tk.Button(self.root, text="Delete All Finished", command=self.delete_all_finished, state=tk.DISABLED)
|
||||
self.delete_all_button = ctk.CTkLabel(self.root, text="Downloads")
|
||||
self.delete_all_button.pack(pady=5)
|
||||
|
||||
self.frame = tk.Frame(self.root)
|
||||
self.delete_all_button = ctk.CTkButton(self.root, text="Delete All Finished", command=self.delete_all_finished, state=ctk.DISABLED)
|
||||
self.delete_all_button.pack(pady=5)
|
||||
|
||||
self.frame = ctk.CTkFrame(self.root)
|
||||
self.frame.pack(pady=10)
|
||||
|
||||
self.progress_bars = [] # Store tuples of (progressbar, frame, duration, delete_button)
|
||||
@@ -48,20 +51,20 @@ class ProgressBarApp:
|
||||
self.already_tracked |= downloads
|
||||
|
||||
for element in new:
|
||||
frame = tk.Frame(self.frame)
|
||||
frame.pack(fill=tk.X, pady=2)
|
||||
frame = ctk.CTkFrame(self.frame)
|
||||
frame.pack(fill=ctk.X, pady=2)
|
||||
|
||||
progress = ttk.Progressbar(frame, length=200, mode='determinate')
|
||||
progress.pack(side=tk.LEFT, padx=5)
|
||||
progress.pack(side=ctk.LEFT, padx=5)
|
||||
|
||||
delete_button = tk.Button(frame, text="Delete", command=lambda f=frame: self.delete_progress(f), state=tk.DISABLED)
|
||||
delete_button.pack(side=tk.LEFT, padx=5)
|
||||
delete_button = ctk.CTkButton(frame, text="Delete", command=lambda f=frame: self.delete_progress(f), state=ctk.DISABLED)
|
||||
delete_button.pack(side=ctk.LEFT, padx=5)
|
||||
|
||||
label = tk.Label(frame, text=os.path.basename(element.path))
|
||||
label.pack(side=tk.LEFT, padx=5)
|
||||
label = ctk.CTkLabel(frame, text=os.path.basename(element.path))
|
||||
label.pack(side=ctk.LEFT, padx=5)
|
||||
|
||||
self.progress_bars.insert(0, (progress, frame, delete_button)) # Insert at the top
|
||||
frame.pack(fill=tk.X, pady=2, before=self.frame.winfo_children()[-1] if self.frame.winfo_children() else None)
|
||||
frame.pack(fill=ctk.X, pady=2, before=self.frame.winfo_children()[-1] if self.frame.winfo_children() else None)
|
||||
|
||||
print("Starting tracker for", element.path)
|
||||
threading.Thread(target=self.fill_progress, args=(progress, element.path, frame, delete_button), daemon=True).start()
|
||||
@@ -94,11 +97,11 @@ class ProgressBarApp:
|
||||
|
||||
print("Percent filled:", percent_filled, path)
|
||||
if percent_filled >= 99.9:
|
||||
self.root.after(0, progress.config, { "value" : 100 })
|
||||
self.root.after(0, progress.configure, { "value" : 100 })
|
||||
print("Finished", path)
|
||||
break
|
||||
else:
|
||||
self.root.after(0, progress.config, { "value" : percent_filled })
|
||||
self.root.after(0, progress.configure, { "value" : percent_filled })
|
||||
time.sleep(0.5)
|
||||
|
||||
# check for stuck downloads #
|
||||
@@ -108,7 +111,7 @@ class ProgressBarApp:
|
||||
else:
|
||||
same_size_count = 0
|
||||
if same_size_count > 100:
|
||||
self.root.after(0, delete_button.config, {"state": tk.NORMAL, "text": "Failed - Delete file manually!"})
|
||||
self.root.after(0, delete_button.configure, {"state": ctk.NORMAL, "text": "Failed - Delete file manually!"})
|
||||
self.progress_bars.append((progress, frame, path, delete_button))
|
||||
self.update_delete_all_button()
|
||||
statekeeper.log_end_download(path)
|
||||
@@ -117,7 +120,7 @@ class ProgressBarApp:
|
||||
prev_precent = percent_filled
|
||||
|
||||
# handle finished download #
|
||||
self.root.after(0, delete_button.config, {"state": tk.NORMAL})
|
||||
self.root.after(0, delete_button.configure, {"state": ctk.NORMAL})
|
||||
self.progress_bars.append((progress, frame, path, delete_button))
|
||||
self.update_delete_all_button()
|
||||
|
||||
@@ -134,9 +137,9 @@ class ProgressBarApp:
|
||||
|
||||
def update_delete_all_button(self):
|
||||
if self.progress_bars:
|
||||
self.delete_all_button.config(state=tk.NORMAL)
|
||||
self.delete_all_button.configure(state=ctk.NORMAL)
|
||||
else:
|
||||
self.delete_all_button.config(state=tk.DISABLED)
|
||||
self.delete_all_button.configure(state=ctk.DISABLED)
|
||||
|
||||
def on_close(self):
|
||||
self.running = False
|
||||
|
||||
@@ -11,6 +11,7 @@ def render_path(path, install_location, game_directory,):
|
||||
result_path = path[:-len(".j2")]
|
||||
|
||||
# prepare template #
|
||||
print("JINJA-> cwd: ", os.getcwd(), "path:", path)
|
||||
input_content = ""
|
||||
with open(path, encoding="utf-16") as f:
|
||||
input_content = f.read()
|
||||
|
||||
Reference in New Issue
Block a user