From 6da6f7044b8d957332d3a6524483538c942c5bf2 Mon Sep 17 00:00:00 2001 From: Keith Edmunds Date: Sun, 22 Dec 2024 17:26:33 +0000 Subject: [PATCH] Add tooltip to radio buttons on import file choices --- app/file_importer.py | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/app/file_importer.py b/app/file_importer.py index c485075..92a7854 100644 --- a/app/file_importer.py +++ b/app/file_importer.py @@ -12,7 +12,6 @@ import shutil from PyQt6.QtCore import ( pyqtSignal, QObject, - Qt, QThread, ) from PyQt6.QtWidgets import ( @@ -20,16 +19,13 @@ from PyQt6.QtWidgets import ( QDialog, QHBoxLayout, QLabel, - QMainWindow, - QMessageBox, QPushButton, QRadioButton, + QStatusBar, QVBoxLayout, ) # Third party imports -from sqlalchemy.exc import IntegrityError -from sqlalchemy.orm.session import Session # App imports from classes import ( @@ -329,17 +325,18 @@ class FileImporter: f"({self.import_files_data[idx].tags.artist})" ) - # Build a list of (track title and artise, track_id) - choices: list[tuple[str, int]] = [] + # Build a list of (track title and artist, track_id, track path) + choices: list[tuple[str, int, str]] = [] # First choice is always to import as a new track - choices.append((Config.DO_NOT_IMPORT, -2)) - choices.append((Config.IMPORT_AS_NEW, 0)) + choices.append((Config.DO_NOT_IMPORT, -2, "")) + choices.append((Config.IMPORT_AS_NEW, 0, "")) for track_id in track_ids: choices.append( ( f"{self.existing_tracks[track_id].title} " f"({self.existing_tracks[track_id].artist})", track_id, + str(self.existing_tracks[track_id].path) ) ) @@ -444,7 +441,7 @@ class PickMatch(QDialog): """ def __init__( - self, new_track_details: str, items_with_ids: list[tuple[str, int]] + self, new_track_details: str, items_with_ids: list[tuple[str, int, str]] ) -> None: super().__init__() self.new_track_details = new_track_details @@ -472,7 +469,7 @@ class PickMatch(QDialog): self.button_group = QButtonGroup() # Add radio buttons for each item - for idx, (text, track_id) in enumerate(items_with_ids): + for idx, (text, track_id, track_path) in enumerate(items_with_ids): if ( track_sequence.current and track_id @@ -485,6 +482,7 @@ class PickMatch(QDialog): self.button_group.addButton(radio_button, -1) else: radio_button = QRadioButton(text) + radio_button.setToolTip(track_path) self.button_group.addButton(radio_button, track_id) layout.addWidget(radio_button) @@ -498,8 +496,8 @@ class PickMatch(QDialog): cancel_button = QPushButton("Cancel") button_layout.addWidget(ok_button) button_layout.addWidget(cancel_button) - layout.addLayout(button_layout) + self.setLayout(layout) # Connect buttons to actions