Skip to content

Commit 211d517

Browse files
feat: add labels to all the inputs fields (#53)
* feat: add labels to all the inputs fields * feat: add labels to all the inputs fields * bump version to 0.2.10 --------- Co-authored-by: Jean-Pierre Chauvel <jean.p.chauvel@gmail.com>
1 parent 44c0c48 commit 211d517

File tree

3 files changed

+54
-6
lines changed

3 files changed

+54
-6
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "edit-python-pe"
3-
version = "0.2.9"
3+
version = "0.2.10"
44
description = "Allows member and project profile editing onto python.pe git repository"
55
readme = "README.md"
66
authors = [

src/edit_python_pe/main.py

Lines changed: 52 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,46 @@
2424
load_file_into_form)
2525

2626

27+
class LabeledInput(Vertical):
28+
29+
DEFAULT_CSS = """
30+
LabeledInput {
31+
height: auto;
32+
33+
}
34+
LabeledInput Static {
35+
width: 25%;
36+
37+
}
38+
LabeledInput Input {
39+
width: 100%;
40+
}
41+
"""
42+
43+
def __init__(
44+
self, label: str, placeholder: str = "", value: str = "", **kwargs
45+
):
46+
super().__init__(**kwargs)
47+
self.label = label
48+
self.placeholder = placeholder
49+
self._value = value
50+
51+
def compose(self) -> ComposeResult:
52+
yield Static(self.label, classes="label")
53+
yield Input(
54+
id="input", placeholder=self.placeholder, value=self._value
55+
)
56+
57+
@property
58+
def value(self):
59+
return self._value
60+
61+
@value.setter
62+
def value(self, v: str):
63+
self._value = v
64+
self.query_one(selector="#input").value = v
65+
66+
2767
class SocialEntry(Horizontal):
2868
DEFAULT_CSS = """
2969
SocialEntry Select {
@@ -129,10 +169,18 @@ def on_mount(self) -> None:
129169

130170
# 2) Build the form portion, hidden at first
131171
self.form_header = Static(FORM_HEADER, classes="header")
132-
self.name_input = Input(placeholder=PLACEHOLDER_NAME)
133-
self.email_input = Input(placeholder=PLACEHOLDER_EMAIL)
134-
self.city_input = Input(placeholder=PLACEHOLDER_CITY)
135-
self.homepage_input = Input(placeholder=PLACEHOLDER_HOMEPAGE)
172+
self.name_input = LabeledInput(
173+
f"{PLACEHOLDER_NAME}:", placeholder=PLACEHOLDER_NAME
174+
)
175+
self.email_input = LabeledInput(
176+
f"{PLACEHOLDER_EMAIL}:", placeholder=PLACEHOLDER_EMAIL
177+
)
178+
self.city_input = LabeledInput(
179+
f"{PLACEHOLDER_CITY}:", placeholder=PLACEHOLDER_CITY
180+
)
181+
self.homepage_input = LabeledInput(
182+
f"{PLACEHOLDER_HOMEPAGE}:", placeholder=PLACEHOLDER_HOMEPAGE
183+
)
136184

137185
self.who_area = TextArea()
138186
self.python_area = TextArea()

uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)