fixed dark mode and scrolling, added symbols to buttons
This commit is contained in:
parent
44c05ed66e
commit
5d838bc27e
1 changed files with 29 additions and 22 deletions
|
|
@ -15,7 +15,7 @@ class PNGMetadataEditor:
|
|||
def __init__(self, root):
|
||||
self.root = root
|
||||
self.root.title(f"{APP_NAME} v{APP_VERSION}")
|
||||
self.root.geometry("800x600") # Smaller window size
|
||||
self.root.geometry("1000x700") # Smaller window size
|
||||
self.current_file = None
|
||||
self.current_directory = None
|
||||
self.metadata_dict = {}
|
||||
|
|
@ -35,7 +35,7 @@ class PNGMetadataEditor:
|
|||
def detect_dark_mode(self):
|
||||
"""Detect if the OS is in dark mode"""
|
||||
system = platform.system()
|
||||
|
||||
|
||||
if system == "Darwin": # macOS
|
||||
try:
|
||||
result = subprocess.run(
|
||||
|
|
@ -89,14 +89,15 @@ class PNGMetadataEditor:
|
|||
def setup_ui(self):
|
||||
# Initialize theme colors
|
||||
self.theme_colors = self.get_theme_colors()
|
||||
|
||||
# Top frame for file operations
|
||||
top_frame = ttk.Frame(self.root, padding="10")
|
||||
top_frame.pack(fill=tk.X)
|
||||
|
||||
ttk.Button(top_frame, text="Open PNG File", command=self.open_file).pack(side=tk.LEFT, padx=5)
|
||||
ttk.Button(top_frame, text="Browse Directory", command=self.browse_directory).pack(side=tk.LEFT, padx=5)
|
||||
ttk.Button(top_frame, text="Save Changes", command=self.save_changes).pack(side=tk.LEFT, padx=5)
|
||||
ttk.Button(top_frame, text="About", command=self.show_about).pack(side=tk.RIGHT, padx=5)
|
||||
ttk.Button(top_frame, text="📄 Open PNG File", command=self.open_file).pack(side=tk.LEFT, padx=5)
|
||||
ttk.Button(top_frame, text="📥 Browse Directory", command=self.browse_directory).pack(side=tk.LEFT, padx=5)
|
||||
ttk.Button(top_frame, text="✅ Save Changes", command=self.save_changes).pack(side=tk.LEFT, padx=5)
|
||||
ttk.Button(top_frame, text="ℹ️ About", command=self.show_about).pack(side=tk.RIGHT, padx=5)
|
||||
|
||||
self.file_label = ttk.Label(top_frame, text="No file loaded", foreground="gray")
|
||||
self.file_label.pack(side=tk.LEFT, padx=20)
|
||||
|
|
@ -190,10 +191,10 @@ class PNGMetadataEditor:
|
|||
button_frame = ttk.Frame(editor_frame, padding="10")
|
||||
button_frame.pack(fill=tk.X)
|
||||
|
||||
ttk.Button(button_frame, text="Add Field", command=self.add_field).pack(side=tk.LEFT, padx=5)
|
||||
ttk.Button(button_frame, text="Edit Field", command=self.edit_entry).pack(side=tk.LEFT, padx=5)
|
||||
ttk.Button(button_frame, text="Delete Field", command=self.delete_field).pack(side=tk.LEFT, padx=5)
|
||||
ttk.Button(button_frame, text="Copy Value", command=self.copy_value).pack(side=tk.LEFT, padx=5)
|
||||
ttk.Button(button_frame, text="🤌 Add Field", command=self.add_field).pack(side=tk.LEFT, padx=5)
|
||||
ttk.Button(button_frame, text="✏️ Edit Field", command=self.edit_entry).pack(side=tk.LEFT, padx=5)
|
||||
ttk.Button(button_frame, text="❌ Delete Field", command=self.delete_field).pack(side=tk.LEFT, padx=5)
|
||||
ttk.Button(button_frame, text="✌️ Copy Value", command=self.copy_value).pack(side=tk.LEFT, padx=5)
|
||||
|
||||
# Status bar at the bottom
|
||||
status_frame = ttk.Frame(self.root, relief=tk.SUNKEN)
|
||||
|
|
@ -288,7 +289,7 @@ class PNGMetadataEditor:
|
|||
loading_frame.pack(fill=tk.BOTH, expand=True, pady=50)
|
||||
|
||||
loading_label = tk.Label(loading_frame, text="Loading thumbnails...",
|
||||
font=("TkDefaultFont", 11, "bold"), foreground="#4a90d9", bg="#f0f0f0")
|
||||
font=("TkDefaultFont", 11, "bold"), foreground="#4a90d9", bg=self.theme_colors["frame_bg"])
|
||||
loading_label.pack()
|
||||
|
||||
# Force immediate display
|
||||
|
|
@ -303,7 +304,7 @@ class PNGMetadataEditor:
|
|||
no_files_frame = tk.Frame(self.thumb_container, bg=self.theme_colors["frame_bg"])
|
||||
no_files_frame.pack(fill=tk.BOTH, expand=True, pady=50)
|
||||
tk.Label(no_files_frame, text="No PNG files found",
|
||||
font=("TkDefaultFont", 10), foreground="gray", bg="#f0f0f0").pack()
|
||||
font=("TkDefaultFont", 10), foreground="gray", bg=self.theme_colors["frame_bg"]).pack()
|
||||
self.set_status(f"No PNG files found in {Path(directory).name}", color="orange")
|
||||
return
|
||||
|
||||
|
|
@ -369,11 +370,17 @@ class PNGMetadataEditor:
|
|||
# Hide loading indicator
|
||||
loading_frame.destroy()
|
||||
|
||||
# CRITICAL: Force update of scroll region after all thumbnails are loaded
|
||||
# Without this, scrolling stops after visible thumbnails
|
||||
self.thumb_container.update_idletasks()
|
||||
self.thumb_canvas.update_idletasks()
|
||||
self.thumb_canvas.configure(scrollregion=self.thumb_canvas.bbox("all"))
|
||||
# Force scroll region update
|
||||
def update_scroll():
|
||||
self.thumb_container.update_idletasks()
|
||||
self.thumb_canvas.update_idletasks()
|
||||
bbox = self.thumb_canvas.bbox("all")
|
||||
if bbox:
|
||||
self.thumb_canvas.configure(scrollregion=bbox)
|
||||
|
||||
update_scroll()
|
||||
self.root.after(100, update_scroll)
|
||||
self.root.after(300, update_scroll)
|
||||
|
||||
self.set_status(f"Loaded {len(png_files)} PNG file(s) from {Path(directory).name}", color="green")
|
||||
|
||||
|
|
@ -430,11 +437,11 @@ class PNGMetadataEditor:
|
|||
about_text = f"{APP_NAME} v{APP_VERSION}\n\n" \
|
||||
"A graphical tool for viewing and editing metadata in PNG files.\n\n" \
|
||||
"Features:\n" \
|
||||
"• Browse directories with thumbnail previews\n" \
|
||||
"• Trackpad/mousewheel scrolling support\n" \
|
||||
"• Auto-scroll to selected images\n" \
|
||||
"• View and edit PNG metadata\n" \
|
||||
"• Copy metadata between files\n\n" \
|
||||
"✅ Browse directories with thumbnail previews\n" \
|
||||
"✅ Trackpad/mousewheel scrolling support\n" \
|
||||
"✅ Auto-scroll to selected images\n" \
|
||||
"✅ View and edit PNG metadata\n" \
|
||||
"✅ Copy metadata between files\n\n" \
|
||||
"Author: Robert Tusa\n" \
|
||||
"License: MIT"
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue