mirror of
https://github.com/dylanaraps/pywal.git
synced 2025-01-05 21:48:55 +01:00
export: Add error handling
This commit is contained in:
parent
07fd6fa661
commit
91fa1e0ca5
@ -89,20 +89,23 @@ def process_args(args):
|
||||
# -i
|
||||
if args.i:
|
||||
image_file = image.get_image(args.i)
|
||||
|
||||
# Create a list of hex colors.
|
||||
colors_plain = magic.get_colors(image_file, args.q)
|
||||
|
||||
if not args.n:
|
||||
wallpaper.set_wallpaper(image_file)
|
||||
|
||||
# -f
|
||||
elif args.f:
|
||||
colors_plain = util.read_file_json(args.f)
|
||||
|
||||
# If wallpaper is unset, set it to "None"
|
||||
if "wallpaper" not in colors_plain:
|
||||
colors_plain["wallpaper"] = "None"
|
||||
|
||||
# -i or -f
|
||||
if args.i or args.f:
|
||||
sequences.send_sequences(colors_plain, args.t)
|
||||
|
||||
if not args.n:
|
||||
wallpaper.set_wallpaper(colors_plain["wallpaper"])
|
||||
|
||||
export.export_all_templates(colors_plain)
|
||||
reload.reload_env()
|
||||
|
||||
|
@ -82,6 +82,9 @@ def set_desktop_wallpaper(desktop, img):
|
||||
|
||||
def set_wallpaper(img):
|
||||
"""Set the wallpaper."""
|
||||
if not os.path.isfile(img):
|
||||
return
|
||||
|
||||
desktop = get_desktop_env()
|
||||
|
||||
if desktop:
|
||||
|
Loading…
Reference in New Issue
Block a user