Skip to content

Commit 0e10c53

Browse files
committed
Resolve merge conflicts with 'main'
1 parent 4bca54c commit 0e10c53

File tree

2 files changed

+19
-36
lines changed

2 files changed

+19
-36
lines changed

tidal_dl_ng/gui.py

Lines changed: 16 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -607,6 +607,9 @@ def menu_context_tree_results(self, point: QtCore.QPoint) -> None:
607607
def menu_context_queue_download(self, point: QtCore.QPoint) -> None:
608608
"""Show context menu for download queue.
609609
610+
Provides options like 'Remove from Queue' (for Waiting items)
611+
or 'Show in Explorer' (for Finished items).
612+
610613
Args:
611614
point (QPoint): The point where the menu is requested.
612615
"""
@@ -616,14 +619,26 @@ def menu_context_queue_download(self, point: QtCore.QPoint) -> None:
616619
if not item:
617620
return
618621

622+
model_item = item.data(0, QtCore.Qt.ItemDataRole.UserRole)
623+
if not isinstance(model_item, QueueDownloadItem):
624+
return
625+
619626
# Build the menu
620627
menu = QtWidgets.QMenu()
621628

629+
status = model_item.get_status()
630+
622631
# Show remove option for waiting items
623-
status = item.text(0)
624632
if status == QueueDownloadStatus.Waiting:
625633
menu.addAction("🗑️ Remove from Queue", lambda: self.on_queue_download_remove_item(item))
626634

635+
# Show "Show in Explorer" if "Finished"
636+
elif status == QueueDownloadStatus.Finished:
637+
file_path = model_item.get_file_path()
638+
if file_path:
639+
action = menu.addAction("📂 Show in Explorer")
640+
action.triggered.connect(lambda: self.on_show_in_explorer(file_path))
641+
627642
if menu.isEmpty():
628643
return
629644

@@ -2047,37 +2062,6 @@ def on_download_album_from_track(self, point: QtCore.QPoint) -> None:
20472062
else:
20482063
logger_gui.warning("Could not retrieve album information from the selected track.")
20492064

2050-
def menu_context_tree_queue(self, point: QtCore.QPoint) -> None:
2051-
"""
2052-
Show context menu for the download queue tree.
2053-
Improved validation and error handling.
2054-
"""
2055-
item = self.tr_queue_download.itemAt(point)
2056-
if not item:
2057-
return
2058-
2059-
# Retrieve our data model from the GUI item
2060-
model_item = item.data(0, QtCore.Qt.ItemDataRole.UserRole)
2061-
2062-
# Verify that it is our model
2063-
if not isinstance(model_item, QueueDownloadItem):
2064-
return
2065-
2066-
if model_item.get_status() != QueueDownloadStatus.Finished:
2067-
return
2068-
2069-
file_path = model_item.get_file_path()
2070-
if not file_path:
2071-
return
2072-
2073-
# Path validation is now deferred to on_show_in_explorer
2074-
# and open_in_explorer, so we don't log warnings prematurely.
2075-
2076-
menu = QtWidgets.QMenu()
2077-
action = menu.addAction("Show in Explorer")
2078-
action.triggered.connect(lambda: self.on_show_in_explorer(file_path))
2079-
menu.exec(self.tr_queue_download.mapToGlobal(point))
2080-
20812065
def on_show_in_explorer(self, path: str) -> None:
20822066
"""
20832067
Opens the file explorer at the given path.

tidal_dl_ng/helper/filesystem.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,16 @@ def normalize_path(path: str) -> pathlib.Path:
2424
"""
2525
if not path:
2626
raise ValueError("Path cannot be empty")
27-
27+
2828
try:
2929
normalized = pathlib.Path(path)
3030
# Resolve to catch issues early (optional, depends on use case)
3131
# normalized.resolve(strict=False)
3232
return normalized
33-
33+
3434
except (ValueError, TypeError) as e:
3535
raise ValueError(f"Invalid path format: {path}") from e
3636

37-
3837
@staticmethod
3938
def path_exists(path: pathlib.Path) -> bool:
4039
"""
@@ -168,4 +167,4 @@ def _open_linux(path: pathlib.Path, is_file: bool, logger) -> bool:
168167
continue
169168

170169
logger.exception("No compatible file manager found on Linux")
171-
return False
170+
return False

0 commit comments

Comments
 (0)