Compare commits

...
Author SHA1 Message Date
Mikaël Capelle ece93e7cb3 Update for MO2 2.5. 2023-10-04 19:27:07 +02:00
Mikaël Capelle 4fa50f89a4 Fix missing optional annotation in some cases. 2023-09-23 13:21:45 +02:00
4 changed files with 118 additions and 33 deletions
+55 -8
View File
@@ -1531,17 +1531,36 @@ mobase:
modsPath:
returns: The (absolute) path to the mods directory.
onAboutToRun:
onAboutToRun.1:
__doc__: |
Install a new handler to be called when an application is about to run.
Multiple handlers can be installed. If any of the handler returns `False`, the application will
not run.
Multiple handlers can be installed. If any of the handler returns `False`, the
application will not run.
args:
callback: |
The function to call when an application is about to run. The parameter is the absolute path
to the application to run. The function can return False to prevent the application from running.
returns: True if the handler was installed properly (there are currently no reasons for this to fail).
The function to call when an application is about to run. The function
receives the absolute path to the application to run, the working directory
for the run and a string containing the arguments passed to the executable.
The function can return False to prevent the application from running.
returns: |
True if the handler was installed properly (there are currently no
reasons for this to fail).
onAboutToRun.2:
__doc__: |
Install a new handler to be called when an application is about to run.
Multiple handlers can be installed. If any of the handler returns `False`, the
application will not run.
args:
callback: |
The function to call when an application is about to run. The parameter
is the absolute path to the application to run. The function can return False
to prevent the application from running.
returns: |
True if the handler was installed properly (there are currently no reasons for
this to fail).
onFinishedRun:
__doc__: Install a new handler to be called when an application has finished running.
@@ -1549,7 +1568,19 @@ mobase:
callback: |
The function to call when an application has finished running. The first parameter is the absolute
path to the application, and the second parameter is the exit code of the application.
returns: True if the handler was installed properly (there are currently no reasons for this to fail).
returns: |
True if the handler was installed properly (there are currently no reasons for
this to fail).
onNextRefresh:
__doc__: Install a new handler to be called on the next refresh or immediately.
args:
callback: Function to call on the next refresh (or immediately).
immediate_if_possible: |
If True, immediately run the callback if no refresh is currently running.
returns: |
True if the handler was installed properly (there are currently no reasons for
this to fail).
onPluginDisabled.1:
__doc__: Install a new handler to be called when a plugin is disabled.
@@ -1951,9 +1982,11 @@ mobase:
See `IPlugin.init()` for more.
CCPlugins:
abstract: false
returns: The current list of active Creation Club plugins.
DLCPlugins:
abstract: false
returns: The list of esp/esm files that are part of known DLCs.
binaryName:
@@ -1965,10 +1998,15 @@ mobase:
documentsDirectory:
returns: The directory of the documents folder where configuration files and such for this game reside.
enabledPlugins:
abstract: false
returns: A list of plugins enabled by the game but not in a strict load order.
executableForcedLoads:
returns: A list of automatically discovered libraries that can be force loaded with executables.
executables:
abstract: false
returns: A list of automatically discovered executables of the game itself and tools surrounding it.
feature:
@@ -2004,12 +2042,14 @@ mobase:
returns: The name of the game (as displayed to the user).
gameNexusName:
abstract: false
returns: The name of the game identifier for Nexus.
gameShortName:
returns: The short name of the game.
gameVariants:
abstract: false
__doc__: |
Retrieve the list of variants for this game.
@@ -2030,6 +2070,7 @@ mobase:
returns: An URL for the support page of this game.
iniFiles:
abstract: false
returns: |
The list of INI files this game uses. The first file in the list should be the
'main' INI file.
@@ -2057,6 +2098,7 @@ mobase:
returns: The list of game saves in the given folder.
loadOrderMechanism:
abstract: false
returns: The load order mechanism used by this game.
looksValid:
@@ -2073,6 +2115,7 @@ mobase:
returns: The Nexus game ID for this game.
nexusModOrganizerID:
abstract: false
__doc__: |
Retrieve the Nexus mod ID of Mod Organizer for this game.
@@ -2081,9 +2124,11 @@ mobase:
returns: The Nexus mod ID of Mod Organizer for this game.
primaryPlugins:
abstract: false
returns: The list of plugins that are part of the game and not considered optional.
primarySources:
abstract: false
__doc__: |
Retrieve primary alternative 'short' names for this game.
@@ -2095,11 +2140,11 @@ mobase:
returns: The directory where save games are stored.
secondaryDataDirectories:
abstract: false
__doc__: |
Retrieve the list of secondary data directories. Each directories should be
assigned a unique name that differs from "data" which is the name of the main
data directory returned by dataDirectory().
returns: A mapping from unique name to secondary data directories.
setGamePath:
@@ -2122,9 +2167,11 @@ mobase:
variant: The game variant selected by the user.
sortMechanism:
abstract: false
returns: The sort mechanism for this game.
steamAPPId:
abstract: false
__doc__: |
Retrieve the Steam app ID for this game.
+6 -3
View File
@@ -108,9 +108,12 @@ def parse_python_signature(s: str, name: str) -> tuple[PyType, list[Argument]]:
raise ValueError(f"invalid argument: {pa}, {s}")
matches = m.groupdict()
arguments.append(
Argument(matches["name"], PyType(matches["type"]), matches["value"])
)
type_ = matches["type"]
if matches["value"] == "None":
if "None" not in type_ and "MoVariant" not in type_:
type_ = type_ + " | None"
arguments.append(Argument(matches["name"], PyType(type_), matches["value"]))
return PyType(return_type), arguments
+56 -21
View File
@@ -1639,7 +1639,7 @@ class IModList:
"""
...
def allModsByProfilePriority(
self: IModList, profile: IProfile = None
self: IModList, profile: IProfile | None = None
) -> Sequence[str]:
"""
Returns:
@@ -2141,19 +2141,43 @@ class IOrganizer:
The (absolute) path to the mods directory.
"""
...
@overload
def onAboutToRun(
self: IOrganizer, callback: Callable[[str, PyQt6.QtCore.QDir, str], bool]
) -> bool:
"""
Install a new handler to be called when an application is about to run.
Multiple handlers can be installed. If any of the handler returns `False`, the
application will not run.
Args:
callback: The function to call when an application is about to run. The function
receives the absolute path to the application to run, the working directory
for the run and a string containing the arguments passed to the executable.
The function can return False to prevent the application from running.
Returns:
True if the handler was installed properly (there are currently no
reasons for this to fail).
"""
...
@overload
def onAboutToRun(self: IOrganizer, callback: Callable[[str], bool]) -> bool:
"""
Install a new handler to be called when an application is about to run.
Multiple handlers can be installed. If any of the handler returns `False`, the application will
not run.
Multiple handlers can be installed. If any of the handler returns `False`, the
application will not run.
Args:
callback: The function to call when an application is about to run. The parameter is the absolute path
to the application to run. The function can return False to prevent the application from running.
callback: The function to call when an application is about to run. The parameter
is the absolute path to the application to run. The function can return False
to prevent the application from running.
Returns:
True if the handler was installed properly (there are currently no reasons for this to fail).
True if the handler was installed properly (there are currently no reasons for
this to fail).
"""
...
def onFinishedRun(self: IOrganizer, callback: Callable[[str, int], None]) -> bool:
@@ -2165,7 +2189,25 @@ class IOrganizer:
path to the application, and the second parameter is the exit code of the application.
Returns:
True if the handler was installed properly (there are currently no reasons for this to fail).
True if the handler was installed properly (there are currently no reasons for
this to fail).
"""
...
def onNextRefresh(
self: IOrganizer,
callback: Callable[[], None],
immediate_if_possible: bool = True,
) -> bool:
"""
Install a new handler to be called on the next refresh or immediately.
Args:
callback: Function to call on the next refresh (or immediately).
immediate_if_possible: If True, immediately run the callback if no refresh is currently running.
Returns:
True if the handler was installed properly (there are currently no reasons for
this to fail).
"""
...
@overload
@@ -2719,14 +2761,12 @@ class IPluginGame(IPlugin):
"""
def __init__(self: IPluginGame) -> None: ...
@abc.abstractmethod
def CCPlugins(self: IPluginGame) -> Sequence[str]:
"""
Returns:
The current list of active Creation Club plugins.
"""
...
@abc.abstractmethod
def DLCPlugins(self: IPluginGame) -> Sequence[str]:
"""
Returns:
@@ -2773,6 +2813,12 @@ class IPluginGame(IPlugin):
The directory of the documents folder where configuration files and such for this game reside.
"""
...
def enabledPlugins(self: IPluginGame) -> Sequence[str]:
"""
Returns:
A list of plugins enabled by the game but not in a strict load order.
"""
...
@abc.abstractmethod
def executableForcedLoads(
self: IPluginGame,
@@ -2782,7 +2828,6 @@ class IPluginGame(IPlugin):
A list of automatically discovered libraries that can be force loaded with executables.
"""
...
@abc.abstractmethod
def executables(self: IPluginGame) -> Sequence[ExecutableInfo]:
"""
Returns:
@@ -2834,7 +2879,6 @@ class IPluginGame(IPlugin):
The name of the game (as displayed to the user).
"""
...
@abc.abstractmethod
def gameNexusName(self: IPluginGame) -> str:
"""
Returns:
@@ -2848,7 +2892,6 @@ class IPluginGame(IPlugin):
The short name of the game.
"""
...
@abc.abstractmethod
def gameVariants(self: IPluginGame) -> Sequence[str]:
"""
Retrieve the list of variants for this game.
@@ -2883,7 +2926,6 @@ class IPluginGame(IPlugin):
An URL for the support page of this game.
"""
...
@abc.abstractmethod
def iniFiles(self: IPluginGame) -> Sequence[str]:
"""
Returns:
@@ -2928,7 +2970,6 @@ class IPluginGame(IPlugin):
The list of game saves in the given folder.
"""
...
@abc.abstractmethod
def loadOrderMechanism(self: IPluginGame) -> LoadOrderMechanism:
"""
Returns:
@@ -2958,7 +2999,6 @@ class IPluginGame(IPlugin):
The Nexus game ID for this game.
"""
...
@abc.abstractmethod
def nexusModOrganizerID(self: IPluginGame) -> int:
"""
Retrieve the Nexus mod ID of Mod Organizer for this game.
@@ -2970,14 +3010,12 @@ class IPluginGame(IPlugin):
The Nexus mod ID of Mod Organizer for this game.
"""
...
@abc.abstractmethod
def primaryPlugins(self: IPluginGame) -> Sequence[str]:
"""
Returns:
The list of plugins that are part of the game and not considered optional.
"""
...
@abc.abstractmethod
def primarySources(self: IPluginGame) -> Sequence[str]:
"""
Retrieve primary alternative 'short' names for this game.
@@ -2996,7 +3034,6 @@ class IPluginGame(IPlugin):
The directory where save games are stored.
"""
...
@abc.abstractmethod
def secondaryDataDirectories(self: IPluginGame) -> Dict[str, PyQt6.QtCore.QDir]:
"""
Retrieve the list of secondary data directories. Each directories should be
@@ -3032,14 +3069,12 @@ class IPluginGame(IPlugin):
variant: The game variant selected by the user.
"""
...
@abc.abstractmethod
def sortMechanism(self: IPluginGame) -> SortMechanism:
"""
Returns:
The sort mechanism for this game.
"""
...
@abc.abstractmethod
def steamAPPId(self: IPluginGame) -> str:
"""
Retrieve the Steam app ID for this game.
@@ -3818,7 +3853,7 @@ class ISaveGameInfoWidget(PyQt6.QtWidgets.QWidget):
"""
def __init__(
self: ISaveGameInfoWidget, parent: PyQt6.QtWidgets.QWidget = None
self: ISaveGameInfoWidget, parent: PyQt6.QtWidgets.QWidget | None = None
) -> None:
"""
Args:
@@ -15,7 +15,7 @@ class TaskDialog:
def __init__(
self: TaskDialog,
parent: PyQt6.QtWidgets.QWidget = None,
parent: PyQt6.QtWidgets.QWidget | None = None,
title: str = "",
main: str = "",
content: str = "",