feat: add download item context menu widget

This commit is contained in:
2026-04-07 23:42:50 +02:00
parent 1f16a58f21
commit 7526eb5d30
2 changed files with 13 additions and 1 deletions
+1 -1
View File
@@ -8,4 +8,4 @@ aiohttp==3.13.0
plyer==2.1.0
psutil==7.1.0
libtorrent==2.0.11
libtorrent-windows-dll==0.0.3
libtorrent-windows-dll==0.0.3
+12
View File
@@ -1,9 +1,11 @@
from utils.logging.logs import consoleLog, remove_download_log
from utils.network.download import download_selected
from utils.data.tracker import get_magnet_link
from PySide6.QtCore import Qt, QPoint, QTimer
from utils.general.wrappers import run_thread
from PySide6.QtWidgets import QMessageBox
from utils.data.state import state
from send2trash import send2trash
from PySide6 import QtWidgets
import threading
import webbrowser
@@ -158,6 +160,7 @@ class ContextMenu_TrackerTable:
self.context_menu = QtWidgets.QMenu(main_window)
self.context_menu.addAction("Copy Tracker URL", self.copyMagnetURIAction)
self.context_menu.addAction("Open in Browser", self.openInBrowserAction)
self.context_menu.addAction("Download Item", self.downloadItemAction)
state.trackertable.setContextMenuPolicy(Qt.ContextMenuPolicy.CustomContextMenu)
state.trackertable.customContextMenuRequested.connect(self._show_context_menu)
@@ -215,3 +218,12 @@ class ContextMenu_TrackerTable:
if url:
try: webbrowser.open(url)
except Exception as e: consoleLog(f"Failed to open URL: {e}", True)
def downloadItemAction(self):
if not hasattr(self, '_context_menu_row'):
return
row = self._context_menu_row
if row < 0 or row >= len(state.trackers):
return
run_thread(threading.Thread(target=download_selected, args=(state.trackertable.selectedItems(),)))