IModInterface

class mobase.IModInterface

Bases: object

Methods Summary

absolutePath()

returns

Absolute path to the mod to be used in file system operations.

addCategory(name)

Assign a category to the mod.

addNexusCategory(category_id)

Set the category id from a nexus category id.

categories()

returns

The list of categories this mod belongs to.

clearPluginSettings(plugin_name)

Remove all the settings of the specified plugin this mod.

color()

returns

The color of the ‘Notes’ column chosen by the user.

comments()

returns

The comments for this mod, if any.

converted()

Check if the mod was marked as converted by the user.

endorsedState()

returns

The endorsement state of this mod.

fileTree()

Retrieve a file tree corresponding to the underlying disk content of this mod.

gameName()

Retrieve the short name of the game associated with this mod.

ignoredVersion()

returns

The ignored version of this mod (for update), or an invalid version if the user

installationFile()

returns

The absolute path to the file that was used to install this mod.

isBackup()

returns

True if this mod represents a backup.

isForeign()

returns

True if this mod represents a foreign mod, not managed by MO2.

isOverwrite()

returns

True if this mod represents the overwrite mod.

isSeparator()

returns

True if this mod represents a separator.

name()

returns

The name of this mod.

newestVersion()

returns

The newest version of this mod (as known by MO2). If this matches version(),

nexusId()

returns

The Nexus ID of this mod.

notes()

returns

The notes for this mod, if any.

pluginSetting(plugin_name, key[, default])

Retrieve the specified setting in this mod for a plugin.

pluginSettings(plugin_name)

Retrieve the settings in this mod for a plugin.

primaryCategory()

returns

The ID of the primary category of this mod.

removeCategory(name)

Unassign a category from this mod.

repository()

returns

The name of the repository from which this mod was installed.

setGameName(name)

Set the source game of this mod.

setIsEndorsed(endorsed)

Set endorsement state of the mod.

setNewestVersion(version)

Set the latest known version of this mod.

setNexusID(nexus_id)

Set the Nexus ID of this mod.

setPluginSetting(plugin_name, key, value)

Set the specified setting in this mod for a plugin.

setUrl(url)

Set the URL of this mod.

setVersion(version)

Set the version of this mod.

trackedState()

returns

The tracked state of this mod.

url()

returns

The URL of this mod, or an empty QString() if no URL is associated

validated()

Check if the mod was marked as validated by the user.

version()

returns

The current version of this mod.

Methods Documentation

absolutePath()
Returns

Absolute path to the mod to be used in file system operations.

Return type

str

addCategory(name)

Assign a category to the mod. If the named category does not exist it is created.

Parameters

name – Name of the new category to assign.

addNexusCategory(category_id)

Set the category id from a nexus category id. Conversion to MO ID happens internally.

If a mapping is not possible, the category is set to the default value.

Parameters

category_id – The Nexus category ID.

categories()
Returns

The list of categories this mod belongs to.

Return type

List[str]

clearPluginSettings(plugin_name)

Remove all the settings of the specified plugin this mod.

Parameters

plugin_name – Name of the plugin for which settings should be removed. This should always be IPlugin.name() unless you have a really good reason to access settings of another plugin.

Returns

The old settings from the given plugin, as returned by pluginSettings().

Return type

Dict[str, Union[None, bool, int, str, List[Any], Dict[str, Any]]]

color()
Returns

The color of the ‘Notes’ column chosen by the user.

Return type

QColor

comments()
Returns

The comments for this mod, if any.

Return type

str

converted()

Check if the mod was marked as converted by the user.

When a mod is for a different game, a flag is shown to users to warn them, but they can mark mods as converted to remove this flag.

Returns

True if this mod was marked as converted by the user.

Return type

bool

endorsedState()
Returns

The endorsement state of this mod.

Return type

EndorsedState

fileTree()

Retrieve a file tree corresponding to the underlying disk content of this mod.

The file tree should not be cached by plugins since it is already and updated when required.

Returns

A file tree representing the content of this mod.

Return type

IFileTree

gameName()

Retrieve the short name of the game associated with this mod. This may differ from the current game plugin (e.g. you can install a Skyrim LE game in a SSE installation).

Returns

The name of the game associated with this mod.

Return type

str

ignoredVersion()
Returns

The ignored version of this mod (for update), or an invalid version if the user

did not ignore version for this mod.

Return type

VersionInfo

installationFile()
Returns

The absolute path to the file that was used to install this mod.

Return type

str

isBackup()
Returns

True if this mod represents a backup.

Return type

bool

isForeign()
Returns

True if this mod represents a foreign mod, not managed by MO2.

Return type

bool

isOverwrite()
Returns

True if this mod represents the overwrite mod.

Return type

bool

isSeparator()
Returns

True if this mod represents a separator.

Return type

bool

name()
Returns

The name of this mod.

Return type

str

newestVersion()
Returns

The newest version of this mod (as known by MO2). If this matches version(),

then the mod is up-to-date.

Return type

VersionInfo

nexusId()
Returns

The Nexus ID of this mod.

Return type

int

notes()
Returns

The notes for this mod, if any.

Return type

str

pluginSetting(plugin_name, key, default=None)

Retrieve the specified setting in this mod for a plugin.

Parameters
  • plugin_name – Name of the plugin for which to retrieve a setting. This should always be IPlugin.name() unless you have a really good reason to access settings of another plugin.

  • key – Identifier of the setting.

  • default – The default value to return if the setting does not exist.

Returns

The setting, if found, or the default value.

Return type

Union[None, bool, int, str, List[Any], Dict[str, Any]]

pluginSettings(plugin_name)

Retrieve the settings in this mod for a plugin.

Parameters

plugin_name – Name of the plugin for which to retrieve settings. This should always be IPlugin.name() unless you have a really good reason to access settings of another plugin.

Returns

A map from setting key to value. The map is empty if there are not settings for this mod.

Return type

Dict[str, Union[None, bool, int, str, List[Any], Dict[str, Any]]]

primaryCategory()
Returns

The ID of the primary category of this mod.

Return type

int

removeCategory(name)

Unassign a category from this mod.

Parameters

name – Name of the category to remove.

Returns

True if the category was removed, False otherwise (e.g. if no such category

was assigned).

Return type

bool

repository()
Returns

The name of the repository from which this mod was installed.

Return type

str

setGameName(name)

Set the source game of this mod.

Parameters

name – The new source game short name of this mod.

setIsEndorsed(endorsed)

Set endorsement state of the mod.

Parameters

endorsed – New endorsement state of this mod.

setNewestVersion(version)

Set the latest known version of this mod.

Parameters

version – The latest known version of this mod.

setNexusID(nexus_id)

Set the Nexus ID of this mod.

Parameters

nexus_id – Thew new Nexus ID of this mod.

setPluginSetting(plugin_name, key, value)

Set the specified setting in this mod for a plugin.

Parameters
  • plugin_name – Name of the plugin for which to retrieve a setting. This should always be IPlugin.name() unless you have a really good reason to access settings of another plugin.

  • key – Identifier of the setting.

  • value – New value for the setting to set.

Returns

True if the setting was set correctly, False otherwise.

Return type

bool

setUrl(url)

Set the URL of this mod.

Parameters

url – The URL of this mod.

setVersion(version)

Set the version of this mod.

Parameters

version – The new version of this mod.

trackedState()
Returns

The tracked state of this mod.

Return type

TrackedState

url()
Returns

The URL of this mod, or an empty QString() if no URL is associated

with this mod.

Return type

str

validated()

Check if the mod was marked as validated by the user.

MO2 uses ModDataChecker to check the content of mods, but sometimes these fail, in which case mods are incorrectly marked as ‘not containing valid games data’. Users can choose to mark these mods as valid to hide the warning / flag.

Returns

True if th is mod was marked as containing valid game data.

Return type

bool

version()
Returns

The current version of this mod.

Return type

VersionInfo