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