Compare commits
9 commits
a549e9a99c
...
ef25e8a026
| Author | SHA1 | Date | |
|---|---|---|---|
| ef25e8a026 | |||
| 3a8406cb19 | |||
| 8349e4f340 | |||
| fb81e2bd1f | |||
| 9d4b229b44 | |||
| 64fd7d47e6 | |||
| d53fe7160f | |||
| bc6c17b940 | |||
| b5c6b33c68 |
3 changed files with 46 additions and 19 deletions
|
|
@ -9,13 +9,15 @@
|
|||
lib = nixpkgs.lib;
|
||||
in
|
||||
{
|
||||
devShells.x86_64-linux.default = pkgs.mkShell {
|
||||
devShells.x86_64-linux.default = pkgs.mkShellNoCC {
|
||||
name = "leek-devshell";
|
||||
packages = with pkgs; [
|
||||
ruff
|
||||
(
|
||||
python3.withPackages (ps: with ps;[
|
||||
python-lsp-server
|
||||
pylsp-mypy
|
||||
mypy
|
||||
pyside6
|
||||
tomlkit
|
||||
]
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ dependencies = [
|
|||
"pyside6",
|
||||
"tomlkit",
|
||||
]
|
||||
requires-python = ">=3.6"
|
||||
|
||||
[project.readme]
|
||||
file = "README.md"
|
||||
|
|
@ -31,6 +32,30 @@ packages = ["leek"]
|
|||
package-dir = {leek = "src"}
|
||||
include-package-data = true
|
||||
|
||||
[tool.ruff.lint]
|
||||
select = [
|
||||
# Defaults
|
||||
"E4",
|
||||
"E7",
|
||||
"E9",
|
||||
"F",
|
||||
|
||||
"W", # Pycodestyle warning
|
||||
"N" # Pep-8 naming
|
||||
]
|
||||
|
||||
[tool.mypy]
|
||||
mypy_path = "$MYPY_CONFIG_FILE_DIR/src"
|
||||
|
||||
# Pyside 6 doesn't have type info so it's better to just ignore it
|
||||
[[tool.mypy.overrides]]
|
||||
module = [
|
||||
"PySide6.QtGui",
|
||||
"PySide6.QtCore",
|
||||
"PySide6.QtQml"
|
||||
]
|
||||
ignore_missing_imports = true
|
||||
|
||||
[tool.setuptools.data-files]
|
||||
"share/applications" = ["xyz.toast003.leek.desktop"]
|
||||
|
||||
|
|
|
|||
|
|
@ -11,35 +11,24 @@ class Mod:
|
|||
def name(self) -> str | None:
|
||||
if "name" not in self.__config:
|
||||
return None
|
||||
return self.__config["name"]
|
||||
return self.__config["name"].as_string()
|
||||
|
||||
@property
|
||||
def description(self) -> str | None:
|
||||
if "description" not in self.__config.keys():
|
||||
return None
|
||||
else:
|
||||
return self.__config["description"]
|
||||
return self.__config["description"].as_string()
|
||||
|
||||
@property
|
||||
def author(self) -> str | None:
|
||||
if "author" not in self.__config:
|
||||
return None
|
||||
return self.__config["author"]
|
||||
return self.__config["author"].as_string()
|
||||
|
||||
@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"]
|
||||
def enabled(self) -> bool:
|
||||
return True if self.__enabled == "true" else False
|
||||
|
||||
@enabled.setter
|
||||
def enabled(self, value: bool) -> None:
|
||||
|
|
@ -47,9 +36,20 @@ class Mod:
|
|||
# Nothing to do
|
||||
return
|
||||
|
||||
with open(self.__path + "config.toml", "w") as configFile:
|
||||
with open(self.__path + "config.toml", "w") as config_file:
|
||||
self.__config["enabled"] = value
|
||||
tomlkit.dump(self.__config, configFile)
|
||||
tomlkit.dump(self.__config, config_file)
|
||||
|
||||
def __init__(self, path: str) -> None:
|
||||
self.__path = path
|
||||
|
||||
with open(path + "config.toml") as config_file:
|
||||
self.__config = tomlkit.load(config_file)
|
||||
|
||||
if "enabled" not in self.__config:
|
||||
raise InvalidModError("config.toml does not contain the enabled key")
|
||||
else:
|
||||
self.__enabled = self.__config["enabled"]
|
||||
|
||||
def __str__(self) -> str:
|
||||
return f"Mod({self.__path})"
|
||||
Loading…
Add table
Add a link
Reference in a new issue