eye.helpers.file_search_plugins.base module

class eye.helpers.file_search_plugins.base.SearchPlugin(*args, **kwargs)[source]

Bases: QObject

Search plugin abstract class

enabled = True

Whether the plugin is enabled

finished = Signal(int)

Signal finished(res)

The signal is emitted when the search is finished and no more results are emitted.

Parameters:

res (int) – the search exit code, a non-zero value in case errors were encountered

found = Signal(dict)

Signal found(res)

The signal is emitted when a search result is found.

Parameters:

res (dict) – the search a result

res must have the following keys:

  • “path”: absolute path of the matching file

  • “line”: 1-based line number of the match

The dict can have the following optional keys:

  • “snippet”: content of the line matching

  • “col”: 1-base column number of the match

  • “shortpath”

id = None

Class attribute, identifier of the plugin

The identifier should be unique across plugin classes since this identifier is used for get_plugin.

interrupt()[source]

Interrupt a running search

This slot has signature interrupt().

classmethod is_available(path)[source]

Return whether the plugin can search inside a particular path

Some plugins use an index (like git or etags) and can only search in certain paths.

classmethod name()[source]

Get the name of the plugin

search(path, pattern, **options)[source]

This slot has signature search(str, str).

classmethod search_root_path(path)[source]
started = Signal()

Signal started()

The signal is emitted when the search starts

eye.helpers.file_search_plugins.base.enabled_plugins()[source]

Iterate on registered and enabled plugins

Return type:

iter[SearchPlugin]

eye.helpers.file_search_plugins.base.get_plugin(plugin_id)[source]

Get a registered plugin by its identifier

Return type:

SearchPlugin

See SearchPlugin.id and registerPlugin.

eye.helpers.file_search_plugins.base.registerPlugin(cls)[source]

Decorator to register a file_search plugin class

The plugin class should inherit SearchPlugin. The plugin class can then be retrieved with get_plugin.