aboutsummaryrefslogtreecommitdiffstats
path: root/dialogs/rip_cd_dialog.py
diff options
context:
space:
mode:
authorPinapelz <yukais@pinapelz.com>2026-10-30 13:46:12 -0700
committerPinapelz <yukais@pinapelz.com>2026-10-30 13:46:12 -0700
commitca7cb853bdf289f9e0776fe8ac9d517ca744e204 (patch)
treef50645520f9474ab0b54e499c4f83a38115bfeec /dialogs/rip_cd_dialog.py
parentc26370de18bd892df5c22a81f9b613a07bb67638 (diff)
chore(gui): refactor dialogs into their own modules
Diffstat (limited to 'dialogs/rip_cd_dialog.py')
-rw-r--r--dialogs/rip_cd_dialog.py50
1 files changed, 50 insertions, 0 deletions
diff --git a/dialogs/rip_cd_dialog.py b/dialogs/rip_cd_dialog.py
new file mode 100644
index 0000000..dd3ac8f
--- /dev/null
+++ b/dialogs/rip_cd_dialog.py
@@ -0,0 +1,50 @@
+from PyQt6.QtCore import Qt
+from PyQt6.QtWidgets import (
+ QDialog,
+ QHBoxLayout,
+ QLabel,
+ QListWidget,
+ QListWidgetItem,
+ QMessageBox,
+ QPushButton,
+ QVBoxLayout,
+)
+
+
+class RipCdDialog(QDialog):
+ def __init__(self, drives: list[tuple[str, str]], parent=None):
+ super().__init__(parent)
+ self.setWindowTitle("Select optical drive")
+ self.resize(680, 360)
+ self.selected_drive: str | None = None
+
+ layout = QVBoxLayout(self)
+ layout.addWidget(QLabel("Select the optical drive to use for CD ripping:"))
+
+ self.drives = QListWidget()
+ for path, label in drives:
+ item = QListWidgetItem(label)
+ item.setData(Qt.ItemDataRole.UserRole, path)
+ self.drives.addItem(item)
+ if drives:
+ self.drives.setCurrentRow(0)
+ self.drives.itemDoubleClicked.connect(lambda _: self._accept())
+ layout.addWidget(self.drives, 1)
+
+ buttons = QHBoxLayout()
+ buttons.addStretch(1)
+ ok_btn = QPushButton("Use Drive")
+ ok_btn.clicked.connect(self._accept)
+ cancel_btn = QPushButton("Cancel")
+ cancel_btn.clicked.connect(self.reject)
+ buttons.addWidget(ok_btn)
+ buttons.addWidget(cancel_btn)
+ layout.addLayout(buttons)
+
+ def _accept(self):
+ item = self.drives.currentItem()
+ if not item:
+ QMessageBox.information(self, "No drive selected", "Select an optical drive first.")
+ return
+ self.selected_drive = item.data(Qt.ItemDataRole.UserRole)
+ self.accept()
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage