Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
for x in args.a:
if path.isfile(glob.glob(x)[0]):
add_action(glob.glob(x)[0])
exit(0)
if args.c:
print(themer.get_current())
exit(0)
if args.z or args.A:
alter_action = color.shuffle_colors if args.z \
else color.auto_adjust
arg_list = args.z if args.z else args.A
for arg in arg_list:
colors = color.get_color_list(arg)
colors = alter_action(colors)
color.write_colors(arg, colors)
sample.create_sample(colors, files.get_sample_path(arg))
logging.info("shuffled %s" % arg)
exit(0)
if args.link:
files.add_template(args.link[1], args.link[0])
exit(0)
if args.i:
themer.import_theme(args.i[0], args.i[1], args.T)
exit(0)
if args.o:
def on_import_click(self, widget):
fcd = Gtk.FileChooserDialog(
'Select a colorscheme', self.parent,
Gtk.FileChooserAction.OPEN,
(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
Gtk.STOCK_OPEN, Gtk.ResponseType.OK))
filter = Gtk.FileFilter()
filter.set_name("JSON colorscheme")
filter.add_mime_type("application/json")
fcd.add_filter(filter)
response = fcd.run()
if response == Gtk.ResponseType.OK:
self.color_list = color.get_color_list(fcd.get_filename(), True)
self.render_buttons()
self.render_sample()
fcd.destroy()
def import_theme(wallpaper, json_file, theme=False):
"""import a colorscheme from a JSON file either in
terminal.sexy or pywal format"""
json_file = realpath(json_file)
filename = basename(json_file)
if theme:
theme = pywal.theme.file(filename)
color_list = list(theme["colors"].values())
else:
try:
color_list = color.get_color_list(json_file, True)
except IOError:
logging.error("file does not exist")
return
color.write_colors(wallpaper, color_list)
sample.create_sample(color_list, files.get_sample_path(wallpaper))
logging.info("applied %s to %s" % (filename, wallpaper))