From 5e3eec96119d1c781d9d40737d93fe71b9aaf488 Mon Sep 17 00:00:00 2001 From: itdominator <1itdominator@gmail.com> Date: Fri, 29 Sep 2023 17:24:16 -0500 Subject: [PATCH] Updated README; improved settings setup --- README.md | 10 +++--- requirements.txt | 2 ++ src/versions/0.0.2/GWinWrap/utils/settings.py | 33 ++++++++++--------- 3 files changed, 26 insertions(+), 19 deletions(-) create mode 100644 requirements.txt diff --git a/README.md b/README.md index 50930d4..aed688e 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,15 @@ # GWinWrap -GWinWrap is a Gtk with Python gui to select videos for XWinWrap, images for Nitrogen Wallpaper Manager, and gifs for Gifsicle. -It includes the XWinWrap binary and source code for Shantanu Goel's version of XWinWrap. +GWinWrap is a Python application with a Gtk UI to select videos, gifs (or other images), or an xscreensaver as your desktop wallpaper/background. +This includes the XWinWrap binary and source code from Shantanu Goel's version of XWinWrap. # Notes * Need python 2+ -* Need PyGObject -* When you first run the application and save settings for a screen, you need to chmod 744 the new file(s) in your $HOME directory. +* Need PyGObject and Gtk * A settings file per screen is generated. +# Install +` sudo pacman -Sy mpv gifsicle nitrogen xscreensaver ` + # Images ![1 Default view starting out. ](images/pic1.png) diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..b7ee8e2 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +PyGObject +setproctitle diff --git a/src/versions/0.0.2/GWinWrap/utils/settings.py b/src/versions/0.0.2/GWinWrap/utils/settings.py index f0517a4..1055d14 100644 --- a/src/versions/0.0.2/GWinWrap/utils/settings.py +++ b/src/versions/0.0.2/GWinWrap/utils/settings.py @@ -16,25 +16,25 @@ from .logger import Logger class Settings: def __init__(self): - self._SCRIPT_PTH = os.path.dirname(os.path.realpath(__file__)) - self._USER_HOME = os.path.expanduser('~') - self._USR_PATH = f"/usr/share/{app_name.lower()}" - self._USR_PATH_CONFIG = f"{self._USR_PATH}/settings.json" - self._CONFIG_PATH = f"{self._USER_HOME}/.config/{app_name.lower()}" - self._GLADE_FILE = f"{self._CONFIG_PATH}/Main_Window.glade" - self._CSS_FILE = f"{self._CONFIG_PATH}/stylesheet.css" - self._DEFAULT_ICONS = f"{self._CONFIG_PATH}/icons" - self._PID_FILE = f"{self._CONFIG_PATH}/{app_name.lower()}.pid" - self._WINDOW_ICON = f"{self._DEFAULT_ICONS}/{app_name.lower()}.png" - self._CONFIG_FILE = f"{self._CONFIG_PATH}/settings.json" + self._SCRIPT_PTH = os.path.dirname(os.path.realpath(__file__)) + self._USER_HOME = os.path.expanduser('~') + self._USR_PATH = f"/usr/share/{app_name.lower()}" + self._USR_CONFIG_FILE = f"{self._USR_PATH}/settings.json" + self._HOME_CONFIG_PATH = f"{self._USER_HOME}/.config/{app_name.lower()}" + self._DEFAULT_ICONS = f"{self._HOME_CONFIG_PATH}/icons" + self._CONFIG_FILE = f"{self._HOME_CONFIG_PATH}/settings.json" + self._GLADE_FILE = f"{self._HOME_CONFIG_PATH}/Main_Window.glade" + self._CSS_FILE = f"{self._HOME_CONFIG_PATH}/stylesheet.css" + self._PID_FILE = f"{self._HOME_CONFIG_PATH}/{app_name.lower()}.pid" + self._WINDOW_ICON = f"{self._DEFAULT_ICONS}/{app_name.lower()}.png" - if not os.path.exists(self._CONFIG_PATH): - os.mkdir(self._CONFIG_PATH) + if not os.path.exists(self._HOME_CONFIG_PATH): + os.mkdir(self._HOME_CONFIG_PATH) if not os.path.exists(self._CONFIG_FILE): import shutil try: - shutil.copyfile(self._USR_PATH_CONFIG, self._CONFIG_FILE) + shutil.copyfile(self._USR_CONFIG_FILE, self._CONFIG_FILE) except Exception as e: raise @@ -47,8 +47,11 @@ class Settings: if not os.path.exists(self._WINDOW_ICON): self._WINDOW_ICON = f"{self.DEFAULT_ICONS}/{app_name.lower()}.png" + thumbnail_path = f"{self._USER_HOME}/.thumbnails/normal" + if not os.path.exists(thumbnail_path): + os.system(f"mkdir -p '{thumbnail_path}'") - self._logger = Logger(self._CONFIG_PATH).get_logger() + self._logger = Logger(self._HOME_CONFIG_PATH).get_logger() self._builder = Gtk.Builder() self._builder.add_from_file(self._GLADE_FILE)