|
|
|
@@ -13,6 +13,9 @@ import configparser
|
|
|
|
|
# CONFIG:
|
|
|
|
|
config = configparser.ConfigParser()
|
|
|
|
|
config.read(r"C:\ProgramData\Program-Search\config.ini")
|
|
|
|
|
SEARCH_WINDOW_SIZE = config["General"]["SEARCH_WINDOW_SIZE"]
|
|
|
|
|
RESULTS_WINDOW_SIZE = config["General"]["RESULTS_WINDOW_SIZE"]
|
|
|
|
|
PREVIEW_WINDOW_SIZE = config["General"]["PREVIEW_WINDOW_SIZE"]
|
|
|
|
|
SEARCH_ROOT = config["Paths"]["SEARCH_ROOT"]
|
|
|
|
|
TRASH_DIR = config["Paths"]["TRASH_DIR"]
|
|
|
|
|
TRASH_ENABLED = config.getboolean("Features", "TRASH_ENABLED")
|
|
|
|
@@ -30,7 +33,7 @@ os.makedirs(TRASH_DIR, exist_ok=True)
|
|
|
|
|
def custom_messagebox(title, message, kind="info"):
|
|
|
|
|
win = tk.Toplevel()
|
|
|
|
|
win.title(title)
|
|
|
|
|
win.geometry("600x300")
|
|
|
|
|
win.geometry(SEARCH_WINDOW_SIZE)
|
|
|
|
|
win.grab_set()
|
|
|
|
|
win.focus_force()
|
|
|
|
|
frame = tk.Frame(win, padx=20, pady=20)
|
|
|
|
@@ -101,7 +104,7 @@ def close_all(root):
|
|
|
|
|
def popup_search_input():
|
|
|
|
|
win = tk.Toplevel()
|
|
|
|
|
win.title("Search")
|
|
|
|
|
win.geometry("600x300")
|
|
|
|
|
win.geometry(SEARCH_WINDOW_SIZE)
|
|
|
|
|
center_window(win)
|
|
|
|
|
|
|
|
|
|
tk.Label(win, text="Enter program number, part number, or name:").pack(pady=10)
|
|
|
|
@@ -149,7 +152,7 @@ def search_files(term):
|
|
|
|
|
def popup_results_list(matches):
|
|
|
|
|
win = tk.Toplevel()
|
|
|
|
|
win.title("Matches Found")
|
|
|
|
|
win.geometry("1200x1000")
|
|
|
|
|
win.geometry(RESULTS_WINDOW_SIZE)
|
|
|
|
|
center_window(win)
|
|
|
|
|
|
|
|
|
|
tk.Label(win, text="Select files to preview:").pack(pady=10)
|
|
|
|
@@ -181,7 +184,7 @@ def popup_results_list(matches):
|
|
|
|
|
def popup_file_preview(path, on_close_callback):
|
|
|
|
|
win = tk.Toplevel()
|
|
|
|
|
win.title(path)
|
|
|
|
|
win.geometry("900x1000")
|
|
|
|
|
win.geometry(PREVIEW_WINDOW_SIZE)
|
|
|
|
|
|
|
|
|
|
box = scrolledtext.ScrolledText(win, wrap=tk.WORD)
|
|
|
|
|
box.pack(expand=True, fill="both")
|
|
|
|
|