Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tweak the cosmetics of the notes editor #18

Merged
merged 2 commits into from
Jan 29, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
💄 Tweak the cosmetics of the notes editor
  • Loading branch information
davep committed Jan 29, 2025
commit 9d18995d3b66726a48365bf5111bb80ac8a84abb
19 changes: 14 additions & 5 deletions src/peplum/app/screens/notes_editor.py
Original file line number Diff line number Diff line change
@@ -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 {
@@ -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: