Skip to content

Commit b22867c

Browse files
committed
Decongest UI tabs with action picker, sub-tabs, and spacing
1 parent c459f80 commit b22867c

File tree

8 files changed

+197
-76
lines changed

8 files changed

+197
-76
lines changed

automation_file/ui/tabs/base.py

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
QHBoxLayout,
1717
QLineEdit,
1818
QPushButton,
19+
QTabWidget,
1920
QVBoxLayout,
2021
QWidget,
2122
)
@@ -92,20 +93,35 @@ class RemoteBackendTab(BaseTab):
9293
"""Shared layout template for cloud/SFTP tabs.
9394
9495
Subclasses supply ``_init_group`` (credentials / session setup) and
95-
``_ops_group`` (file transfer actions). The base class stacks both
96-
inside a ``QVBoxLayout`` with a trailing stretch so the groups pin
97-
to the top of the tab.
96+
``_ops_group`` (file transfer actions). The base class places each
97+
group on its own inner sub-tab ("Credentials" / "Operations") so
98+
the two concerns aren't crammed together on a single vertical page.
9899
"""
99100

100101
def __init__(self, log: LogPanel, pool: QThreadPool) -> None:
101102
super().__init__(log, pool)
102103
root = QVBoxLayout(self)
103-
root.addWidget(self._init_group())
104-
root.addWidget(self._ops_group())
105-
root.addStretch()
104+
root.setContentsMargins(12, 12, 12, 12)
105+
root.setSpacing(12)
106+
107+
inner = QTabWidget()
108+
inner.addTab(self._page(self._init_group()), "Credentials")
109+
inner.addTab(self._page(self._ops_group()), "Operations")
110+
root.addWidget(inner)
106111

107112
def _init_group(self) -> QGroupBox:
108113
raise NotImplementedError
109114

110115
def _ops_group(self) -> QGroupBox:
111116
raise NotImplementedError
117+
118+
@staticmethod
119+
def _page(group: QGroupBox) -> QWidget:
120+
"""Wrap a group box in a padded page so the sub-tab has breathing room."""
121+
page = QWidget()
122+
layout = QVBoxLayout(page)
123+
layout.setContentsMargins(12, 12, 12, 12)
124+
layout.setSpacing(12)
125+
layout.addWidget(group)
126+
layout.addStretch()
127+
return page

automation_file/ui/tabs/drive_tab.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,19 @@
77
QGroupBox,
88
QLineEdit,
99
QPushButton,
10-
QVBoxLayout,
1110
)
1211

1312
from automation_file.remote.google_drive.client import driver_instance
1413
from automation_file.remote.google_drive.delete_ops import drive_delete_file
1514
from automation_file.remote.google_drive.download_ops import drive_download_file
1615
from automation_file.remote.google_drive.search_ops import drive_search_all_file
1716
from automation_file.remote.google_drive.upload_ops import drive_upload_to_drive
18-
from automation_file.ui.tabs.base import BaseTab
17+
from automation_file.ui.tabs.base import RemoteBackendTab
1918

2019

21-
class GoogleDriveTab(BaseTab):
20+
class GoogleDriveTab(RemoteBackendTab):
2221
"""Initialise Drive credentials and dispatch a subset of FA_drive_* ops."""
2322

24-
def __init__(self, log, pool) -> None:
25-
super().__init__(log, pool)
26-
root = QVBoxLayout(self)
27-
root.addWidget(self._init_group())
28-
root.addWidget(self._ops_group())
29-
root.addStretch()
30-
3123
def _init_group(self) -> QGroupBox:
3224
box = QGroupBox("Credentials")
3325
form = QFormLayout(box)

automation_file/ui/tabs/home_tab.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,11 @@ def __init__(self, log: LogPanel, pool: QThreadPool) -> None:
4949
self._status_labels: dict[str, QLabel] = {}
5050

5151
root = QVBoxLayout(self)
52+
root.setContentsMargins(12, 12, 12, 12)
53+
root.setSpacing(12)
5254
root.addWidget(self._overview_group())
5355
row = QHBoxLayout()
56+
row.setSpacing(12)
5457
row.addWidget(self._status_group(), 1)
5558
row.addWidget(self._actions_group(), 1)
5659
root.addLayout(row)

automation_file/ui/tabs/http_tab.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@ class HTTPDownloadTab(BaseTab):
1414
def __init__(self, log, pool) -> None:
1515
super().__init__(log, pool)
1616
root = QVBoxLayout(self)
17+
root.setContentsMargins(12, 12, 12, 12)
18+
root.setSpacing(12)
1719
form = QFormLayout()
20+
form.setVerticalSpacing(10)
21+
form.setHorizontalSpacing(12)
1822
self._url = QLineEdit()
1923
self._url.setPlaceholderText("https://example.com/file.bin")
2024
self._dest = QLineEdit()

automation_file/ui/tabs/json_editor_tab.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,8 @@ def __init__(self, log, pool) -> None:
264264
splitter.setStretchFactor(1, 2)
265265

266266
root = QVBoxLayout(self)
267+
root.setContentsMargins(12, 12, 12, 12)
268+
root.setSpacing(12)
267269
root.addWidget(self._build_toolbar())
268270
root.addWidget(splitter)
269271
root.addWidget(self._build_run_bar())

0 commit comments

Comments
 (0)