Mod, QMod: add long description property

This commit is contained in:
Toast 2025-05-29 19:08:59 +02:00
parent 902227a8bd
commit 8a36617298
2 changed files with 12 additions and 0 deletions

View file

@ -41,6 +41,12 @@ class Mod:
else: else:
return self.__config.get("description", str) return self.__config.get("description", str)
@property
def long_description(self) -> str | None:
if "descriptionLong" in self.__meta:
return self.__meta.get("descriptionLong", str)
return None
@property @property
def author(self) -> str | None: def author(self) -> str | None:
# TODO: return list with authors # TODO: return list with authors

View file

@ -9,6 +9,8 @@ QML_IMPORT_NAME = "Leek"
QML_IMPORT_MAJOR_VERSION = 1 QML_IMPORT_MAJOR_VERSION = 1
# Qt follows C++ naming conventions
# ruff: noqa: N802
@QmlElement @QmlElement
@QmlUncreatable("QMod is intended to be returned by a QModListModel") @QmlUncreatable("QMod is intended to be returned by a QModListModel")
class QMod(QObject): class QMod(QObject):
@ -34,6 +36,10 @@ class QMod(QObject):
def description(self) -> str | None: def description(self) -> str | None:
return self.__mod.description return self.__mod.description
@Property(str, constant=True)
def longDescription(self) -> str | None:
return self.__mod.long_description
mod_enabled = Signal(name="enabled") mod_enabled = Signal(name="enabled")
@Property(bool, notify=mod_enabled) @Property(bool, notify=mod_enabled)