Skip to content

Commit

Permalink
Merge pull request #119 from darrenburns/textual-update-0.85.0
Browse files Browse the repository at this point in the history
Bump Textual version
darrenburns authored Oct 25, 2024
2 parents 5b9a76b + b6e3594 commit 8f5354a
Showing 13 changed files with 568 additions and 545 deletions.
Binary file modified .coverage
Binary file not shown.
8 changes: 5 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "posting"
version = "2.0.0"
version = "2.0.1"
description = "The modern API client that lives in your terminal."
authors = [
{ name = "Darren Burns", email = "[email protected]" }
@@ -15,8 +15,10 @@ dependencies = [
"pyyaml>=6.0.2,<7.0.0",
"pydantic-settings>=2.4.0,<3.0.0",
"python-dotenv>=1.0.1,<2.0.0",
"textual[syntax]==0.83.0", # pinned intentionally
"textual-autocomplete==3.0.0a12", # pinned intentionally
"textual[syntax]==0.85.0",
# pinned intentionally
"textual-autocomplete==3.0.0a12",
# pinned intentionally
"watchfiles>=0.24.0",
]
readme = "README.md"
10 changes: 5 additions & 5 deletions src/posting/app.py
Original file line number Diff line number Diff line change
@@ -176,7 +176,7 @@ class MainScreen(Screen[None]):

selected_method: Reactive[HttpRequestMethod] = reactive("GET", init=False)
"""The currently selected method of the request."""
layout: Reactive[PostingLayout] = reactive("vertical", init=False)
current_layout: Reactive[PostingLayout] = reactive("vertical", init=False)
"""The current layout of the app."""
expanded_section: Reactive[Literal["request", "response"] | None] = reactive(
None, init=False
@@ -197,7 +197,7 @@ def __init__(
self.settings = SETTINGS.get()

def on_mount(self) -> None:
self.layout = self._initial_layout
self.current_layout = self._initial_layout

# Set the initial focus based on the settings.
focus_on_startup = self.settings.focus.on_startup
@@ -581,8 +581,8 @@ async def action_new_request(self) -> None:
"""Open the new request flow."""
await self.collection_tree.new_request_flow(None)

def watch_layout(self, layout: Literal["horizontal", "vertical"]) -> None:
"""Update the layout of the app to be horizontal or vertical."""
def watch_current_layout(self, layout: Literal["horizontal", "vertical"]) -> None:
"""Update the current layout of the app to be horizontal or vertical."""
classes = {"horizontal", "vertical"}
other_class = classes.difference({layout}).pop()
self.app_body.add_class(f"layout-{layout}")
@@ -1000,7 +1000,7 @@ def get_css_variables(self) -> dict[str, str]:
return {**super().get_css_variables(), **color_system}

def command_layout(self, layout: Literal["vertical", "horizontal"]) -> None:
self.main_screen.layout = layout
self.main_screen.current_layout = layout

def command_theme(self, theme: str) -> None:
self.theme = theme
4 changes: 2 additions & 2 deletions src/posting/commands.py
Original file line number Diff line number Diff line change
@@ -24,7 +24,7 @@ def commands(

if isinstance(screen, MainScreen):
# Only show the option to change to the layout which isn't the current one.
if screen.layout == "horizontal":
if screen.current_layout == "horizontal":
commands_to_show.append(
(
"layout: vertical",
@@ -33,7 +33,7 @@ def commands(
True,
),
)
elif screen.layout == "vertical":
elif screen.current_layout == "vertical":
commands_to_show.append(
(
"layout: horizontal",
6 changes: 3 additions & 3 deletions src/posting/posting.scss
Original file line number Diff line number Diff line change
@@ -86,7 +86,7 @@ AppBody {
& KeyValueInput {
layout: vertical;
& Button {
width: 1fr;
width: 100%;
}
}

@@ -134,11 +134,11 @@ Footer {
}

RichLog {
background: $surface;
background: $surface 50%;
padding-left: 1;

&:focus {
background: $surface-lighten-1;
background: $surface-lighten-1 50%;
border-left: wide $accent;
padding-left: 0;
}
1 change: 1 addition & 0 deletions src/posting/widgets/key_value.py
Original file line number Diff line number Diff line change
@@ -19,6 +19,7 @@ class KeyValueInput(Horizontal):
border: none;
width: 1fr;
margin-left: 1;
margin-right: 1;
&:focus {
border: none;
padding: 0 1;
15 changes: 6 additions & 9 deletions src/posting/widgets/request/request_options.py
Original file line number Diff line number Diff line change
@@ -15,7 +15,6 @@ class RequestOptions(VerticalScroll):
Checkbox {
height: 1;
margin: 0 2 1 2;
padding: 0 1;
border: none;
background: transparent;
@@ -32,15 +31,13 @@ class RequestOptions(VerticalScroll):
}
#proxy-option {
padding-left: 3;
margin-bottom: 1;
height: auto;
padding: 0 1 0 2;
height: 2;
}
#timeout-option {
padding-left: 3;
height: auto;
margin-bottom: 1;
padding: 0 1 0 2;
height: 2;
}
& #option-description {
@@ -98,11 +95,11 @@ def compose(self) -> ComposeResult:
)

with Vertical(id="proxy-option"):
yield Label("Proxy URL")
yield Label("Proxy URL:")
yield VariableInput(id="proxy-url")

with Vertical(id="timeout-option"):
yield Label("Timeout")
yield Label("Timeout:")
yield VariableInput(
value=str(self.options.timeout),
id="timeout",
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
182 changes: 91 additions & 91 deletions tests/__snapshots__/test_snapshots/TestJumpMode.test_click_switch.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
221 changes: 111 additions & 110 deletions tests/__snapshots__/test_snapshots/TestScripts.test_script_runs.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 28 additions & 6 deletions uv.lock

0 comments on commit 8f5354a

Please sign in to comment.