Skip to content

Commit

Permalink
Merge branch 'main' into simplify-some-rxvt-sequences
Browse files Browse the repository at this point in the history
  • Loading branch information
davep committed Nov 29, 2023
2 parents d9e0258 + 9fbaffe commit 9dcc2fa
Show file tree
Hide file tree
Showing 49 changed files with 1,318 additions and 1,227 deletions.
31 changes: 8 additions & 23 deletions .github/workflows/pythonpackage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,40 +16,25 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.8", "3.9", "3.10", "3.11"]
defaults:
run:
shell: bash
steps:
- uses: actions/[email protected]
- name: Install and configure Poetry # This could be cached, too...
uses: snok/[email protected]
with:
version: 1.4.2
virtualenvs-in-project: true
- uses: actions/[email protected]
- name: Install Poetry
run: pipx install poetry==1.7.1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/[email protected]
with:
python-version: ${{ matrix.python-version }}
architecture: x64
allow-prereleases: true
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v3
with:
path: .venv
key: venv-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }}
cache: 'poetry'
- name: Install dependencies
run: poetry install --extras syntax
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
# - name: Typecheck with mypy
# run: |
# make typecheck
run: poetry install --no-interaction --extras syntax
- name: Test with pytest
run: |
source $VENV
pytest tests -v --cov=./src/textual --cov-report=xml:./coverage.xml --cov-report term-missing
poetry run pytest tests -v --cov=./src/textual --cov-report=xml:./coverage.xml --cov-report term-missing
- name: Upload snapshot report
if: always()
uses: actions/upload-artifact@v3
Expand Down
36 changes: 34 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,33 @@ 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/).


## Unreleased

### Changed

- Breaking changes https://github.com/Textualize/textual/issues/1530
- `link-hover-background` renamed to `link-background-hover`
- `link-hover-color` renamed to `link-color-hover`
- `link-hover-style` renamed to `link-style-hover`

### Added

- Added support for Ctrl+Fn and Ctrl+Shift+Fn keys in urxvt https://github.com/Textualize/textual/pull/3737

## [0.43.2] - 2023-11-29

### Fixed

- Fixed NoWidget error https://github.com/Textualize/textual/pull/3779

## [0.43.1] - 2023-11-29

### Fixed

- Fixed clicking on scrollbar moves TextArea cursor https://github.com/Textualize/textual/issues/3763

## [0.43.0] - 2023-11-28

### Fixed

- Fixed mouse targeting issue in `TextArea` when tabs were not fully expanded https://github.com/Textualize/textual/pull/3725
Expand All @@ -19,6 +43,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- Added experimental Canvas class https://github.com/Textualize/textual/pull/3669/
- Added `keyline` rule https://github.com/Textualize/textual/pull/3669/
- Widgets can now have an ALLOW_CHILDREN (bool) classvar to disallow adding children to a widget https://github.com/Textualize/textual/pull/3758
- Added the ability to set the `label` property of a `Checkbox` https://github.com/Textualize/textual/pull/3765
- Added the ability to set the `label` property of a `RadioButton` https://github.com/Textualize/textual/pull/3765
- Added support for various modified edit and navigation keys in urxvt https://github.com/Textualize/textual/pull/3739
- Added app focus/blur for textual-web https://github.com/Textualize/textual/pull/3767

### Changed

Expand Down Expand Up @@ -58,18 +86,19 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- Added `Pilot.mouse_down` to simulate `MouseDown` events https://github.com/Textualize/textual/pull/3495
- Added `Pilot.mouse_up` to simulate `MouseUp` events https://github.com/Textualize/textual/pull/3495
- Added `Widget.is_mounted` property https://github.com/Textualize/textual/pull/3709
- Added `TreeNode.refresh` https://github.com/Textualize/textual/pull/3639

### Changed

- CSS error reporting will no longer provide links to the files in question https://github.com/Textualize/textual/pull/3582
- inline CSS error reporting will report widget/class variable where the CSS was read from https://github.com/Textualize/textual/pull/3582
- Breaking change: `Tree.refresh_line` has now become an internal https://github.com/Textualize/textual/pull/3639
- Breaking change: Setting `Select.value` to `None` no longer clears the selection (See `Select.BLANK` and `Select.clear`) https://github.com/Textualize/textual/pull/3614
- Breaking change: `Button` no longer inherits from `Static`, now it inherits directly from `Widget` https://github.com/Textualize/textual/issues/3603
- Rich markup in markdown headings is now escaped when building the TOC https://github.com/Textualize/textual/issues/3689
- Mechanics behind mouse clicks. See [this](https://github.com/Textualize/textual/pull/3495#issue-1934915047) for more details. https://github.com/Textualize/textual/pull/3495
- Breaking change: max/min-width/height now includes padding and border. https://github.com/Textualize/textual/pull/3712


## [0.41.0] - 2023-10-31

### Fixed
Expand Down Expand Up @@ -1457,6 +1486,9 @@ 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.43.2]: https://github.com/Textualize/textual/compare/v0.43.1...v0.43.2
[0.43.1]: https://github.com/Textualize/textual/compare/v0.43.0...v0.43.1
[0.43.0]: https://github.com/Textualize/textual/compare/v0.42.0...v0.43.0
[0.42.0]: https://github.com/Textualize/textual/compare/v0.41.0...v0.42.0
[0.41.0]: https://github.com/Textualize/textual/compare/v0.40.0...v0.41.0
[0.40.0]: https://github.com/Textualize/textual/compare/v0.39.0...v0.40.0
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/styles/keyline.tcss
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Grid {
Placeholder {
height: 1fr;
}
hidden {
.hidden {
visibility: hidden;
}
#foo {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@


class LinkHoverBackgroundApp(App):
CSS_PATH = "link_hover_background.tcss"
CSS_PATH = "link_background_hover.tcss"

def compose(self):
yield Label(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#lbl1, #lbl2 {
link-hover-background: red; /* (1)! */
link-background-hover: red; /* (1)! */
}

#lbl3 {
link-hover-background: hsl(60,100%,50%) 50%;
link-background-hover: hsl(60,100%,50%) 50%;
}

#lbl4 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@


class LinkHoverColorApp(App):
CSS_PATH = "link_hover_color.tcss"
CSS_PATH = "link_color_hover.tcss"

def compose(self):
yield Label(
Expand Down
11 changes: 11 additions & 0 deletions docs/examples/styles/link_color_hover.tcss
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#lbl1, #lbl2 {
link-color-hover: red; /* (1)! */
}

#lbl3 {
link-color-hover: hsl(60,100%,50%) 50%;
}

#lbl4 {
link-color-hover: black;
}
11 changes: 0 additions & 11 deletions docs/examples/styles/link_hover_color.tcss

This file was deleted.

11 changes: 0 additions & 11 deletions docs/examples/styles/link_hover_style.tcss

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@


class LinkHoverStyleApp(App):
CSS_PATH = "link_hover_style.tcss"
CSS_PATH = "link_style_hover.tcss"

def compose(self):
yield Label(
Expand Down
11 changes: 11 additions & 0 deletions docs/examples/styles/link_style_hover.tcss
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#lbl1, #lbl2 {
link-style-hover: bold italic; /* (1)! */
}

#lbl3 {
link-style-hover: reverse strike;
}

#lbl4 {
link-style-hover: bold;
}
12 changes: 6 additions & 6 deletions docs/styles/links/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ There are a number of styles which influence the appearance of these links withi
| Property | Description |
|-------------------------------------------------------|-------------------------------------------------------------------|
| [`link-background`](./link_background.md) | The background color of the link text. |
| [`link-background-hover`](./link_background_hover.md) | The background color of the link text when the cursor is over it. |
| [`link-color`](./link_color.md) | The color of the link text. |
| [`link-hover-background`](./link_hover_background.md) | The background color of the link text when the cursor is over it. |
| [`link-hover-color`](./link_hover_color.md) | The color of the link text when the cursor is over it. |
| [`link-hover-style`](./link_hover_style.md) | The style of the link text when the cursor is over it. |
| [`link-color-hover`](./link_color_hover.md) | The color of the link text when the cursor is over it. |
| [`link-style`](./link_style.md) | The style of the link text (e.g. underline). |
| [`link-style-hover`](./link_style_hover.md) | The style of the link text when the cursor is over it. |

## Syntax

Expand All @@ -25,11 +25,11 @@ There are a number of styles which influence the appearance of these links withi

<a href="./link_style">link-style</a>: <a href="../../css_types/text_style">&lt;text-style&gt;</a>;

<a href="./link_hover_background">link-hover-background</a>: <a href="../../css_types/color">&lt;color&gt;</a> [<a href="../../css_types/percentage">&lt;percentage&gt;</a>];
<a href="./link_background_hover">link-background-hover</a>: <a href="../../css_types/color">&lt;color&gt;</a> [<a href="../../css_types/percentage">&lt;percentage&gt;</a>];

<a href="./link_hover_color">link-hover-color</a>: <a href="../../css_types/color">&lt;color&gt;</a> [<a href="../../css_types/percentage">&lt;percentage&gt;</a>];
<a href="./link_color_hover">link-color-hover</a>: <a href="../../css_types/color">&lt;color&gt;</a> [<a href="../../css_types/percentage">&lt;percentage&gt;</a>];

<a href="./link_hover_style">link-hover-style</a>: <a href="../../css_types/text_style">&lt;text-style&gt;</a>;
<a href="./link_style_hover">link-style-hover</a>: <a href="../../css_types/text_style">&lt;text-style&gt;</a>;
--8<-- "docs/snippets/syntax_block_end.md"

Visit each style's reference page to learn more about how the values are used.
Expand Down
2 changes: 1 addition & 1 deletion docs/styles/links/link_background.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,4 @@ widget.styles.link_background = Color(100, 30, 173)
## See also

- [`link-color`](./link_color.md) to set the color of link text.
- [`link-hover-background](./link_hover_background.md) to set the background color of link text when the mouse pointer is over it.
- [`link-background-hover](./link_background_hover.md) to set the background color of link text when the mouse pointer is over it.
Original file line number Diff line number Diff line change
@@ -1,53 +1,53 @@
# Link-hover-background
# Link-background-hover

The `link-hover-background` style sets the background color of the link when the mouse cursor is over the link.
The `link-background-hover` style sets the background color of the link when the mouse cursor is over the link.

!!! note

`link-hover-background` only applies to Textual action links as described in the [actions guide](../../guide/actions.md#links) and not to regular hyperlinks.
`link-background-hover` only applies to Textual action links as described in the [actions guide](../../guide/actions.md#links) and not to regular hyperlinks.

## Syntax

--8<-- "docs/snippets/syntax_block_start.md"
link-hover-background: <a href="../../css_types/color">&lt;color&gt;</a> [<a href="../../css_types/percentage">&lt;percentage&gt;</a>];
link-background-hover: <a href="../../css_types/color">&lt;color&gt;</a> [<a href="../../css_types/percentage">&lt;percentage&gt;</a>];
--8<-- "docs/snippets/syntax_block_end.md"

`link-hover-background` accepts a [`<color>`](../../css_types/color.md) (with an optional opacity level defined by a [`<percentage>`](../../css_types/percentage.md)) that is used to define the background color of text enclosed in Textual action links when the mouse pointer is over it.
`link-background-hover` accepts a [`<color>`](../../css_types/color.md) (with an optional opacity level defined by a [`<percentage>`](../../css_types/percentage.md)) that is used to define the background color of text enclosed in Textual action links when the mouse pointer is over it.

### Defaults

If not provided, a Textual action link will have `link-hover-background` set to `$accent`.
If not provided, a Textual action link will have `link-background-hover` set to `$accent`.

## Example

The example below shows some links that have their background colour changed when the mouse moves over it and it shows that there is a default color for `link-hover-background`.
The example below shows some links that have their background colour changed when the mouse moves over it and it shows that there is a default color for `link-background-hover`.

It also shows that `link-hover-background` does not affect hyperlinks.
It also shows that `link-background-hover` does not affect hyperlinks.

=== "Output"

![](./demos/link_hover_background_demo.gif)
![](./demos/link_background_hover_demo.gif)

!!! note

The GIF has reduced quality to make it easier to load in the documentation.
Try running the example yourself with `textual run docs/examples/styles/link_hover_background.py`.
Try running the example yourself with `textual run docs/examples/styles/link_background_hover.py`.

=== "link_hover_background.py"
=== "link_background_hover.py"

```py hl_lines="10-11 14-15 18-19 22-23"
--8<-- "docs/examples/styles/link_hover_background.py"
--8<-- "docs/examples/styles/link_background_hover.py"
```

1. This label has a hyperlink so it won't be affected by the `link-hover-background` rule.
2. This label has an "action link" that can be styled with `link-hover-background`.
3. This label has an "action link" that can be styled with `link-hover-background`.
4. This label has an "action link" that can be styled with `link-hover-background`.
1. This label has a hyperlink so it won't be affected by the `link-background-hover` rule.
2. This label has an "action link" that can be styled with `link-background-hover`.
3. This label has an "action link" that can be styled with `link-background-hover`.
4. This label has an "action link" that can be styled with `link-background-hover`.

=== "link_hover_background.tcss"
=== "link_background_hover.tcss"

```sass hl_lines="2 6 10"
--8<-- "docs/examples/styles/link_hover_background.tcss"
--8<-- "docs/examples/styles/link_background_hover.tcss"
```

1. This will only affect one of the labels because action links are the only links that this rule affects.
Expand All @@ -56,22 +56,22 @@ It also shows that `link-hover-background` does not affect hyperlinks.
## CSS

```sass
link-hover-background: red 70%;
link-hover-background: $accent;
link-background-hover: red 70%;
link-background-hover: $accent;
```

## Python

```py
widget.styles.link_hover_background = "red 70%"
widget.styles.link_hover_background = "$accent"
widget.styles.link_background_hover = "red 70%"
widget.styles.link_background_hover = "$accent"

# You can also use a `Color` object directly:
widget.styles.link_hover_background = Color(100, 30, 173)
widget.styles.link_background_hover = Color(100, 30, 173)
```

## See also

- [`link-background`](./link_background.md) to set the background color of link text.
- [`link-hover-color](./link_hover_color.md) to set the color of link text when the mouse pointer is over it.
- [`link-hover-style](./link_hover_style.md) to set the style of link text when the mouse pointer is over it.
- [`link-color-hover](./link_color_hover.md) to set the color of link text when the mouse pointer is over it.
- [`link-style-hover](./link_style_hover.md) to set the style of link text when the mouse pointer is over it.
2 changes: 1 addition & 1 deletion docs/styles/links/link_color.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,4 @@ widget.styles.link_color = Color(100, 30, 173)
## See also

- [`link-background`](./link_background.md) to set the background color of link text.
- [`link-hover-color](./link_hover_color.md) to set the color of link text when the mouse pointer is over it.
- [`link-color-hover](./link_color_hover.md) to set the color of link text when the mouse pointer is over it.
Loading

0 comments on commit 9dcc2fa

Please sign in to comment.