Feat: Add tkinter to select a folder to process
This commit is contained in:
parent
4db77da2ac
commit
1ad307a462
@ -7,8 +7,14 @@ import pathlib
|
|||||||
from PIL import Image, ExifTags
|
from PIL import Image, ExifTags
|
||||||
import pendulum
|
import pendulum
|
||||||
|
|
||||||
INGEST_DIR = pathlib.PureWindowsPath(
|
from tkinter import filedialog
|
||||||
r'C:\Users\ahosking\Nextcloud\Camera Uploads\Alex\2022')
|
from tkinter import *
|
||||||
|
root = Tk()
|
||||||
|
root.withdraw()
|
||||||
|
INGEST_DIR = filedialog.askdirectory()
|
||||||
|
|
||||||
|
# INGEST_DIR = pathlib.PureWindowsPath(
|
||||||
|
# r'C:\Users\ahosking\Nextcloud\Camera Uploads\Alex\2022')
|
||||||
PHOTO_LIBRARY = '//192.168.1.4/photos/photo_library/'
|
PHOTO_LIBRARY = '//192.168.1.4/photos/photo_library/'
|
||||||
# TODO: Add dircectory traversal
|
# TODO: Add dircectory traversal
|
||||||
file_list = []
|
file_list = []
|
||||||
@ -24,8 +30,8 @@ def compare_and_move():
|
|||||||
print(root, d_names, f_names)
|
print(root, d_names, f_names)
|
||||||
print(file_list)
|
print(file_list)
|
||||||
print(len(file_list))
|
print(len(file_list))
|
||||||
process_files(file_list)
|
# process_files(file_list)
|
||||||
remove_empty_directories(INGEST_DIR)
|
# remove_empty_directories(INGEST_DIR)
|
||||||
|
|
||||||
|
|
||||||
def process_files(file_list):
|
def process_files(file_list):
|
||||||
|
@ -1,37 +0,0 @@
|
|||||||
import tkinter as tk
|
|
||||||
from tkinter import filedialog
|
|
||||||
# from tkinter import *
|
|
||||||
|
|
||||||
class Application(tk.Frame):
|
|
||||||
def __init__(self, master=None):
|
|
||||||
super().__init__(master)
|
|
||||||
self.master = master
|
|
||||||
self.pack()
|
|
||||||
self.create_widgets()
|
|
||||||
|
|
||||||
def create_widgets(self):
|
|
||||||
self.copy_from = tk.Button(self)
|
|
||||||
self.copy_from["text"] = "Copy from..."
|
|
||||||
# self.copy_from["command"] = self.get_dir(self.copy_from)
|
|
||||||
self.copy_from.pack(side="top")
|
|
||||||
|
|
||||||
self.copy_to = tk.Button(self)
|
|
||||||
self.copy_to["text"] = "Copy to..."
|
|
||||||
# self.copy_to.bind('<Enter>', self.get_dir(self.copy_to))
|
|
||||||
self.copy_to.pack(side="top")
|
|
||||||
|
|
||||||
|
|
||||||
self.quit = tk.Button(self, text="QUIT", fg="red",
|
|
||||||
command=self.master.destroy)
|
|
||||||
self.quit.pack(side="bottom")
|
|
||||||
|
|
||||||
def get_dir(self, the_widget):
|
|
||||||
folder_selected = filedialog.askdirectory()
|
|
||||||
if len(folder_selected) > 6:
|
|
||||||
the_widget.config(text=folder_selected)
|
|
||||||
|
|
||||||
|
|
||||||
root = tk.Tk()
|
|
||||||
app = Application(master=root)
|
|
||||||
app.copy_from.configure(command=app.get_dir(app.copy_from))
|
|
||||||
app.mainloop()
|
|
Loading…
Reference in New Issue
Block a user