Compare commits

...

13 Commits

Author SHA1 Message Date
Gustavo Henrique Miranda 3bef353939
Merge pull request #42
Fixed the edit diary modal to accept the key "enter" and automatically the function
2025-07-14 18:24:14 -03:00
Gustavo Henrique Miranda a80ecc24f5
Merge pull request #43
Fixed the new diary modal to accept the key "enter" and automatically the function
2025-07-14 18:23:58 -03:00
Gustavo Henrique Miranda 7f193d0fbb
Merge pull request #44 from gmbrax/dependabot/pip/textual-approx-eq-4.0.0
origin/dependabot/pip/textual-approx-eq-4.0.0
2025-07-14 18:17:49 -03:00
Gustavo Henrique Miranda 7dfeec20f1
Merge pull request #45 from gmbrax/dependabot/pip/typing-extensions-4.14.1
origin/dependabot/pip/typing-extensions-4.14.1
2025-07-14 18:17:32 -03:00
Gustavo Henrique Miranda d1545ad2e2
Merge branch 'staging' into dependabot/pip/typing-extensions-4.14.1 2025-07-14 18:17:15 -03:00
Gustavo Henrique Miranda 5d26c5394d
Merge branch 'development' into dependabot/pip/textual-approx-eq-4.0.0 2025-07-14 16:02:35 -03:00
dependabot[bot] a867744d45
Update textual requirement from ~=3.3.0 to ~=4.0.0
---
updated-dependencies:
- dependency-name: textual
  dependency-version: 4.0.0
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-07-14 18:29:28 +00:00
dependabot[bot] d2e69ae770
Bump typing-extensions from 4.14.0 to 4.14.1
Bumps [typing-extensions](https://github.com/python/typing_extensions) from 4.14.0 to 4.14.1.
- [Release notes](https://github.com/python/typing_extensions/releases)
- [Changelog](https://github.com/python/typing_extensions/blob/main/CHANGELOG.md)
- [Commits](https://github.com/python/typing_extensions/compare/4.14.0...4.14.1)

---
updated-dependencies:
- dependency-name: typing-extensions
  dependency-version: 4.14.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-07-14 17:45:35 +00:00
Gustavo Henrique Santos Souza de Miranda f174fd1d8a Fixed the edit diary modal to accept the key "enter" and automatically the function 2025-07-14 02:23:29 -03:00
Gustavo Henrique Santos Souza de Miranda c98a106d97 Fixed the new diary modal to accept the key "enter" and automatically the function 2025-07-14 02:06:25 -03:00
Gustavo Henrique Miranda 1312674186
Merge pull request #35 from gmbrax/fix/bindings-not-properly-working
Fixed the bindings to properly work and changed some bindings to avoid conflicts with the system
2025-07-13 23:06:14 -03:00
Gustavo Henrique Miranda fcaf17b593
Update README.md 2025-07-08 19:01:26 -03:00
Gustavo Henrique Miranda 1e07ea49df
Update README.md 2025-07-08 19:01:11 -03:00
3 changed files with 38 additions and 17 deletions

View File

@ -3,4 +3,4 @@ SQLAlchemy==2.0.41
typing_extensions==4.14.1
textual~=3.6.0
textual~=4.0.0

View File

@ -8,6 +8,7 @@ from textual.widgets import Label, Input, Button
class EditDiaryModal(ModalScreen[tuple[int,str]]):
BINDINGS = [
Binding("escape", "cancel", "Cancel"),
Binding("enter", "edit_diary", "Save",priority=True),
]
def __init__(self, diary_id: int):
@ -32,17 +33,28 @@ class EditDiaryModal(ModalScreen[tuple[int,str]]):
def on_button_pressed(self, event: Button.Pressed) -> None:
if event.button.id == "save_diary_button":
new_diary_name = self.name_input.value.strip()
if new_diary_name and new_diary_name != self.current_diary_name:
self.dismiss((self.diary_id, new_diary_name))
elif new_diary_name == self.current_diary_name:
self.notify("No changes made.", severity="warning")
self.dismiss(None)
else:
self.notify("Diary name cannot be empty.", severity="warning")
self.name_input.focus()
self.action_edit_diary()
elif event.button.id == "cancel_button":
self.dismiss(None)
def on_key(self, event):
if event.key == "enter":
self.action_edit_diary()
event.prevent_default()
def action_edit_diary(self) -> None:
new_diary_name = self.name_input.value.strip()
if new_diary_name and new_diary_name != self.current_diary_name:
self.dismiss((self.diary_id, new_diary_name))
elif new_diary_name == self.current_diary_name:
self.notify("No changes made.", severity="warning")
self.dismiss(None)
else:
self.notify("Diary name cannot be empty.", severity="warning")
self.name_input.focus()
def on_input_submitted(self, event: Input.Submitted) -> None:
if event.input.id == "edit_diary_name_input":
self.action_edit_diary()
def action_cancel(self) -> None:
self.dismiss(None)

View File

@ -8,6 +8,7 @@ from textual.widgets import Label, Input, Button
class NewDiaryModal(ModalScreen[str]):
BINDINGS = [
Binding("escape", "cancel", "Cancel"),
Binding("enter", "create_diary", "Create",priority=True),
]
def __init__(self):
super().__init__()
@ -31,15 +32,23 @@ class NewDiaryModal(ModalScreen[str]):
def on_button_pressed(self, event: Button.Pressed) -> None:
"""Handles button clicks."""
if event.button.id == "create_diary_button":
diary_name = self.name_input.value.strip()
if diary_name:
self.dismiss(diary_name)
else:
self.notify("Diary name cannot be empty.", severity="warning")
self.name_input.focus()
self.action_create_diary()
elif event.button.id == "cancel_button":
self.dismiss("")
def action_cancel(self) -> None:
"""Action to cancel the modal."""
self.dismiss("")
self.dismiss("")
def action_create_diary(self) -> None:
diary_name = self.name_input.value.strip()
if diary_name:
self.dismiss(diary_name)
else:
self.notify("Diary name cannot be empty.", severity="warning")
self.name_input.focus()
def on_input_submitted(self, event: Input.Submitted) -> None:
if event.input.id == "NewDiaryModal-NameInput":
self.action_create_diary()