mirror of
https://github.com/1j01/textual-paint.git
synced 2024-12-01 00:10:06 +03:00
Add label for filename input, instead of using placeholder text
This commit is contained in:
parent
1a28f5cb49
commit
e7b251a1c3
@ -2,7 +2,8 @@ import os
|
||||
from typing import Any, Callable
|
||||
from textual.containers import Container
|
||||
from textual.widget import Widget
|
||||
from textual.widgets import Button, Input, Tree
|
||||
from textual.widgets import Button, Input, Tree, Label
|
||||
from textual.containers import Horizontal
|
||||
from textual.widgets._directory_tree import DirEntry
|
||||
from textual.containers import Container
|
||||
from localization.i18n import get as _
|
||||
@ -92,7 +93,10 @@ class OpenDialogWindow(FileDialogWindow):
|
||||
"""Called when the window is mounted."""
|
||||
self.content.mount(
|
||||
EnhancedDirectoryTree(path="/"),
|
||||
Input(classes="filename_input", placeholder=_("Filename")),
|
||||
Horizontal(
|
||||
Label(_("File name:")),
|
||||
Input(classes="filename_input"),
|
||||
),
|
||||
Container(
|
||||
Button(_("Open"), classes="open submit", variant="primary"),
|
||||
Button(_("Cancel"), classes="cancel"),
|
||||
@ -139,7 +143,10 @@ class SaveAsDialogWindow(FileDialogWindow):
|
||||
"""Called when the window is mounted."""
|
||||
self.content.mount(
|
||||
EnhancedDirectoryTree(path="/"),
|
||||
Input(classes="filename_input", placeholder=_("Filename"), value=self._starting_file_name),
|
||||
Horizontal(
|
||||
Label(_("File name:")),
|
||||
Input(classes="filename_input", value=self._starting_file_name),
|
||||
),
|
||||
Container(
|
||||
Button(_("Save"), classes="save submit", variant="primary"),
|
||||
Button(_("Cancel"), classes="cancel"),
|
||||
|
@ -205,9 +205,14 @@ FileDialogWindow .window_content {
|
||||
height: 30;
|
||||
}
|
||||
FileDialogWindow .window_content Input {
|
||||
width: 100%;
|
||||
width: 1fr;
|
||||
margin-bottom: 1;
|
||||
}
|
||||
FileDialogWindow .window_content Label {
|
||||
height: 1fr;
|
||||
content-align-vertical: middle;
|
||||
min-width: 12;
|
||||
}
|
||||
FileDialogWindow .window_content DirectoryTree {
|
||||
height: 15;
|
||||
margin-bottom: 1;
|
||||
@ -320,6 +325,7 @@ DialogWindow .buttons Button {
|
||||
#attributes_dialog .window_content Horizontal Static {
|
||||
width: 10;
|
||||
height: 3; /* matching Input height; 1fr or auto didn't work */
|
||||
/* TODO: what's different between this and the FileDialogWindow, where 1fr works? */
|
||||
content-align-vertical: middle;
|
||||
}
|
||||
#attributes_dialog Input {
|
||||
|
Loading…
Reference in New Issue
Block a user