Compare commits

..

No commits in common. "d3d2f8a829108686b635a630f38843722088dd62" and "5a913e25d8153dfbdb732b4958b686571df26a39" have entirely different histories.

2 changed files with 7 additions and 5 deletions

View file

@ -1,3 +1,4 @@
#!/usr/bin/env python3
from sys import exit from sys import exit
from os import chdir, getenv, system from os import chdir, getenv, system
import logging import logging
@ -41,6 +42,7 @@ class _ConfigLib:
logger.warning("'systray' is not set in the dictionary general in the config file, defaulting to 'true'.") logger.warning("'systray' is not set in the dictionary general in the config file, defaulting to 'true'.")
# Setup logging # Setup logging
self._set_log_level() self._set_log_level()
if self.config_systray: if self.config_systray:
@ -55,7 +57,7 @@ class _ConfigLib:
def _set_log_level(self): def _set_log_level(self):
global logging global logging
global logger global logger
chdir("/var/log/wallman/") chdir(str(getenv("HOME")) + "/.local/share/wallman/")
numeric_level = getattr(logging, self.config_log_level, logging.INFO) numeric_level = getattr(logging, self.config_log_level, logging.INFO)
logger.setLevel(numeric_level) logger.setLevel(numeric_level)
logging.basicConfig(filename="wallman.log", encoding="utf-8", level=numeric_level) logging.basicConfig(filename="wallman.log", encoding="utf-8", level=numeric_level)
@ -88,8 +90,8 @@ class ConfigValidity(_ConfigLib):
else: else:
try: try:
self._set_fallback_wallpaper() self._set_fallback_wallpaper()
logger.error("The amount of changing_times and the amount of wallpapers_per_set does not match, the fallback wallpaper has been set.") logger.error("The amount of changing_times and the amount of wallpapers_per_set does not much, the fallback wallpaper has been set.")
print("ERROR: The amount of changing_times and the amount of wallpapers_per_set does not match, the fallback wallpaper has been set.") print("ERROR: The amount of changing_times and the amount of wallpapers_per_set does not much, the fallback wallpaper has been set.")
return False return False
except ConfigError: except ConfigError:
logger.critical("The amount of changing times and the amount of wallpapers per set does not match, exiting...") logger.critical("The amount of changing times and the amount of wallpapers per set does not match, exiting...")
@ -255,7 +257,7 @@ class WallpaperLogic(_ConfigLib):
systray.item("Reroll Wallpapers", partial(systray.reroll_wallpapers, first_callback=self._choose_wallpaper_set, second_callback=self.set_wallpaper_by_time)), systray.item("Reroll Wallpapers", partial(systray.reroll_wallpapers, first_callback=self._choose_wallpaper_set, second_callback=self.set_wallpaper_by_time)),
systray.item("Quit", partial(systray.on_quit, callback=scheduler.shutdown)) systray.item("Quit", partial(systray.on_quit, callback=scheduler.shutdown))
) )
icon = systray.Icon("wallman_icon", systray.icon_image, "My Tray Icon", menu) icon =systray.Icon("wallman_icon", systray.icon_image, "My Tray Icon", menu)
icon.run() icon.run()
else: else:
_schedule_blocking_wallpapers() _schedule_blocking_wallpapers()

View file

@ -34,7 +34,7 @@ def on_quit(icon, item, callback):
icon.stop() icon.stop()
chdir("/etc/wallman/icons/systrayIcon") chdir(str(getenv("HOME")) + "/.config/wallman/")
try: try:
icon_image = Image.open("systrayIcon.jpg") icon_image = Image.open("systrayIcon.jpg")
except FileNotFoundError: except FileNotFoundError: