IModInterface

class mobase.IModInterface

Bases: object

Methods Summary

absolutePath()

rtype:

str

addCategory(name)

Assign a category to the mod.

addNexusCategory(category_id)

Set the category id from a nexus category id.

categories()

rtype:

Sequence[str]

clearPluginSettings(plugin_name)

Remove all the settings of the specified plugin this mod.

color()

rtype:

QColor

comments()

rtype:

str

converted()

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

endorsedState()

rtype:

EndorsedState

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()

rtype:

VersionInfo

installationFile()

rtype:

str

isBackup()

rtype:

bool

isForeign()

rtype:

bool

isOverwrite()

rtype:

bool

isSeparator()

rtype:

bool

name()

rtype:

str

newestVersion()

rtype:

VersionInfo

nexusId()

rtype:

int

notes()

rtype:

str

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()

rtype:

int

removeCategory(name)

Unassign a category from this mod.

repository()

rtype:

str

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()

rtype:

TrackedState

url()

rtype:

str

validated()

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

version()

rtype:

VersionInfo

Methods Documentation

absolutePath()
Return type:

str

Returns:

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

addCategory(name)

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

Return type:

None

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.

Return type:

None

Parameters:

category_id – The Nexus category ID.

categories()
Return type:

Sequence[str]

Returns:

The list of categories this mod belongs to.

clearPluginSettings(plugin_name)

Remove all the settings of the specified plugin this mod.

Return type:

Dict[str, UnionType[None, bool, int, str, list[object], dict[str, object]]]

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().

color()
Return type:

QColor

Returns:

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

comments()
Return type:

str

Returns:

The comments for this mod, if any.

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.

Return type:

bool

Returns:

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

endorsedState()
Return type:

EndorsedState

Returns:

The endorsement state of this mod.

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.

Return type:

IFileTree

Returns:

A file tree representing the content of this mod.

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).

Return type:

str

Returns:

The name of the game associated with this mod.

ignoredVersion()
Return type:

VersionInfo

Returns:

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

did not ignore version for this mod.

installationFile()
Return type:

str

Returns:

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

isBackup()
Return type:

bool

Returns:

True if this mod represents a backup.

isForeign()
Return type:

bool

Returns:

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

isOverwrite()
Return type:

bool

Returns:

True if this mod represents the overwrite mod.

isSeparator()
Return type:

bool

Returns:

True if this mod represents a separator.

name()
Return type:

str

Returns:

The name of this mod.

newestVersion()
Return type:

VersionInfo

Returns:

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

then the mod is up-to-date.

nexusId()
Return type:

int

Returns:

The Nexus ID of this mod.

notes()
Return type:

str

Returns:

The notes for this mod, if any.

pluginSetting(plugin_name, key, default=None)

Retrieve the specified setting in this mod for a plugin.

Return type:

UnionType[None, bool, int, str, list[object], dict[str, object]]

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.

pluginSettings(plugin_name)

Retrieve the settings in this mod for a plugin.

Return type:

Dict[str, UnionType[None, bool, int, str, list[object], dict[str, object]]]

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.

primaryCategory()
Return type:

int

Returns:

The ID of the primary category of this mod.

removeCategory(name)

Unassign a category from this mod.

Return type:

bool

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).

repository()
Return type:

str

Returns:

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

setGameName(name)

Set the source game of this mod.

Return type:

None

Parameters:

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

setIsEndorsed(endorsed)

Set endorsement state of the mod.

Return type:

None

Parameters:

endorsed – New endorsement state of this mod.

setNewestVersion(version)

Set the latest known version of this mod.

Return type:

None

Parameters:

version – The latest known version of this mod.

setNexusID(nexus_id)

Set the Nexus ID of this mod.

Return type:

None

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.

Return type:

bool

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.

setUrl(url)

Set the URL of this mod.

Return type:

None

Parameters:

url – The URL of this mod.

setVersion(version)

Set the version of this mod.

Return type:

None

Parameters:

version – The new version of this mod.

trackedState()
Return type:

TrackedState

Returns:

The tracked state of this mod.

url()
Return type:

str

Returns:

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

with this mod.

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.

Return type:

bool

Returns:

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

version()
Return type:

VersionInfo

Returns:

The current version of this mod.