mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 22:42:25 -04:00
Add browserSearch bridge command
This commit is contained in:
parent
ef9f6b022b
commit
fdf4c6628f
1 changed files with 9 additions and 0 deletions
|
@ -51,6 +51,7 @@ class NewDeckStats(QDialog):
|
||||||
gui_hooks.stats_dialog_will_show(self)
|
gui_hooks.stats_dialog_will_show(self)
|
||||||
self.show()
|
self.show()
|
||||||
self.refresh()
|
self.refresh()
|
||||||
|
self.form.web.set_bridge_command(self._on_bridge_cmd, self)
|
||||||
self.activateWindow()
|
self.activateWindow()
|
||||||
|
|
||||||
def reject(self):
|
def reject(self):
|
||||||
|
@ -89,6 +90,14 @@ class NewDeckStats(QDialog):
|
||||||
def changeScope(self, type):
|
def changeScope(self, type):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def _on_bridge_cmd(self, cmd: str) -> bool:
|
||||||
|
if cmd.startswith("browserSearch"):
|
||||||
|
_, query = cmd.split(':', 1)
|
||||||
|
browser = aqt.dialogs.open("Browser", self.mw)
|
||||||
|
browser.search_for(query)
|
||||||
|
|
||||||
|
return False
|
||||||
|
|
||||||
def refresh(self):
|
def refresh(self):
|
||||||
self.form.web.load_ts_page("graphs")
|
self.form.web.load_ts_page("graphs")
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue