Rename SearchContext.properties to SearchContext.addon_metadata

This commit is contained in:
Jonathan Schoreels 2025-04-25 09:48:02 +02:00
parent a993577279
commit 3fbf6d8253
3 changed files with 7 additions and 6 deletions

View file

@ -29,7 +29,7 @@ class SearchContext:
browser: aqt.browser.Browser browser: aqt.browser.Browser
order: bool | str | Column = True order: bool | str | Column = True
reverse: bool = False reverse: bool = False
properties: dict | None = None addon_metadata: dict | None = None
# if set, provided ids will be used instead of the regular search # if set, provided ids will be used instead of the regular search
ids: Sequence[ItemId] | None = None ids: Sequence[ItemId] | None = None

View file

@ -269,7 +269,7 @@ class DataModel(QAbstractTableModel):
# invalid sort column in config # invalid sort column in config
context.order = self.columns["noteCrt"] context.order = self.columns["noteCrt"]
context.reverse = self._state.sort_backwards context.reverse = self._state.sort_backwards
context.properties = {} context.addon_metadata = {}
gui_hooks.browser_will_search(context) gui_hooks.browser_will_search(context)
if context.ids is None: if context.ids is None:
context.ids = self._state.find_items( context.ids = self._state.find_items(

View file

@ -549,8 +549,9 @@ hooks = [
You can modify context.search to change the text that is sent to the You can modify context.search to change the text that is sent to the
searching backend. searching backend.
If you need to pass properties to the browser_did_search hook, you can If you need to pass metadata to the browser_did_search hook, you can
do it with context.properties do it with context.addon_metadata. For example, to trigger filtering
based on a new custom filter.
If you set context.ids to a list of ids, the regular search will If you set context.ids to a list of ids, the regular search will
not be performed, and the provided ids will be used instead. not be performed, and the provided ids will be used instead.
@ -581,8 +582,8 @@ hooks = [
backend did not recognize will be returned as an empty string, and can be backend did not recognize will be returned as an empty string, and can be
replaced with custom content. replaced with custom content.
You can retrieve properties passed from browser_will_search with You can retrieve metadata passed from browser_will_search with
context.properties (for example to trigger post-processing filtering) context.addon_metadata (for example to trigger post-processing filtering).
Columns is a list of string values identifying what each column in the row Columns is a list of string values identifying what each column in the row
represents. represents.