Skip to content

Commit

Permalink
Add bindings group titles
Browse files Browse the repository at this point in the history
  • Loading branch information
darrenburns committed Nov 16, 2024
1 parent 235cabe commit f8ffc47
Show file tree
Hide file tree
Showing 11 changed files with 31 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/posting/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ class AppBody(Vertical):

class MainScreen(Screen[None]):
AUTO_FOCUS = None
BINDING_GROUP_TITLE = "Main Screen"
BINDINGS = [
Binding(
"ctrl+j,alt+enter",
Expand Down Expand Up @@ -804,6 +805,7 @@ class Posting(App[None], inherit_bindings=False):
AUTO_FOCUS = None
COMMANDS = {PostingProvider}
CSS_PATH = Path(__file__).parent / "posting.scss"
BINDING_GROUP_TITLE = "Global Keybinds"
BINDINGS = [
Binding(
"ctrl+p",
Expand Down
2 changes: 1 addition & 1 deletion src/posting/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def commands(
(
"help: Hide keybindings sidebar",
app.action_hide_help_panel,
"Hide the keybindings sidebar.",
"Hide the keybindings sidebar",
True,
),
)
Expand Down
8 changes: 8 additions & 0 deletions src/posting/posting.scss
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,14 @@ Footer {
padding-left: 2;
}

HelpPanel {
#title {
display: block;
}
KeyPanel {
scrollbar-size-vertical: 1;
}
}
.modal-body {
background: $background;
padding: 1 2;
Expand Down
2 changes: 2 additions & 0 deletions src/posting/widgets/collection/browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ class CollectionTree(PostingTree[CollectionNode]):
""",
)

BINDING_GROUP_TITLE = "Collection Browser"

BINDINGS = [
Binding(
"d",
Expand Down
6 changes: 6 additions & 0 deletions src/posting/widgets/request/header_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,12 @@ class HeaderInput(PostingInput):
""",
)

BINDING_GROUP_TITLE = "HTTP Header Input"


class HeaderEditor(Vertical):
BINDING_GROUP_TITLE = "HTTP Header Editor"

def compose(self) -> ComposeResult:
yield KeyValueEditor(
HeadersTable(),
Expand Down Expand Up @@ -70,6 +74,8 @@ class HeadersTable(PostingDataTable):
""",
)

BINDING_GROUP_TITLE = "Headers Table"

BINDINGS = [
Binding("backspace", action="remove_row", description="Remove header"),
]
Expand Down
2 changes: 2 additions & 0 deletions src/posting/widgets/request/method_selection.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ class MethodSelector(PostingSelect[str]):
""",
)

BINDING_GROUP_TITLE = "HTTP Method Selector"

BINDINGS = [
Binding("g", "select_method('GET')", "GET", show=False),
Binding("p", "select_method('POST')", "POST", show=False),
Expand Down
2 changes: 2 additions & 0 deletions src/posting/widgets/request/request_body.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ class RequestBodyTextArea(PostingTextArea):
For editing request bodies.
"""

BINDING_GROUP_TITLE = "Request Body Text Area"

help = HelpData(
title="Request Body Text Area",
description="""\
Expand Down
2 changes: 2 additions & 0 deletions src/posting/widgets/request/url_bar.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ class UrlInput(PostingInput):
""",
)

BINDING_GROUP_TITLE = "URL Input"

BINDINGS = [
Binding("down", "app.focus_next", "Focus next", show=False),
]
Expand Down
2 changes: 2 additions & 0 deletions src/posting/widgets/response/response_body.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ class ResponseTextArea(ReadOnlyTextArea):
""",
)

BINDING_GROUP_TITLE = "Response Body Text Area"

@on(TextArea.Changed)
def on_change(self, event: TextArea.Changed) -> None:
empty = len(self.text) == 0
Expand Down
2 changes: 2 additions & 0 deletions src/posting/widgets/response/script_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ class ScriptOutput(VerticalScroll):
""",
)

BINDING_GROUP_TITLE = "Script Output"

setup_status: Reactive[ScriptStatus] = reactive("no-script")
request_status: Reactive[ScriptStatus] = reactive("no-script")
response_status: Reactive[ScriptStatus] = reactive("no-script")
Expand Down
2 changes: 2 additions & 0 deletions src/posting/widgets/variable_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ class VariableInput(PostingInput):
""",
)

BINDING_GROUP_TITLE = "Variable Input"

def on_mount(self) -> None:
self.highlighter = VariableHighlighter()
self.auto_complete = VariableAutoComplete(
Expand Down

0 comments on commit f8ffc47

Please sign in to comment.