From dbd8e6a8ac58116106bf71da3318e38064e6937e Mon Sep 17 00:00:00 2001 From: Ethanfel Date: Sat, 6 Jun 2026 17:04:31 +0200 Subject: [PATCH] fix: opened/dropped files go to the visible tab, not the last-interacted one _on_open_files/dropEvent added to self._playlist (the last-interacted pane, which could be the tab whose file is loaded in the player). Now they target _add_target_playlist(): the currently visible tab in tab view, or the active pane in side-by-side, and make it the active list. Co-Authored-By: Claude Opus 4.6 --- main.py | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index 12fcf08..fdaa8e1 100755 --- a/main.py +++ b/main.py @@ -4464,6 +4464,18 @@ class MainWindow(QMainWindow): return w return self._pws[0] if self._pws else None + def _add_target_playlist(self) -> "PlaylistWidget": + """The list that newly-opened files should go into. + + In normal tab view that's the visible tab; in side-by-side it's the + last-interacted pane. + """ + if self._list_stack.currentWidget() is self._playlist_tabs: + w = self._playlist_tabs.currentWidget() + if w is not None: + return w + return self._playlist + # ── Export folder (optionally tagged with the active tab name) ── def _active_tab_name(self) -> str: """Sanitized name of the active tab, or "" for default 'List N' tabs.""" @@ -4941,7 +4953,9 @@ class MainWindow(QMainWindow): "Video files (*.mp4 *.mkv *.avi *.mov *.webm *.flv *.wmv *.ts);;All files (*)", ) if paths: - self._playlist.add_files(paths) + target = self._add_target_playlist() + self._active_pw = target + target.add_files(paths) self._apply_playlist_filters() self._save_playlist_tabs() @@ -7227,7 +7241,9 @@ class MainWindow(QMainWindow): if os.path.isfile(u.toLocalFile()) ] if paths: - self._playlist.add_files(paths) + target = self._add_target_playlist() + self._active_pw = target + target.add_files(paths) self._apply_playlist_filters() self._save_playlist_tabs()