mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
Rich log (#3046)
* log * tests * snapshot tests * change to richlog * keep raw lines * disable highlighting by default * simplify * superfluous test * optimization * update cell length * add refresh * write method * version bump * doc fix link * makes lines private * docstring * relax dev dependancy * remove superfluous code [skip ci] * added FAQ [skipci] * fix code in faq [skipci] * fix typo * max lines fix
This commit is contained in:
16
questions/no-widget-called-textlog.question.md
Normal file
16
questions/no-widget-called-textlog.question.md
Normal file
@@ -0,0 +1,16 @@
|
||||
---
|
||||
title: "No widget called TextLog"
|
||||
alt_titles:
|
||||
- "ImportError with TextLog"
|
||||
- "TextLog does not exist"
|
||||
---
|
||||
|
||||
The `TextLog` widget was renamed to `RichLog` in Textual 0.32.0.
|
||||
You will need to replace all references to `TextLog` in your code, with `RichLog`.
|
||||
Most IDEs will have a search and replace function which will help you do this.
|
||||
|
||||
Here's how you should import RichLog:
|
||||
|
||||
```python
|
||||
from textual.widgets import RichLog
|
||||
```
|
||||
@@ -30,7 +30,7 @@ Then the app can be run, passing in various arguments; for example:
|
||||
# Running with default arguments.
|
||||
Greetings().run()
|
||||
|
||||
# Running with a keyword arguyment.
|
||||
# Running with a keyword argument.
|
||||
Greetings(to_greet="davep").run()
|
||||
|
||||
# Running with both positional arguments.
|
||||
|
||||
26
questions/worker-thread-error.question.md
Normal file
26
questions/worker-thread-error.question.md
Normal file
@@ -0,0 +1,26 @@
|
||||
---
|
||||
title: "How do I fix WorkerDeclarationError?"
|
||||
alt_titles:
|
||||
- "Thread=True on Worker"
|
||||
- "Problem with threaded workers"
|
||||
---
|
||||
|
||||
Textual version 0.31.0 requires that you set `thread=True` on the `@work` decorator if you want to run a threaded worker.
|
||||
|
||||
If you want a threaded worker, you would declare it in the following way:
|
||||
|
||||
```python
|
||||
@work(thread=True)
|
||||
def run_in_background():
|
||||
...
|
||||
```
|
||||
|
||||
If you *don't* want a threaded worker, you should make your work function `async`:
|
||||
|
||||
```python
|
||||
@work()
|
||||
async def run_in_background():
|
||||
...
|
||||
```
|
||||
|
||||
This change was made because it was too easy to accidentally create a threaded worker, which may produce unexpected results.
|
||||
Reference in New Issue
Block a user