ScriptLibManObject¶
- class ScriptLibManObject.LibManager¶
Bases:
object
An instance implementing this interface is injected into the scriptengine scope under the name library manager.
- property repositories¶
Gets the list of available library repositories.
The order of those repositories is configurable by the user in the dialog and the script.
This list is a snapshot of the current state. When repositories are created, removed or moved, those changes are not reflected “live” in the list, and you need to get a fresh copy.
- Return type:
tuple[
LibRepository
]- Returns:
The list of available repositories.
- insert_repository(rootfolder, name, index=-1)¶
Creates a new library repository.
- Parameters:
rootfolder (str) – The rootfolder for the repository (this must be the full path to an existing directory on disk).
name (str) – The name of the repository.
index (int) – The index of the repository in the list. -1 means the repository is added to the end of the list.
- Return type:
- Returns:
The newly created repository.
- move_repository(repository, new_index)¶
Move_repositories the specified repository to a new position in the list.
Use this to manipulate the search order.
- Parameters:
repository (
LibRepository
) – The repository.new_index (int) – The new index. You can pass -1 to move it to the end of the list.
- remove_repository(repository, delete_on_disk=False)¶
Removes the specified repository.
- Parameters:
repository (
LibRepository
) – The repository.delete_on_disk (bool) – If set to
True
, the on-disk directory is also deleted.
- update_repository(repository, new_name=None, new_location=None, copy_libraries=False)¶
Update the specified repository.
- Parameters:
repository (
LibRepository
) – The repository.new_name (str) – The new name.
new_location (str) – The new location.
copy_libraries (bool) – if set to
True
, the libraries from the old location are installed at the new location, if they don’t exist.
- get_file_path(library)¶
Gets the file path of the specified library in the library repository.
- Parameters:
library (
ManagedLib
) – The library.- Return type:
str
- Returns:
The file path of the library.
- property categories¶
Gets all the known library categories.
- Return type:
tuple[
LibCategory
]- Returns:
All the known library categories.
- property top_level_categories¶
Gets the all known top level library categories.
- Return type:
tuple[
LibCategory
]- Returns:
All known top level library categories.
- get_category(guid)¶
Gets the category with the specified GUID.
- Parameters:
guid (Guid) – The GUID.
- Return type:
- Returns:
The library category.
- install_library(filepath, repository=None, overwrite=False)¶
Installs the library with the specified filepath.
- Parameters:
filepath (str) – The filepath of the library to install.
repository (
LibRepository
) – The repository. This parameter is optional, if omitted, the first repository in the list is used.overwrite (bool) – if set to
True
, existing libraries are replaced.
- Return type:
- Returns:
The installed library.
- uninstall_library(repository, library)¶
Uninstalls a library from the specified repository.
- Parameters:
repository (
LibRepository
) – The repository.library (
ManagedLib
) – The library.
- get_library(name, repository)¶
Gets all libraries with the specified name.
- Parameters:
name (str) – The name.
repository (
LibRepository
) – The repository. If you pass None, all repositories are searched in order.
- Return type:
- Returns:
The found library.
- get_all_libraries(exclude_shadowed_libs: bool = True)¶
This override is used when parameter is of type bool.
Gets all libraries.
- Parameters:
exclude_shadowed_libs (bool) – If set to
True
, shadowed libs are excluded.- Return type:
tuple[
ManagedLib
]
- find_library(display_name)¶
Finds the library with the specified display_name.
- Parameters:
display_name (str) – The display name to search for.
- Return type:
tuple [
ManagedLib
,LibRepository
]- Returns:
A python tuple containing the ManagedLib and the LibRepository, or None if nothing found.
- class ScriptLibManObject.LibRepository¶
Bases:
object
Description class for a library repository.
- property editable¶
Gets a value indicating whether this LibRepository is editable.
The default system library repository is not editable - that means, it cannot be removed from the list of repositories.
- Return type:
bool
- Returns:
True
if editable, otherwiseFalse
.
- property name¶
Gets the name of the repository.
- Return type:
str
- property root_folder¶
Gets the root folder of the repository.
- Return type:
str
- class ScriptLibManObject.ManagedLib¶
Bases:
object
Description class for a managed library.
- property displayname¶
Display name.
- Return type:
str
- property company¶
Company.
- Return type:
str
- property title¶
Title.
- Return type:
str
- property version¶
Version.
- Return type:
Version
- property default_namespace¶
Default namespace.
- Return type:
str
- property dependencies¶
Gets the dependencies as a list of strings.
- Return type:
tuple[str]
- property categories¶
Gets the categories.
Gets the list of
LibCategory
.- Return type:
tuple[
LibCategory
]
- class ScriptLibManObject.LibCategory¶
Bases:
object
Information about a library category.
- property guid¶
Gets the guid identifying the category.
- Return type:
Guid
- property parent¶
Gets the parent category, or None if the category is top level.
- Return type:
- property default_name¶
Gets the default name.
- Return type:
str
- property name¶
Gets the localized name, or the default name if no localized name is available.
- Return type:
str
- property localized_name¶
Gets the localized name for the current UI culture.
- Return type:
str
- property version¶
Version.
- Return type:
Version
- class ScriptLibManObject.ScriptLibManObjectMarker¶
Bases:
object
Every ScriptObject instance will be extended with this method.
- Version added:
3.4.3.0
- property is_libman¶
Gets a value indicating whether this instance is a lib man object.
- Return type:
bool
- Returns:
True
if this instance is lib man object, otherwiseFalse
.
- class ScriptLibManObject.ScriptLibManObject¶
Bases:
ScriptLibManObjectMarker
Functionality for manipulating library managers.
All objects implementing LibManObject will be extended with this methods.
- get_libraries(recursive=False)¶
Returns a list of all libraries.
- Parameters:
recursive (bool) – If set to
True
, sublibraries are also queried recursively.- Return type:
list [str]
- Returns:
The list of library names.
- add_library(library: ManagedLib)¶
Adds a reference to the specified library.
- Parameters:
library (
ManagedLib
) – The library (since V3.5.5.0).
- add_placeholder(name: str, default_resolution: ManagedLib)¶
Adds a placeholder with the specified default resolution.
- Parameters:
name (str) – The name.
default_resolution (
ManagedLib
) – The default resolution (since V3.5.5.0).
- remove_library(name)¶
Removes the librariy with the specified name.
- Parameters:
name (str) – The name.
- property references¶
Gets the collection of the references currently configured within this library manager.
- Version added:
3.5.5.0
- Return type:
- class ScriptLibManObject.ScriptLibraryReferences(iterable=(), /)¶
Bases:
list
The references currently managed by the library manager.
- class ScriptLibManObject.ScriptLibraryReference¶
Bases:
object
A library reference in the library manager.
- property id¶
Id.
- Return type:
int
- property is_placeholder¶
Gets a value indicating whether this ScriptLibraryReference is a placeholder.
- Return type:
bool
- Returns:
True
if it is a placeholder, otherwiseFalse
.
- property is_managed¶
Gets a value indicating whether this ScriptLibraryReference is a managed reference to a fixed library version.
- Return type:
bool
- property name¶
Gets the name of this library.
For managed items, this follows the pattern “Name, Version (Company)”. For placeholder items, this name follows the pattern “#Name”. See also:
ScriptPlaceholderReference.placeholder_name
.- Return type:
str
- property namespace¶
Gets or sets the namespace for this library.
- Return type:
str
- property system_library¶
Gets a boolean value indicating whether this library is a system library or not.
System libraries have been added implicitly by plug-ins whereas non-system libraries have been explicitly added by the user.
- Return type:
bool
- get_dependencies()¶
Gets the dependencies of this library.
For libraries containing cyclic dependencies, this may lead to an endless recursion.
- Return type:
list[
ScriptLibraryReference
]- Returns:
A list of dependencies.
- property parameters¶
Gets the library parameter set.
If a global variable list containing only constant values has the attribute ‘parameterlist’, its content may be modified in the referencing project using this mechanism.
- Return type:
- property hide_when_referenced_as_dependency¶
Gets or sets a value indicating whether this library node should be hidden in the user interface if it a direct or indirect dependency of a top-level library node.
- Return type:
bool
- property publish_symbols_in_container¶
Gets or sets the qualified-only flag.
If set, the name of the library is mandatory for any access to the library content.
The default is true.
- Return type:
bool
- property qualified_only¶
Gets or sets the qualified-only flag.
If set, the name of the library is mandatory for any access to the library content.
Defaults to
True
.- Return type:
bool
- property optional¶
Gets or sets the optional flag.
Libraries which are optional are not reported to the user as missing if they do not exist.
- Return type:
bool
- class ScriptLibManObject.ScriptManagedLibraryReference¶
Bases:
ScriptLibraryReference
A managed library reference which points to a fixed version of the library.
ScriptLibraryReference.is_managed
is true for those instances.- property managed_library¶
Gets the managed library.
- Return type:
- class ScriptLibManObject.ScriptPlaceholderReference¶
Bases:
ScriptLibraryReference
A placeholder reference. :class`ScriptLibraryReference` instances with
ScriptLibraryReference.is_placeholder
== True implement this interface.- property placeholder_name¶
Gets the name of the placeholder.
In contrast to
ScriptLibraryReference.name
, this name does not include the leading ‘#’ character.- Return type:
str
- property default_resolution¶
Gets or sets the default resolution of the library.
- Return type:
str
- property effective_resolution¶
Effective resolution.
- Return type:
str
- property is_redirected¶
Gets a value indicating whether this ScriptPlaceholderReference is redirected.
- Return type:
bool
- get_redirection()¶
Gets the redirection setting for this library.
- Return type:
str
- Returns:
The redirection.
- set_redirection(fixed_resolution='')¶
Sets the redirection for this library.
- Parameters:
fixed_resolution (str) – The fixed resolution. Use
None
or an empty string to delete the redirection.
- property resolution_info¶
Gets a human readable information how this placeholder is resolved.
- Return type:
str
- property resolver_guid¶
Gets a machinable readable information how this placeholder is resolved.
- Return type:
Guid
- class ScriptLibManObject.ScriptLibraryParameters(iterable=(), /)¶
Bases:
list
The library parameters interface. This is a sequence of the parameter names.
If a global variable list containing only constant values has the attribute ‘parameterlist’, its content may be modified in the referencing project using this mechanism.
- class ScriptLibManObject.ScriptLibManObjectContainer¶
Bases:
object
Projects and Application Objects are extended with this interface.
- Version added:
3.5.2.0
- property has_library_manager¶
Gets a value indicating whether this ScriptLibManObjectContainer has a library manager.
- Return type:
bool
- Returns:
True
if there is a library manager, otherwiseFalse
.
- get_library_manager()¶
Gets the library manager for this application or project, implicitly creating one if none is existing yet.
- Return type:
- Returns:
The library manager object. (ScriptObject)