|
|
@ -29,6 +29,7 @@ |
|
|
|
|
|
|
|
|
|
|
|
# Standard Lib |
|
|
|
# Standard Lib |
|
|
|
import os |
|
|
|
import os |
|
|
|
|
|
|
|
from os.path import abspath |
|
|
|
|
|
|
|
|
|
|
|
# This Application |
|
|
|
# This Application |
|
|
|
from .pkg_json import PackageJSON |
|
|
|
from .pkg_json import PackageJSON |
|
|
@ -55,15 +56,23 @@ logger.addHandler(stream_handler) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def checkTheme(self): |
|
|
|
def checkTheme(self): |
|
|
|
themes = listThemes(self) |
|
|
|
theme: str = self.config.greeter.theme |
|
|
|
config_theme = self.config.greeter.theme |
|
|
|
dir = self.config.themes_dir |
|
|
|
default = "gruvbox" |
|
|
|
path_to_theme: str = os.path.join(dir, theme, "index.html") |
|
|
|
if self.config.greeter.theme in themes: |
|
|
|
def_theme = "gruvbox" |
|
|
|
pass |
|
|
|
|
|
|
|
else: |
|
|
|
if theme.startswith("/"): path_to_theme = theme; |
|
|
|
logger.error("Config theme not valid: \"{0}\". Going with \"{1}\" theme".format( |
|
|
|
elif "." in theme or "/" in theme: |
|
|
|
config_theme, default)) |
|
|
|
path_to_theme = os.path.abspath(theme) |
|
|
|
self.config.greeter.theme = default |
|
|
|
|
|
|
|
|
|
|
|
if not path_to_theme.endswith(".html"): |
|
|
|
|
|
|
|
path_to_theme = os.path.join(path_to_theme, "index.html") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if not os.path.exists(path_to_theme): |
|
|
|
|
|
|
|
logger.error("\"{0}\" theme does not exists. Using \"{1}\"".format(theme, def_theme)) |
|
|
|
|
|
|
|
path_to_theme = os.path.join(dir, def_theme, "index.html") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return path_to_theme |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def listThemes(self): |
|
|
|
def listThemes(self): |
|
|
|