hooks
Hooks management.
Attributes
SUPPORTED_LANGUAGES = [exts.PYTHON_SCRIPT_FILE_FORMAT, exts.CSHARP_SCRIPT_FILE_FORMAT, exts.VB_SCRIPT_FILE_FORMAT]
module-attribute
mlogger = get_logger(__name__)
module-attribute
ExtensionEventHook = namedtuple('ExtensionEventHook', ['id', 'name', 'target', 'script', 'syspaths', 'extension_name'])
module-attribute
Functions
get_hooks_handler()
set_hooks_handler(handler)
Set the hook handler environment variable.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
handler |
EventHooks
|
hook handler |
required |
is_valid_hook_script(hook_script)
Check if the given hook script is valid.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
hook_script |
str
|
hook script path |
required |
Returns:
Type | Description |
---|---|
bool
|
True if the script is valid, False otherwise |
Source code in pyrevitlib/pyrevit/loader/hooks.py
get_extension_hooks(extension)
Get the hooks of the given extension.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
extension |
Extension
|
pyRevit extension |
required |
Returns:
Type | Description |
---|---|
list[ExtensionEventHook]
|
list of hooks |
Source code in pyrevitlib/pyrevit/loader/hooks.py
get_event_hooks()
register_hooks(extension)
Register the hooks for the given extension.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
extension |
Extension
|
pyRevit extension |
required |
Source code in pyrevitlib/pyrevit/loader/hooks.py
unregister_hooks(extension)
Unregister all hooks for the given extension.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
extension |
Extension
|
pyRevit extension |
required |
Source code in pyrevitlib/pyrevit/loader/hooks.py
unregister_all_hooks()
activate()
deactivate()
setup_hooks(session_id=None)
Setup the hooks for the given session.
If no session is specified, use the current one.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
session_id |
str
|
Session. Defaults to None. |
None
|