mirror of
https://github.com/FAUSheppy/homelab_gamevault
synced 2025-12-06 15:01:36 +01:00
wip: initial
This commit is contained in:
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
*.zip
|
||||
67
client.py
Normal file
67
client.py
Normal file
@@ -0,0 +1,67 @@
|
||||
import tkinter
|
||||
import customtkinter
|
||||
import PIL
|
||||
|
||||
customtkinter.set_appearance_mode("dark")
|
||||
customtkinter.set_default_color_theme("blue")
|
||||
|
||||
app = customtkinter.CTk()
|
||||
app.geometry("720x780")
|
||||
last_geometry = app.winfo_geometry()
|
||||
app.title("Test")
|
||||
app.update()
|
||||
|
||||
img = PIL.Image.open("test.jpg")
|
||||
img = img.resize((200, 300))
|
||||
img = PIL.ImageTk.PhotoImage(img)
|
||||
#img = PIL.ImageTk.PhotoImage(file="test.jpg")
|
||||
|
||||
buttons = []
|
||||
|
||||
def create_button():
|
||||
|
||||
button = customtkinter.CTkButton(app, image=img, width=200, height=300, command=lambda: button_click(button),
|
||||
border_width=0, corner_radius=0, border_spacing=0, text="Test Title LOLOLOL",
|
||||
fg_color="transparent", compound="top", anchor="s")
|
||||
return button
|
||||
|
||||
def button_click():
|
||||
print(button.cget("image"))
|
||||
|
||||
def update_button_positions(event=None):
|
||||
|
||||
global last_geometry
|
||||
|
||||
new_geometry = app.winfo_geometry()
|
||||
if last_geometry[0] == new_geometry[0] and last_geometry[1] == new_geometry[1]:
|
||||
return
|
||||
else:
|
||||
last_geometry = new_geometry
|
||||
|
||||
# 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
|
||||
|
||||
# window became too slow #
|
||||
if num_columns == 0:
|
||||
return
|
||||
|
||||
|
||||
for i, button in enumerate(buttons):
|
||||
|
||||
grid_info_current = button.grid_info()
|
||||
column_new = i % num_columns
|
||||
row_new = i // num_columns
|
||||
|
||||
if grid_info_current.get("row") and grid_info_current["row"] == row_new and grid_info_current["column"] == column_new:
|
||||
continue
|
||||
else:
|
||||
button.grid(row=i // num_columns, column=i % num_columns, sticky="we")
|
||||
|
||||
|
||||
for i in range(0,5):
|
||||
button = create_button()
|
||||
buttons.append(button)
|
||||
|
||||
app.bind("<Configure>", update_button_positions)
|
||||
update_button_positions()
|
||||
app.mainloop()
|
||||
53
data_backend.py
Normal file
53
data_backend.py
Normal file
@@ -0,0 +1,53 @@
|
||||
import os
|
||||
import glob
|
||||
import yaml
|
||||
|
||||
class DataBackend:
|
||||
|
||||
def __init__(self, user, password, cache_dir, remote_root_dir=None):
|
||||
|
||||
self.user = user
|
||||
self.password = password
|
||||
self.cache_dir = cache_dir
|
||||
self.remote_root_dir = remote_root_dir
|
||||
|
||||
if not os.path.isdir(self.cache_dir):
|
||||
os.mkdir(self.cache_dir)
|
||||
|
||||
def get(self, path):
|
||||
'''Return the contents of this path'''
|
||||
raise NotImplementedError()
|
||||
|
||||
def list(self, path):
|
||||
'''List the contents of this path'''
|
||||
raise NotImplementedError()
|
||||
|
||||
def find_all_metadata(self):
|
||||
'''Return key-value map of { software : metadata-dict }'''
|
||||
raise NotImplementedError
|
||||
|
||||
class LocalFS(DataBackend):
|
||||
|
||||
def get(self, path):
|
||||
fullpath = os.path.join(self.remote_root_dir, path)
|
||||
with open(fullpath, "rb") as f:
|
||||
target = os.path.join(self.cache_dir, os.path.basename(path))
|
||||
with open(target, "wb") as ft:
|
||||
ft.write(f.read())
|
||||
|
||||
def list(self, path):
|
||||
fullpath = os.path.join(self.remote_root_dir, path)
|
||||
return os.listdir(fullpath)
|
||||
|
||||
def find_all_metadata(self):
|
||||
|
||||
meta_info_list = []
|
||||
for software_dir in glob.iglob(self.remote_root_dir + "/*"):
|
||||
meta_file = os.path.join(software_dir, "meta.yaml")
|
||||
if not os.path.isfile(meta_file):
|
||||
continue
|
||||
else:
|
||||
with open(meta_file) as f:
|
||||
meta_info_list.append(yaml.safe_load(f))
|
||||
|
||||
return meta_info_list
|
||||
@@ -0,0 +1 @@
|
||||
HelloWorld
|
||||
15
example_software_root/FreeDink/meta.yaml
Normal file
15
example_software_root/FreeDink/meta.yaml
Normal file
@@ -0,0 +1,15 @@
|
||||
genre: RPG
|
||||
title: GNU FreeDink
|
||||
description: |
|
||||
Free GNU RPG from 1993.
|
||||
The game centers on Dink, a pig farmer-turned-hero who embarks on various quests throughout his world.
|
||||
The game features isometric, Diablo-like gameplay,[3] including weapons, items, and magic.
|
||||
The game has a satirical off-color slant, including everything from a fiercely abusive uncle
|
||||
to a town that worships ducks. Dink is never freed from the grievances of being a pig farmer,
|
||||
a fact he is far too often reminded of by his nemesis, Milder Flatstomp.
|
||||
dependencies:
|
||||
- dummy_dep_1
|
||||
link_only: false
|
||||
extra_files:
|
||||
dummy_file_1.txt: "%APP_DATA%/game_vault/"
|
||||
dummy_dir_1: "%APP_DATA%/game_vault/"
|
||||
BIN
example_software_root/FreeDink/pictures/freedink_1.jpg
Normal file
BIN
example_software_root/FreeDink/pictures/freedink_1.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 256 KiB |
BIN
example_software_root/FreeDink/pictures/wallpaper.jpg
Normal file
BIN
example_software_root/FreeDink/pictures/wallpaper.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 190 KiB |
Binary file not shown.
30
localaction.py
Normal file
30
localaction.py
Normal file
@@ -0,0 +1,30 @@
|
||||
def _template_registry_file(template_file, game_path=None):
|
||||
'''Template the registry file before installation'''
|
||||
pass
|
||||
|
||||
def unpack_software(software_cache_path, target_path):
|
||||
'''Unpack a downloaded software to the target location'''
|
||||
pass
|
||||
|
||||
def install_registry_file(registry_file, game_path=None):
|
||||
'''Install a given registy file'''
|
||||
|
||||
def install_extra_files(extra_files_list, path):
|
||||
'''Copy/Install extra gamedata to a give location'''
|
||||
pass
|
||||
|
||||
def launch_software(path, synchronous=False):
|
||||
'''Launches a given software'''
|
||||
pass
|
||||
|
||||
def remove_software(path):
|
||||
'''Remove a software at the target location'''
|
||||
pass
|
||||
|
||||
def uninstall_registry_file(registry_file):
|
||||
'''Uninstall given registry file by it's keys'''
|
||||
pass
|
||||
|
||||
def uninstall_extra_files(extra_file_list, path):
|
||||
'''Uninstall all extra game data'''
|
||||
pass
|
||||
15
localconfig.py
Normal file
15
localconfig.py
Normal file
@@ -0,0 +1,15 @@
|
||||
class LocalConfig:
|
||||
|
||||
def __init__(self):
|
||||
|
||||
self.remote_user = None
|
||||
self.remote_pass = None
|
||||
self.skip_registry_ask = None
|
||||
|
||||
def save_to_fs(self):
|
||||
'''Save the current config to the local file system'''
|
||||
pass
|
||||
|
||||
def load_from_fs(self):
|
||||
'''Load a config file from the filesystem'''
|
||||
pass
|
||||
11
remote.py
Normal file
11
remote.py
Normal file
@@ -0,0 +1,11 @@
|
||||
def get_meta_all(backend):
|
||||
'''Get a list of all software metadata on the remote'''
|
||||
pass
|
||||
|
||||
def download_software(backend, software, progress_callback=None):
|
||||
'''Download a software from the remote'''
|
||||
pass
|
||||
|
||||
def download_pictures(backend, software):
|
||||
'''Downloads the pictures/thumbnails for a software'''
|
||||
pass
|
||||
Reference in New Issue
Block a user