From bc01c50fae338dcaa28c9ca7ca3ac44e29046c7a Mon Sep 17 00:00:00 2001 From: Leonard Kugis Date: Tue, 11 Apr 2023 03:15:45 +0200 Subject: Included rename schemes in GUI --- gui.py | 46 +++++++++++++++++++++++++--------------------- 1 file changed, 25 insertions(+), 21 deletions(-) (limited to 'gui.py') diff --git a/gui.py b/gui.py index f99b62a..19d265c 100644 --- a/gui.py +++ b/gui.py @@ -13,6 +13,7 @@ class GuiMain(object): self.__args = args self.__base = StringVar(self.__master, value=args["base"]) self.__file_dir = StringVar(self.__master, value=args["file_dir"]) + self.__rename = StringVar(self.__master, value=str(args["rename"])) self.__tag_metadata = BooleanVar(self.__master, value=args["tag_metadata"]) self.__predict_images = BooleanVar(self.__master, value=args["predict_images"]) self.__predict_images_backend = StringVar(self.__master, value=str(args["predict_images_backend"])) @@ -36,27 +37,29 @@ class GuiMain(object): Label(self.__master, text="File directory for walking:").grid(row=1, column=0) Entry(self.__master, textvariable=self.__file_dir).grid(row=1, column=1, columnspan=2) Button(self.__master, text="Browse", command=lambda: self.__browse(self.__file_dir)).grid(row=1, column=3) - Checkbutton(self.__master, text="Use metadata as default tags", variable=self.__tag_metadata).grid(row=2, column=0, columnspan=4, sticky=W) - Checkbutton(self.__master, text="Use prediction for image tagging", variable=self.__predict_images).grid(row=3, column=0, columnspan=4, sticky=W) - Label(self.__master, text="Image prediction backend:").grid(row=4, column=0) - ttk.Combobox(self.__master, textvariable=self.__predict_images_backend, values=("torch", "tensorflow", "keras"), state="readonly").grid(row=4, column=1) - Label(self.__master, text="Number of top results:").grid(row=5, column=0) - Entry(self.__master, textvariable=self.__predict_images_top, validate='all', validatecommand=(validate_number, '%P')).grid(row=5, column=1, columnspan=1) - Checkbutton(self.__master, text="Skip detail scan in image prediction", variable=self.__predict_images_skip_detail).grid(row=6, column=0, columnspan=4, sticky=W) - Label(self.__master, text="Width factor for detail scan:").grid(row=7, column=0) - Entry(self.__master, textvariable=self.__predict_images_detail_factor, validate='all', validatecommand=(validate_number, '%P')).grid(row=7, column=1, columnspan=1) - Checkbutton(self.__master, text="Use prediction for video tagging", variable=self.__predict_videos).grid(row=8, column=0, columnspan=4, sticky=W) - Label(self.__master, text="Number of key frames:").grid(row=9, column=0) - Entry(self.__master, textvariable=self.__predict_videos_key_frames, validate='all', validatecommand=(validate_number, '%P')).grid(row=9, column=1, columnspan=1) - Checkbutton(self.__master, text="Show GUI for tagging", variable=self.__gui_tag).grid(row=10, column=0, columnspan=4, sticky=W) - Label(self.__master, text="Image GUI preview size:").grid(row=11, column=0) - Entry(self.__master, textvariable=self.__gui_image_length, validate='all', validatecommand=(validate_number, '%P')).grid(row=11, column=1, columnspan=1) - Checkbutton(self.__master, text="Open all files with system default", variable=self.__open_system).grid(row=12, column=0, columnspan=4, sticky=W) - Checkbutton(self.__master, text="Skip prompt for file tags", variable=self.__skip_prompt).grid(row=13, column=0, columnspan=4, sticky=W) - Checkbutton(self.__master, text="Skip already tagged files", variable=self.__skip_tagged).grid(row=14, column=0, columnspan=4, sticky=W) - Label(self.__master, text="Start at index:").grid(row=15, column=0) - Entry(self.__master, textvariable=self.__index, validate='all', validatecommand=(validate_number, '%P')).grid(row=15, column=1, columnspan=1) - Button(self.__master, text="Start", command=self.__master.destroy).grid(row=16, column=0, columnspan=4) + Label(self.__master, text="File rename scheme:").grid(row=2, column=0) + ttk.Combobox(self.__master, textvariable=self.__rename, values=("none", "sha1", "sha256", "cdate", "mdate"), state="readonly").grid(row=2, column=1) + Checkbutton(self.__master, text="Use metadata as default tags", variable=self.__tag_metadata).grid(row=3, column=0, columnspan=4, sticky=W) + Checkbutton(self.__master, text="Use prediction for image tagging", variable=self.__predict_images).grid(row=4, column=0, columnspan=4, sticky=W) + Label(self.__master, text="Image prediction backend:").grid(row=5, column=0) + ttk.Combobox(self.__master, textvariable=self.__predict_images_backend, values=("torch", "tensorflow", "keras"), state="readonly").grid(row=5, column=1) + Label(self.__master, text="Number of top results:").grid(row=6, column=0) + Entry(self.__master, textvariable=self.__predict_images_top, validate='all', validatecommand=(validate_number, '%P')).grid(row=6, column=1, columnspan=1) + Checkbutton(self.__master, text="Skip detail scan in image prediction", variable=self.__predict_images_skip_detail).grid(row=7, column=0, columnspan=4, sticky=W) + Label(self.__master, text="Width factor for detail scan:").grid(row=8, column=0) + Entry(self.__master, textvariable=self.__predict_images_detail_factor, validate='all', validatecommand=(validate_number, '%P')).grid(row=8, column=1, columnspan=1) + Checkbutton(self.__master, text="Use prediction for video tagging", variable=self.__predict_videos).grid(row=9, column=0, columnspan=4, sticky=W) + Label(self.__master, text="Number of key frames:").grid(row=10, column=0) + Entry(self.__master, textvariable=self.__predict_videos_key_frames, validate='all', validatecommand=(validate_number, '%P')).grid(row=10, column=1, columnspan=1) + Checkbutton(self.__master, text="Show GUI for tagging", variable=self.__gui_tag).grid(row=11, column=0, columnspan=4, sticky=W) + Label(self.__master, text="Image GUI preview size:").grid(row=12, column=0) + Entry(self.__master, textvariable=self.__gui_image_length, validate='all', validatecommand=(validate_number, '%P')).grid(row=12, column=1, columnspan=1) + Checkbutton(self.__master, text="Open all files with system default", variable=self.__open_system).grid(row=13, column=0, columnspan=4, sticky=W) + Checkbutton(self.__master, text="Skip prompt for file tags", variable=self.__skip_prompt).grid(row=14, column=0, columnspan=4, sticky=W) + Checkbutton(self.__master, text="Skip already tagged files", variable=self.__skip_tagged).grid(row=15, column=0, columnspan=4, sticky=W) + Label(self.__master, text="Start at index:").grid(row=16, column=0) + Entry(self.__master, textvariable=self.__index, validate='all', validatecommand=(validate_number, '%P')).grid(row=16, column=1, columnspan=1) + Button(self.__master, text="Start", command=self.__master.destroy).grid(row=17, column=0, columnspan=4) def loop(self): self.__master.mainloop() @@ -64,6 +67,7 @@ class GuiMain(object): self.__args["base"] = self.__base.get() self.__args["file_dir"] = self.__file_dir.get() self.__args["tag_metadata"] = self.__tag_metadata.get() + self.__args["rename"] = self.__rename.get() self.__args["predict_images"] = self.__predict_images.get() self.__args["predict_images_backend"] = self.__predict_images_backend.get() self.__args["predict_images_top"] = int(self.__predict_images_top.get()) -- cgit v1.2.1