fix: Linux/Ubuntu support — icon fallback, HiDPI scaling, CUDA lib paths, per-file timing
- app.py: graceful icon loading (no crash on Linux Tk without .ico support) - app.py: auto-detect display scaling for 4K/HiDPI screens - _LocalTranscribe.py: register NVIDIA pip-package .so paths on Linux (LD_LIBRARY_PATH) so faster-whisper finds libcublas/libcudnn at runtime - _LocalTranscribe.py: auto-fallback to CPU if CUDA runtime libs missing - _LocalTranscribe.py: filter input to supported media extensions only - _LocalTranscribe.py: show real decode errors instead of generic skip message - _LocalTranscribe.py: per-file timer showing wall-clock vs audio duration
This commit is contained in:
33
app.py
33
app.py
@@ -52,6 +52,34 @@ customtkinter.set_appearance_mode("System")
|
||||
customtkinter.set_default_color_theme("blue") # Themes: blue (default), dark-blue, green
|
||||
firstclick = True
|
||||
|
||||
|
||||
def _set_app_icon(root):
|
||||
"""Set app icon when supported, without crashing on unsupported platforms."""
|
||||
base_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
icon_path = os.path.join(base_dir, "images", "icon.ico")
|
||||
|
||||
if not os.path.exists(icon_path):
|
||||
return
|
||||
|
||||
try:
|
||||
root.iconbitmap(icon_path)
|
||||
except tk.TclError:
|
||||
# Some Linux Tk builds don't accept .ico for iconbitmap.
|
||||
pass
|
||||
|
||||
|
||||
def _apply_display_scaling(root):
|
||||
"""Auto-scale UI for high-resolution displays (e.g., 4K)."""
|
||||
try:
|
||||
screen_w = root.winfo_screenwidth()
|
||||
screen_h = root.winfo_screenheight()
|
||||
scale = min(screen_w / 1920.0, screen_h / 1080.0)
|
||||
scale = max(1.0, min(scale, 2.0))
|
||||
customtkinter.set_widget_scaling(scale)
|
||||
customtkinter.set_window_scaling(scale)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
class App:
|
||||
def __init__(self, master):
|
||||
self.master = master
|
||||
@@ -184,13 +212,14 @@ class App:
|
||||
if __name__ == "__main__":
|
||||
# Setting custom themes
|
||||
root = customtkinter.CTk()
|
||||
_apply_display_scaling(root)
|
||||
root.title("Local Transcribe with Whisper")
|
||||
# Geometry — taller to accommodate the embedded console panel
|
||||
width, height = 550, 560
|
||||
root.geometry('{}x{}'.format(width, height))
|
||||
root.minsize(450, 480)
|
||||
# Icon
|
||||
root.iconbitmap('images/icon.ico')
|
||||
# Icon (best-effort; ignored on platforms/builds without .ico support)
|
||||
_set_app_icon(root)
|
||||
# Run
|
||||
app = App(root)
|
||||
root.mainloop()
|
||||
|
||||
Reference in New Issue
Block a user