Skip to content

Commit

Permalink
Merge pull request #3038 from mirpedrol/format-create-grid
Browse files Browse the repository at this point in the history
Create app: display input textbox with equally spaced grid
  • Loading branch information
mirpedrol authored Jul 3, 2024
2 parents 9f0d251 + 53d334a commit 1af6cd9
Show file tree
Hide file tree
Showing 4 changed files with 651 additions and 641 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,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))
- Update python:3.12-slim Docker digest to da2d7af ([#3041](https://github.com/nf-core/tools/pull/3041))

## [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

0 comments on commit 1af6cd9

Please sign in to comment.