Add tooltip to radio buttons on import file choices
This commit is contained in:
parent
a1709e92ae
commit
6da6f7044b
@ -12,7 +12,6 @@ import shutil
|
|||||||
from PyQt6.QtCore import (
|
from PyQt6.QtCore import (
|
||||||
pyqtSignal,
|
pyqtSignal,
|
||||||
QObject,
|
QObject,
|
||||||
Qt,
|
|
||||||
QThread,
|
QThread,
|
||||||
)
|
)
|
||||||
from PyQt6.QtWidgets import (
|
from PyQt6.QtWidgets import (
|
||||||
@ -20,16 +19,13 @@ from PyQt6.QtWidgets import (
|
|||||||
QDialog,
|
QDialog,
|
||||||
QHBoxLayout,
|
QHBoxLayout,
|
||||||
QLabel,
|
QLabel,
|
||||||
QMainWindow,
|
|
||||||
QMessageBox,
|
|
||||||
QPushButton,
|
QPushButton,
|
||||||
QRadioButton,
|
QRadioButton,
|
||||||
|
QStatusBar,
|
||||||
QVBoxLayout,
|
QVBoxLayout,
|
||||||
)
|
)
|
||||||
|
|
||||||
# Third party imports
|
# Third party imports
|
||||||
from sqlalchemy.exc import IntegrityError
|
|
||||||
from sqlalchemy.orm.session import Session
|
|
||||||
|
|
||||||
# App imports
|
# App imports
|
||||||
from classes import (
|
from classes import (
|
||||||
@ -329,17 +325,18 @@ class FileImporter:
|
|||||||
f"({self.import_files_data[idx].tags.artist})"
|
f"({self.import_files_data[idx].tags.artist})"
|
||||||
)
|
)
|
||||||
|
|
||||||
# Build a list of (track title and artise, track_id)
|
# Build a list of (track title and artist, track_id, track path)
|
||||||
choices: list[tuple[str, int]] = []
|
choices: list[tuple[str, int, str]] = []
|
||||||
# First choice is always to import as a new track
|
# First choice is always to import as a new track
|
||||||
choices.append((Config.DO_NOT_IMPORT, -2))
|
choices.append((Config.DO_NOT_IMPORT, -2, ""))
|
||||||
choices.append((Config.IMPORT_AS_NEW, 0))
|
choices.append((Config.IMPORT_AS_NEW, 0, ""))
|
||||||
for track_id in track_ids:
|
for track_id in track_ids:
|
||||||
choices.append(
|
choices.append(
|
||||||
(
|
(
|
||||||
f"{self.existing_tracks[track_id].title} "
|
f"{self.existing_tracks[track_id].title} "
|
||||||
f"({self.existing_tracks[track_id].artist})",
|
f"({self.existing_tracks[track_id].artist})",
|
||||||
track_id,
|
track_id,
|
||||||
|
str(self.existing_tracks[track_id].path)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -444,7 +441,7 @@ class PickMatch(QDialog):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(
|
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:
|
) -> None:
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.new_track_details = new_track_details
|
self.new_track_details = new_track_details
|
||||||
@ -472,7 +469,7 @@ class PickMatch(QDialog):
|
|||||||
self.button_group = QButtonGroup()
|
self.button_group = QButtonGroup()
|
||||||
|
|
||||||
# Add radio buttons for each item
|
# 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 (
|
if (
|
||||||
track_sequence.current
|
track_sequence.current
|
||||||
and track_id
|
and track_id
|
||||||
@ -485,6 +482,7 @@ class PickMatch(QDialog):
|
|||||||
self.button_group.addButton(radio_button, -1)
|
self.button_group.addButton(radio_button, -1)
|
||||||
else:
|
else:
|
||||||
radio_button = QRadioButton(text)
|
radio_button = QRadioButton(text)
|
||||||
|
radio_button.setToolTip(track_path)
|
||||||
self.button_group.addButton(radio_button, track_id)
|
self.button_group.addButton(radio_button, track_id)
|
||||||
layout.addWidget(radio_button)
|
layout.addWidget(radio_button)
|
||||||
|
|
||||||
@ -498,8 +496,8 @@ class PickMatch(QDialog):
|
|||||||
cancel_button = QPushButton("Cancel")
|
cancel_button = QPushButton("Cancel")
|
||||||
button_layout.addWidget(ok_button)
|
button_layout.addWidget(ok_button)
|
||||||
button_layout.addWidget(cancel_button)
|
button_layout.addWidget(cancel_button)
|
||||||
|
|
||||||
layout.addLayout(button_layout)
|
layout.addLayout(button_layout)
|
||||||
|
|
||||||
self.setLayout(layout)
|
self.setLayout(layout)
|
||||||
|
|
||||||
# Connect buttons to actions
|
# Connect buttons to actions
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user