Skip to content

Update textual-enhanced #101

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

Merged
merged 4 commits into from
Apr 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ authors = [
]
dependencies = [
"textual>=2.1.1",
"textual-enhanced>=0.11.0",
"textual-enhanced>=0.13.0",
"textual-fspicker>=0.4.1",
"xdg-base-dirs>=6.0.2",
"httpx>=0.28.1",
Expand Down
20 changes: 10 additions & 10 deletions requirements-dev.lock
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
-e file:.
aiohappyeyeballs==2.6.1
# via aiohttp
aiohttp==3.11.16
aiohttp==3.11.18
# via aiohttp-jinja2
# via textual-dev
# via textual-serve
Expand Down Expand Up @@ -46,7 +46,7 @@ distlib==0.3.9
# via virtualenv
filelock==3.18.0
# via virtualenv
frozenlist==1.5.0
frozenlist==1.6.0
# via aiohttp
# via aiosignal
ghp-import==2.1.0
Expand All @@ -57,7 +57,7 @@ httpcore==1.0.8
# via httpx
httpx==0.28.1
# via hike
identify==2.6.9
identify==2.6.10
# via pre-commit
idna==3.10
# via anyio
Expand Down Expand Up @@ -96,7 +96,7 @@ mkdocs==1.6.1
# via mkdocs-material
mkdocs-get-deps==0.2.0
# via mkdocs
mkdocs-material==9.6.11
mkdocs-material==9.6.12
mkdocs-material-extensions==1.3.1
# via mkdocs-material
msgpack==1.1.0
Expand All @@ -105,11 +105,11 @@ multidict==6.4.3
# via aiohttp
# via yarl
mypy==1.15.0
mypy-extensions==1.0.0
mypy-extensions==1.1.0
# via mypy
nodeenv==1.9.1
# via pre-commit
packaging==24.2
packaging==25.0
# via mkdocs
# via pytest
paginate==0.5.7
Expand Down Expand Up @@ -154,18 +154,18 @@ six==1.17.0
# via python-dateutil
sniffio==1.3.1
# via anyio
textual==3.1.0
textual==3.1.1
# via hike
# via textual-dev
# via textual-enhanced
# via textual-fspicker
# via textual-serve
textual-dev==1.7.0
textual-enhanced==0.11.0
textual-enhanced==0.13.0
# via hike
textual-fspicker==0.4.1
# via hike
textual-serve==1.1.1
textual-serve==1.1.2
# via textual-dev
typing-extensions==4.13.2
# via hike
Expand All @@ -182,5 +182,5 @@ watchdog==6.0.0
# via mkdocs
xdg-base-dirs==6.0.2
# via hike
yarl==1.19.0
yarl==1.20.0
# via aiohttp
4 changes: 2 additions & 2 deletions requirements.lock
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ rich==14.0.0
# via textual
sniffio==1.3.1
# via anyio
textual==3.1.0
textual==3.1.1
# via hike
# via textual-enhanced
# via textual-fspicker
textual-enhanced==0.11.0
textual-enhanced==0.13.0
# via hike
textual-fspicker==0.4.1
# via hike
Expand Down
19 changes: 0 additions & 19 deletions src/hike/screens/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,64 +382,53 @@ def check_action(self, action: str, parameters: tuple[object, ...]) -> bool | No
return self.query_one(Viewer).location is not None
return True

@on(Reload)
def action_reload_command(self) -> None:
"""Reload the current document."""
self.query_one(Viewer).reload()

@on(SearchBookmarks)
def action_search_bookmarks_command(self) -> None:
"""Search the bookmarks in the command palette."""
self.show_palette(BookmarkCommands)

@on(SearchHistory)
def action_search_history_command(self) -> None:
"""search the history in the command palette."""
self.show_palette(HistoryCommands)

@on(ToggleNavigation)
def action_toggle_navigation_command(self) -> None:
"""Toggle the display of the navigation panel."""
self.navigation_visible = not self.navigation_visible

@on(ChangeNavigationSide)
def action_change_navigation_side_command(self) -> None:
"""Change the side that the navigation panel lives on."""
navigation = self.query_one(Navigation)
navigation.dock_right = not navigation.dock_right
with update_configuration() as config:
config.navigation_on_right = navigation.dock_right

@on(ChangeCommandLineLocation)
def action_change_command_line_location_command(self) -> None:
"""Change the location of the command line."""
command_line = self.query_one(CommandLine)
command_line.dock_top = not command_line.dock_top
with update_configuration() as config:
config.command_line_on_top = command_line.dock_top

@on(JumpToCommandLine)
def action_jump_to_command_line_command(self) -> None:
"""Jump to the command line."""
if self.AUTO_FOCUS:
self.query_one(self.AUTO_FOCUS).focus()

@on(JumpToDocument)
def action_jump_to_document_command(self) -> None:
"""Jump to the document."""
self.query_one(Viewer).focus()

@on(Backward)
def action_backward_command(self) -> None:
"""Move backward through history."""
self.query_one(Viewer).backward()

@on(Forward)
def action_forward_command(self) -> None:
"""Move forward through history."""
self.query_one(Viewer).forward()

@on(BookmarkLocation)
@work
async def action_bookmark_location_command(self) -> None:
"""Add the current location to the bookmarks."""
Expand Down Expand Up @@ -468,42 +457,34 @@ def _with_navigation_visible(self) -> Navigation:
self.navigation_visible = True
return self.query_one(Navigation)

@on(JumpToTableOfContents)
def action_jump_to_table_of_contents_command(self) -> None:
"""Jump to the table of contents."""
self._with_navigation_visible().jump_to_content()

@on(JumpToLocalBrowser)
def action_jump_to_local_browser_command(self) -> None:
"""Jump to the local browser."""
self._with_navigation_visible().jump_to_local()

@on(JumpToBookmarks)
def action_jump_to_bookmarks_command(self) -> None:
"""Jump to the bookmarks."""
self._with_navigation_visible().jump_to_bookmarks()

@on(JumpToHistory)
def action_jump_to_history_command(self) -> None:
"""Jump to the history."""
self._with_navigation_visible().jump_to_history()

@on(CopyLocationToClipboard)
def action_copy_location_to_clipboard_command(self) -> None:
"""Copy the current location to the clipboard."""
self.post_message(CopyToClipboard(str(self.query_one(Viewer).location)))

@on(CopyMarkdownToClipboard)
def action_copy_markdown_to_clipboard_command(self) -> None:
"""Copy the current markdown to the clipboard."""
self.post_message(CopyToClipboard(self.query_one(Viewer).source))

@on(Edit)
def action_edit_command(self) -> None:
"""Edit the current markdown document, if possible."""
self.query_one(Viewer).edit()

@on(SaveCopy)
@work
async def action_save_copy_command(self) -> None:
"""Save a copy of the current document to a new file."""
Expand Down
3 changes: 1 addition & 2 deletions src/hike/support/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@

##############################################################################
# Local imports.
from .history import History
from .mouse import is_copy_request_click
from .view_in_browser import view_in_browser

##############################################################################
# Exports.
__all__ = ["History", "is_copy_request_click", "view_in_browser"]
__all__ = ["is_copy_request_click", "view_in_browser"]

### __init__.py ends here
129 changes: 0 additions & 129 deletions src/hike/support/history.py

This file was deleted.

4 changes: 2 additions & 2 deletions src/hike/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
from httpx import URL

##############################################################################
# Local imports.
from .support import History
# Textual enhanced imports.
from textual_enhanced.tools import History

##############################################################################
HikeLocation: TypeAlias = Path | URL
Expand Down
Loading
Loading