tmp: перекрывающее окно textual при backup
This commit is contained in:
parent
3d930836f5
commit
505c5f3421
@ -3,10 +3,13 @@
|
||||
|
||||
import logging
|
||||
from logging.handlers import MemoryHandler
|
||||
from typing import Dict, Any, Optional
|
||||
from typing import Dict, Any, Optional, List, Tuple
|
||||
from textual.app import App, ComposeResult
|
||||
from textual.containers import Vertical, Horizontal
|
||||
from textual.widgets import Button, Header, Footer, Static, Log
|
||||
from textual.containers import Vertical, Horizontal, Container
|
||||
from textual.css.query import DOMQuery
|
||||
from textual.reactive import reactive
|
||||
from textual.screen import Screen
|
||||
from textual.widgets import Button, Header, Footer, Static, Log, Label, ListView, ListItem, OptionList
|
||||
|
||||
# --- Настройки и инициирование логирования модуля ---
|
||||
logger = logging.getLogger(__name__)
|
||||
@ -44,6 +47,24 @@ class MainMenu(Static):
|
||||
id="menu",
|
||||
)
|
||||
|
||||
# Новый простой экран для Backup
|
||||
class SimpleBackupScreen(Screen):
|
||||
"""
|
||||
Простой экран для демонстрации перехода при выборе Backup.
|
||||
"""
|
||||
|
||||
BINDINGS = [
|
||||
("escape", "pop_screen", "Назад"), # Позволяет вернуться на главный экран по Escape
|
||||
]
|
||||
|
||||
def compose(self) -> ComposeResult:
|
||||
yield Header(name="Экран Бэкапа") # Заголовок для нового экрана
|
||||
yield Label("Привет, мир! Это экран для бэкапа.", classes="greeting-label")
|
||||
yield Footer()
|
||||
|
||||
def on_mount(self) -> None:
|
||||
logger.info(f"Экран '{self.id}' (SimpleBackupScreen) смонтирован.")
|
||||
|
||||
class PGanecApp(App):
|
||||
CSS = """
|
||||
Screen {
|
||||
@ -65,9 +86,9 @@ class PGanecApp(App):
|
||||
margin: 0; padding: 0;
|
||||
}
|
||||
|
||||
Button#backup, Button#restore { color: orange; border: round orange; }
|
||||
Button#backup, Button#restore, Button#quit { color: orange; border: round orange; }
|
||||
|
||||
Button#copy, Button#quit { color: grey; border: round orange; }
|
||||
Button#copy { color: grey; border: round orange; }
|
||||
|
||||
Button:focus { border: heavy green; }
|
||||
|
||||
@ -79,6 +100,15 @@ class PGanecApp(App):
|
||||
background: 15%;
|
||||
}
|
||||
Log#app_log_viewer:focus { height: 50%; border-top: solid green; background: 45%; }
|
||||
|
||||
/* Стили для нового экрана */
|
||||
SimpleBackupScreen .greeting-label {
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
padding: 2 0; /* Немного отступов сверху и снизу */
|
||||
text-style: bold;
|
||||
}
|
||||
|
||||
Footer { dock: bottom; height: 1; }
|
||||
Header { dock: top; height: 1; }
|
||||
|
||||
@ -91,7 +121,7 @@ class PGanecApp(App):
|
||||
("q", "quit", "Quit"),
|
||||
("right", "focus_next"), ("down", "focus_next"), # Стрелочки для навигации (вниз/вправо -- вперед)
|
||||
("left", "focus_previous"), ("up", "focus_previous"), # Стрелочки для навигации (вверх/влево -- назад)
|
||||
("enter", "activate", "Activate"),
|
||||
("enter", "activate"),
|
||||
]
|
||||
|
||||
def __init__(self,
|
||||
@ -124,10 +154,12 @@ class PGanecApp(App):
|
||||
async def on_button_pressed(self, event: Button.Pressed) -> None:
|
||||
button_id = event.button.id
|
||||
if button_id == "backup":
|
||||
await self.push_screen(BackupScreen()) # пока заглушка
|
||||
await self.push_screen(SimpleBackupScreen())
|
||||
elif button_id == "restore":
|
||||
await self.push_screen(RestoreScreen()) # пока заглушка
|
||||
logger.info("Действие 'Restore' пока не реализовано с новым экраном.")
|
||||
self.app.bell() # Сигнал, что действие не выполнено
|
||||
elif button_id == "copy":
|
||||
logger.warning("Copy action is currently a placeholder for quit.")
|
||||
await self.action_quit()
|
||||
elif button_id == "quit":
|
||||
await self.action_quit()
|
||||
@ -168,8 +200,8 @@ class PGanecApp(App):
|
||||
self.early_log_handler = None # Очищаем ссылку
|
||||
# --- Конец переноса и сброса ---
|
||||
|
||||
logger.debug("TUI: DEBUG сообщение для проверки")
|
||||
logger.info("TUI-логгер инициализирован")
|
||||
logger.debug("TUI: DEBUG сообщение для проверки")
|
||||
logger.warning("TUI: WARNING для проверки")
|
||||
logger.error("TUI: ERROR тоже для проверки")
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user