mirror of
https://github.com/szymon-jozef/zutui.git
synced 2026-09-07 20:20:42 +02:00
Compare commits
6 Commits
pkg/pkgbui
...
fix/xdg-pa
| Author | SHA1 | Date | |
|---|---|---|---|
| 9117ff1354 | |||
| f25306380f | |||
| 483270349e | |||
| 86d792e24d | |||
|
|
acc19d9539 | ||
|
|
ceefa475cb |
3
.gitignore
vendored
3
.gitignore
vendored
@@ -214,3 +214,6 @@ __marimo__/
|
|||||||
|
|
||||||
# Streamlit
|
# Streamlit
|
||||||
.streamlit/secrets.toml
|
.streamlit/secrets.toml
|
||||||
|
|
||||||
|
# nix
|
||||||
|
result
|
||||||
|
|||||||
8
PKGBUILD
8
PKGBUILD
@@ -1,13 +1,13 @@
|
|||||||
# Maintainer: <szymon_jozef@proton.me>
|
# Maintainer: <szymon_jozef@proton.me>
|
||||||
_pkgname="zutui"
|
_pkgname="zutui"
|
||||||
pkgname="$_pkgname-git"
|
pkgname="$_pkgname-git"
|
||||||
pkgver=1.0.0
|
pkgver="1.0.0.r8.ceefa47"
|
||||||
pkgrel=1
|
pkgrel=4
|
||||||
pkgdesc="TUI for accessing edziekanat of ZUT university"
|
pkgdesc="TUI for accessing edziekanat of ZUT university"
|
||||||
arch=("any")
|
arch=("any")
|
||||||
url="https://github.com/shv187/zutui"
|
url="https://github.com/shv187/zutui"
|
||||||
license=("MIT")
|
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")
|
makedepends=("git" "python-build" "python-installer" "python-wheel" "python-setuptools")
|
||||||
provides=("zutui")
|
provides=("zutui")
|
||||||
conflicts=("zutui")
|
conflicts=("zutui")
|
||||||
@@ -16,7 +16,7 @@ sha256sums=("SKIP")
|
|||||||
|
|
||||||
pkgver() {
|
pkgver() {
|
||||||
cd "$_pkgname"
|
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() {
|
build() {
|
||||||
|
|||||||
@@ -24,6 +24,11 @@ or if you want to, you can use AUR helper of your choice. For example:
|
|||||||
```bash
|
```bash
|
||||||
yay -S zutui-git
|
yay -S zutui-git
|
||||||
```
|
```
|
||||||
|
### Nix:
|
||||||
|
```bash
|
||||||
|
nix profile install github:shv187/zutui
|
||||||
|
```
|
||||||
|
|
||||||
### MacOs and other Linux distros:
|
### MacOs and other Linux distros:
|
||||||
Most distros environments are externally managed by the system package manager, so the most straightforward way would be using something like `pipx`.
|
Most distros environments are externally managed by the system package manager, so the most straightforward way would be using something like `pipx`.
|
||||||
```bash
|
```bash
|
||||||
|
|||||||
61
flake.lock
generated
Normal file
61
flake.lock
generated
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
{
|
||||||
|
"nodes": {
|
||||||
|
"flake-utils": {
|
||||||
|
"inputs": {
|
||||||
|
"systems": "systems"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1731533236,
|
||||||
|
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1771369470,
|
||||||
|
"narHash": "sha256-0NBlEBKkN3lufyvFegY4TYv5mCNHbi5OmBDrzihbBMQ=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "0182a361324364ae3f436a63005877674cf45efb",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "NixOS",
|
||||||
|
"ref": "nixos-unstable",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"inputs": {
|
||||||
|
"flake-utils": "flake-utils",
|
||||||
|
"nixpkgs": "nixpkgs"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"systems": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1681028828,
|
||||||
|
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||||
|
"owner": "nix-systems",
|
||||||
|
"repo": "default",
|
||||||
|
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-systems",
|
||||||
|
"repo": "default",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": "root",
|
||||||
|
"version": 7
|
||||||
|
}
|
||||||
60
flake.nix
Normal file
60
flake.nix
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
{
|
||||||
|
description = "TUI for accessing edziekanat of ZUT university";
|
||||||
|
|
||||||
|
inputs = {
|
||||||
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||||
|
flake-utils.url = "github:numtide/flake-utils";
|
||||||
|
};
|
||||||
|
|
||||||
|
outputs =
|
||||||
|
{
|
||||||
|
self,
|
||||||
|
nixpkgs,
|
||||||
|
flake-utils,
|
||||||
|
}:
|
||||||
|
|
||||||
|
flake-utils.lib.eachDefaultSystem (
|
||||||
|
system:
|
||||||
|
let
|
||||||
|
pkgs = nixpkgs.legacyPackages.${system};
|
||||||
|
in
|
||||||
|
{
|
||||||
|
packages = {
|
||||||
|
default = pkgs.python3Packages.buildPythonApplication {
|
||||||
|
pname = "zutui";
|
||||||
|
version = "1.0.0";
|
||||||
|
src = ./.;
|
||||||
|
pyproject = true;
|
||||||
|
|
||||||
|
build-system = with pkgs.python3Packages; [
|
||||||
|
setuptools
|
||||||
|
wheel
|
||||||
|
];
|
||||||
|
|
||||||
|
dependencies = with pkgs.python3Packages; [
|
||||||
|
keyring
|
||||||
|
textual
|
||||||
|
requests
|
||||||
|
beautifulsoup4
|
||||||
|
appdirs
|
||||||
|
];
|
||||||
|
|
||||||
|
meta = with pkgs.lib; {
|
||||||
|
description = "TUI for accessing edziekanat of ZUT university";
|
||||||
|
homepage = "https://github.com/shv187/zutui";
|
||||||
|
license = licenses.mit;
|
||||||
|
mainProgram = "zutui";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
devShells = {
|
||||||
|
default = pkgs.mkShell {
|
||||||
|
inputsFrom = [ self.packages.${system}.default ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
3
setup.py
3
setup.py
@@ -9,7 +9,8 @@ setup(
|
|||||||
"beautifulsoup4",
|
"beautifulsoup4",
|
||||||
"textual",
|
"textual",
|
||||||
"keyring",
|
"keyring",
|
||||||
"pywin32; sys_platform == 'win32'"
|
"pywin32; sys_platform == 'win32'",
|
||||||
|
"appdirs",
|
||||||
],
|
],
|
||||||
entry_points={
|
entry_points={
|
||||||
'console_scripts': [
|
'console_scripts': [
|
||||||
|
|||||||
@@ -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
|
|
||||||
@@ -1,13 +1,18 @@
|
|||||||
import requests
|
import requests
|
||||||
from bs4 import BeautifulSoup
|
from bs4 import BeautifulSoup
|
||||||
import json
|
import json
|
||||||
|
from appdirs import user_config_dir, user_cache_dir
|
||||||
import os
|
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
|
TIMEOUT = 10
|
||||||
|
|
||||||
class ZUT:
|
class ZUT:
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import os
|
|||||||
import keyring
|
import keyring
|
||||||
from keyring.errors import KeyringError
|
from keyring.errors import KeyringError
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
from appdirs import user_config_dir
|
||||||
from textual.app import App, ComposeResult
|
from textual.app import App, ComposeResult
|
||||||
from textual.containers import Container
|
from textual.containers import Container
|
||||||
from textual.widgets import Header, Footer, DataTable, Label, Button, Input
|
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 textual.binding import Binding
|
||||||
|
|
||||||
from .zut_client import ZUT
|
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")
|
CONFIG_FILE = os.path.join(APP_DIR, "config.json")
|
||||||
REFRESH_INTERVAL = 1800
|
REFRESH_INTERVAL = 1800
|
||||||
|
|||||||
Reference in New Issue
Block a user