aboutsummaryrefslogtreecommitdiff
path: root/libs/plugin_python/tests/runner/plugins/dummy-game.py
blob: e17c9b88f50c443f892e76e74ae299dfe149b7ad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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