This commit is contained in:
Kovid Goyal 2025-12-02 17:26:37 +05:30
parent 98094724e8
commit 8987b77f2b
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
3 changed files with 10 additions and 1 deletions

View File

@ -122,6 +122,9 @@ class Input(QWidget):
b.clicked.connect(self.send_requested)
l.addWidget(b, alignment=Qt.AlignmentFlag.AlignCenter)
def setFocus(self, reason) -> None:
self.text_input.setFocus(reason)
@property
def value(self) -> str:
return self.text_input.value
@ -161,6 +164,9 @@ class ChatWidget(QWidget):
self.setSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Expanding)
self.line_spacing = self.browser.fontMetrics().lineSpacing()
def setFocus(self, reason) -> None:
self.input.setFocus(reason)
def wrap_content_in_padding_table(self, html: str, background_color: str = '') -> str:
style = f'style="background-color: {background_color}"' if background_color else ''
return f'''<table width="100%" {style} cellpadding="2"><tr><td>{html}</td></tr></table>'''

View File

@ -259,7 +259,7 @@ class LLMBookDialog(Dialog):
self.llm.close_requested.connect(self.accept)
l.addWidget(llm)
self.bb.setVisible(False)
self.llm.result_display.input.text_input.setFocus(Qt.FocusReason.OtherFocusReason)
self.llm.result_display.input.setFocus(Qt.FocusReason.OtherFocusReason)
def sizeHint(self):
return QSize(600, 750)

View File

@ -240,6 +240,9 @@ class ConverseWidget(QWidget):
self.show_initial_message()
self.update_cost()
def setFocus(self, reason) -> None:
self.result_display.input.setFocus(reason)
def language_instruction(self):
lang = ui_language_as_english()
return f'If you can speak in {lang}, then respond in {lang}.'