mirror of
https://github.com/FAUSheppy/homelab_gamevault
synced 2025-12-09 08:18:31 +01:00
feat: only enable run button if installed
This commit is contained in:
@@ -2,7 +2,7 @@ import PIL
|
||||
import tkinter
|
||||
import customtkinter
|
||||
import imagetools
|
||||
|
||||
import os
|
||||
|
||||
def show_large_picture(app, path):
|
||||
'''Show a full-window version of the clicked picture'''
|
||||
@@ -150,9 +150,10 @@ def create_details_page(app, software, backswitch_function):
|
||||
run_button = customtkinter.CTkButton(button_frame, text="Run",
|
||||
command=lambda: software.run())
|
||||
run_button.pack(padx=10, pady=15, anchor="sw", side="left")
|
||||
software.run_button = run_button
|
||||
|
||||
# install button #
|
||||
if not software.run_exe:
|
||||
if not software.run_exe or not os.path.isfile(software.run_exe):
|
||||
run_button.configure(state=tkinter.DISABLED)
|
||||
run_button.configure(fg_color="gray")
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import yaml
|
||||
import tkinter
|
||||
import os
|
||||
import localaction
|
||||
import zipfile
|
||||
@@ -15,6 +16,7 @@ class Software:
|
||||
self.meta_file = meta_file
|
||||
self.directory = os.path.dirname(meta_file)
|
||||
self.backend = backend
|
||||
self.run_button = None
|
||||
print("Software Directory:", self.directory)
|
||||
|
||||
self.cache_dir = backend.cache_dir or os.path.join("cache", self.directory.lstrip("/").lstrip("\\"))
|
||||
@@ -155,6 +157,10 @@ class Software:
|
||||
shutil.copy(tmp, dest_dir)
|
||||
|
||||
self.progress_bar_wrapper.set_text(text="")
|
||||
if self.run_button:
|
||||
self.run_button.configure(state=tkinter.NORMAL)
|
||||
self.run_button.configure(fg_color="green")
|
||||
|
||||
|
||||
def run(self):
|
||||
'''Run the configured exe for this software'''
|
||||
|
||||
Reference in New Issue
Block a user