Merge pull request #24

Fix/binding not working
This commit is contained in:
Gustavo Henrique Miranda 2025-07-06 03:38:20 -03:00 committed by GitHub
commit 6724a66fed
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 17 additions and 12 deletions

View File

@ -1,4 +1,5 @@
from textual.app import ComposeResult from textual.app import ComposeResult
from textual.binding import Binding
from textual.containers import Vertical, Horizontal from textual.containers import Vertical, Horizontal
from textual.screen import ModalScreen from textual.screen import ModalScreen
from textual.widgets import Label, Input, Button from textual.widgets import Label, Input, Button
@ -6,7 +7,7 @@ from textual.widgets import Label, Input, Button
class EditDiaryModal(ModalScreen[tuple[int,str]]): class EditDiaryModal(ModalScreen[tuple[int,str]]):
BINDINGS = [ BINDINGS = [
("escape", "cancel", "Cancel"), Binding("escape", "cancel", "Cancel"),
] ]
def __init__(self, diary_id: int): def __init__(self, diary_id: int):

View File

@ -12,6 +12,7 @@ from pilgrim.ui.screens.modals.edit_photo_modal import EditPhotoModal
from pilgrim.ui.screens.modals.file_picker_modal import FilePickerModal from pilgrim.ui.screens.modals.file_picker_modal import FilePickerModal
from pilgrim.ui.screens.rename_entry_modal import RenameEntryModal from pilgrim.ui.screens.rename_entry_modal import RenameEntryModal
from textual.app import ComposeResult from textual.app import ComposeResult
from textual.binding import Binding
from textual.containers import Container, Horizontal, Vertical from textual.containers import Container, Horizontal, Vertical
from textual.screen import Screen from textual.screen import Screen
from textual.widgets import Header, Footer, Static, TextArea, OptionList from textual.widgets import Header, Footer, Static, TextArea, OptionList
@ -21,15 +22,15 @@ class EditEntryScreen(Screen):
TITLE = "Pilgrim - Edit" TITLE = "Pilgrim - Edit"
BINDINGS = [ BINDINGS = [
("ctrl+q", "quit", "Quit"), Binding("ctrl+q", "quit", "Quit"),
("ctrl+s", "save", "Save"), Binding("ctrl+s", "save", "Save"),
("ctrl+n", "new_entry", "New Entry"), Binding("ctrl+n", "new_entry", "New Entry"),
("ctrl+shift+n", "next_entry", "Next Entry"), Binding("ctrl+shift+n", "next_entry", "Next Entry"),
("ctrl+shift+p", "prev_entry", "Previous Entry"), Binding("ctrl+shift+p", "prev_entry", "Previous Entry"),
("ctrl+r", "rename_entry", "Rename Entry"), Binding("ctrl+r", "rename_entry", "Rename Entry"),
("f8", "toggle_sidebar", "Toggle Photos"), Binding("f8", "toggle_sidebar", "Toggle Photos"),
("f9", "toggle_focus", "Toggle Focus"), Binding("f9", "toggle_focus", "Toggle Focus"),
("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):

View File

@ -1,11 +1,13 @@
from textual.app import ComposeResult from textual.app import ComposeResult
from textual.binding import Binding
from textual.containers import Vertical, Horizontal from textual.containers import Vertical, Horizontal
from textual.screen import ModalScreen from textual.screen import ModalScreen
from textual.widgets import Label, Input, Button from textual.widgets import Label, Input, Button
class NewDiaryModal(ModalScreen[str]): class NewDiaryModal(ModalScreen[str]):
BINDINGS = [ BINDINGS = [
("escape", "cancel", "Cancel"), Binding("escape", "cancel", "Cancel"),
] ]
def __init__(self): def __init__(self):
super().__init__() super().__init__()

View File

@ -1,4 +1,5 @@
from textual.app import ComposeResult from textual.app import ComposeResult
from textual.binding import Binding
from textual.containers import Vertical, Horizontal from textual.containers import Vertical, Horizontal
from textual.screen import ModalScreen from textual.screen import ModalScreen
from textual.widgets import Label, Input, Button from textual.widgets import Label, Input, Button
@ -8,7 +9,7 @@ class RenameEntryModal(ModalScreen[str]):
"""A modal screen to rename a diary entry.""" """A modal screen to rename a diary entry."""
BINDINGS = [ BINDINGS = [
("escape", "cancel", "Cancel"), Binding("escape", "cancel", "Cancel"),
] ]
def __init__(self, current_name: str): def __init__(self, current_name: str):