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

Bump Textual version #119

Merged
merged 4 commits into from
Oct 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
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]" }
Expand All @@ -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"
Expand Down
10 changes: 5 additions & 5 deletions src/posting/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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}")
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/posting/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -33,7 +33,7 @@ def commands(
True,
),
)
elif screen.layout == "vertical":
elif screen.current_layout == "vertical":
commands_to_show.append(
(
"layout: horizontal",
Expand Down
6 changes: 3 additions & 3 deletions src/posting/posting.scss
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ AppBody {
& KeyValueInput {
layout: vertical;
& Button {
width: 1fr;
width: 100%;
}
}

Expand Down Expand Up @@ -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;
}
Expand Down
1 change: 1 addition & 0 deletions src/posting/widgets/key_value.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class KeyValueInput(Horizontal):
border: none;
width: 1fr;
margin-left: 1;
margin-right: 1;
&:focus {
border: none;
padding: 0 1;
Expand Down
15 changes: 6 additions & 9 deletions src/posting/widgets/request/request_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ class RequestOptions(VerticalScroll):

Checkbox {
height: 1;
margin: 0 2 1 2;
padding: 0 1;
border: none;
background: transparent;
Expand All @@ -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 {
Expand Down Expand Up @@ -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",
Expand Down
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
Loading