open url
This commit is contained in:
@@ -43,6 +43,8 @@ class OneDriveTUI(App):
|
|||||||
Binding("q", "quit", "Quit"),
|
Binding("q", "quit", "Quit"),
|
||||||
Binding("r", "refresh", "Refresh"),
|
Binding("r", "refresh", "Refresh"),
|
||||||
Binding("f", "toggle_follow", "Toggle Follow"),
|
Binding("f", "toggle_follow", "Toggle Follow"),
|
||||||
|
Binding("o", "open_url", "Open URL"),
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
@@ -375,6 +377,18 @@ class OneDriveTUI(App):
|
|||||||
# Currently just a placeholder for the key binding
|
# Currently just a placeholder for the key binding
|
||||||
self.notify("Toggle follow functionality not implemented yet")
|
self.notify("Toggle follow functionality not implemented yet")
|
||||||
|
|
||||||
|
async def action_open_url(self) -> None:
|
||||||
|
"""Open the web URL of the selected item."""
|
||||||
|
table = self.query_one("#items_table")
|
||||||
|
if table.cursor_row is not None:
|
||||||
|
selected_row = table.get_row_at(table.cursor_row)
|
||||||
|
if selected_row and len(selected_row) > 4:
|
||||||
|
web_url = selected_row[4]
|
||||||
|
if web_url:
|
||||||
|
self.notify(f"Opening URL: {web_url}")
|
||||||
|
# Use Textual's built-in open_url method instead of os.system
|
||||||
|
self.app.open_url(web_url)
|
||||||
|
|
||||||
async def action_quit(self) -> None:
|
async def action_quit(self) -> None:
|
||||||
"""Quit the application."""
|
"""Quit the application."""
|
||||||
self.exit()
|
self.exit()
|
||||||
|
|||||||
Reference in New Issue
Block a user