mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
simplify
This commit is contained in:
@@ -31,9 +31,15 @@ class CodeBrowser(App):
|
|||||||
def on_directory_tree_file_click(self, event: DirectoryTree.FileClick) -> None:
|
def on_directory_tree_file_click(self, event: DirectoryTree.FileClick) -> None:
|
||||||
code_view = self.query_one("#code", Static)
|
code_view = self.query_one("#code", Static)
|
||||||
try:
|
try:
|
||||||
syntax = Syntax.from_path(event.path, line_numbers=True, word_wrap=True)
|
syntax = Syntax.from_path(
|
||||||
|
event.path,
|
||||||
|
line_numbers=True,
|
||||||
|
word_wrap=True,
|
||||||
|
indent_guides=True,
|
||||||
|
theme="monokai",
|
||||||
|
)
|
||||||
except Exception:
|
except Exception:
|
||||||
code_view.update(Traceback())
|
code_view.update(Traceback(theme="monokai", width=None))
|
||||||
self.sub_title = "ERROR"
|
self.sub_title = "ERROR"
|
||||||
else:
|
else:
|
||||||
code_view.update(syntax)
|
code_view.update(syntax)
|
||||||
|
|||||||
@@ -581,7 +581,7 @@ class Widget(DOMNode):
|
|||||||
Returns:
|
Returns:
|
||||||
Region: Screen region that contains a widget's content.
|
Region: Screen region that contains a widget's content.
|
||||||
"""
|
"""
|
||||||
content_region = self.region.shrink(self.gutter)
|
content_region = self.region.shrink(self.styles.gutter)
|
||||||
return content_region
|
return content_region
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
|||||||
Reference in New Issue
Block a user