Merge branch 'main' of github.com:Textualize/textual into more-testing

This commit is contained in:
Darren Burns
2022-10-24 11:16:56 +01:00
124 changed files with 1989 additions and 3808 deletions

View File

@@ -2,4 +2,7 @@
{% block extrahead %}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/firacode/6.2.0/fira_code.min.css" integrity="sha512-MbysAYimH1hH2xYzkkMHB6MqxBqfP0megxsCLknbYqHVwXTCg9IqHbk+ZP/vnhO8UEW6PaXAkKe2vQ+SWACxxA==" crossorigin="anonymous" referrerpolicy="no-referrer" />
<!-- Fathom - beautiful, simple website analytics -->
<script src="https://cdn.usefathom.com/script.js" data-site="TAUKXRLQ" defer></script>
<!-- / Fathom -->
{% endblock %}

View File

@@ -25,18 +25,59 @@ You can install Textual via PyPI.
If you plan on developing Textual apps, then you should install `textual[dev]`. The `[dev]` part installs a few extra dependencies for development.
```
pip install "textual[dev]==0.2.0b7"
pip install "textual[dev]"
```
If you only plan on _running_ Textual apps, then you can drop the `[dev]` part:
```
pip install textual==0.2.0b7
pip install textual
```
!!! important
## Demo
Once you have Textual installed, run the following to get an impression of what it can do:
```bash
python -m textual
```
If Textual is installed you should see the following:
```{.textual path="src/textual/demo.py" columns="127" lines="53" press="enter,_,_,_,_,_,_,tab,_,w,i,l,l"}
```
## Examples
The Textual repository comes with a number of example apps. To try out the examples, first clone the Textual repository:
=== "HTTPS"
```bash
git clone https://github.com/Textualize/textual.git
```
=== "SSH"
```bash
git clone git@github.com:Textualize/textual.git
```
=== "GitHub CLI"
```bash
gh repo clone Textualize/textual
```
With the repository cloned, navigate to the `/examples/` directory where you fill find a number of Python files you can run from the command line:
```bash
cd textual/examples/
python code_browser.py ../
```
There may be a more recent beta version since the time of writing. Check the [release history](https://pypi.org/project/textual/#history) for a more recent version.
## Textual CLI

View File

@@ -1 +0,0 @@
# Animation

View File

@@ -1,3 +0,0 @@
# How to ...
For those who want more focused information on Textual features.

View File

@@ -1 +0,0 @@
# Mouse and Keyboard

View File

@@ -1 +0,0 @@
# Scroll

View File

@@ -8,13 +8,21 @@ We have many new features in the pipeline. This page will keep track of that wor
High-level features we plan on implementing.
- [ ] Accessibility
* [ ] Integration with screen readers
* [x] Monochrome mode
* [ ] High contrast theme
* [ ] Color blind themes
- [ ] Command interface
* [ ] Command menu
* [ ] Fuzzy search
- [ ] Configuration (.toml based extensible configuration format)
- [x] Devtools
* [ ] Browser-inspired devtools interface with integrated DOM view, log, and REPL
- [ ] Reactive state
- [x] Console
- [ ] Devtools
* [ ] Integrated log
* [ ] DOM tree view
* [ ] REPL
- [ ] Reactive state abstraction
- [x] Themes
* [ ] Customize via config
* [ ] Builtin theme editor
@@ -40,25 +48,26 @@ Widgets are key to making user friendly interfaces. The builtin widgets should c
* [ ] Export to `attrs` objects
* [ ] Export to `PyDantic` objects
- [ ] Image support
- [ ] Half block
- [ ] Braile
- [ ] Sixels, and other image extensions
* [ ] Half block
* [ ] Braille
* [ ] Sixels, and other image extensions
- [x] Input
* [ ] Validation
* [ ] Error / warning states
* [ ] Template types: IP address, physical units (weight, volume), currency, credit card etc
- [ ] Markdown viewer (more dynamic than Rich markdown, with scrollable code areas / collapseable sections)
- [ ] Markdown viewer (more dynamic than Rich markdown, with scrollable code areas / collapsible sections)
- [ ] Plots
- [ ] bar chart
- [ ] line chart
- [ ] Candlestick chars
* [ ] bar chart
* [ ] line chart
* [ ] Candlestick chars
- [ ] Progress bars
* [ ] Style variants (solid, thin etc)
- [ ] Radio boxes
- [ ] Sparklines
- [ ] Spark-lines
- [ ] Tabs
- [ ] TextArea (multi-line input)
* [ ] Basic controls
* [ ] Syntax highlighting
* [ ] Indentation guides
* [ ] Smart features for various languages
* [ ] Syntax highlighting

View File

@@ -35,13 +35,13 @@ If you want to try the finished Stopwatch app and follow along with the code, fi
=== "HTTPS"
```bash
git clone -b css https://github.com/Textualize/textual.git
git clone https://github.com/Textualize/textual.git
```
=== "SSH"
```bash
git clone -b css git@github.com:Textualize/textual.git
git clone git@github.com:Textualize/textual.git
```
=== "GitHub CLI"
@@ -222,7 +222,7 @@ If we run the app now, it will look *very* different.
```{.textual path="docs/examples/tutorial/stopwatch03.py" title="stopwatch03.py"}
```
This app looks much more like our sketch. Let's look at how the Textual uses `stopwatch03.css` to apply styles.
This app looks much more like our sketch. Let's look at how Textual uses `stopwatch03.css` to apply styles.
### CSS basics
@@ -381,14 +381,15 @@ We've seen how we can update widgets with a timer, but we still need to wire up
We need to be able to start, stop, and reset each stopwatch independently. We can do this by adding a few more methods to the `TimeDisplay` class.
```python title="stopwatch06.py" hl_lines="14 18 30-44 50-61"
```python title="stopwatch06.py" hl_lines="14 18 22 30-44 50-61"
--8<-- "docs/examples/tutorial/stopwatch06.py"
```
Here's a summary of the changes made to `TimeDisplay`.
- We've added a `total` reactive attribute to store the total time elapsed between clicking that start and stop buttons.
- We've added a `total` reactive attribute to store the total time elapsed between clicking the start and stop buttons.
- The call to `set_interval` has grown a `pause=True` argument which starts the timer in pause mode (when a timer is paused it won't run until [resume()][textual.timer.Timer.resume] is called). This is because we don't want the time to update until the user hits the start button.
- The `update_time` method now adds `total` to the current time to account for the time between any previous clicks of the start and stop buttons.
- We've stored the result of `set_interval` which returns a Timer object. We will use this later to _resume_ the timer when we start the Stopwatch.
- We've added `start()`, `stop()`, and `reset()` methods.