General: Remove last global variable.

This commit is contained in:
Dylan Araps 2017-06-26 23:23:38 +10:00
parent 21c19af696
commit 0b38d7affc
3 changed files with 4 additions and 11 deletions

View File

@ -61,7 +61,6 @@ def process_args(args):
# -q
if args.q:
sys.stdout = sys.stderr = open(os.devnull, "w")
g.Args.notify = False
# -c
if args.c:
@ -82,7 +81,7 @@ def process_args(args):
image = gen_colors.get_image(args.i)
# Create a list of hex colors.
colors_plain = gen_colors.get_colors(image)
colors_plain = gen_colors.get_colors(image, args.q)
colors_plain[8] = set_colors.set_grey(colors_plain)
if not args.n:

View File

@ -84,7 +84,7 @@ def gen_colors(img):
return [re.search("#.{6}", str(col)).group(0) for col in raw_colors]
def get_colors(img):
def get_colors(img, quiet):
"""Generate a colorscheme using imagemagick."""
# Cache the wallpaper name.
util.save_file(img, g.CACHE_DIR / "wal")
@ -98,7 +98,7 @@ def get_colors(img):
else:
print("colors: Generating a colorscheme...")
if g.Args.notify:
if not quiet:
util.disown("notify-send", "wal: Generating a colorscheme...")
# Generate the colors.
@ -109,7 +109,7 @@ def get_colors(img):
util.save_file("\n".join(colors), cache_file)
print("colors: Generated colorscheme")
if g.Args.notify:
if not quiet:
util.disown("notify-send", "wal: Generation complete.")
return colors

View File

@ -10,9 +10,3 @@ __version__ = "0.2.0"
# Internal variables.
COLOR_COUNT = 16
CACHE_DIR = pathlib.Path.home() / ".cache/wal/"
# pylint: disable=too-few-public-methods
class Args(object):
"""Store args."""
notify = True