diff options
| author | Robert Honz <exislow+github@gmail.com> | 2025-10-20 09:37:01 +0200 |
|---|---|---|
| committer | Robert Honz <exislow+github@gmail.com> | 2025-10-20 09:37:01 +0200 |
| commit | aaca12cacc7cbb3e20c3c709db15164ee2330d39 (patch) | |
| tree | 4769393e69541f3b255a349f2ce4867ea9d7271f /tidal_dl_ng | |
| parent | 51556f1d80a2e7629d13b3729c5756c6af64d355 (diff) | |
| download | tidal-dl-ng-aaca12cacc7cbb3e20c3c709db15164ee2330d39.tar.gz | |
fix(gui): 🐛 improve album download action and update docstring
* Refactored the menu action for downloading the full album from a track.
* Enhanced the docstring for `on_download_album_from_track` to clarify its functionality and error handling.
Diffstat (limited to 'tidal_dl_ng')
| -rw-r--r-- | tidal_dl_ng/gui.py | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/tidal_dl_ng/gui.py b/tidal_dl_ng/gui.py index 744cc06..d0ee637 100644 --- a/tidal_dl_ng/gui.py +++ b/tidal_dl_ng/gui.py @@ -583,11 +583,11 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow): # We build the menu. menu = QtWidgets.QMenu() - media = get_results_media_item(index, self.proxy_tr_results, self.model_tr_results) + if isinstance(media, Track) and media.album: - menu.addAction("Download Full Album", lambda: self.thread_download_album_from_track(point)) - + menu.addAction("Download Full Album", lambda: self.thread_download_album_from_track(point)) + menu.addAction("Copy Share URL", lambda: self.on_copy_url_share(self.tr_results, point)) menu.exec(self.tr_results.mapToGlobal(point)) @@ -1712,9 +1712,14 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow): """ self.thread_it(self.on_download_album_from_track, point) - def on_download_album_from_track(self, point: QtCore.QPoint) -> None: - """Gets the album from a selected track and adds it to the download queue.""" + """Adds the album associated with a selected track to the download queue. + + This method retrieves the album from a track selected in the results tree and attempts to add it to the download queue. If the album cannot be retrieved or an error occurs, a warning or error is logged. + + Args: + point (QtCore.QPoint): The point in the results tree where the user clicked. + """ index: QtCore.QModelIndex = self.tr_results.indexAt(point) media_track: Track = get_results_media_item(index, self.proxy_tr_results, self.model_tr_results) |
