IModList¶
-
class
mobase.IModList¶ Bases:
objectInterface to the mod-list.
All api functions in this interface work need the internal name of a mod to find a mod. For regular mods (mods the user installed) the display name (as shown to the user) and internal name are identical. For other mods (non-MO mods) there is currently no way to translate from display name to internal name because the display name might not me un-ambiguous.
Methods Summary
allMods()- returns
A list containing the internal names of all installed mods.
allModsByProfilePriority([profile])- returns
The list of mod (names), sorted according to the current profile priorities.
displayName(name)Retrieve the display name of a mod from its internal name.
getMod(name)Retrieve an interface to a mod using its name.
onModInstalled(callback)Install a new handler to be called when a new mod is installed.
onModMoved(callback)Install a handler to be called when a mod is moved.
onModRemoved(callback)Install a new handler to be called when a mod is removed.
onModStateChanged(callback)Install a handler to be called when mod states change (enabled/disabled, endorsed, …).
priority(name)Retrieve the priority of a mod.
removeMod(mod)Remove a mod (from disc and from the UI).
renameMod(mod, name)Rename the given mod.
setActive(**kwds)Helper for @overload to raise when called.
setPriority(name, priority)Change the priority of a mod.
state(name)Retrieve the state of a mod.
Methods Documentation
-
allMods()¶ - Returns
A list containing the internal names of all installed mods.
- Return type
List[str]
-
allModsByProfilePriority(profile=None)¶ - Returns
The list of mod (names), sorted according to the current profile priorities.
- Return type
List[str]
-
displayName(name)¶ Retrieve the display name of a mod from its internal name.
If you received an internal name from the API (e.g. IPluginList.origin) then you should use that name to identify the mod in all other api calls but use this function to retrieve the name to show to the user.
- Parameters
name – Internal name of the mod.
- Returns
The display name of the given mod.
- Return type
str
-
getMod(name)¶ Retrieve an interface to a mod using its name.
- Parameters
name – Name of the mod to retrieve.
- Returns
An interface to the given mod, or None if there is no mod with this name.
- Return type
-
onModInstalled(callback)¶ Install a new handler to be called when a new mod is installed.
- Parameters
callback – The function to call when a mod is installed. The parameter of the function is the name of the newly installed mod.
- Returns
True if the handler was installed properly (there are currently no reasons for this to fail).
- Return type
bool
-
onModMoved(callback)¶ Install a handler to be called when a mod is moved.
- Parameters
callback – The function to call when a mod is moved. The first argument is the internal name of the mod, the second argument the old priority and the third argument the new priority.
- Returns
True if the handler was installed properly (there are currently no reasons for this to fail).
- Return type
bool
-
onModRemoved(callback)¶ Install a new handler to be called when a mod is removed.
- Parameters
callback – The function to call when a mod is removed. The parameter of the function is the name of the removed mod.
- Returns
True if the handler was installed properly (there are currently no reasons for this to fail).
- Return type
bool
-
onModStateChanged(callback)¶ Install a handler to be called when mod states change (enabled/disabled, endorsed, …).
- Parameters
callback – The function to call when the states of mod change. The argument is a map containing the mods whose states have changed. Keys are internal mod names and values are mod states.
- Returns
True if the handler was installed properly (there are currently no reasons for this to fail).
- Return type
bool
-
priority(name)¶ Retrieve the priority of a mod.
- Parameters
name – Internal name of the mod.
- Returns
The priority of the given mod.
- Return type
int
-
removeMod(mod)¶ Remove a mod (from disc and from the UI).
- Parameters
mod – The mod to remove.
- Returns
True if the mod was removed, False otherwise.
- Return type
bool
-
renameMod(mod, name)¶ Rename the given mod.
This method usually invalidates the given mod so you should use the returned value after calling it instead of the passed value.
- Parameters
mod – The mod to rename.
name – The new name of the mod.
- Returns
A valid reference to the given mod after renaming it.
- Return type
-
setActive(**kwds)¶ Helper for @overload to raise when called.
-
setPriority(name, priority)¶ Change the priority of a mod.
priority is the new priority after the move. Keep in mind that the mod disappears from its old location and all mods with higher priority than the moved mod decrease in priority by one.
- Parameters
name – Internal name of the mod.
priority – The new priority of the mod.
- Returns
True if the priority was changed, False otherwise (if the name or priority were invalid).
- Return type
bool
-
state(name)¶ Retrieve the state of a mod.
- Parameters
name – Internal name of the mod.
- Returns
The state of the given mod.
- Return type
int