Skip to content

Commit

Permalink
✨ Python 3.12
Browse files Browse the repository at this point in the history
  • Loading branch information
juftin committed Mar 14, 2024
1 parent 00d5520 commit 08f8ee8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
17 changes: 10 additions & 7 deletions browsr/screens/code_browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,16 @@ def action_parent_dir(self) -> None:
directory_tree_open = self.code_browser.has_class("-show-tree")
if not directory_tree_open:
return
new_path = self.config_object.path.parent.resolve()
if new_path != self.config_object.path:
self.config_object.file_path = str(new_path)
self.code_browser.directory_tree.path = new_path
if (
self.code_browser.directory_tree.path
!= self.code_browser.directory_tree.path.parent
):
self.code_browser.directory_tree.path = (
self.code_browser.directory_tree.path.parent
)
self.notify(
title="Directory Changed",
message=str(new_path),
message=str(self.code_browser.directory_tree.path),
severity="information",
timeout=1,
)
Expand Down Expand Up @@ -152,9 +155,9 @@ def action_reload(self) -> None:
message_lines = []
if reload_directory:
self.code_browser.directory_tree.reload()
directory_name = self.code_browser.directory_tree.path.name or "/"
message_lines.append(
"[bold]Directory:[/bold] "
f"[italic]{self.config_object.path.name}[/italic]"
"[bold]Directory:[/bold] " f"[italic]{directory_name}[/italic]"
)
if reload_file:
selected_file_path = cast(UPath, self.code_browser.selected_file_path)
Expand Down
1 change: 0 additions & 1 deletion browsr/widgets/code_browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,6 @@ def handle_directory_double_click(
Called when the user double clicks a directory in the directory tree.
"""
self.directory_tree.path = message.path
self.config_object.file_path = str(message.path)
self.notify(
title="Directory Changed",
message=str(message.path),
Expand Down
4 changes: 1 addition & 3 deletions tests/debug_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ async def test_debug_app() -> None:
"""
Test the actual browsr app
"""
config = TextualAppContext(
file_path="github://juftin:textual-universal-directorytree@main", debug=True
)
config = TextualAppContext(file_path=".", debug=True)
app = Browsr(config_object=config)
async with app.run_test() as pilot:
_ = pilot.app

0 comments on commit 08f8ee8

Please sign in to comment.