new release

This commit is contained in:
Will McGugan 2020-02-04 18:26:53 +00:00
parent 1b5dbae4ac
commit 132c46940b
8 changed files with 22 additions and 33 deletions

View File

@ -10,6 +10,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
- Fixed Windows color support
- Fixed line width on windows issue (https://github.com/willmcgugan/rich/issues/7)
- Fixed Pretty print on Windows
## [0.3.2] - 2020-01-26

View File

@ -1,26 +0,0 @@
<!DOCTYPE html>
<head>
<style>
body {
color: #000000;
background-color: #ffffff;
}
</style>
</head>
<html>
<body>
<code>
<pre style="font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace"><span style="font-style: italic"> Star Wars Movies </span>
┏━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┓
<span style="font-weight: bold"> Released </span><span style="font-weight: bold"> Title </span><span style="font-weight: bold"> Box Office </span>
┡━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━┩
<span style="color: #008080"> Dec 20, 2019 </span><span style="color: #800080"> Star Wars: The Rise of Skywalker </span><span style="color: #008000"> $952,110,690 </span>
<span style="color: #008080"> May 25, 2018 </span><span style="color: #800080"> Solo: A Star Wars Story </span><span style="color: #008000"> $393,151,347 </span>
<span style="color: #008080"> Dec 15, 2017 </span><span style="color: #800080"> Star Wars Ep. V111: The Last Jedi </span><span style="color: #008000"> $1,332,539,889 </span>
<span style="color: #008080"> Dec 16, 2016 </span><span style="color: #800080"> Rouge One: A Star Wars Story </span><span style="color: #008000"> $1,332,439,889 </span>
└──────────────┴───────────────────────────────────┴────────────────┘
</pre>
</code>
</body>
</html>

View File

@ -2,11 +2,23 @@
name = "rich"
homepage = "https://github.com/willmcgugan/rich"
documentation = "https://rich.readthedocs.io/en/latest/"
version = "0.3.2"
version = "0.3.3"
description = "Render rich text, tables, syntax highlighting, markdown and more to the terminal"
authors = ["Will McGugan <willmcgugan@gmail.com>"]
license = "MIT"
readme = "README.md"
classifiers = [
"Development Status :: 3 - Alpha",
"Environment :: Console",
"Intended Audience :: Developers",
"Operating System :: Microsoft :: Windows",
"Operating System :: MacOS",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
]
[tool.poetry.dependencies]
python = "^3.6"

View File

@ -398,6 +398,8 @@ class Color(NamedTuple):
def downgrade(self, system: ColorSystem) -> "Color":
"""Downgrade a color system to a system with fewer colors."""
if self.type == ColorType.DEFAULT or self.type == system:
return self
# Convert to 8-bit color from truecolor color
if system == ColorSystem.EIGHT_BIT and self.system == ColorSystem.TRUECOLOR:
assert self.triplet is not None

View File

@ -316,8 +316,8 @@ class Console:
return ConsoleDimensions(self._width, self._height)
width, height = shutil.get_terminal_size()
if WINDOWS:
width -= 1
# Fixes Issue with Windows console (https://github.com/willmcgugan/rich/issues/7)
width -= 1
return ConsoleDimensions(
width if self._width is None else self._width,
height if self._height is None else self._height,

View File

@ -19,6 +19,7 @@ class Pretty:
self, console: "Console", options: "ConsoleOptions"
) -> "RenderResult":
pretty_str = pformat(self._object, width=options.max_width)
pretty_str = pretty_str.replace("\r", "")
pretty_text = self.highlighter(pretty_str)
yield pretty_text

View File

@ -88,7 +88,7 @@ class Segment(NamedTuple):
"""
line_length = sum(len(text) for text, _style in line)
if line_length < length:
return line[:] + [Segment(" " * (length - line_length), style)]
return line + [Segment(" " * (length - line_length), style)]
elif line_length > length:
line_length = 0
new_line: List[Segment] = []
@ -103,7 +103,7 @@ class Segment(NamedTuple):
append(Segment(text[: length - line_length], style))
break
return new_line
return line
return line[:]
@classmethod
def get_line_length(cls, line: List["Segment"]) -> int:

View File

@ -480,8 +480,6 @@ class Text:
break
span = new_span
line_index += 1
# if line_index >= len(line_ranges):
# break
line_start, line_end = line_ranges[line_index]
return new_lines