updated programs and added FileManager
This commit is contained in:
1 parent
55177b1444
commit
4c994a28f0
7 files changed
+717
-248
No files matched your search
@@ -2,51 +2,60 @@
|
||||
import os
|
||||
import tkinter as tk
|
||||
from tkinter import scrolledtext
|
||||
import pickle
|
||||
import shutil
|
||||
import ctypes
|
||||
import string
|
||||
import configparser
|
||||
import Indexer
|
||||
|
||||
# ============================================================
|
||||
# CONFIG:
|
||||
config = configparser.ConfigParser()
|
||||
config.read(r"C:\ProgramData\Program-Search\config.ini")
|
||||
# PATHS
|
||||
SEARCH_ROOT = config["Paths"]["SEARCH_ROOT"]
|
||||
TRASH_DIR = config["Paths"]["TRASH_DIR"]
|
||||
INDEX_FILE = config["Paths"]["INDEX_FILE"]
|
||||
TRASH_ENABLED = config.getboolean("Features", "TRASH_ENABLED")
|
||||
EDITOR_ENABLED = config.getboolean("Features", "EDITOR_ENABLED")
|
||||
AUTO_CLOSE_SECONDS = config.getint("Features", "AUTO_CLOSE_SECONDS")
|
||||
EXTENSION = config["Copy"]["Extension"]
|
||||
TEXT_FONT = config["UI"]["TEXT_FONT"]
|
||||
ERROR_FONT_SIZE = config.getint("UI", "ERROR_FONT_SIZE")
|
||||
SEARCH_WIDTH = config.getint("UI", "SEARCH_WIDTH")
|
||||
SEARCH_HEIGHT = config.getint("UI", "SEARCH_HEIGHT")
|
||||
SEARCH_FONT_SIZE = config.getint("UI", "SEARCH_FONT_SIZE")
|
||||
RESULTS_WIDTH = config.getint("UI", "RESULTS_WIDTH")
|
||||
RESULTS_HEIGHT = config.getint("UI", "RESULTS_HEIGHT")
|
||||
RESULTS_FONT_SIZE = config.getint("UI", "RESULTS_FONT_SIZE")
|
||||
PREVIEW_WIDTH = config.getint("UI", "PREVIEW_WIDTH")
|
||||
PREVIEW_HEIGHT = config.getint("UI", "PREVIEW_HEIGHT")
|
||||
PREVIEW_FONT_SIZE = config.getint("UI", "PREVIEW_FONT_SIZE")
|
||||
ERROR_WIDTH = config.getint("UI", "ERROR_WIDTH")
|
||||
ERROR_HEIGHT = config.getint("UI", "ERROR_HEIGHT")
|
||||
BUTTON_SIZE_SEARCH = config.getint("Buttons", "BUTTON_SIZE_SEARCH")
|
||||
BUTTON_SIZE_OPEN = config.getint("Buttons", "BUTTON_SIZE_OPEN")
|
||||
BUTTON_SIZE_SELECT_ALL = config.getint("Buttons", "BUTTON_SIZE_SELECT_ALL")
|
||||
BUTTON_SIZE_SAVE = config.getint("Buttons", "BUTTON_SIZE_SAVE")
|
||||
BUTTON_SIZE_COPY = config.getint("Buttons", "BUTTON_SIZE_COPY")
|
||||
BUTTON_SIZE_TRASH = config.getint("Buttons", "BUTTON_SIZE_TRASH")
|
||||
BUTTON_SIZE_CLOSE = config.getint("Buttons", "BUTTON_SIZE_CLOSE")
|
||||
BUTTON_SIZE_MESSAGE = config.getint("Buttons", "BUTTON_SIZE_MESSAGE")
|
||||
BUTTON_SIZE_YES_NO = config.getint("Buttons", "BUTTON_SIZE_YES_NO")
|
||||
# FEATURES
|
||||
TRASH_ENABLED = config.getboolean("Features", "TRASH_ENABLED", fallback=False)
|
||||
EDITOR_ENABLED = config.getboolean("Features", "EDITOR_ENABLED", fallback=False)
|
||||
AUTO_CLOSE_SECONDS = config.getint("Features", "AUTO_CLOSE_SECONDS", fallback=3600)
|
||||
# COPY
|
||||
EXTENSION = config.get("Copy", "Extension", fallback="")
|
||||
# UI
|
||||
TEXT_FONT = config.get("UI","TEXT_FONT", fallback="Consolas")
|
||||
SEARCH_WIDTH = config.getint("UI", "SEARCH_WIDTH", fallback=400)
|
||||
SEARCH_HEIGHT = config.getint("UI", "SEARCH_HEIGHT", fallback=150)
|
||||
SEARCH_FONT_SIZE = config.getint("UI", "SEARCH_FONT_SIZE", fallback=12)
|
||||
RESULTS_WIDTH = config.getint("UI", "RESULTS_WIDTH", fallback=1000)
|
||||
RESULTS_HEIGHT = config.getint("UI", "RESULTS_HEIGHT", fallback=700)
|
||||
RESULTS_FONT_SIZE = config.getint("UI", "RESULTS_FONT_SIZE", fallback=11)
|
||||
PREVIEW_WIDTH = config.getint("UI", "PREVIEW_WIDTH", fallback=1200)
|
||||
PREVIEW_HEIGHT = config.getint("UI", "PREVIEW_HEIGHT", fallback=900)
|
||||
PREVIEW_FONT_SIZE = config.getint("UI", "PREVIEW_FONT_SIZE", fallback=24)
|
||||
ERROR_WIDTH = config.getint("UI", "ERROR_WIDTH", fallback=400)
|
||||
ERROR_HEIGHT = config.getint("UI", "ERROR_HEIGHT", fallback=100)
|
||||
ERROR_FONT_SIZE = config.getint("UI", "ERROR_FONT_SIZE", fallback=11)
|
||||
# BUTTONS
|
||||
BUTTON_SIZE_SEARCH = config.getint("Buttons", "BUTTON_SIZE_SEARCH", fallback=15)
|
||||
BUTTON_SIZE_OPEN = config.getint("Buttons", "BUTTON_SIZE_OPEN", fallback=15)
|
||||
BUTTON_SIZE_SELECT_ALL = config.getint("Buttons", "BUTTON_SIZE_SELECT_ALL", fallback=15)
|
||||
BUTTON_SIZE_SAVE = config.getint("Buttons", "BUTTON_SIZE_SAVE", fallback=15)
|
||||
BUTTON_SIZE_COPY = config.getint("Buttons", "BUTTON_SIZE_COPY", fallback=15)
|
||||
BUTTON_SIZE_TRASH = config.getint("Buttons", "BUTTON_SIZE_TRASH", fallback=15)
|
||||
BUTTON_SIZE_CLOSE = config.getint("Buttons", "BUTTON_SIZE_CLOSE", fallback=15)
|
||||
BUTTON_SIZE_MESSAGE = config.getint("Buttons", "BUTTON_SIZE_MESSAGE", fallback=15)
|
||||
BUTTON_SIZE_YES_NO = config.getint("Buttons", "BUTTON_SIZE_YES_NO", fallback=15)
|
||||
# ============================================================
|
||||
|
||||
os.makedirs(TRASH_DIR, exist_ok=True)
|
||||
|
||||
with open(INDEX_FILE, "rb") as f:
|
||||
SEARCH_INDEX = pickle.load(f)
|
||||
SEARCH_INDEX = Indexer.load_index()
|
||||
if Indexer.update_index(SEARCH_INDEX):
|
||||
try:
|
||||
Indexer.save_index(SEARCH_INDEX)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
def find_external_drives():
|
||||
drives = []
|
||||
|
||||
Reference in new issue
Block a user