|
16 | 16 | QHBoxLayout, |
17 | 17 | QLineEdit, |
18 | 18 | QPushButton, |
| 19 | + QTabWidget, |
19 | 20 | QVBoxLayout, |
20 | 21 | QWidget, |
21 | 22 | ) |
@@ -92,20 +93,35 @@ class RemoteBackendTab(BaseTab): |
92 | 93 | """Shared layout template for cloud/SFTP tabs. |
93 | 94 |
|
94 | 95 | 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. |
98 | 99 | """ |
99 | 100 |
|
100 | 101 | def __init__(self, log: LogPanel, pool: QThreadPool) -> None: |
101 | 102 | super().__init__(log, pool) |
102 | 103 | 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) |
106 | 111 |
|
107 | 112 | def _init_group(self) -> QGroupBox: |
108 | 113 | raise NotImplementedError |
109 | 114 |
|
110 | 115 | def _ops_group(self) -> QGroupBox: |
111 | 116 | 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 |
0 commit comments