mirror of https://github.com/Textualize/rich.git
Merge branch 'master' of github.com:willmcgugan/rich
This commit is contained in:
commit
2344cd889d
|
@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
|
|
||||||
- Change the render prefix to correspond to the decimal units in progress
|
- Change the render prefix to correspond to the decimal units in progress
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Fixed typo in `Style.transparent_background` method name.
|
||||||
|
|
||||||
## [8.0.0] - 2020-10-03
|
## [8.0.0] - 2020-10-03
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
|
@ -620,7 +620,7 @@ class Console:
|
||||||
return ConsoleDimensions(80, 25)
|
return ConsoleDimensions(80, 25)
|
||||||
|
|
||||||
width, height = shutil.get_terminal_size()
|
width, height = shutil.get_terminal_size()
|
||||||
# get_terminal_size can report 0, 0 if run from psuedo-terminal
|
# get_terminal_size can report 0, 0 if run from pseudo-terminal
|
||||||
width = width or 80
|
width = width or 80
|
||||||
height = height or 25
|
height = height or 25
|
||||||
return ConsoleDimensions(
|
return ConsoleDimensions(
|
||||||
|
@ -749,7 +749,7 @@ class Console:
|
||||||
is required, such as the Panel class which draws a border around any renderable object.
|
is required, such as the Panel class which draws a border around any renderable object.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
renderables (Iterable[RenderableType]): Any object or objects renderable in the console.
|
renderable (RenderableType): Any object renderable in the console.
|
||||||
options (Optional[ConsoleOptions], optional): Console options, or None to use self.options. Default to ``None``.
|
options (Optional[ConsoleOptions], optional): Console options, or None to use self.options. Default to ``None``.
|
||||||
style (Style, optional): Optional style to apply to renderables. Defaults to ``None``.
|
style (Style, optional): Optional style to apply to renderables. Defaults to ``None``.
|
||||||
pad (bool, optional): Pad lines shorter than render width. Defaults to ``True``.
|
pad (bool, optional): Pad lines shorter than render width. Defaults to ``True``.
|
||||||
|
@ -858,7 +858,7 @@ class Console:
|
||||||
"""Combined a number of renderables and text in to one renderable.
|
"""Combined a number of renderables and text in to one renderable.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
renderables (Iterable[Union[str, ConsoleRenderable]]): Anything that Rich can render.
|
objects (Iterable[Any]): Anything that Rich can render.
|
||||||
sep (str, optional): String to write between print data. Defaults to " ".
|
sep (str, optional): String to write between print data. Defaults to " ".
|
||||||
end (str, optional): String to write at end of print data. Defaults to "\\n".
|
end (str, optional): String to write at end of print data. Defaults to "\\n".
|
||||||
justify (str, optional): One of "left", "right", "center", or "full". Defaults to ``None``.
|
justify (str, optional): One of "left", "right", "center", or "full". Defaults to ``None``.
|
||||||
|
@ -1366,7 +1366,7 @@ class Console:
|
||||||
clear (bool, optional): Clear record buffer after exporting. Defaults to ``True``.
|
clear (bool, optional): Clear record buffer after exporting. Defaults to ``True``.
|
||||||
code_format (str, optional): Format string to render HTML, should contain {foreground}
|
code_format (str, optional): Format string to render HTML, should contain {foreground}
|
||||||
{background} and {code}.
|
{background} and {code}.
|
||||||
inline_styes (bool, optional): If ``True`` styles will be inlined in to spans, which makes files
|
inline_styles (bool, optional): If ``True`` styles will be inlined in to spans, which makes files
|
||||||
larger but easier to cut and paste markup. If ``False``, styles will be embedded in a style tag.
|
larger but easier to cut and paste markup. If ``False``, styles will be embedded in a style tag.
|
||||||
Defaults to False.
|
Defaults to False.
|
||||||
|
|
||||||
|
|
|
@ -359,7 +359,7 @@ def pretty_repr(
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
_object (Any): Object to repr.
|
_object (Any): Object to repr.
|
||||||
max_width (int, optional): Diresired maximum width of repr string. Defaults to 80.
|
max_width (int, optional): Desired maximum width of repr string. Defaults to 80.
|
||||||
indent_size (int, optional): Number of spaces to indent. Defaults to 4.
|
indent_size (int, optional): Number of spaces to indent. Defaults to 4.
|
||||||
expand_all (bool, optional): Expand all containers regardless of available width. Defaults to False.
|
expand_all (bool, optional): Expand all containers regardless of available width. Defaults to False.
|
||||||
|
|
||||||
|
|
|
@ -345,7 +345,7 @@ class Style:
|
||||||
return self._link
|
return self._link
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def transaprent_background(self) -> bool:
|
def transparent_background(self) -> bool:
|
||||||
"""Check if the style specified a transparent background."""
|
"""Check if the style specified a transparent background."""
|
||||||
return self.bgcolor is None or self.bgcolor.is_default
|
return self.bgcolor is None or self.bgcolor.is_default
|
||||||
|
|
||||||
|
|
|
@ -353,7 +353,7 @@ class Syntax(JupyterMixin):
|
||||||
|
|
||||||
base_style = self._get_base_style()
|
base_style = self._get_base_style()
|
||||||
justify: JustifyMethod = (
|
justify: JustifyMethod = (
|
||||||
"default" if base_style.transaprent_background else "left"
|
"default" if base_style.transparent_background else "left"
|
||||||
)
|
)
|
||||||
|
|
||||||
text = Text(
|
text = Text(
|
||||||
|
@ -401,7 +401,7 @@ class Syntax(JupyterMixin):
|
||||||
def _get_number_styles(self, console: Console) -> Tuple[Style, Style, Style]:
|
def _get_number_styles(self, console: Console) -> Tuple[Style, Style, Style]:
|
||||||
"""Get background, number, and highlight styles for line numbers."""
|
"""Get background, number, and highlight styles for line numbers."""
|
||||||
background_style = self._get_base_style()
|
background_style = self._get_base_style()
|
||||||
if background_style.transaprent_background:
|
if background_style.transparent_background:
|
||||||
return Style.null(), Style(dim=True), Style.null()
|
return Style.null(), Style(dim=True), Style.null()
|
||||||
if console.color_system in ("256", "truecolor"):
|
if console.color_system in ("256", "truecolor"):
|
||||||
number_style = Style.chain(
|
number_style = Style.chain(
|
||||||
|
@ -428,7 +428,7 @@ class Syntax(JupyterMixin):
|
||||||
def __rich_console__(
|
def __rich_console__(
|
||||||
self, console: Console, options: ConsoleOptions
|
self, console: Console, options: ConsoleOptions
|
||||||
) -> RenderResult:
|
) -> RenderResult:
|
||||||
transparent_background = self._get_base_style().transaprent_background
|
transparent_background = self._get_base_style().transparent_background
|
||||||
code_width = (
|
code_width = (
|
||||||
(options.max_width - self._numbers_column_width - 1)
|
(options.max_width - self._numbers_column_width - 1)
|
||||||
if self.code_width is None
|
if self.code_width is None
|
||||||
|
|
|
@ -9,8 +9,6 @@ from typing import Callable, Dict, List, Optional, Type
|
||||||
|
|
||||||
from pygments.lexers import guess_lexer_for_filename
|
from pygments.lexers import guess_lexer_for_filename
|
||||||
from pygments.token import (
|
from pygments.token import (
|
||||||
Comment,
|
|
||||||
Generic,
|
|
||||||
Keyword,
|
Keyword,
|
||||||
Name,
|
Name,
|
||||||
Number,
|
Number,
|
||||||
|
@ -212,7 +210,7 @@ class Traceback:
|
||||||
traceback: Optional[TracebackType],
|
traceback: Optional[TracebackType],
|
||||||
show_locals: bool = False,
|
show_locals: bool = False,
|
||||||
) -> Trace:
|
) -> Trace:
|
||||||
"""Extrace traceback information.
|
"""Extract traceback information.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
exc_type (Type[BaseException]): Exception type.
|
exc_type (Type[BaseException]): Exception type.
|
||||||
|
@ -342,7 +340,7 @@ class Traceback:
|
||||||
if syntax_error.filename != "<stdin>":
|
if syntax_error.filename != "<stdin>":
|
||||||
text = Text.assemble(
|
text = Text.assemble(
|
||||||
(f" {syntax_error.filename}", "pygments.string"),
|
(f" {syntax_error.filename}", "pygments.string"),
|
||||||
(":", "pgments.text"),
|
(":", "pygments.text"),
|
||||||
(str(syntax_error.lineno), "pygments.number"),
|
(str(syntax_error.lineno), "pygments.number"),
|
||||||
style="pygments.text",
|
style="pygments.text",
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue