Format code

This commit is contained in:
Toast 2025-05-28 10:50:13 +02:00
parent 669dd9168d
commit f3650c10a9
3 changed files with 32 additions and 17 deletions

View file

@ -6,44 +6,54 @@ import Leek
Kirigami.ApplicationWindow {
id: root
title: "Leek"
pageStack.initialPage: Kirigami.ScrollablePage {
title: "Mods"
Kirigami.CardsListView {
id: modsView
model: QModListModel {}
delegate: ModCardDelegate {}
delegate: ModCardDelegate {
}
model: QModListModel {
}
}
}
component ModCardDelegate: Kirigami.AbstractCard {
required property QMod mod
// headerOrientation: Qt.Horizontal
contentItem: Item {
implicitWidth: modCardLayout.implicitWidth
implicitHeight: modCardLayout.implicitHeight
implicitWidth: modCardLayout.implicitWidth
GridLayout {
id: modCardLayout
anchors {
left: parent.left
top: parent.top
right: parent.right
}
rowSpacing: Kirigami.Units.largeSpacing
columnSpacing: Kirigami.Units.largeSpacing
columns: root.wideScreen ? 4 : 2
rowSpacing: Kirigami.Units.largeSpacing
anchors {
left: parent.left
right: parent.right
top: parent.top
}
// TODO: Replace this with an image once we can get them
Kirigami.Padding {
padding: Kirigami.Units.largeSpacing
contentItem: Kirigami.Icon {
source: "package-x-generic"
implicitHeight: Kirigami.Units.iconSizes.huge
implicitWidth: implicitHeight
source: "package-x-generic"
}
}
ColumnLayout {
Kirigami.Heading {
Layout.fillWidth: true
@ -55,17 +65,19 @@ Kirigami.ApplicationWindow {
}
Controls.Label {
property string desc: mod.description
Layout.fillWidth: true
wrapMode: Text.WordWrap
text: desc ? desc : "No description available"
font.italic: desc ? false : true
text: desc ? desc : "No description available"
wrapMode: Text.WordWrap
}
}
ColumnLayout {
Layout.alignment: Qt.AlignRight
Controls.Switch {
text: "Enabled"
checked: mod.enabled
text: "Enabled"
}
Controls.Button {
text: "Delete"

View file

@ -27,13 +27,13 @@ class Mod:
if "description" not in self.__config.keys():
return None
else:
return self.__config.get("description",str)
return self.__config.get("description", str)
@property
def author(self) -> str | None:
if "author" not in self.__config:
return None
return self.__config.get("author",str)
return self.__config.get("author", str)
@property
def enabled(self) -> bool:

View file

@ -8,9 +8,12 @@ QML_IMPORT_NAME = "Leek"
QML_IMPORT_MAJOR_VERSION = 1
# TODO: Don't harcode the mods path
GAME_PATH = Path("/home/toast/.local/share/Steam/steamapps/common/Hatsune Miku Project DIVA Mega Mix Plus/")
GAME_PATH = Path(
"/home/toast/.local/share/Steam/steamapps/common/Hatsune Miku Project DIVA Mega Mix Plus/"
)
MOD_PATH = Path(GAME_PATH, "mods")
# Qt follows C++ naming conventions
# ruff: noqa: N802
@QmlElement