minor UI improvements

This commit is contained in:
rambros 2026-03-08 01:58:32 +05:30
parent a32334eaa3
commit 104a284f88
3 changed files with 17 additions and 15 deletions

View file

@ -50,7 +50,7 @@ class MigrationContext:
self.is_running = False
def _find_backup_path(self, server_id: str, base_dir_str: str) -> Path:
"""Searches workspace for a DISCORD_BACKUP-{server_id} directory. Creates it if missing."""
"""Searches workspace for a DISCORD_BACKUP-{server_id} directory. Returns the path (does not create)."""
base_dir = Path(base_dir_str) if base_dir_str else Path(".")
# 1. Search inside the specific workspace directory first
@ -66,11 +66,9 @@ class MigrationContext:
logger.info(f"Found backup directory globally: {d}")
return d
# If not found anywhere, create it inside the workspace
base_dir.mkdir(exist_ok=True)
# If not found anywhere, return the expected location inside the workspace
new_path = base_dir / f"DISCORD_BACKUP-{server_id}"
logger.info(f"No existing backup directory found for {server_id}. Creating new one: {new_path}")
new_path.mkdir(exist_ok=True)
logger.info(f"Using lazy backup path: {new_path}")
return new_path
async def validate_all(self) -> Dict[str, Any]:

View file

@ -112,7 +112,7 @@ class ConfigSelectionScreen(Screen):
lv = self.query_one("#config_list", ListView)
lv.clear()
for c in configs:
lv.append(ListItem(Label(f"ReaperFiles-{c}"), name=c))
lv.append(ListItem(Label(c), name=c))
def on_list_view_selected(self, event: ListView.Selected) -> None:
cfg_name = event.item.name

View file

@ -9,7 +9,7 @@ Shows the appropriate pane(s) based on the mode:
from pathlib import Path
from textual.app import ComposeResult
from textual.containers import Container, Horizontal, VerticalScroll
from textual.containers import Container, Vertical, Horizontal, VerticalScroll
from textual.widgets import Header, Footer, Button, ContentSwitcher, Rule
from textual.screen import Screen
@ -35,12 +35,15 @@ class ModeScreen(Screen):
padding: 1 2;
margin: 2 0;
}
#switcher {
#switcher, #pane_backup, #pane_migrate {
height: 1fr;
}
#mode_footer {
height: auto;
dock: bottom;
}
#bottom_actions {
height: auto;
dock: bottom;
margin: 1 1 0 1;
}
#bottom_actions Button, #btn_switch {
@ -126,12 +129,13 @@ class ModeScreen(Screen):
yield BackupPane(self.cfg_name, self.config_path, id="pane_backup")
yield ShuttlePane(self.cfg_name, self.config_path, id="pane_migrate")
yield Rule()
with Horizontal(id="bottom_actions"):
if mode == "backup_transfer":
yield Button("Switch to Migrate ⇄", id="btn_switch", variant="primary", tooltip="Switch between\nBackup & Migrate operations")
yield Button("Configuration", id="btn_config", variant="success", tooltip="Change Bot tokens\nand Reaper Mode")
yield Button("Exit", id="btn_exit", variant="error")
with Vertical(id="mode_footer"):
yield Rule()
with Horizontal(id="bottom_actions"):
if mode == "backup_transfer":
yield Button("Switch to Migrate ⇄", id="btn_switch", variant="primary", tooltip="Switch between\nBackup & Migrate operations")
yield Button("Configuration", id="btn_config", variant="success", tooltip="Change Bot tokens\nand Reaper Mode")
yield Button("Exit", id="btn_exit", variant="error")
yield Footer()