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 <noreply@anthropic.com>
This commit is contained in:
2026-06-06 17:04:31 +02:00
parent 73dfea4ae9
commit dbd8e6a8ac
+18 -2
View File
@@ -4464,6 +4464,18 @@ class MainWindow(QMainWindow):
return w return w
return self._pws[0] if self._pws else None 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) ── # ── Export folder (optionally tagged with the active tab name) ──
def _active_tab_name(self) -> str: def _active_tab_name(self) -> str:
"""Sanitized name of the active tab, or "" for default 'List N' tabs.""" """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 (*)", "Video files (*.mp4 *.mkv *.avi *.mov *.webm *.flv *.wmv *.ts);;All files (*)",
) )
if paths: 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._apply_playlist_filters()
self._save_playlist_tabs() self._save_playlist_tabs()
@@ -7227,7 +7241,9 @@ class MainWindow(QMainWindow):
if os.path.isfile(u.toLocalFile()) if os.path.isfile(u.toLocalFile())
] ]
if paths: 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._apply_playlist_filters()
self._save_playlist_tabs() self._save_playlist_tabs()