Merge branch 'fix/create-a-new-entry-on-open' into development

Changed the behaviour to create a new entry when a diary is open a
This commit is contained in:
Gustavo Henrique Santos Souza de Miranda 2025-07-12 12:14:17 -03:00
commit 6ab35e680d
3 changed files with 25 additions and 8 deletions

View File

@ -16,6 +16,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Export features - Export features
- Testing implementation - Testing implementation
## [0.0.3] - 2025-07-07
### Changed
- Removed the dependency on textual-dev from pyproject.toml
## [0.0.2] - 2025-07-07
### Changed
- Changed the license in pyproject.toml to BSD
## [0.0.1] - 2025-07-06 ## [0.0.1] - 2025-07-06
### Added ### Added
@ -34,7 +44,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Installation Method 1 not yet implemented - Installation Method 1 not yet implemented
- No testing suite implemented yet - No testing suite implemented yet
- Some features may be unstable in alpha version - Some features may be unstable in an alpha version
[Unreleased]: https://github.com/username/pilgrim/compare/v0.0.1...HEAD [Unreleased]: https://github.com/username/pilgrim/compare/v0.0.1...HEAD

View File

@ -25,7 +25,7 @@ structured and accessible format.
To install the application you must issue the command: To install the application you must issue the command:
```bash ```bash
pip install pilgrim pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple Pilgrim
``` ```
## Usage ## Usage

View File

@ -33,17 +33,24 @@ class EditEntryScreen(Screen):
Binding("escape", "back_to_list", "Back to List"), Binding("escape", "back_to_list", "Back to List"),
] ]
def __init__(self, diary_id: int = 1): def __init__(self, diary_id: int = 1,create_new: bool = True):
super().__init__() super().__init__()
if create_new:
self.current_entry_index = -1
self.is_new_entry = True
self.next_entry_id = None
else:
self.is_new_entry = False
self.current_entry_index = 0
self.next_entry_id = 1
self.new_entry_title = ""
self.new_entry_content = ""
self.diary_id = diary_id self.diary_id = diary_id
self.diary_name = f"Diary {diary_id}" self.diary_name = f"Diary {diary_id}"
self.current_entry_index = 0
self.entries: List[Entry] = [] self.entries: List[Entry] = []
self.is_new_entry = False
self.has_unsaved_changes = False self.has_unsaved_changes = False
self.new_entry_content = ""
self.new_entry_title = "New Entry"
self.next_entry_id = 1
self._updating_display = False self._updating_display = False
self._original_content = "" self._original_content = ""
self.is_refreshing = False self.is_refreshing = False