Fix tabbing
This commit is contained in:
parent
89a2668c25
commit
2c1c530f3a
4 changed files with 11 additions and 21 deletions
|
|
@ -64,10 +64,6 @@ class InspectorApp(App): # type: ignore[misc]
|
||||||
|
|
||||||
BINDINGS = [
|
BINDINGS = [
|
||||||
Binding("q", "quit", "Quit", show=True),
|
Binding("q", "quit", "Quit", show=True),
|
||||||
Binding("d", "focus_documents", "Documents", show=True),
|
|
||||||
Binding("c", "focus_chunks", "Chunks", show=True),
|
|
||||||
Binding("v", "focus_detail", "Detail", show=True),
|
|
||||||
Binding("/", "search", "Search", show=True),
|
|
||||||
]
|
]
|
||||||
|
|
||||||
def __init__(self, db_path: Path):
|
def __init__(self, db_path: Path):
|
||||||
|
|
@ -93,28 +89,15 @@ class InspectorApp(App): # type: ignore[misc]
|
||||||
doc_list = self.query_one(DocumentList)
|
doc_list = self.query_one(DocumentList)
|
||||||
await doc_list.load_documents(self.client)
|
await doc_list.load_documents(self.client)
|
||||||
|
|
||||||
|
# Focus the document list view
|
||||||
|
if doc_list.list_view:
|
||||||
|
doc_list.list_view.focus()
|
||||||
|
|
||||||
async def on_unmount(self) -> None:
|
async def on_unmount(self) -> None:
|
||||||
"""Clean up when unmounting."""
|
"""Clean up when unmounting."""
|
||||||
if self.client:
|
if self.client:
|
||||||
await self.client.__aexit__(None, None, None)
|
await self.client.__aexit__(None, None, None)
|
||||||
|
|
||||||
def action_focus_documents(self) -> None:
|
|
||||||
"""Focus the documents list."""
|
|
||||||
self.query_one(DocumentList).focus()
|
|
||||||
|
|
||||||
def action_focus_chunks(self) -> None:
|
|
||||||
"""Focus the chunks list."""
|
|
||||||
self.query_one(ChunkList).focus()
|
|
||||||
|
|
||||||
def action_focus_detail(self) -> None:
|
|
||||||
"""Focus the detail view."""
|
|
||||||
self.query_one(DetailView).focus()
|
|
||||||
|
|
||||||
def action_search(self) -> None:
|
|
||||||
"""Open search dialog."""
|
|
||||||
# TODO: Implement search dialog
|
|
||||||
pass
|
|
||||||
|
|
||||||
async def on_document_list_document_selected(
|
async def on_document_list_document_selected(
|
||||||
self, message: DocumentList.DocumentSelected
|
self, message: DocumentList.DocumentSelected
|
||||||
) -> None:
|
) -> None:
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,8 @@ from haiku.rag.store.models import Chunk
|
||||||
class ChunkList(VerticalScroll):
|
class ChunkList(VerticalScroll):
|
||||||
"""Widget for displaying and browsing chunks."""
|
"""Widget for displaying and browsing chunks."""
|
||||||
|
|
||||||
|
can_focus = False
|
||||||
|
|
||||||
class ChunkSelected(Message):
|
class ChunkSelected(Message):
|
||||||
"""Message sent when a chunk is selected."""
|
"""Message sent when a chunk is selected."""
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,8 @@ from haiku.rag.store.models import Chunk, Document
|
||||||
class DetailView(VerticalScroll):
|
class DetailView(VerticalScroll):
|
||||||
"""Widget for displaying detailed content of documents or chunks."""
|
"""Widget for displaying detailed content of documents or chunks."""
|
||||||
|
|
||||||
|
can_focus = False
|
||||||
|
|
||||||
def __init__(self, **kwargs) -> None:
|
def __init__(self, **kwargs) -> None:
|
||||||
super().__init__(**kwargs)
|
super().__init__(**kwargs)
|
||||||
self.title_widget: Static | None = None
|
self.title_widget: Static | None = None
|
||||||
|
|
@ -18,6 +20,7 @@ class DetailView(VerticalScroll):
|
||||||
self.title_widget = Static("[bold]Detail View[/bold]", classes="title")
|
self.title_widget = Static("[bold]Detail View[/bold]", classes="title")
|
||||||
yield self.title_widget
|
yield self.title_widget
|
||||||
self.content_widget = Markdown("")
|
self.content_widget = Markdown("")
|
||||||
|
self.content_widget.can_focus = True
|
||||||
yield self.content_widget
|
yield self.content_widget
|
||||||
|
|
||||||
async def show_document(self, document: Document) -> None:
|
async def show_document(self, document: Document) -> None:
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,8 @@ from haiku.rag.store.models import Document
|
||||||
class DocumentList(VerticalScroll):
|
class DocumentList(VerticalScroll):
|
||||||
"""Widget for displaying and browsing documents."""
|
"""Widget for displaying and browsing documents."""
|
||||||
|
|
||||||
|
can_focus = False
|
||||||
|
|
||||||
class DocumentSelected(Message):
|
class DocumentSelected(Message):
|
||||||
"""Message sent when a document is selected."""
|
"""Message sent when a document is selected."""
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue