mirror of
https://github.com/ModOrganizer2/modorganizer-plugin_python.git
synced 2026-07-27 14:03:33 -07:00
* Expose INVALID_HANDLE_VALUE as mobase.INVALID_HANDLE_VALUE. * Add tests for startApplication() returning INVALID_HANDLE_VALUE. * Clean tests and generate stub files for them.
46 lines
1.2 KiB
Python
46 lines
1.2 KiB
Python
from collections.abc import Sequence
|
|
|
|
from PyQt6.QtWidgets import QWidget
|
|
|
|
import mobase
|
|
|
|
|
|
class DummyModDataChecker(mobase.ModDataChecker):
|
|
def dataLooksValid(
|
|
self, filetree: mobase.IFileTree
|
|
) -> mobase.ModDataChecker.CheckReturn:
|
|
return mobase.ModDataChecker.VALID
|
|
|
|
def fix(self, filetree: mobase.IFileTree) -> mobase.IFileTree:
|
|
return filetree
|
|
|
|
|
|
class DummySaveGameInfo(mobase.SaveGameInfo):
|
|
def getMissingAssets(self, save: mobase.ISaveGame) -> dict[str, Sequence[str]]:
|
|
return {}
|
|
|
|
def getSaveGameWidget(self, parent: QWidget) -> mobase.ISaveGameInfoWidget | None:
|
|
return None
|
|
|
|
|
|
# we do not implement everything since this will do fine if we do not call anything
|
|
# from the C++ side
|
|
#
|
|
class DummyGame(mobase.IPluginGame):
|
|
_features: dict[type, object]
|
|
|
|
def __init__(self):
|
|
super().__init__()
|
|
|
|
self._features = {
|
|
mobase.ModDataChecker: DummyModDataChecker(),
|
|
mobase.SaveGameInfo: DummySaveGameInfo(),
|
|
}
|
|
|
|
def _featureList(self) -> dict[type, object]:
|
|
return self._features
|
|
|
|
|
|
def createPlugin() -> mobase.IPlugin:
|
|
return DummyGame() # type: ignore
|