diff --git a/GUI.py b/GUI.py index 89d8c50..d031bfb 100644 --- a/GUI.py +++ b/GUI.py @@ -394,7 +394,7 @@ class App(customtkinter.CTk): command=self.switchBackgroundType ) self.background_select.grid(row=3, column=4, padx=15) - + # Custom title self.background_custom_title = customtkinter.CTkLabel( master=self.frame_bg_settings, @@ -432,9 +432,11 @@ class App(customtkinter.CTk): self.background_builtin_title.grid(row=4, column=4, padx=15) # Builtin - self.background_builtin = customtkinter.CTkEntry( + # Gets the config template toml options and creates a dropdown menu + configtemplate = toml.load("utils/.config.template.toml") + self.background_builtin = customtkinter.CTkOptionMenu( master=self.frame_bg_settings, - placeholder_text="minecraft, rocket-league" + values=configtemplate["settings"]["background"]["background_choice"]["options"] ) self.background_builtin.grid(row=5, column=4, padx=15) @@ -701,15 +703,21 @@ class App(customtkinter.CTk): def backgroundBrowse(self): filepath = filedialog.askopenfilename( initialdir="/", - title="Select a mp4 file" + title="Select a mp4 file", + multiple=False, + filetypes=(("mp4 files", "*.mp4"), ("all files", "*.*")) ) - filename = Path(filepath).stem self.background_custom.configure(text=filename) if filepath == "": self.background_custom.configure(text="Select background") + else: + #get current path + current_path = os.getcwd() + Path("./assets/backgrounds/").mkdir(parents=True, exist_ok=True) + shutil.copy(filepath, f"{current_path}\\assets\\backgrounds\\{filename}.mp4") # Background type switch def switchBackgroundType(self, type): diff --git a/utils/.config.template.toml b/utils/.config.template.toml index 7e3f9ec..92cbbf5 100644 --- a/utils/.config.template.toml +++ b/utils/.config.template.toml @@ -25,7 +25,7 @@ storymode = { optional = true, type = "bool", default = false, example = false, [settings.background] -background_choice = { optional = true, default = "minecraft", example = "rocket-league", options = ["minecraft", "gta", "rocket-league", "motor-gta", "csgo-surf", "cluster-truck", ""], explanation = "Sets the background for the video based on game name" } +background_choice = { optional = true, default = "minecraft", example = "rocket-league", options = ["minecraft", "gta", "rocket-league", "motor-gta", "csgo-surf", "cluster-truck"], explanation = "Sets the background for the video based on game name" } #background_audio = { optional = true, type = "bool", default = false, example = false, options = [true, false,], explanation = "Sets a audio to play in the background (put a background.mp3 file in the assets/backgrounds directory for it to be used.)" } #background_audio_volume = { optional = true, type = "float", default = 0.3, example = 0.1, explanation="Sets the volume of the background audio. only used if the background_audio is also set to true" }