mirror of
https://github.com/ModOrganizer2/modorganizer-basic_games.git
synced 2026-07-27 14:07:29 -07:00
Fix for typing after stubs update.
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
import sys
|
||||
from pathlib import Path
|
||||
from typing import Callable, List, Optional
|
||||
from typing import Callable
|
||||
|
||||
from PyQt6.QtCore import QDateTime, Qt
|
||||
from PyQt6.QtGui import QImage, QPixmap
|
||||
@@ -28,12 +28,12 @@ class BasicGameSaveGame(mobase.ISaveGame):
|
||||
def getSaveGroupIdentifier(self) -> str:
|
||||
return ""
|
||||
|
||||
def allFiles(self) -> List[str]:
|
||||
def allFiles(self) -> list[str]:
|
||||
return [self.getFilepath()]
|
||||
|
||||
|
||||
class BasicGameSaveGameInfoWidget(mobase.ISaveGameInfoWidget):
|
||||
def __init__(self, parent: QWidget, get_preview: Callable[[str], str]):
|
||||
def __init__(self, parent: QWidget, get_preview: Callable[[Path], Path | None]):
|
||||
super().__init__(parent)
|
||||
|
||||
self._get_preview = get_preview
|
||||
@@ -60,7 +60,7 @@ class BasicGameSaveGameInfoWidget(mobase.ISaveGameInfoWidget):
|
||||
self.resize(0, 0)
|
||||
|
||||
# Retrieve the pixmap:
|
||||
value = self._get_preview(save.getFilepath())
|
||||
value = self._get_preview(Path(save.getFilepath()))
|
||||
|
||||
if value is None:
|
||||
return
|
||||
@@ -89,7 +89,7 @@ class BasicGameSaveGameInfoWidget(mobase.ISaveGameInfoWidget):
|
||||
|
||||
|
||||
class BasicGameSaveGameInfo(mobase.SaveGameInfo):
|
||||
def __init__(self, get_preview: Optional[Callable[[str], str]] = None):
|
||||
def __init__(self, get_preview: Callable[[Path], Path | None] | None = None):
|
||||
super().__init__()
|
||||
self._get_preview = get_preview
|
||||
|
||||
|
||||
@@ -300,7 +300,7 @@ class BlackAndWhite2SaveGameInfoWidget(BasicGameSaveGameInfoWidget):
|
||||
self.resize(0, 0)
|
||||
|
||||
# Retrieve the pixmap:
|
||||
value = self._get_preview(save.getFilepath())
|
||||
value = self._get_preview(Path(save.getFilepath()))
|
||||
|
||||
if value is None:
|
||||
return
|
||||
|
||||
+1
-3
@@ -1,5 +1,3 @@
|
||||
import os
|
||||
|
||||
import mobase
|
||||
|
||||
from ..basic_features import BasicGameSaveGameInfo
|
||||
@@ -33,6 +31,6 @@ class DA2Game(BasicGame):
|
||||
def init(self, organizer: mobase.IOrganizer):
|
||||
super().init(organizer)
|
||||
self._featureMap[mobase.SaveGameInfo] = BasicGameSaveGameInfo(
|
||||
lambda s: os.path.split(s)[0] + "/screen.dds"
|
||||
lambda s: s.parent.joinpath("screen.dds")
|
||||
)
|
||||
return True
|
||||
|
||||
+1
-3
@@ -1,5 +1,3 @@
|
||||
import os
|
||||
|
||||
import mobase
|
||||
|
||||
from ..basic_features import BasicGameSaveGameInfo
|
||||
@@ -29,6 +27,6 @@ class DAOriginsGame(BasicGame):
|
||||
def init(self, organizer: mobase.IOrganizer):
|
||||
super().init(organizer)
|
||||
self._featureMap[mobase.SaveGameInfo] = BasicGameSaveGameInfo(
|
||||
lambda s: os.path.split(s)[0] + "/screen.dds"
|
||||
lambda s: s.parent.joinpath("screen.dds")
|
||||
)
|
||||
return True
|
||||
|
||||
@@ -34,6 +34,6 @@ class DivinityOriginalSinGame(BasicGame):
|
||||
def init(self, organizer: mobase.IOrganizer):
|
||||
super().init(organizer)
|
||||
self._featureMap[mobase.SaveGameInfo] = BasicGameSaveGameInfo(
|
||||
lambda s: s.replace(".lsv", ".png") # Not confirmed
|
||||
lambda s: s.with_suffix(".png") # Not confirmed
|
||||
)
|
||||
return True
|
||||
|
||||
@@ -94,7 +94,7 @@ class DivinityOriginalSinEnhancedEditionGame(BasicGame, mobase.IPluginFileMapper
|
||||
def init(self, organizer: mobase.IOrganizer):
|
||||
super().init(organizer)
|
||||
self._featureMap[mobase.SaveGameInfo] = BasicGameSaveGameInfo(
|
||||
lambda s: s.replace(".lsv", ".png")
|
||||
lambda s: s.with_suffix(".png")
|
||||
)
|
||||
self._featureMap[
|
||||
mobase.ModDataChecker
|
||||
|
||||
@@ -42,7 +42,7 @@ class Witcher3Game(BasicGame):
|
||||
def init(self, organizer: mobase.IOrganizer):
|
||||
super().init(organizer)
|
||||
self._featureMap[mobase.SaveGameInfo] = BasicGameSaveGameInfo(
|
||||
lambda s: s.replace(".sav", ".png")
|
||||
lambda s: s.with_suffix(".png")
|
||||
)
|
||||
return True
|
||||
|
||||
|
||||
Reference in New Issue
Block a user