Skip to content

Commit

Permalink
🔀 Merge pull request #18 from davep/tweak-note-editor
Browse files Browse the repository at this point in the history
Tweak the cosmetics of the notes editor
  • Loading branch information
davep authored Jan 29, 2025
2 parents f9af63e + c32726e commit c7542c0
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
3 changes: 3 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@

- Added the ability to view the source of a PEP.
([#17](https://github.com/davep/peplum/pull/17))
- Made some cosmetic changes to the notes editor dialog so that it better
matches the rest of the application.
([#18](https://github.com/davep/peplum/pull/18))

## v0.2.0

Expand Down
19 changes: 14 additions & 5 deletions src/peplum/app/screens/notes_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,26 @@ class NotesEditor(ModalScreen[str | None]):
max-width: 80;
height: auto;
background: $panel;
border: panel $border;
border: solid $border;
}
TextArea, TextArea:focus {
background: transparent;
height: 20;
margin: 1 1 0 1;
padding: 0;
border: none;
scrollbar-background: $panel;
scrollbar-background-hover: $panel;
scrollbar-background-active: $panel;
& > .text-area--cursor-line {
background: transparent;
}
}
#buttons {
height: auto;
margin-top: 1;
align-horizontal: right;
border-top: solid $border;
}
Button {
Expand All @@ -62,12 +68,15 @@ def __init__(self, pep: PEP) -> None:

def compose(self) -> ComposeResult:
"""Compose the dialog's content."""
key_colour = (
"dim" if self.app.current_theme is None else self.app.current_theme.accent
)
with Vertical() as dialog:
dialog.border_title = f"Notes for PEP{self._pep.number}"
yield TextArea(self._pep.notes)
with Horizontal(id="buttons"):
yield Button("Save [dim]\\[F2][/]", id="save", variant="success")
yield Button("Cancel [dim]\\[Esc][/]", id="cancel", variant="error")
yield Button(f"Save [{key_colour}]\\[F2][/]", id="save")
yield Button(f"Cancel [{key_colour}]\\[Esc][/]", id="cancel")

@on(Button.Pressed, "#save")
def action_save(self) -> None:
Expand Down

0 comments on commit c7542c0

Please sign in to comment.