Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversion of Segments to Windows Console API calls on legacy Windows platform #1993

Merged
merged 27 commits into from Mar 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
1a11ea3
Conversion of Segments to legacy Windows API calls
darrenburns Mar 1, 2022
fe57132
Add None windll definition for mypy
darrenburns Mar 1, 2022
ffc5813
Attempting to appease mypy on non-Windows platforms
darrenburns Mar 1, 2022
fb227b8
Use type of Any for windll
darrenburns Mar 1, 2022
e384106
On legacy Windows, we sometimes still need ANSI output...
darrenburns Mar 1, 2022
78fc8d9
Only calling Windows legacy console API if Console.file is stdout
darrenburns Mar 1, 2022
1d38b45
Handling utf-8 error in check_buffer consistently across Windows & Unix
darrenburns Mar 1, 2022
6779e51
Don't default to outputting ANSI just because Console.record=True
darrenburns Mar 1, 2022
bb9ab3c
Merge branch 'master' of https://github.com/Textualize/rich into ansi…
darrenburns Mar 1, 2022
501dcbd
Add tests for LegacyWindowsTerm
darrenburns Mar 1, 2022
97d05f5
Fixing test module on non-Windows platforms
darrenburns Mar 1, 2022
7d08e0a
Fixing test module on non-Windows platforms
darrenburns Mar 1, 2022
151276b
Run legacy Windows tests on Windows only
darrenburns Mar 2, 2022
862416a
Fix typing issues
darrenburns Mar 2, 2022
7525377
Use Python 3.6 & 3.7 compatible means of acceessing mock call args/kw…
darrenburns Mar 2, 2022
80912a5
Update CHANGELOG.md
darrenburns Mar 2, 2022
28786c7
Merge branch 'ansi-to-win32' of https://github.com/Textualize/rich in…
darrenburns Mar 2, 2022
ceef724
Use Windows Console API to write text
darrenburns Mar 3, 2022
1122501
Use WriteConsoleW instead of file.write(...) in LegacyWindowsTerm
darrenburns Mar 3, 2022
d87498b
Use bitwise operators in LegacyWindowsTerm, fix formatting
darrenburns Mar 3, 2022
5a051f9
Make GetConsoleMode Windows Console wrapper more Pythonic
darrenburns Mar 3, 2022
8f738c7
Support reverse, bold (bright), and dim
darrenburns Mar 3, 2022
ca3e966
Handle legacy windows error
darrenburns Mar 3, 2022
81c4dc4
Add docstrings to Windows console wrapper functions
darrenburns Mar 3, 2022
9b76da2
Merge pull request #2019 from Textualize/ansi-to-win32_pull-request-f…
darrenburns Mar 7, 2022
8fe170a
Merge branch 'master' into ansi-to-win32
willmcgugan Mar 9, 2022
91e0146
check win32
willmcgugan Mar 9, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -2,6 +2,7 @@
.pytype
.DS_Store
.vscode
.idea/
mypy_report
docs/build
docs/source/_build
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added ProgressColumn `MofNCompleteColumn` to display raw `completed/total` column (similar to DownloadColumn,
but displays values as ints, does not convert to floats or add bit/bytes units).
https://github.com/Textualize/rich/pull/1941
- Remove Colorama dependency, call Windows Console API from Rich https://github.com/Textualize/rich/pull/1993
- Add support for namedtuples to `Pretty` https://github.com/Textualize/rich/pull/2031

### Fixed
Expand Down
3 changes: 0 additions & 3 deletions mypy.ini
Expand Up @@ -9,8 +9,5 @@ ignore_missing_imports = True
[mypy-commonmark.*]
ignore_missing_imports = True

[mypy-colorama.*]
ignore_missing_imports = True

[mypy-ipywidgets.*]
ignore_missing_imports = True
65 changes: 55 additions & 10 deletions poetry.lock

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion pyproject.toml
Expand Up @@ -31,7 +31,6 @@ typing-extensions = { version = ">=3.7.4, <5.0", python = "<3.8" }
dataclasses = { version = ">=0.7,<0.9", python = "<3.7" }
pygments = "^2.6.0"
commonmark = "^0.9.0"
colorama = "^0.4.0"
ipywidgets = { version = "^7.5.1", optional = true }


Expand Down
5 changes: 1 addition & 4 deletions rich/__main__.py
Expand Up @@ -226,10 +226,7 @@ def iter_last(values: Iterable[T]) -> Iterable[Tuple[bool, T]]:
console.print(test_card)
taken = round((process_time() - start) * 1000.0, 1)

text = console.file.getvalue()
# https://bugs.python.org/issue37871
for line in text.splitlines(True):
print(line, end="")
Console().print(test_card)

print(f"rendered in {pre_cache_taken}ms (cold cache)")
print(f"rendered in {taken}ms (warm cache)")
Expand Down