33 lines
856 B
Python
33 lines
856 B
Python
"""
|
|
Configuration management for VoidShell
|
|
"""
|
|
|
|
import configparser
|
|
from pathlib import Path
|
|
from gi.repository import AstalIO
|
|
|
|
|
|
class Configuration:
|
|
|
|
_scss_file: Path | None
|
|
css_file: Path
|
|
|
|
def compile_scss(self):
|
|
if self._scss_file.is_file():
|
|
AstalIO.Process.execv(["sass", str(self._scss_file), str(self.css_file)])
|
|
|
|
def __init__(self, config_file: Path):
|
|
|
|
parser = configparser.ConfigParser()
|
|
parser.read(config_file)
|
|
|
|
if "style" in parser and "stylesheet" in parser["style"]:
|
|
self.css_file = config_file / Path(parser["style"])
|
|
else:
|
|
self.css_file = config_file / "style.css"
|
|
|
|
if self.css_file.suffix == "scss":
|
|
self._scss_file = self.css_file
|
|
self.css_file = self._scss_file.with_suffix("css")
|
|
self.compile_scss()
|