Added background options from config template toml

pull/1207/head
StopmotionSimonYT 3 years ago
parent 3e4caac5fa
commit be76adbc02

@ -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):

@ -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" }

Loading…
Cancel
Save