mirror of https://github.com/gmbrax/Pilgrim.git
Refactored bindings to use `Binding` class for consistency across modal and screen components.
This commit is contained in:
parent
b1e83aabbb
commit
8a10fddb14
|
|
@ -1,4 +1,5 @@
|
|||
from textual.app import ComposeResult
|
||||
from textual.binding import Binding
|
||||
from textual.containers import Vertical, Horizontal
|
||||
from textual.screen import ModalScreen
|
||||
from textual.widgets import Label, Input, Button
|
||||
|
|
@ -6,7 +7,7 @@ from textual.widgets import Label, Input, Button
|
|||
|
||||
class EditDiaryModal(ModalScreen[tuple[int,str]]):
|
||||
BINDINGS = [
|
||||
("escape", "cancel", "Cancel"),
|
||||
Binding("escape", "cancel", "Cancel"),
|
||||
]
|
||||
|
||||
def __init__(self, diary_id: int):
|
||||
|
|
|
|||
|
|
@ -1,40 +1,36 @@
|
|||
from typing import Optional, List
|
||||
import asyncio
|
||||
import re
|
||||
from datetime import datetime
|
||||
from pathlib import Path
|
||||
import hashlib
|
||||
import re
|
||||
import time
|
||||
|
||||
from textual.app import ComposeResult
|
||||
from textual.screen import Screen
|
||||
from textual.widgets import Header, Footer, Static, TextArea, OptionList, Input, Button
|
||||
from textual.binding import Binding
|
||||
from textual.containers import Container, Horizontal, Vertical, ScrollableContainer
|
||||
from typing import Optional, List
|
||||
|
||||
from pilgrim.models.entry import Entry
|
||||
from pilgrim.models.travel_diary import TravelDiary
|
||||
from pilgrim.models.photo import Photo
|
||||
from pilgrim.models.travel_diary import TravelDiary
|
||||
from pilgrim.ui.screens.modals.add_photo_modal import AddPhotoModal
|
||||
from pilgrim.ui.screens.modals.edit_photo_modal import EditPhotoModal
|
||||
from pilgrim.ui.screens.modals.confirm_delete_modal import ConfirmDeleteModal
|
||||
from pilgrim.ui.screens.modals.edit_photo_modal import EditPhotoModal
|
||||
from pilgrim.ui.screens.modals.file_picker_modal import FilePickerModal
|
||||
from pilgrim.ui.screens.rename_entry_modal import RenameEntryModal
|
||||
from textual.app import ComposeResult
|
||||
from textual.binding import Binding
|
||||
from textual.containers import Container, Horizontal, Vertical
|
||||
from textual.screen import Screen
|
||||
from textual.widgets import Header, Footer, Static, TextArea, OptionList
|
||||
|
||||
|
||||
class EditEntryScreen(Screen):
|
||||
TITLE = "Pilgrim - Edit"
|
||||
|
||||
BINDINGS = [
|
||||
("ctrl+q", "quit", "Quit"),
|
||||
("ctrl+s", "save", "Save"),
|
||||
("ctrl+n", "new_entry", "New Entry"),
|
||||
("ctrl+shift+n", "next_entry", "Next Entry"),
|
||||
("ctrl+shift+p", "prev_entry", "Previous Entry"),
|
||||
("ctrl+r", "rename_entry", "Rename Entry"),
|
||||
("f8", "toggle_sidebar", "Toggle Photos"),
|
||||
("f9", "toggle_focus", "Toggle Focus"),
|
||||
("escape", "back_to_list", "Back to List"),
|
||||
Binding("ctrl+q", "quit", "Quit"),
|
||||
Binding("ctrl+s", "save", "Save"),
|
||||
Binding("ctrl+n", "new_entry", "New Entry"),
|
||||
Binding("ctrl+shift+n", "next_entry", "Next Entry"),
|
||||
Binding("ctrl+shift+p", "prev_entry", "Previous Entry"),
|
||||
Binding("ctrl+r", "rename_entry", "Rename Entry"),
|
||||
Binding("f8", "toggle_sidebar", "Toggle Photos"),
|
||||
Binding("f9", "toggle_focus", "Toggle Focus"),
|
||||
Binding("escape", "back_to_list", "Back to List"),
|
||||
]
|
||||
|
||||
def __init__(self, diary_id: int = 1):
|
||||
|
|
|
|||
|
|
@ -1,11 +1,13 @@
|
|||
from textual.app import ComposeResult
|
||||
from textual.binding import Binding
|
||||
from textual.containers import Vertical, Horizontal
|
||||
from textual.screen import ModalScreen
|
||||
from textual.widgets import Label, Input, Button
|
||||
|
||||
|
||||
class NewDiaryModal(ModalScreen[str]):
|
||||
BINDINGS = [
|
||||
("escape", "cancel", "Cancel"),
|
||||
Binding("escape", "cancel", "Cancel"),
|
||||
]
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
from textual.app import ComposeResult
|
||||
from textual.binding import Binding
|
||||
from textual.containers import Vertical, Horizontal
|
||||
from textual.screen import ModalScreen
|
||||
from textual.widgets import Label, Input, Button
|
||||
|
|
@ -8,7 +9,7 @@ class RenameEntryModal(ModalScreen[str]):
|
|||
"""A modal screen to rename a diary entry."""
|
||||
|
||||
BINDINGS = [
|
||||
("escape", "cancel", "Cancel"),
|
||||
Binding("escape", "cancel", "Cancel"),
|
||||
]
|
||||
|
||||
def __init__(self, current_name: str):
|
||||
|
|
|
|||
Loading…
Reference in New Issue