From 77c2e9cd9ecbfae6aa083cee54761d3f6d43f68a Mon Sep 17 00:00:00 2001 From: Vxrtrauter <101264710+Vxrtrauter@users.noreply.github.com> Date: Sat, 21 Mar 2026 02:48:48 +0100 Subject: [PATCH] fix: tab layout, clear search state, and cleanup UI: remove trackertable from the Search tab and reorder widgets to correct layout. Tab helper: add QLayout directly instead of wrapping it in a temporary QWidget to avoid extra nesting. Search helper: clear the trackertable rows and reset state.posts when starting a new search to ensure fresh results. Minor: import check_space in main and simplify an unused loop variable in libtorrent_int for clarity/linting. --- src/interface/gui.py | 2 +- src/interface/utils/searchhelper.py | 2 ++ src/interface/utils/tabhelper.py | 4 +--- src/main.py | 1 + src/network/libtorrent_int.py | 2 +- 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/interface/gui.py b/src/interface/gui.py index 851e115..1b048ef 100644 --- a/src/interface/gui.py +++ b/src/interface/gui.py @@ -164,7 +164,7 @@ class MainWindow(QtWidgets.QMainWindow, QWidget): self.horizontal_layout.addWidget(state.trackertable) # Tabs - create_tab("Search", [self.searchbar, state.trackertable, self.dlbutton, self.horizontal_layout], tabs=self.tabs, stretch=False) + create_tab("Search", [self.searchbar, self.horizontal_layout, self.dlbutton], tabs=self.tabs, stretch=False) create_tab("Downloads", [self.emptyDownload, self.downloadList], tabs=self.tabs, stretch=False) # Corner Widget (Settings Button, Tracker list, Tab button container) diff --git a/src/interface/utils/searchhelper.py b/src/interface/utils/searchhelper.py index ca4bc60..eeefdf3 100644 --- a/src/interface/utils/searchhelper.py +++ b/src/interface/utils/searchhelper.py @@ -6,6 +6,7 @@ for scraper in SCRAPERS: state.trackers[scraper.name] = scraper def run_search(self) -> None: + state.trackertable.setRowCount(0) self.show_empty_results(False) search_text = self.searchbar.text() @@ -14,6 +15,7 @@ def run_search(self) -> None: consoleLog("Error: Can't search for nothing") return + state.posts = [] self.searchbar.setEnabled(False) consoleLog(f"User searched for: {search_text}") diff --git a/src/interface/utils/tabhelper.py b/src/interface/utils/tabhelper.py index a328979..5a61aa7 100644 --- a/src/interface/utils/tabhelper.py +++ b/src/interface/utils/tabhelper.py @@ -10,9 +10,7 @@ def create_tab(title, items, tabs, stretch): continue if isinstance(item, QLayout): - wrapper = QWidget() - wrapper.setLayout(item) - layout.addWidget(wrapper) + layout.addLayout(item) else: layout.addWidget(item) diff --git a/src/main.py b/src/main.py index 4cdcf70..b7b3405 100644 --- a/src/main.py +++ b/src/main.py @@ -3,6 +3,7 @@ from utils.logging.loghandler import split_data, check_completed, check_download from network.interface import list_interfaces, init_interfaces from utils.logging.logs import get_download_logs from utils.logging.logs import set_main_window +from network.libtorrent_int import check_space from utils.general.shutdown import closehelper from utils.general.wrappers import run_thread from utils.general.shutdown import force_exit diff --git a/src/network/libtorrent_int.py b/src/network/libtorrent_int.py index c1bb694..db31889 100644 --- a/src/network/libtorrent_int.py +++ b/src/network/libtorrent_int.py @@ -23,7 +23,7 @@ def get_free_space_mb(dirname): def check_space(): while not state.shutdown_event.is_set(): - for magnet_uri, magnetdl in list(state.active_downloads.items()): + for _, magnetdl in list(state.active_downloads.items()): try: status = magnetdl.status() except RuntimeError: