Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions gui/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""GUI package for optional Qt tooling."""
61 changes: 61 additions & 0 deletions gui/qt_launcher.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
"""Standalone Qt preview window launcher."""
from __future__ import annotations

import sys


QtWidgets = None
QtCore = None

try: # Prefer PySide6 when available.
from PySide6 import QtCore, QtWidgets # type: ignore
except Exception: # pragma: no cover - optional dependency
try:
from PyQt6 import QtCore, QtWidgets # type: ignore
except Exception as exc: # pragma: no cover - optional dependency
raise SystemExit(
"PySide6 or PyQt6 is required to launch the Qt preview window. "
"Install one of them and try again."
) from exc


class QtPreviewWindow(QtWidgets.QMainWindow):
"""Simple placeholder Qt window for incremental migration."""

def __init__(self) -> None:
super().__init__()
self.setWindowTitle("AlphaDEX Qt Preview")
self.resize(900, 600)

container = QtWidgets.QWidget()
layout = QtWidgets.QVBoxLayout(container)

heading = QtWidgets.QLabel("Qt Preview Window")
heading.setAlignment(QtCore.Qt.AlignmentFlag.AlignCenter)
heading.setStyleSheet("font-size: 20px; font-weight: 600;")

body = QtWidgets.QLabel(
"This window is launched from the Tkinter app to begin a staged Qt migration.\n"
"Add new Qt panels here as they are ported from the Tk interface."
)
body.setAlignment(QtCore.Qt.AlignmentFlag.AlignCenter)
body.setWordWrap(True)

layout.addStretch(1)
layout.addWidget(heading)
layout.addSpacing(12)
layout.addWidget(body)
layout.addStretch(2)

self.setCentralWidget(container)


def main() -> int:
app = QtWidgets.QApplication.instance() or QtWidgets.QApplication(sys.argv)
window = QtPreviewWindow()
window.show()
return app.exec()


if __name__ == "__main__":
raise SystemExit(main())
28 changes: 28 additions & 0 deletions main_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
# from ttkthemes import ThemedStyle as Style
# import ttkbootstrap as tb; Style = tb.Style
import json
import importlib.util
import queue
import subprocess
from tkinter import filedialog, messagebox, Text, Scrollbar
Expand Down Expand Up @@ -6137,6 +6138,10 @@ def build_ui(self):
label="Duplicate Pair Review…",
command=self._open_duplicate_pair_review_tool,
)
tools_menu.add_command(
label="Qt Preview Window…",
command=self._open_qt_preview_window,
)
tools_menu.add_command(label="M4A Tester…", command=self._open_m4a_tester_tool)
tools_menu.add_command(label="Opus Tester…", command=self._open_opus_tester_tool)
tools_menu.add_separator()
Expand Down Expand Up @@ -8638,6 +8643,29 @@ def _open_file_cleanup_tool(self) -> None:
def _open_duplicate_bucketing_poc_tool(self) -> None:
DuplicateBucketingPocDialog(self)

def _open_qt_preview_window(self) -> None:
qt_available = any(
importlib.util.find_spec(module)
for module in ("PySide6", "PyQt6")
)
if not qt_available:
messagebox.showerror(
"Qt Preview",
"PySide6 or PyQt6 is not installed. Install one of them to launch the Qt preview window.",
)
return

try:
subprocess.Popen(
[sys.executable, "-m", "gui.qt_launcher"],
cwd=str(Path(__file__).resolve().parent),
)
except Exception as exc:
messagebox.showerror(
"Qt Preview",
f"Unable to launch the Qt preview window: {exc}",
)

def _open_m4a_tester_tool(self) -> None:
M4ATesterDialog(self)

Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ tqdm
ttkthemes
ttkbootstrap
sv-ttk
PySide6

# Optional alternative audio engine; see README.md for install steps
# essentia==2.1b6