Skip to content

Commit e0db599

Browse files
committed
Collapse remote backend tabs into a single Transfer tab
The six remote backend tabs (HTTP, Google Drive, S3, Azure Blob, Dropbox, SFTP) now live behind a shared sidebar inside a new Transfer tab. The outer tab bar shrinks from nine entries to four — Local, Transfer, JSON actions, Servers — while the existing per-backend widgets are reused unchanged so feature parity holds.
1 parent bf8ac47 commit e0db599

5 files changed

Lines changed: 89 additions & 12 deletions

File tree

automation_file/ui/main_window.py

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,10 @@
88
from automation_file.logging_config import file_automation_logger
99
from automation_file.ui.log_widget import LogPanel
1010
from automation_file.ui.tabs import (
11-
AzureBlobTab,
12-
DropboxTab,
13-
GoogleDriveTab,
14-
HTTPDownloadTab,
1511
JSONEditorTab,
1612
LocalOpsTab,
17-
S3Tab,
1813
ServerTab,
19-
SFTPTab,
14+
TransferTab,
2015
)
2116

2217
_WINDOW_TITLE = "automation_file"
@@ -36,12 +31,7 @@ def __init__(self) -> None:
3631

3732
tabs = QTabWidget()
3833
tabs.addTab(LocalOpsTab(self._log, self._pool), "Local")
39-
tabs.addTab(HTTPDownloadTab(self._log, self._pool), "HTTP")
40-
tabs.addTab(GoogleDriveTab(self._log, self._pool), "Google Drive")
41-
tabs.addTab(S3Tab(self._log, self._pool), "S3")
42-
tabs.addTab(AzureBlobTab(self._log, self._pool), "Azure Blob")
43-
tabs.addTab(DropboxTab(self._log, self._pool), "Dropbox")
44-
tabs.addTab(SFTPTab(self._log, self._pool), "SFTP")
34+
tabs.addTab(TransferTab(self._log, self._pool), "Transfer")
4535
tabs.addTab(JSONEditorTab(self._log, self._pool), "JSON actions")
4636
self._server_tab = ServerTab(self._log, self._pool)
4737
tabs.addTab(self._server_tab, "Servers")

automation_file/ui/tabs/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
from automation_file.ui.tabs.s3_tab import S3Tab
1212
from automation_file.ui.tabs.server_tab import ServerTab
1313
from automation_file.ui.tabs.sftp_tab import SFTPTab
14+
from automation_file.ui.tabs.transfer_tab import TransferTab
1415

1516
__all__ = [
1617
"AzureBlobTab",
@@ -22,4 +23,5 @@
2223
"S3Tab",
2324
"SFTPTab",
2425
"ServerTab",
26+
"TransferTab",
2527
]
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
"""Unified transfer tab — sidebar of remote backends over one stack.
2+
3+
Collapses the six remote-backend tabs (HTTP, Google Drive, S3, Azure
4+
Blob, Dropbox, SFTP) into a single tab with a sidebar picker. The
5+
existing per-backend widgets are reused verbatim as the stack pages
6+
so feature parity is preserved.
7+
"""
8+
9+
from __future__ import annotations
10+
11+
from typing import NamedTuple
12+
13+
from PySide6.QtCore import QThreadPool
14+
from PySide6.QtWidgets import (
15+
QHBoxLayout,
16+
QListWidget,
17+
QListWidgetItem,
18+
QStackedWidget,
19+
QWidget,
20+
)
21+
22+
from automation_file.ui.log_widget import LogPanel
23+
from automation_file.ui.tabs.azure_tab import AzureBlobTab
24+
from automation_file.ui.tabs.base import BaseTab
25+
from automation_file.ui.tabs.drive_tab import GoogleDriveTab
26+
from automation_file.ui.tabs.dropbox_tab import DropboxTab
27+
from automation_file.ui.tabs.http_tab import HTTPDownloadTab
28+
from automation_file.ui.tabs.s3_tab import S3Tab
29+
from automation_file.ui.tabs.sftp_tab import SFTPTab
30+
31+
32+
class _BackendEntry(NamedTuple):
33+
label: str
34+
factory: type[BaseTab]
35+
36+
37+
_BACKENDS: tuple[_BackendEntry, ...] = (
38+
_BackendEntry("HTTP download", HTTPDownloadTab),
39+
_BackendEntry("Google Drive", GoogleDriveTab),
40+
_BackendEntry("Amazon S3", S3Tab),
41+
_BackendEntry("Azure Blob", AzureBlobTab),
42+
_BackendEntry("Dropbox", DropboxTab),
43+
_BackendEntry("SFTP", SFTPTab),
44+
)
45+
46+
47+
class TransferTab(BaseTab):
48+
"""Sidebar-selectable container for every remote backend."""
49+
50+
def __init__(self, log: LogPanel, pool: QThreadPool) -> None:
51+
super().__init__(log, pool)
52+
self._sidebar = QListWidget()
53+
self._sidebar.setFixedWidth(180)
54+
self._stack = QStackedWidget()
55+
for entry in _BACKENDS:
56+
self._sidebar.addItem(QListWidgetItem(entry.label))
57+
self._stack.addWidget(entry.factory(log, pool))
58+
self._sidebar.currentRowChanged.connect(self._stack.setCurrentIndex)
59+
self._sidebar.setCurrentRow(0)
60+
61+
root = QHBoxLayout(self)
62+
root.setContentsMargins(0, 0, 0, 0)
63+
root.addWidget(self._sidebar)
64+
root.addWidget(self._stack, 1)
65+
66+
def current_backend(self) -> str:
67+
row = self._sidebar.currentRow()
68+
return _BACKENDS[row].label if 0 <= row < len(_BACKENDS) else ""
69+
70+
def select_backend(self, label: str) -> bool:
71+
for index, entry in enumerate(_BACKENDS):
72+
if entry.label == label:
73+
self._sidebar.setCurrentRow(index)
74+
return True
75+
return False
76+
77+
def inner_widget(self, label: str) -> QWidget | None:
78+
for index, entry in enumerate(_BACKENDS):
79+
if entry.label == label:
80+
return self._stack.widget(index)
81+
return None

docs/source/api/ui.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ Tabs
5959
.. automodule:: automation_file.ui.tabs.sftp_tab
6060
:members:
6161

62+
.. automodule:: automation_file.ui.tabs.transfer_tab
63+
:members:
64+
6265
.. automodule:: automation_file.ui.tabs.json_editor_tab
6366
:members:
6467

tests/test_ui_smoke.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ def test_main_window_constructs(qt_app) -> None:
5353
"SFTPTab",
5454
"JSONEditorTab",
5555
"ServerTab",
56+
"TransferTab",
5657
],
5758
)
5859
def test_each_tab_constructs(qt_app, tab_name: str) -> None:

0 commit comments

Comments
 (0)