UniNews
University news from Greek and international universities in one place
Loading...
Searching...
No Matches
uninews.config Namespace Reference

Functions

Path xdg_dir (str variable, str default)
 
dict load_settings ()
 
None save_settings (dict settings)
 
str load_unios_university ()
 
str home_university (dict settings)
 
int refresh_interval_ms (dict settings)
 

Variables

str APP_NAME = "uninews"
 
 PACKAGE_DIR = Path(__file__).resolve().parent
 
str PUBLISHERS_DIR = PACKAGE_DIR / "resources" / "publishers"
 
str ICON_FILE = PACKAGE_DIR / "resources" / "icons" / "uninews.png"
 
Path CONFIG_DIR = xdg_dir("XDG_CONFIG_HOME", ".config")
 
Path DATA_DIR = xdg_dir("XDG_DATA_HOME", ".local/share")
 
Path CACHE_DIR = xdg_dir("XDG_CACHE_HOME", ".cache")
 
Path SETTINGS_FILE = CONFIG_DIR / "settings.json"
 
Path DATABASE_FILE = DATA_DIR / "uninews.db"
 
str ACADEMIC_CONFIG_FILE = Path.home() / ".unios" / "academicConfig.json"
 
dict DEFAULT_SETTINGS
 
str HOME_UNIVERSITY_ALL = "all"
 
int MIN_REFRESH_INTERVAL_MINUTES = 15
 

Detailed Description

Where files live, and the user's preferences.

User data follows the XDG spec, so an installed copy never writes next to its
own code: ~/.config/uninews/settings.json and ~/.local/share/uninews/uninews.db

Function Documentation

◆ home_university()

str uninews.config.home_university ( dict  settings)
Publisher to open with, or "" for All sources.

Order: the UniNews setting, then the UniOS profile from UniDesk, then All sources.

◆ load_settings()

dict uninews.config.load_settings ( )
Defaults, with whatever the user has saved on top.

◆ load_unios_university()

str uninews.config.load_unios_university ( )
The university picked in UniDesk, or "" when none is set or the file is unreadable.

◆ refresh_interval_ms()

int uninews.config.refresh_interval_ms ( dict  settings)
Auto-refresh interval in milliseconds, or 0 when it is off.

◆ save_settings()

None uninews.config.save_settings ( dict  settings)
Write atomically, so a crash mid-save can't corrupt the file.

◆ xdg_dir()

Path uninews.config.xdg_dir ( str  variable,
str  default 
)

Variable Documentation

◆ ACADEMIC_CONFIG_FILE

str uninews.config.ACADEMIC_CONFIG_FILE = Path.home() / ".unios" / "academicConfig.json"

◆ APP_NAME

str uninews.config.APP_NAME = "uninews"

◆ CACHE_DIR

Path uninews.config.CACHE_DIR = xdg_dir("XDG_CACHE_HOME", ".cache")

◆ CONFIG_DIR

Path uninews.config.CONFIG_DIR = xdg_dir("XDG_CONFIG_HOME", ".config")

◆ DATA_DIR

Path uninews.config.DATA_DIR = xdg_dir("XDG_DATA_HOME", ".local/share")

◆ DATABASE_FILE

Path uninews.config.DATABASE_FILE = DATA_DIR / "uninews.db"

◆ DEFAULT_SETTINGS

dict uninews.config.DEFAULT_SETTINGS
Initial value:
1= {
2 "theme": "light",
3 "page_size": 12,
4 "refresh_on_startup": True,
5 "refresh_interval_minutes": 0, # 0 = only when asked
6 "max_cached_articles": 500,
7 "home_university": "", # "" = UniOS profile, "all" = All sources
8}

◆ HOME_UNIVERSITY_ALL

str uninews.config.HOME_UNIVERSITY_ALL = "all"

◆ ICON_FILE

str uninews.config.ICON_FILE = PACKAGE_DIR / "resources" / "icons" / "uninews.png"

◆ MIN_REFRESH_INTERVAL_MINUTES

int uninews.config.MIN_REFRESH_INTERVAL_MINUTES = 15

◆ PACKAGE_DIR

uninews.config.PACKAGE_DIR = Path(__file__).resolve().parent

◆ PUBLISHERS_DIR

str uninews.config.PUBLISHERS_DIR = PACKAGE_DIR / "resources" / "publishers"

◆ SETTINGS_FILE

Path uninews.config.SETTINGS_FILE = CONFIG_DIR / "settings.json"