From f269544805084b46f8d18c441ab6685dbdc0a6d5 Mon Sep 17 00:00:00 2001 From: mangelryujin Date: Tue, 9 Sep 2025 12:43:37 -0400 Subject: [PATCH 1/3] feat: add labels to all the inputs fields --- src/edit_python_pe/main.py | 58 ++++++++++++++++++++++++++++++++++---- 1 file changed, 53 insertions(+), 5 deletions(-) diff --git a/src/edit_python_pe/main.py b/src/edit_python_pe/main.py index b37514d..c489a92 100755 --- a/src/edit_python_pe/main.py +++ b/src/edit_python_pe/main.py @@ -24,6 +24,46 @@ load_file_into_form) +class LabeledInput(Vertical): + + DEFAULT_CSS = """ + LabeledInput { + height: auto; + + } + LabeledInput Static { + width: 25%; + + } + LabeledInput Input { + width: 100%; + } + """ + + def __init__( + self, label: str, placeholder: str = "", value: str = "", **kwargs + ): + super().__init__(**kwargs) + self.label = label + self.placeholder = placeholder + self._value = value + + def compose(self) -> ComposeResult: + yield Static(self.label, classes="label") + yield Input( + id="input", placeholder=self.placeholder, value=self._value + ) + + @property + def value(self): + return self._value + + @value.setter + def value(self, v: str): + self._value = v + self.query_one(selector="#input").value = v + + class SocialEntry(Horizontal): DEFAULT_CSS = """ SocialEntry Select { @@ -129,10 +169,18 @@ def on_mount(self) -> None: # 2) Build the form portion, hidden at first self.form_header = Static(FORM_HEADER, classes="header") - self.name_input = Input(placeholder=PLACEHOLDER_NAME) - self.email_input = Input(placeholder=PLACEHOLDER_EMAIL) - self.city_input = Input(placeholder=PLACEHOLDER_CITY) - self.homepage_input = Input(placeholder=PLACEHOLDER_HOMEPAGE) + self.name_input = LabeledInput( + f"{PLACEHOLDER_NAME}:", placeholder=PLACEHOLDER_NAME + ) + self.email_input = LabeledInput( + f"{PLACEHOLDER_EMAIL}:", placeholder=PLACEHOLDER_EMAIL + ) + self.city_input = LabeledInput( + f"{PLACEHOLDER_CITY}:", placeholder=PLACEHOLDER_CITY + ) + self.homepage_input = LabeledInput( + f"{PLACEHOLDER_HOMEPAGE}:", placeholder=PLACEHOLDER_HOMEPAGE + ) self.who_area = TextArea() self.python_area = TextArea() @@ -233,7 +281,7 @@ def clear_form(self) -> None: def on_list_view_selected(self, event: ListView.Selected) -> None: """User clicked on a file in the list. Parse it into the form fields.""" item_text_widget = event.item.children[0] - filename = item_text_widget.renderable + filename = item_text_widget.content self.current_file = filename self.clear_form() From aa24af04a1a87954fe23ae396dac4cc6cb248f5c Mon Sep 17 00:00:00 2001 From: mangelryujin Date: Tue, 9 Sep 2025 12:43:37 -0400 Subject: [PATCH 2/3] feat: add labels to all the inputs fields --- src/edit_python_pe/main.py | 56 +++++++++++++++++++++++++++++++++++--- 1 file changed, 52 insertions(+), 4 deletions(-) diff --git a/src/edit_python_pe/main.py b/src/edit_python_pe/main.py index 7f3447e..c489a92 100755 --- a/src/edit_python_pe/main.py +++ b/src/edit_python_pe/main.py @@ -24,6 +24,46 @@ load_file_into_form) +class LabeledInput(Vertical): + + DEFAULT_CSS = """ + LabeledInput { + height: auto; + + } + LabeledInput Static { + width: 25%; + + } + LabeledInput Input { + width: 100%; + } + """ + + def __init__( + self, label: str, placeholder: str = "", value: str = "", **kwargs + ): + super().__init__(**kwargs) + self.label = label + self.placeholder = placeholder + self._value = value + + def compose(self) -> ComposeResult: + yield Static(self.label, classes="label") + yield Input( + id="input", placeholder=self.placeholder, value=self._value + ) + + @property + def value(self): + return self._value + + @value.setter + def value(self, v: str): + self._value = v + self.query_one(selector="#input").value = v + + class SocialEntry(Horizontal): DEFAULT_CSS = """ SocialEntry Select { @@ -129,10 +169,18 @@ def on_mount(self) -> None: # 2) Build the form portion, hidden at first self.form_header = Static(FORM_HEADER, classes="header") - self.name_input = Input(placeholder=PLACEHOLDER_NAME) - self.email_input = Input(placeholder=PLACEHOLDER_EMAIL) - self.city_input = Input(placeholder=PLACEHOLDER_CITY) - self.homepage_input = Input(placeholder=PLACEHOLDER_HOMEPAGE) + self.name_input = LabeledInput( + f"{PLACEHOLDER_NAME}:", placeholder=PLACEHOLDER_NAME + ) + self.email_input = LabeledInput( + f"{PLACEHOLDER_EMAIL}:", placeholder=PLACEHOLDER_EMAIL + ) + self.city_input = LabeledInput( + f"{PLACEHOLDER_CITY}:", placeholder=PLACEHOLDER_CITY + ) + self.homepage_input = LabeledInput( + f"{PLACEHOLDER_HOMEPAGE}:", placeholder=PLACEHOLDER_HOMEPAGE + ) self.who_area = TextArea() self.python_area = TextArea() From e2fca4ebc1ba017f9f5a1c7807e86598aada9b3c Mon Sep 17 00:00:00 2001 From: Jean-Pierre Chauvel Date: Tue, 9 Sep 2025 18:15:10 -0500 Subject: [PATCH 3/3] bump version to 0.2.10 --- pyproject.toml | 2 +- uv.lock | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 1959d6d..34acf73 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "edit-python-pe" -version = "0.2.9" +version = "0.2.10" description = "Allows member and project profile editing onto python.pe git repository" readme = "README.md" authors = [ diff --git a/uv.lock b/uv.lock index 11b7749..098ea14 100644 --- a/uv.lock +++ b/uv.lock @@ -325,7 +325,7 @@ wheels = [ [[package]] name = "edit-python-pe" -version = "0.2.9" +version = "0.2.10" source = { editable = "." } dependencies = [ { name = "babel" },