Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create app: display input textbox with equally spaced grid #3038

Merged
merged 4 commits into from
Jul 3, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
- Update pre-commit hook astral-sh/ruff-pre-commit to v0.4.10 ([#3031](https://github.com/nf-core/tools/pull/3031))
- Add warning deprecation message to top-level commands ([#3036](https://github.com/nf-core/tools/pull/3036))
- Create: Mock git cretentials to generate stable textual snapshots ([#3007](https://github.com/nf-core/tools/pull/3007))
- Create app: display input textbox with equally spaced grid ([#3038](https://github.com/nf-core/tools/pull/3038))

## [v2.14.1 - Tantalum Toad - Patch](https://github.com/nf-core/tools/releases/tag/2.14.1) - [2024-05-09]

Expand Down
6 changes: 6 additions & 0 deletions nf_core/pipelines/create/create.tcss
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@
width: auto;
}

.text-input-grid {
padding: 1 1 1 1;
grid-size: 1 3;
grid-rows: 3 3 auto;
height: auto;
}
.field_help {
padding: 1 1 0 1;
color: $text-muted;
Expand Down
19 changes: 11 additions & 8 deletions nf_core/pipelines/create/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from textual import on
from textual._context import active_app
from textual.app import ComposeResult
from textual.containers import HorizontalScroll
from textual.containers import Grid, HorizontalScroll
from textual.message import Message
from textual.validation import ValidationResult, Validator
from textual.widget import Widget
Expand Down Expand Up @@ -116,14 +116,17 @@ def __init__(self, field_id, placeholder, description, default=None, password=No
self.password: bool = password

def compose(self) -> ComposeResult:
yield Static(self.description, classes="field_help")
yield Input(
placeholder=self.placeholder,
validators=[ValidateConfig(self.field_id)],
value=self.default,
password=self.password,
yield Grid(
Static(self.description, classes="field_help"),
Input(
placeholder=self.placeholder,
validators=[ValidateConfig(self.field_id)],
value=self.default,
password=self.password,
),
Static(classes="validation_msg"),
classes="text-input-grid",
)
yield Static(classes="validation_msg")

@on(Input.Changed)
@on(Input.Submitted)
Expand Down
Loading
Loading