Skip to content

Commit

Permalink
Merge pull request #1800 from Textualize/release0-11-0
Browse files Browse the repository at this point in the history
version bump, post, added --screenshot options to console run
  • Loading branch information
willmcgugan authored Feb 15, 2023
2 parents 4f4f066 + a47bb56 commit a2d48cf
Show file tree
Hide file tree
Showing 5 changed files with 327 additions and 3 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [0.11.0] - Unreleased
## [0.11.0] - 2023-02-15

### Added

Expand Down Expand Up @@ -40,6 +40,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- Added `DOMNode.css_tree` which is a renderable that shows the DOM and CSS https://github.com/Textualize/textual/pull/1778
- Added `DOMNode.children_view` which is a view on to a nodes children list, use for querying https://github.com/Textualize/textual/pull/1778
- Added `Markdown` and `MarkdownViewer` widgets.
- Added `--screenshot` option to `textual run`

### Changed

Expand Down Expand Up @@ -462,6 +463,8 @@ https://textual.textualize.io/blog/2022/11/08/version-040/#version-040
- New handler system for messages that doesn't require inheritance
- Improved traceback handling

[0.11.0]: https://github.com/Textualize/textual/compare/v0.10.1...v0.11.0
[0.10.1]: https://github.com/Textualize/textual/compare/v0.10.0...v0.10.1
[0.10.0]: https://github.com/Textualize/textual/compare/v0.9.1...v0.10.0
[0.9.1]: https://github.com/Textualize/textual/compare/v0.9.0...v0.9.1
[0.9.0]: https://github.com/Textualize/textual/compare/v0.8.2...v0.9.0
Expand Down
257 changes: 257 additions & 0 deletions docs/blog/images/markdown-viewer.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
52 changes: 52 additions & 0 deletions docs/blog/posts/release0-11-0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
---
draft: false
date: 2023-02-15
categories:
- Release
title: "version-0110"
authors:
- willmcgugan
---

# Textual 0.11.0 adds a beautiful Markdown widget

We released Textual 0.10.0 25 days ago, which is a little longer than our usual release cycle. What have we been up to?

<!-- more -->

The headline feature of this release is the enhanced Markdown support. Here's a screenshot of an example:

<div>
--8<-- "docs/blog/images/markdown-viewer.svg"
</div>

!!! tip

You can generate these SVG screenshots for your app with `textual run my_app.py --screenshot 5` which will export a screenshot after 5 seconds.

There are actually 2 new widgets: [Markdown](./../../widgets/markdown.md) for a simple Markdown document, and [MarkdownViewer](./../../widgets/markdown_viewer.md) which adds browser-like navigation and a table of contents.

Textual has had support for Markdown since day one by embedding a Rich [Markdown](https://rich.readthedocs.io/en/latest/markdown.html) object -- which still gives decent results! This new widget adds dynamic controls such as scrollable code fences and tables, in addition to working links.

In future releases we plan on adding more Markdown extensions, and the ability to easily embed custom widgets within the document. I'm sure there are plenty of interesting applications that could be powered by dynamically generated Markdown documents.

## DataTable improvements

There has been a lot of work on the [DataTable](../../widgets/data_table.md) API. We've added the ability to sort the data, which required that we introduce the concept of row and column keys. You can now reference rows / columns / cells by their coordinate or by row / column key.

## Tree control

The [Tree](../../api/tree.md) widget has grown a few methods to programmatically expand, collapse and toggle tree nodes.

## Breaking changes

There are a few breaking changes in this release. These are mostly naming and import related, which should be easy to fix if you are affected. Here's a few notable examples:

- `Checkbox` has been renamed to `Switch`. This is because we plan to introduce complimentary `Checkbox` and `RadioButton` widgets in a future release, but we loved the look of *Switches* too much to drop them.
- We've dropped the `emit` and `emit_no_wait` methods. These methods posted message to the parent widget, but we found that made it problematic to subclass widgets. In almost all situations you want to replace these with `self.post_message` (or `self.post_message_no_wait`).

Be sure to check the [CHANGELOG](https://github.com/Textualize/textual/blob/main/CHANGELOG.md) for the full details on potential breaking changes.

## Join us!

We're having fun on our [Discord server](https://discord.gg/Enf6Z3qhVr). Join us there to talk to Textualize developers and share ideas.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "textual"
version = "0.10.1"
version = "0.11.0"
homepage = "https://github.com/Textualize/textual"
description = "Modern Text User Interface framework"
authors = ["Will McGugan <will@textualize.io>"]
Expand Down
14 changes: 13 additions & 1 deletion src/textual/cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,14 @@ def console(verbose: bool, exclude: list[str]) -> None:
@click.argument("import_name", metavar="FILE or FILE:APP")
@click.option("--dev", "dev", help="Enable development mode", is_flag=True)
@click.option("--press", "press", help="Comma separated keys to simulate press")
def run_app(import_name: str, dev: bool, press: str) -> None:
@click.option(
"--screenshot",
type=int,
default=None,
metavar="DELAY",
help="Take screenshot after DELAY seconds",
)
def run_app(import_name: str, dev: bool, press: str, screenshot: int | None) -> None:
"""Run a Textual app.
The code to run may be given as a path (ending with .py) or as a Python
Expand All @@ -73,6 +80,7 @@ def run_app(import_name: str, dev: bool, press: str) -> None:

import os
import sys
from asyncio import sleep

from textual.features import parse_features

Expand All @@ -96,6 +104,10 @@ def run_app(import_name: str, dev: bool, press: str) -> None:
async def run_press_keys(pilot: Pilot) -> None:
if press_keys is not None:
await pilot.press(*press_keys)
if screenshot is not None:
await sleep(screenshot)
filename = pilot.app.save_screenshot()
pilot.app.exit(message=f"Saved {filename!r}")

result = app.run(auto_pilot=run_press_keys)

Expand Down

0 comments on commit a2d48cf

Please sign in to comment.