Compare commits
10 commits
404d8e0f18
...
a549e9a99c
| Author | SHA1 | Date | |
|---|---|---|---|
| a549e9a99c | |||
| 796f0aa209 | |||
| 34cf1da185 | |||
| 010deddc8e | |||
| 02621b79aa | |||
| 34b8610432 | |||
| 6a4272502e | |||
| 1575222c9d | |||
| 786be23b6e | |||
| 792ee5c281 |
10 changed files with 159 additions and 17 deletions
1
.envrc
Normal file
1
.envrc
Normal file
|
|
@ -0,0 +1 @@
|
|||
use flake
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -8,3 +8,4 @@ result-*
|
|||
|
||||
# ---> Python
|
||||
.venv
|
||||
__pycache__
|
||||
|
|
|
|||
1
MANIFEST.in
Normal file
1
MANIFEST.in
Normal file
|
|
@ -0,0 +1 @@
|
|||
include src/*.qml
|
||||
31
flake.nix
31
flake.nix
|
|
@ -11,22 +11,21 @@
|
|||
{
|
||||
devShells.x86_64-linux.default = pkgs.mkShell {
|
||||
name = "leek-devshell";
|
||||
packages =
|
||||
let
|
||||
kdeDeps = with pkgs.kdePackages; [
|
||||
extra-cmake-modules
|
||||
qtbase
|
||||
qtdeclarative
|
||||
kirigami
|
||||
ki18n
|
||||
kcoreaddons
|
||||
qqc2-desktop-style
|
||||
];
|
||||
in
|
||||
with pkgs; [
|
||||
clang-tools
|
||||
cmake
|
||||
] ++ kdeDeps;
|
||||
packages = with pkgs; [
|
||||
ruff
|
||||
(
|
||||
python3.withPackages (ps: with ps;[
|
||||
python-lsp-server
|
||||
pyside6
|
||||
tomlkit
|
||||
]
|
||||
)
|
||||
)
|
||||
];
|
||||
};
|
||||
packages.x86_64-linux = rec {
|
||||
default = leek;
|
||||
leek = pkgs.callPackage ./package.nix { };
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
33
package.nix
Normal file
33
package.nix
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
{
|
||||
kdePackages,
|
||||
python3Packages,
|
||||
qt6
|
||||
}: python3Packages.buildPythonApplication rec {
|
||||
pname = "leek";
|
||||
version = "0.0.1";
|
||||
pyproject = true;
|
||||
|
||||
src = ./.;
|
||||
|
||||
build-system = [
|
||||
python3Packages.setuptools
|
||||
];
|
||||
|
||||
|
||||
dependencies = with python3Packages; [
|
||||
pyside6
|
||||
tomlkit
|
||||
];
|
||||
|
||||
nativeBuildInputs = [
|
||||
qt6.wrapQtAppsHook
|
||||
];
|
||||
|
||||
propagatedBuildInputs = [
|
||||
kdePackages.kirigami
|
||||
];
|
||||
|
||||
makeWrapperArgs = [
|
||||
"\${qtWrapperArgs[@]}"
|
||||
];
|
||||
}
|
||||
36
pyproject.toml
Normal file
36
pyproject.toml
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
[build-system]
|
||||
requires = ["setuptools"]
|
||||
build-backend = "setuptools.build_meta"
|
||||
|
||||
[project]
|
||||
name = "leek"
|
||||
version = "0.0.1"
|
||||
authors = [{name = "Toast"}]
|
||||
description = "Project diva megamix + mod manager"
|
||||
license = "MIT"
|
||||
classifiers = [
|
||||
"Intended Audience :: End Users/Desktop",
|
||||
"Topic :: Utilities",
|
||||
"Programming Language :: Python",
|
||||
"Operating System :: POSIX :: Linux",
|
||||
]
|
||||
dependencies = [
|
||||
"pyside6",
|
||||
"tomlkit",
|
||||
]
|
||||
|
||||
[project.readme]
|
||||
file = "README.md"
|
||||
content-type = "text/markdown"
|
||||
|
||||
[project.scripts]
|
||||
leek = "leek.leek_app:main"
|
||||
|
||||
[tool.setuptools]
|
||||
packages = ["leek"]
|
||||
package-dir = {leek = "src"}
|
||||
include-package-data = true
|
||||
|
||||
[tool.setuptools.data-files]
|
||||
"share/applications" = ["xyz.toast003.leek.desktop"]
|
||||
|
||||
68
src/Mod.py
Normal file
68
src/Mod.py
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
import tomlkit
|
||||
|
||||
|
||||
class Mod:
|
||||
@property
|
||||
def path(self) -> str:
|
||||
return self.__path
|
||||
|
||||
# Mod metadata
|
||||
@property
|
||||
def name(self) -> str | None:
|
||||
if "name" not in self.__config:
|
||||
return None
|
||||
return self.__config["name"]
|
||||
|
||||
@property
|
||||
def description(self) -> str | None:
|
||||
if "description" not in self.__config.keys():
|
||||
return None
|
||||
else:
|
||||
return self.__config["description"]
|
||||
|
||||
@property
|
||||
def author(self) -> str | None:
|
||||
if "author" not in self.__config:
|
||||
return None
|
||||
return self.__config["author"]
|
||||
|
||||
@property
|
||||
def enabled(self) -> str:
|
||||
return self.__enabled
|
||||
|
||||
def __init__(self, path: str) -> None:
|
||||
self.__path = path
|
||||
|
||||
with open(path + "config.toml") as configFile:
|
||||
self.__config = tomlkit.load(configFile)
|
||||
|
||||
if "enabled" not in self.__config:
|
||||
raise InvalidModError("config.toml does not contain the enabled key")
|
||||
else:
|
||||
self.__enabled = self.__config["enabled"]
|
||||
|
||||
@enabled.setter
|
||||
def enabled(self, value: bool) -> None:
|
||||
if value == self.__enabled:
|
||||
# Nothing to do
|
||||
return
|
||||
|
||||
with open(self.__path + "config.toml", "w") as configFile:
|
||||
self.__config["enabled"] = value
|
||||
tomlkit.dump(self.__config, configFile)
|
||||
|
||||
def __str__(self) -> str:
|
||||
return f"Mod({self.__path})"
|
||||
|
||||
|
||||
class InvalidModError(Exception):
|
||||
"""
|
||||
This exception is raised when the Mod class gets given a path of something that's not a valid mod
|
||||
"""
|
||||
|
||||
def __init__(self, message: str) -> None:
|
||||
super().__init__(message)
|
||||
self.message = message
|
||||
|
||||
def __str__(self) -> str:
|
||||
return f"{self.message}"
|
||||
0
src/__init__.py
Normal file
0
src/__init__.py
Normal file
1
src/__main__.py
Normal file
1
src/__main__.py
Normal file
|
|
@ -0,0 +1 @@
|
|||
from . import leek_app
|
||||
|
|
@ -11,6 +11,8 @@ from PySide6.QtQml import QQmlApplicationEngine
|
|||
def main():
|
||||
"""Initializes and manages the application execution"""
|
||||
app: QGuiApplication = QGuiApplication(sys.argv)
|
||||
app.desktopFileName = "xyz.xyz.toast003.leek"
|
||||
app.applicationName = "Leek"
|
||||
engine = QQmlApplicationEngine()
|
||||
|
||||
"""Needed to close the app with Ctrl+C"""
|
||||
|
|
@ -21,7 +23,7 @@ def main():
|
|||
os.environ["QT_QUICK_CONTROLS_STYLE"] = "org.kde.desktop"
|
||||
|
||||
base_path = os.path.abspath(os.path.dirname(__file__))
|
||||
url = QUrl(f"file://{base_path}/main.qml")
|
||||
url = QUrl(f"file://{base_path}/Main.qml")
|
||||
engine.load(url)
|
||||
|
||||
if len(engine.rootObjects()) == 0:
|
||||
Loading…
Add table
Add a link
Reference in a new issue