Skip to content

Commit

Permalink
correct filename
Browse files Browse the repository at this point in the history
  • Loading branch information
willmcgugan committed Aug 29, 2024
1 parent 79ac1c7 commit 9cd3d8d
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/textual/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -1369,15 +1369,16 @@ def action_toggle_dark(self) -> None:
"""An [action](/guide/actions) to toggle dark mode."""
self.dark = not self.dark

def action_screenshot(self, filename: str | None = None, path: str = "./") -> None:
def action_screenshot(
self, filename: str | None = None, path: str | None = None
) -> None:
"""This [action](/guide/actions) will save an SVG file containing the current contents of the screen.
Args:
filename: Filename of screenshot, or None to auto-generate.
path: Path to directory. Defaults to current working directory.
"""
self.deliver_screenshot(filename, path)
self.notify("Exported screenshot")

def export_screenshot(self, *, title: str | None = None) -> str:
"""Export an SVG screenshot of the current screen.
Expand Down Expand Up @@ -1457,7 +1458,6 @@ def deliver_screenshot(
Returns:
The delivery key that uniquely identifies the file delivery.
"""
path = path or "./"
if not filename:
svg_filename = generate_datetime_filename(self.title, ".svg", time_format)
else:
Expand Down Expand Up @@ -4142,7 +4142,8 @@ def _on_delivery_complete(self, event: events.DeliveryComplete) -> None:
self.notify("Saved screenshot", title="Screenshot")
else:
self.notify(
f"Saved screenshot to {event.path.name!r}", title="Screenshot"
f"Saved screenshot to [green]{str(event.path)!r}",
title="Screenshot",
)

@on(events.DeliveryFailed)
Expand Down

0 comments on commit 9cd3d8d

Please sign in to comment.