5 Commits

Author SHA1 Message Date
9117ff1354 Merge branch 'fix/xdg-path-fix-again' of github.com:szymon-jozef/zutui into fix/xdg-path-fix-again 2026-02-26 18:53:12 +01:00
f25306380f comma 2026-02-26 18:52:08 +01:00
483270349e pkgbuild version bump 2026-02-26 18:30:44 +01:00
86d792e24d make xdg dirs more correct! 2026-02-26 18:25:13 +01:00
Szymon
acc19d9539 Add nix flake (#7) 2026-02-22 18:19:16 +01:00
6 changed files with 25 additions and 29 deletions

View File

@@ -1,13 +1,13 @@
# Maintainer: <szymon_jozef@proton.me>
_pkgname="zutui"
pkgname="$_pkgname-git"
pkgver=1.0.0
pkgrel=1
pkgver="1.0.0.r8.ceefa47"
pkgrel=4
pkgdesc="TUI for accessing edziekanat of ZUT university"
arch=("any")
url="https://github.com/shv187/zutui"
license=("MIT")
depends=("python" "python-keyring" "python-textual")
depends=("python" "python-keyring" "python-textual" "python-appdirs" "python-beautifulsoup4" "python-requests")
makedepends=("git" "python-build" "python-installer" "python-wheel" "python-setuptools")
provides=("zutui")
conflicts=("zutui")
@@ -16,7 +16,7 @@ sha256sums=("SKIP")
pkgver() {
cd "$_pkgname"
printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
printf "1.0.0.r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}
build() {

View File

@@ -36,6 +36,7 @@
textual
requests
beautifulsoup4
appdirs
];
meta = with pkgs.lib; {
@@ -46,6 +47,14 @@
};
};
};
devShells = {
default = pkgs.mkShell {
inputsFrom = [ self.packages.${system}.default ];
};
};
}
);
}

View File

@@ -9,7 +9,8 @@ setup(
"beautifulsoup4",
"textual",
"keyring",
"pywin32; sys_platform == 'win32'"
"pywin32; sys_platform == 'win32'",
"appdirs",
],
entry_points={
'console_scripts': [

View File

@@ -1,19 +0,0 @@
import os
import platform
USER_HOME = os.path.expanduser("~")
WINDOWS_PATH = "zutui" # probably should be in %AppData% or something, but I'm not sure, so I won't change it
LINUX_PATH = ".config/zutui"
def get_config_path():
system = platform.system()
if system == "Windows":
APP_DIR = os.path.join(USER_HOME, WINDOWS_PATH)
elif system in ["Linux", "Darwin"]:
APP_DIR = os.path.join(USER_HOME, LINUX_PATH)
else:
print(f"System {system} not supported, aborting...")
exit(1)
if not os.path.exists(APP_DIR):
os.makedirs(APP_DIR)
return APP_DIR

View File

@@ -1,13 +1,18 @@
import requests
from bs4 import BeautifulSoup
import json
from appdirs import user_config_dir, user_cache_dir
import os
from .config import get_config_path
app_name = "zutui"
app_author = "shv187"
APP_DIR = get_config_path()
CONFIG_DIR = user_config_dir(app_name, app_author)
CACHE_DIR = user_cache_dir(app_name, app_author)
os.makedirs(CACHE_DIR, exist_ok=True)
os.makedirs(CONFIG_DIR, exist_ok=True)
CACHE_FILE = os.path.join(APP_DIR, "grades_cache.json")
CACHE_FILE = os.path.join(CACHE_DIR, "grades_cache.json")
TIMEOUT = 10
class ZUT:

View File

@@ -3,6 +3,7 @@ import os
import keyring
from keyring.errors import KeyringError
from datetime import datetime
from appdirs import user_config_dir
from textual.app import App, ComposeResult
from textual.containers import Container
from textual.widgets import Header, Footer, DataTable, Label, Button, Input
@@ -10,9 +11,8 @@ from textual.screen import Screen
from textual.binding import Binding
from .zut_client import ZUT
from .config import get_config_path
APP_DIR = get_config_path()
APP_DIR = user_config_dir("zutui", "shv187")
CONFIG_FILE = os.path.join(APP_DIR, "config.json")
REFRESH_INTERVAL = 1800