diff --git a/GUI.py b/GUI.py index a4f1e01..2ae1518 100644 --- a/GUI.py +++ b/GUI.py @@ -1,128 +1,431 @@ -import json -import re -import webbrowser -from pathlib import Path - -# Used "tomlkit" instead of "toml" because it doesn't change formatting on "dump" -import tomlkit -from flask import ( - Flask, - flash, - redirect, - render_template, - request, - send_from_directory, - url_for, -) - -# Set the hostname -HOST = "localhost" -# Set the port number -PORT = 4000 - -# Configure application -app = Flask(__name__, template_folder="GUI") - -# Configure secret key only to use 'flash' -app.secret_key = b'_5#y2L"F4Q8z\n\xec]/' - - -# Ensure responses aren't cached -@app.after_request -def after_request(response): - response.headers["Cache-Control"] = "no-cache, no-store, must-revalidate" - response.headers["Expires"] = 0 - response.headers["Pragma"] = "no-cache" - return response - - -# Display index.html -@app.route("/") -def index(): - return render_template("index.html") - - -# Make videos.json accessible -@app.route("/videos.json") -def videos_json(): - return send_from_directory("video_creation/data", "videos.json") - - -# Make videos in results folder accessible -@app.route("/results/") -def results(name): - return send_from_directory("results", name, as_attachment=True) - - -@app.route("/add_background", methods=["POST"]) -def add_background(): - # Get form values - youtube_uri = request.form.get("youtube_uri").strip() - filename = request.form.get("filename").strip() - citation = request.form.get("citation").strip() - position = request.form.get("position").strip() - - # Validate YouTube URI - regex = re.compile( - r"(?:\/|%3D|v=|vi=)([0-9A-z-_]{11})(?:[%#?&]|$)" - ).search(youtube_uri) - - if not regex: - flash("YouTube URI is invalid!", "error") - return redirect(url_for("index")) - - youtube_uri = f"https://www.youtube.com/watch?v={regex.group(1)}" - - # Check if position is valid - if position == "" or position == "center": - position = "center" - - elif position.isdecimal(): - position = int(position) - - else: - flash('Position is invalid! It can be "center" or decimal number.', "error") - return redirect(url_for("index")) - - # Sanitize filename - filename = filename.replace(" ", "-").split(".")[0] - - # Check if background doesn't already exist - with open("utils/backgrounds.json", "r", encoding="utf-8") as backgrounds: - data = json.load(backgrounds) - - # Check if key isn't already taken - if filename in list(data.keys()): - flash("Background video with this name already exist!", "error") - return redirect(url_for("index")) - - # Check if the YouTube URI isn't already used under different name - if youtube_uri in [data[i][0] for i in list(data.keys())]: - flash("Background video with this YouTube URI is already added!", "error") - return redirect(url_for("index")) - - # Add background video to json file - with open("utils/backgrounds.json", "r+", encoding="utf-8") as backgrounds: - data = json.load(backgrounds) - - data[filename] = [youtube_uri, filename + ".mp4", citation, position] - backgrounds.seek(0) - json.dump(data, backgrounds, ensure_ascii=False, indent=4) - - # Add background video to ".config.template.toml" to make it accessible - config = tomlkit.loads(Path("utils/.config.template.toml").read_text()) - config["settings"]["background"]["background_choice"]["options"].append(filename) - - with Path("utils/.config.template.toml").open("w") as toml_file: - toml_file.write(tomlkit.dumps(config)) - - flash(f'Added "{citation}-{filename}.mp4" as a new background video!') - - return redirect(url_for("index")) - - -# Run browser and start the app -if __name__ == "__main__": - webbrowser.open(f"http://{HOST}:{PORT}", new=2) - print("Website opened in new tab. Refresh if it didn't load.") - app.run(port=PORT) +from main import main, shutdown + +from doctest import master +import tkinter +import tkinter.messagebox +import customtkinter +from utils.settings import settings + +customtkinter.set_appearance_mode("System") # Modes: "System" (standard), "Dark", "Light" +customtkinter.set_default_color_theme("blue") # Themes: "blue" (standard), "green", "dark-blue" + + +class App(customtkinter.CTk): + + WIDTH = 1200 + HEIGHT = 600 + + def __init__(self): + super().__init__() + + self.title("Reddit Video Maker Bot GUI") + self.geometry(f"{App.WIDTH}x{App.HEIGHT}") + self.resizable(False, False) + self.protocol("WM_DELETE_WINDOW", self.on_closing) # call .on_closing() when app gets closed + self.resizable(False, False) + + # ============ create two frames ============ + + # configure grid layout (2x1) + self.grid_columnconfigure(1, weight=1) + self.grid_rowconfigure(0, weight=1) + + self.frame_left = customtkinter.CTkFrame(master=self, + width=180, + corner_radius=0) + self.frame_left.grid(row=0, column=0, sticky="nswe") + + # Results Frame + self.frame_results = customtkinter.CTkFrame(master=self) + self.frame_results.grid(row=0, column=1, sticky="nswe", padx=20, pady=20) + + # Settings Frame + self.frame_settings = customtkinter.CTkFrame(master=self) + self.frame_settings.grid(row=0, column=1, sticky="nswe", padx=20, pady=20) + + # Home Frame + self.frame_home = customtkinter.CTkFrame(master=self) + self.frame_home.grid(row=0, column=1, sticky="nswe", padx=20, pady=20) + + # ============ frame_left ============ + + # configure grid layout (1x11) + self.frame_left.grid_rowconfigure(0, minsize=10) # empty row with minsize as spacing + self.frame_left.grid_rowconfigure(5, weight=1) # empty row as spacing + self.frame_left.grid_rowconfigure(8, minsize=20) # empty row with minsize as spacing + self.frame_left.grid_rowconfigure(11, minsize=10) # empty row with minsize as spacing + + self.label_1 = customtkinter.CTkLabel(master=self.frame_left, + text="Reddit Video Maker Bot", + text_font=("Roboto Medium", -16)) # font name and size in px + self.label_1.grid(row=1, column=0, pady=10, padx=10) + + # Home Btn + self.home_btn = customtkinter.CTkButton(master=self.frame_left, + text="Home", + command=self.btn_home) + self.home_btn.grid(row=2, column=0, pady=10, padx=20) + + # Settings Btn + self.settings_btn = customtkinter.CTkButton(master=self.frame_left, + text="Settings", + command=self.btn_settings) + self.settings_btn.grid(row=3, column=0, pady=10, padx=20) + + # Results Btn + self.results_btn = customtkinter.CTkButton(master=self.frame_left, + text="Results", + command=self.btn_results) + self.results_btn.grid(row=4, column=0, pady=10, padx=20) + + # Start Btn + self.start_btn = customtkinter.CTkButton(master=self.frame_left, + text="Start", + command=self.btn_start) + self.start_btn.grid(row=5, column=0, pady=10, padx=40) + + + + # Appeareance Stuff + self.label_mode = customtkinter.CTkLabel(master=self.frame_left, text="Appearance Mode:") + self.label_mode.grid(row=9, column=0, pady=10, padx=20, sticky="w") + + self.optionmenu_1 = customtkinter.CTkOptionMenu(master=self.frame_left, + values=["Light", "Dark", "System"], + command=self.change_appearance_mode) + self.optionmenu_1.grid(row=10, column=0, pady=0, padx=20, sticky="w") + +### Adds all the stuff for frame_settings ### + + # Background within frame + self.frame_bg_settings = customtkinter.CTkFrame(master=self.frame_settings) + self.frame_bg_settings.grid(row=0, column=0, pady=15, padx=15, sticky=("nswe")) + + self.frame_bg_settings.rowconfigure(10, weight=1) + self.frame_bg_settings.columnconfigure(10, weight=1) + + # Title + self.settings_title = customtkinter.CTkLabel( + master=self.frame_bg_settings, + text="Settings", + text_font=("Courier_Bold", 24) + ) + self.settings_title.grid(row=0, column=0, columnspan=8, pady=15, padx=15) + +## USER SETTINGS ## + + # User settings title + self.user_title = customtkinter.CTkLabel( + master=self.frame_bg_settings, + text="User Settings", + text_font=("Courier_Bold", 14) + ) + self.user_title.grid(row=1, column=0, columnspan=2, pady=10) + + # Client secret title + self.client_secret_title = customtkinter.CTkLabel( + master=self.frame_bg_settings, + text="Client Secrect" + ) + self.client_secret_title.grid(row=2, column=0, padx=15) + + # Client secret input box + self.client_secret = customtkinter.CTkEntry( + master=self.frame_bg_settings, + placeholder_text = "Client Secret" + ) + self.client_secret.grid(row=3, column=0, padx=15) + + # Client id title + self.client_id_title = customtkinter.CTkLabel( + master=self.frame_bg_settings, + text = "Client Id" + ) + self.client_id_title.grid(row=4, column=0, padx=15) + + # Client id input box + self.client_id = customtkinter.CTkEntry( + master=self.frame_bg_settings, + placeholder_text="Client Id" + ) + self.client_id.grid(row=5, column=0, padx=15) + + # Username title + self.user_name_title = customtkinter.CTkLabel( + master=self.frame_bg_settings, + text="Username" + ) + self.user_name_title.grid(row=2, column=1, padx=15) + + # Username input box + self.user_name = customtkinter.CTkEntry( + master=self.frame_bg_settings, + placeholder_text="Username" + ) + self.user_name.grid(row=3, column=1, padx=15) + + # Password title + self.user_password_title = customtkinter.CTkLabel( + master=self.frame_bg_settings, + text="Password" + ) + self.user_password_title.grid(row=4, column=1, padx=15) + + # Password input box + self.user_password = customtkinter.CTkEntry( + master=self.frame_bg_settings, + placeholder_text="Password" + ) + self.user_password.grid(row=5, column=1, padx=15) + + # 2fa label + self.user_2fa_label = customtkinter.CTkLabel( + master=self.frame_bg_settings, + text = "2FA enabled?" + ) + self.user_2fa_label.grid(row=6, column=0, padx=15) + + # 2fa option menu + self.user_2fa = customtkinter.CTkOptionMenu( + master=self.frame_bg_settings, + values=["false", "true"] + ) + self.user_2fa.grid(row=7, column=0, padx=15) + +# Thread Settings + + # Thread settings title + self.thread_title = customtkinter.CTkLabel( + master=self.frame_bg_settings, + text="Thread Settings", + text_font=("Courier_Bold", 14) + ) + self.thread_title.grid(row=1, column=2, columnspan=2, pady=10) + + # Random Title + self.thread_random_title = customtkinter.CTkLabel( + master=self.frame_bg_settings, + text="Random" + ) + self.thread_random_title.grid(row=2, column=2, padx=15) + + # Random option menu + self.thread_random = customtkinter.CTkOptionMenu( + master=self.frame_bg_settings, + values=["false", "true"] + ) + self.thread_random.grid(row=3, column=2, padx=15) + + # Subreddit title + self.thread_subreddit_title = customtkinter.CTkLabel( + master=self.frame_bg_settings, + text="Subreddit" + ) + self.thread_subreddit_title.grid(row=2, column=3, padx=15) + + # Subreddit input box + self.thread_subreddit = customtkinter.CTkEntry( + master=self.frame_bg_settings, + placeholder_text="Subreddit" + ) + self.thread_subreddit.grid(row=3, column=3, padx=15) + + # Post id title + self.thread_post_id_title = customtkinter.CTkLabel( + master=self.frame_bg_settings, + text="Post Id" + ) + self.thread_post_id_title.grid(row=4, column=2, padx=15) + + # Post id input box + self.thread_post_id = customtkinter.CTkEntry( + master=self.frame_bg_settings, + placeholder_text="Post Id" + ) + self.thread_post_id.grid(row=5, column=2, padx=15) + + # Max comment length title + self.thread_max_comment_length_title = customtkinter.CTkLabel( + master=self.frame_bg_settings, + text="Max comment length" + ) + self.thread_max_comment_length_title.grid(row=4, column=3, padx=15) + + # Max comment length + self.thread_max_comment_length = customtkinter.CTkEntry( + master=self.frame_bg_settings, + placeholder_text="Max comment length (NUM)" + ) + self.thread_max_comment_length.grid(row=5, column=3, padx=15) + + # Post lang title + self.thread_post_lang_title = customtkinter.CTkLabel( + master=self.frame_bg_settings, + text="Post language" + ) + self.thread_post_lang_title.grid(row=6, column=2, padx=15) + + # Post lang + self.thread_post_lang = customtkinter.CTkEntry( + master=self.frame_bg_settings, + placeholder_text="Post language (en/cr)" + ) + self.thread_post_lang.grid(row=7, column=2, padx=15) + + # Min comment length title + self.thread_min_comment_length_title = customtkinter.CTkLabel( + master=self.frame_bg_settings, + text="Min comment length (NUM)" + ) + self.thread_min_comment_length_title.grid(row=6, column=3, padx=15) + + # Min comment length + self.thread_min_comment_length = customtkinter.CTkEntry( + master=self.frame_bg_settings, + placeholder_text="Min comment length" + ) + self.thread_min_comment_length.grid(row=7, column=3, padx=15) + +# Misc Settings + + # Misc settings title + self.misc_title = customtkinter.CTkLabel( + master=self.frame_bg_settings, + text="Misc Settings", + text_font=("Courier_Bold", 14) + ) + self.misc_title.grid(row=8, column=0, columnspan=2, pady=10) + + # Allow nsfw title + self.misc_allow_nsfw_title = customtkinter.CTkLabel( + master=self.frame_bg_settings, + text="Allow NSFW" + ) + self.misc_allow_nsfw_title.grid(row=9, column=0, padx=15) + + # Allow nsfw option box + self.misc_allow_nsfw = customtkinter.CTkOptionMenu( + master=self.frame_bg_settings, + values=["False", "True"] + ) + self.misc_allow_nsfw.grid(row=10, column=0, padx=15) + + # Theme title + self.misc_theme_title = customtkinter.CTkLabel( + master=self.frame_bg_settings, + text="Theme" + ) + self.misc_theme_title.grid(row=9, column=1, padx=15) + + # Theme + self.misc_theme = customtkinter.CTkOptionMenu( + master=self.frame_bg_settings, + values=["dark", "light"] + ) + self.misc_theme.grid(row=10, column=1, padx=15) + + # Times to run title + self.misc_times_to_run_title = customtkinter.CTkLabel( + master=self.frame_bg_settings, + text="Times to run (NUM)" + ) + self.misc_times_to_run_title.grid(row=11, column=0, padx=15) + + # Times to run + self.misc_times_to_run = customtkinter.CTkEntry( + master=self.frame_bg_settings, + placeholder_text="Times to run" + ) + self.misc_times_to_run.grid(row=12, column=0, padx=15) + + # Opacity title + self.misc_opacity_title = customtkinter.CTkLabel( + master=self.frame_bg_settings, + text="Opacity (NUM 0.1-0.9)" + ) + self.misc_opacity_title.grid(row=11, column=1, padx=15) + + # Opcaity + self.misc_opacity = customtkinter.CTkEntry( + master=self.frame_bg_settings, + placeholder_text="Opacity" + ) + self.misc_opacity.grid(row=12, column=1, padx=15) + + + # configure grid layout (3x7) + + self.frame_info = customtkinter.CTkFrame(master=self.frame_home) + self.frame_info.grid(row=0, column=0, columnspan=2, rowspan=4, pady=20, padx=20, sticky="nsew") + + # ============ frame_info ============ + + # configure grid layout (1x1) + self.frame_info.rowconfigure(0, weight=1) + self.frame_info.columnconfigure(0, weight=1) + + self.label_info_1 = customtkinter.CTkLabel(master=self.frame_info, + text="Thanks for using this tool! \n" + + "Feel free to contribute to this project on GitHub!\n"+ + "If you have any questions, feel free to reach out to\nme on Twitter or submit a GitHub issue. \n"+ + "You can find solutions to many common problems in the Documentation\nhttps://reddit-video-maker-bot.netlify.app/" , + height=100, + corner_radius=6, # <- custom corner radius + fg_color=("white", "gray38"), # <- custom tuple-color + justify=tkinter.LEFT) + self.label_info_1.grid(column=0, row=0, sticky="nwe", padx=15, pady=15) + + self.progressbar = customtkinter.CTkProgressBar(master=self.frame_info) + self.progressbar.grid(row=1, column=0, sticky="ew", padx=15, pady=15) + + + # set default values + self.optionmenu_1.set("Dark") + ###self.button_3.configure(state="disabled", text="Disabled CTkButton") + ###self.combobox_1.set("CTkCombobox") + ###self.radio_button_1.select() + ###self.slider_1.set(0.2) + ###self.slider_2.set(0.7) + ###self.progressbar.set(0.5) + ###self.switch_2.select() + ###self.radio_button_3.configure(state=tkinter.DISABLED) + ###self.check_box_1.configure(state=tkinter.DISABLED, text="CheckBox disabled") + ###self.check_box_2.select() + + def load_value_from_toml(self): + self.client_secret.set(config["settings"]["times_to_run"]) + # Show frame + def showFrame(self, frame): + frame.tkraise() + + # Home button event + def btn_home(self): + self.showFrame(self.frame_home) + + # Settings button event + def btn_settings(self): + self.showFrame(self.frame_settings) + + # Results button event + def btn_results(self): + print("Results Pressed!") + + # Start button event + def btn_start(self): + print("Start Pressed!") + + # Appearance event + def change_appearance_mode(self, new_appearance_mode): + customtkinter.set_appearance_mode(new_appearance_mode) + + # Close event + def on_closing(self, event=0): + self.destroy() + shutdown() + +def start(): + if __name__ == "__main__": + app = App() + app.mainloop() + +start() \ No newline at end of file diff --git a/GUI/GUI.py b/GUI/GUI.py deleted file mode 100644 index b2a42f7..0000000 --- a/GUI/GUI.py +++ /dev/null @@ -1,428 +0,0 @@ -from main import main, shutdown - -from doctest import master -import tkinter -import tkinter.messagebox -import customtkinter - -customtkinter.set_appearance_mode("System") # Modes: "System" (standard), "Dark", "Light" -customtkinter.set_default_color_theme("blue") # Themes: "blue" (standard), "green", "dark-blue" - - -class App(customtkinter.CTk): - - WIDTH = 1200 - HEIGHT = 600 - - def __init__(self): - super().__init__() - - self.title("Reddit Video Maker Bot GUI") - self.geometry(f"{App.WIDTH}x{App.HEIGHT}") - self.resizable(False, False) - self.protocol("WM_DELETE_WINDOW", self.on_closing) # call .on_closing() when app gets closed - self.resizable(False, False) - - # ============ create two frames ============ - - # configure grid layout (2x1) - self.grid_columnconfigure(1, weight=1) - self.grid_rowconfigure(0, weight=1) - - self.frame_left = customtkinter.CTkFrame(master=self, - width=180, - corner_radius=0) - self.frame_left.grid(row=0, column=0, sticky="nswe") - - # Results Frame - self.frame_results = customtkinter.CTkFrame(master=self) - self.frame_results.grid(row=0, column=1, sticky="nswe", padx=20, pady=20) - - # Settings Frame - self.frame_settings = customtkinter.CTkFrame(master=self) - self.frame_settings.grid(row=0, column=1, sticky="nswe", padx=20, pady=20) - - # Home Frame - self.frame_home = customtkinter.CTkFrame(master=self) - self.frame_home.grid(row=0, column=1, sticky="nswe", padx=20, pady=20) - - # ============ frame_left ============ - - # configure grid layout (1x11) - self.frame_left.grid_rowconfigure(0, minsize=10) # empty row with minsize as spacing - self.frame_left.grid_rowconfigure(5, weight=1) # empty row as spacing - self.frame_left.grid_rowconfigure(8, minsize=20) # empty row with minsize as spacing - self.frame_left.grid_rowconfigure(11, minsize=10) # empty row with minsize as spacing - - self.label_1 = customtkinter.CTkLabel(master=self.frame_left, - text="Reddit Video Maker Bot", - text_font=("Roboto Medium", -16)) # font name and size in px - self.label_1.grid(row=1, column=0, pady=10, padx=10) - - # Home Btn - self.home_btn = customtkinter.CTkButton(master=self.frame_left, - text="Home", - command=self.btn_home) - self.home_btn.grid(row=2, column=0, pady=10, padx=20) - - # Settings Btn - self.settings_btn = customtkinter.CTkButton(master=self.frame_left, - text="Settings", - command=self.btn_settings) - self.settings_btn.grid(row=3, column=0, pady=10, padx=20) - - # Results Btn - self.results_btn = customtkinter.CTkButton(master=self.frame_left, - text="Results", - command=self.btn_results) - self.results_btn.grid(row=4, column=0, pady=10, padx=20) - - # Start Btn - self.start_btn = customtkinter.CTkButton(master=self.frame_left, - text="Start", - command=self.btn_start) - self.start_btn.grid(row=5, column=0, pady=10, padx=40) - - - - # Appeareance Stuff - self.label_mode = customtkinter.CTkLabel(master=self.frame_left, text="Appearance Mode:") - self.label_mode.grid(row=9, column=0, pady=10, padx=20, sticky="w") - - self.optionmenu_1 = customtkinter.CTkOptionMenu(master=self.frame_left, - values=["Light", "Dark", "System"], - command=self.change_appearance_mode) - self.optionmenu_1.grid(row=10, column=0, pady=0, padx=20, sticky="w") - -### Adds all the stuff for frame_settings ### - - # Background within frame - self.frame_bg_settings = customtkinter.CTkFrame(master=self.frame_settings) - self.frame_bg_settings.grid(row=0, column=0, pady=15, padx=15, sticky=("nswe")) - - self.frame_bg_settings.rowconfigure(10, weight=1) - self.frame_bg_settings.columnconfigure(10, weight=1) - - # Title - self.settings_title = customtkinter.CTkLabel( - master=self.frame_bg_settings, - text="Settings", - text_font=("Courier_Bold", 24) - ) - self.settings_title.grid(row=0, column=0, columnspan=8, pady=15, padx=15) - -## USER SETTINGS ## - - # User settings title - self.user_title = customtkinter.CTkLabel( - master=self.frame_bg_settings, - text="User Settings", - text_font=("Courier_Bold", 14) - ) - self.user_title.grid(row=1, column=0, columnspan=2, pady=10) - - # Client secret title - self.client_secret_title = customtkinter.CTkLabel( - master=self.frame_bg_settings, - text="Client Secrect" - ) - self.client_secret_title.grid(row=2, column=0, padx=15) - - # Client secret input box - self.client_secret = customtkinter.CTkEntry( - master=self.frame_bg_settings, - placeholder_text = "Client Secret" - ) - self.client_secret.grid(row=3, column=0, padx=15) - - # Client id title - self.client_id_title = customtkinter.CTkLabel( - master=self.frame_bg_settings, - text = "Client Id" - ) - self.client_id_title.grid(row=4, column=0, padx=15) - - # Client id input box - self.client_id = customtkinter.CTkEntry( - master=self.frame_bg_settings, - placeholder_text="Client Id" - ) - self.client_id.grid(row=5, column=0, padx=15) - - # Username title - self.user_name_title = customtkinter.CTkLabel( - master=self.frame_bg_settings, - text="Username" - ) - self.user_name_title.grid(row=2, column=1, padx=15) - - # Username input box - self.user_name = customtkinter.CTkEntry( - master=self.frame_bg_settings, - placeholder_text="Username" - ) - self.user_name.grid(row=3, column=1, padx=15) - - # Password title - self.user_password_title = customtkinter.CTkLabel( - master=self.frame_bg_settings, - text="Password" - ) - self.user_password_title.grid(row=4, column=1, padx=15) - - # Password input box - self.user_password = customtkinter.CTkEntry( - master=self.frame_bg_settings, - placeholder_text="Password" - ) - self.user_password.grid(row=5, column=1, padx=15) - - # 2fa label - self.user_2fa_label = customtkinter.CTkLabel( - master=self.frame_bg_settings, - text = "2FA enabled?" - ) - self.user_2fa_label.grid(row=6, column=0, padx=15) - - # 2fa option menu - self.user_2fa = customtkinter.CTkOptionMenu( - master=self.frame_bg_settings, - values=["false", "true"] - ) - self.user_2fa.grid(row=7, column=0, padx=15) - -# Thread Settings - - # Thread settings title - self.thread_title = customtkinter.CTkLabel( - master=self.frame_bg_settings, - text="Thread Settings", - text_font=("Courier_Bold", 14) - ) - self.thread_title.grid(row=1, column=2, columnspan=2, pady=10) - - # Random Title - self.thread_random_title = customtkinter.CTkLabel( - master=self.frame_bg_settings, - text="Random" - ) - self.thread_random_title.grid(row=2, column=2, padx=15) - - # Random option menu - self.thread_random = customtkinter.CTkOptionMenu( - master=self.frame_bg_settings, - values=["false", "true"] - ) - self.thread_random.grid(row=3, column=2, padx=15) - - # Subreddit title - self.thread_subreddit_title = customtkinter.CTkLabel( - master=self.frame_bg_settings, - text="Subreddit" - ) - self.thread_subreddit_title.grid(row=2, column=3, padx=15) - - # Subreddit input box - self.thread_subreddit = customtkinter.CTkEntry( - master=self.frame_bg_settings, - placeholder_text="Subreddit" - ) - self.thread_subreddit.grid(row=3, column=3, padx=15) - - # Post id title - self.thread_post_id_title = customtkinter.CTkLabel( - master=self.frame_bg_settings, - text="Post Id" - ) - self.thread_post_id_title.grid(row=4, column=2, padx=15) - - # Post id input box - self.thread_post_id = customtkinter.CTkEntry( - master=self.frame_bg_settings, - placeholder_text="Post Id" - ) - self.thread_post_id.grid(row=5, column=2, padx=15) - - # Max comment length title - self.thread_max_comment_length_title = customtkinter.CTkLabel( - master=self.frame_bg_settings, - text="Max comment length" - ) - self.thread_max_comment_length_title.grid(row=4, column=3, padx=15) - - # Max comment length - self.thread_max_comment_length = customtkinter.CTkEntry( - master=self.frame_bg_settings, - placeholder_text="Max comment length (NUM)" - ) - self.thread_max_comment_length.grid(row=5, column=3, padx=15) - - # Post lang title - self.thread_post_lang_title = customtkinter.CTkLabel( - master=self.frame_bg_settings, - text="Post language" - ) - self.thread_post_lang_title.grid(row=6, column=2, padx=15) - - # Post lang - self.thread_post_lang = customtkinter.CTkEntry( - master=self.frame_bg_settings, - placeholder_text="Post language (en/cr)" - ) - self.thread_post_lang.grid(row=7, column=2, padx=15) - - # Min comment length title - self.thread_min_comment_length_title = customtkinter.CTkLabel( - master=self.frame_bg_settings, - text="Min comment length (NUM)" - ) - self.thread_min_comment_length_title.grid(row=6, column=3, padx=15) - - # Min comment length - self.thread_min_comment_length = customtkinter.CTkEntry( - master=self.frame_bg_settings, - placeholder_text="Min comment length" - ) - self.thread_min_comment_length.grid(row=7, column=3, padx=15) - -# Misc Settings - - # Misc settings title - self.misc_title = customtkinter.CTkLabel( - master=self.frame_bg_settings, - text="Misc Settings", - text_font=("Courier_Bold", 14) - ) - self.misc_title.grid(row=8, column=0, columnspan=2, pady=10) - - # Allow nsfw title - self.misc_allow_nsfw_title = customtkinter.CTkLabel( - master=self.frame_bg_settings, - text="Allow NSFW" - ) - self.misc_allow_nsfw_title.grid(row=9, column=0, padx=15) - - # Allow nsfw option box - self.misc_allow_nsfw = customtkinter.CTkOptionMenu( - master=self.frame_bg_settings, - values=["False", "True"] - ) - self.misc_allow_nsfw.grid(row=10, column=0, padx=15) - - # Theme title - self.misc_theme_title = customtkinter.CTkLabel( - master=self.frame_bg_settings, - text="Theme" - ) - self.misc_theme_title.grid(row=9, column=1, padx=15) - - # Theme - self.misc_theme = customtkinter.CTkOptionMenu( - master=self.frame_bg_settings, - values=["dark", "light"] - ) - self.misc_theme.grid(row=10, column=1, padx=15) - - # Times to run title - self.misc_times_to_run_title = customtkinter.CTkLabel( - master=self.frame_bg_settings, - text="Times to run (NUM)" - ) - self.misc_times_to_run_title.grid(row=11, column=0, padx=15) - - # Times to run - self.misc_times_to_run = customtkinter.CTkEntry( - master=self.frame_bg_settings, - placeholder_text="Times to run" - ) - self.misc_times_to_run.grid(row=12, column=0, padx=15) - - # Opacity title - self.misc_opacity_title = customtkinter.CTkLabel( - master=self.frame_bg_settings, - text="Opacity (NUM 0.1-0.9)" - ) - self.misc_opacity_title.grid(row=11, column=1, padx=15) - - # Opcaity - self.misc_opacity = customtkinter.CTkEntry( - master=self.frame_bg_settings, - placeholder_text="Opacity" - ) - self.misc_opacity.grid(row=12, column=1, padx=15) - - - # configure grid layout (3x7) - - self.frame_info = customtkinter.CTkFrame(master=self.frame_home) - self.frame_info.grid(row=0, column=0, columnspan=2, rowspan=4, pady=20, padx=20, sticky="nsew") - - # ============ frame_info ============ - - # configure grid layout (1x1) - self.frame_info.rowconfigure(0, weight=1) - self.frame_info.columnconfigure(0, weight=1) - - self.label_info_1 = customtkinter.CTkLabel(master=self.frame_info, - text="Thanks for using this tool! \n" + - "Feel free to contribute to this project on GitHub!\n"+ - "If you have any questions, feel free to reach out to\nme on Twitter or submit a GitHub issue. \n"+ - "You can find solutions to many common problems in the Documentation\nhttps://reddit-video-maker-bot.netlify.app/" , - height=100, - corner_radius=6, # <- custom corner radius - fg_color=("white", "gray38"), # <- custom tuple-color - justify=tkinter.LEFT) - self.label_info_1.grid(column=0, row=0, sticky="nwe", padx=15, pady=15) - - self.progressbar = customtkinter.CTkProgressBar(master=self.frame_info) - self.progressbar.grid(row=1, column=0, sticky="ew", padx=15, pady=15) - - - # set default values - self.optionmenu_1.set("Dark") - ###self.button_3.configure(state="disabled", text="Disabled CTkButton") - ###self.combobox_1.set("CTkCombobox") - ###self.radio_button_1.select() - ###self.slider_1.set(0.2) - ###self.slider_2.set(0.7) - ###self.progressbar.set(0.5) - ###self.switch_2.select() - ###self.radio_button_3.configure(state=tkinter.DISABLED) - ###self.check_box_1.configure(state=tkinter.DISABLED, text="CheckBox disabled") - ###self.check_box_2.select() - - # Show frame - def showFrame(self, frame): - frame.tkraise() - - # Home button event - def btn_home(self): - self.showFrame(self.frame_home) - - # Settings button event - def btn_settings(self): - self.showFrame(self.frame_settings) - - # Results button event - def btn_results(self): - print("Results Pressed!") - - # Start button event - def btn_start(self): - print("Start Pressed!") - - # Appearance event - def change_appearance_mode(self, new_appearance_mode): - customtkinter.set_appearance_mode(new_appearance_mode) - - # Close event - def on_closing(self, event=0): - self.destroy() - shutdown() - -def start(): - if __name__ == "__main__": - app = App() - app.mainloop() - -start() \ No newline at end of file diff --git a/GUI/index.html b/GUI/index.html deleted file mode 100644 index 00deeb7..0000000 --- a/GUI/index.html +++ /dev/null @@ -1,404 +0,0 @@ - - - - - - - RedditVideoMakerBot - - - - - - - - - -
- {% if get_flashed_messages() %} - {% for category, message in get_flashed_messages(with_categories=true) %} - - {% if category == "error" %} - - - {% else %} - - {% endif %} - {% endfor %} - {% endif %} - -
- -
-
-
- -
-
- -
-
- -
- -
-
-
-
- - - - - - - - - - - - - \ No newline at end of file