From e2d94546bd773f350f884c12dafb767d78ab1904 Mon Sep 17 00:00:00 2001 From: shuki Date: Sat, 7 Mar 2026 07:05:10 +0200 Subject: [PATCH] Put back button and title on the same line MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Wrap ← Back button and screen title in a Horizontal title-bar container across all screens. Co-Authored-By: Claude Opus 4.6 --- tui/gniza.tcss | 8 +++++++- tui/screens/backup.py | 5 +++-- tui/screens/logs.py | 5 +++-- tui/screens/remotes.py | 5 +++-- tui/screens/restore.py | 5 +++-- tui/screens/retention.py | 5 +++-- tui/screens/running_tasks.py | 5 +++-- tui/screens/schedule.py | 5 +++-- tui/screens/settings.py | 5 +++-- tui/screens/snapshots.py | 5 +++-- tui/screens/targets.py | 5 +++-- 11 files changed, 37 insertions(+), 21 deletions(-) diff --git a/tui/gniza.tcss b/tui/gniza.tcss index a527b26..9240dd5 100644 --- a/tui/gniza.tcss +++ b/tui/gniza.tcss @@ -8,7 +8,8 @@ Screen { text-style: bold; color: #00cc00; padding: 1 0; - text-align: center; + width: 1fr; + content-align: center middle; } /* Main menu */ @@ -175,6 +176,11 @@ SelectionList { margin: 0 0 0 0; } +#title-bar { + height: auto; + align: left middle; +} + /* Button rows */ #backup-buttons, #restore-buttons, diff --git a/tui/screens/backup.py b/tui/screens/backup.py index f7468f7..f04e65c 100644 --- a/tui/screens/backup.py +++ b/tui/screens/backup.py @@ -18,8 +18,9 @@ class BackupScreen(Screen): remotes = list_conf_dir("remotes.d") with Horizontal(classes="screen-with-docs"): with Vertical(id="backup-screen"): - yield Button("← Back", id="btn-back", classes="back-btn") - yield Static("Backup", id="screen-title") + with Horizontal(id="title-bar"): + yield Button("← Back", id="btn-back", classes="back-btn") + yield Static("Backup", id="screen-title") if not targets: yield Static("No sources configured. Add a source first.") else: diff --git a/tui/screens/logs.py b/tui/screens/logs.py index 3711715..eadabcb 100644 --- a/tui/screens/logs.py +++ b/tui/screens/logs.py @@ -90,8 +90,9 @@ class LogsScreen(Screen): yield Header(show_clock=True) with Horizontal(classes="screen-with-docs"): with Vertical(id="logs-screen"): - yield Button("← Back", id="btn-back", classes="back-btn") - yield Static("Logs", id="screen-title") + with Horizontal(id="title-bar"): + yield Button("← Back", id="btn-back", classes="back-btn") + yield Static("Logs", id="screen-title") yield DataTable(id="logs-table") with Horizontal(id="logs-buttons"): yield Button("View", variant="primary", id="btn-view") diff --git a/tui/screens/remotes.py b/tui/screens/remotes.py index 9eeb610..978f64d 100644 --- a/tui/screens/remotes.py +++ b/tui/screens/remotes.py @@ -18,8 +18,9 @@ class RemotesScreen(Screen): yield Header(show_clock=True) with Horizontal(classes="screen-with-docs"): with Vertical(id="remotes-screen"): - yield Button("← Back", id="btn-back", classes="back-btn") - yield Static("Destinations", id="screen-title") + with Horizontal(id="title-bar"): + yield Button("← Back", id="btn-back", classes="back-btn") + yield Static("Destinations", id="screen-title") yield DataTable(id="remotes-table") with Horizontal(id="remotes-buttons"): yield Button("Add", variant="primary", id="btn-add") diff --git a/tui/screens/restore.py b/tui/screens/restore.py index 67c449b..14c3e64 100644 --- a/tui/screens/restore.py +++ b/tui/screens/restore.py @@ -21,8 +21,9 @@ class RestoreScreen(Screen): remotes = list_conf_dir("remotes.d") with Horizontal(classes="screen-with-docs"): with Vertical(id="restore-screen"): - yield Button("← Back", id="btn-back", classes="back-btn") - yield Static("Restore", id="screen-title") + with Horizontal(id="title-bar"): + yield Button("← Back", id="btn-back", classes="back-btn") + yield Static("Restore", id="screen-title") if not targets or not remotes: yield Static("Both sources and destinations must be configured for restore.") else: diff --git a/tui/screens/retention.py b/tui/screens/retention.py index e14f530..26862c7 100644 --- a/tui/screens/retention.py +++ b/tui/screens/retention.py @@ -21,8 +21,9 @@ class RetentionScreen(Screen): current_count = conf.get("RETENTION_COUNT", "30") with Horizontal(classes="screen-with-docs"): with Vertical(id="retention-screen"): - yield Button("← Back", id="btn-back", classes="back-btn") - yield Static("Retention Cleanup", id="screen-title") + with Horizontal(id="title-bar"): + yield Button("← Back", id="btn-back", classes="back-btn") + yield Static("Retention Cleanup", id="screen-title") if not targets: yield Static("No sources configured.") else: diff --git a/tui/screens/running_tasks.py b/tui/screens/running_tasks.py index 01c9c57..fb3c3a1 100644 --- a/tui/screens/running_tasks.py +++ b/tui/screens/running_tasks.py @@ -34,8 +34,9 @@ class RunningTasksScreen(Screen): yield Header(show_clock=True) with Horizontal(classes="screen-with-docs"): with Vertical(id="running-tasks-screen"): - yield Button("← Back", id="btn-back", classes="back-btn") - yield Static("Running Tasks", id="screen-title") + with Horizontal(id="title-bar"): + yield Button("← Back", id="btn-back", classes="back-btn") + yield Static("Running Tasks", id="screen-title") yield DataTable(id="rt-table") with Horizontal(id="rt-buttons"): yield Button("View Log", variant="primary", id="btn-rt-view") diff --git a/tui/screens/schedule.py b/tui/screens/schedule.py index f2c5c81..75a3c40 100644 --- a/tui/screens/schedule.py +++ b/tui/screens/schedule.py @@ -21,8 +21,9 @@ class ScheduleScreen(Screen): yield Header(show_clock=True) with Horizontal(classes="screen-with-docs"): with Vertical(id="schedule-screen"): - yield Button("← Back", id="btn-back", classes="back-btn") - yield Static("Schedules", id="screen-title") + with Horizontal(id="title-bar"): + yield Button("← Back", id="btn-back", classes="back-btn") + yield Static("Schedules", id="screen-title") yield DataTable(id="sched-table") with Horizontal(id="sched-buttons"): yield Button("Add", variant="primary", id="btn-add") diff --git a/tui/screens/settings.py b/tui/screens/settings.py index 3b46d3b..a1a024d 100644 --- a/tui/screens/settings.py +++ b/tui/screens/settings.py @@ -21,8 +21,9 @@ class SettingsScreen(Screen): settings = AppSettings.from_conf(conf) with Horizontal(classes="screen-with-docs"): with Vertical(id="settings-screen"): - yield Button("← Back", id="btn-back", classes="back-btn") - yield Static("Settings", id="screen-title") + with Horizontal(id="title-bar"): + yield Button("← Back", id="btn-back", classes="back-btn") + yield Static("Settings", id="screen-title") with Vertical(classes="settings-section", id="section-general"): yield Static("Log Level:") yield Select( diff --git a/tui/screens/snapshots.py b/tui/screens/snapshots.py index 717fea4..7037d9f 100644 --- a/tui/screens/snapshots.py +++ b/tui/screens/snapshots.py @@ -32,8 +32,9 @@ class SnapshotsScreen(Screen): remotes = list_conf_dir("remotes.d") with Horizontal(classes="screen-with-docs"): with Vertical(id="snapshots-screen"): - yield Button("← Back", id="btn-back", classes="back-btn") - yield Static("Snapshots Browser", id="screen-title") + with Horizontal(id="title-bar"): + yield Button("← Back", id="btn-back", classes="back-btn") + yield Static("Snapshots Browser", id="screen-title") if not targets or not remotes: yield Static("Sources and destinations must be configured to browse snapshots.") else: diff --git a/tui/screens/targets.py b/tui/screens/targets.py index 2d003da..4ad0dd6 100644 --- a/tui/screens/targets.py +++ b/tui/screens/targets.py @@ -16,8 +16,9 @@ class TargetsScreen(Screen): yield Header(show_clock=True) with Horizontal(classes="screen-with-docs"): with Vertical(id="targets-screen"): - yield Button("← Back", id="btn-back", classes="back-btn") - yield Static("Sources", id="screen-title") + with Horizontal(id="title-bar"): + yield Button("← Back", id="btn-back", classes="back-btn") + yield Static("Sources", id="screen-title") yield DataTable(id="targets-table") with Horizontal(id="targets-buttons"): yield Button("Add", variant="primary", id="btn-add")