How to use the wpgtk.data.files function in wpgtk

To help you get started, we’ve selected a few wpgtk examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github deviantfero / wpgtk / wpgtk / __main__.py View on Github external
settings["alpha"] = args.alpha[0]

    if args.backend and args.backend != "list":
        if args.backend in pywal.colors.list_backends():
            settings['backend'] = args.backend
        else:
            logging.error("no such backend, please "
                          "choose a valid backend")
            exit(1)

    if args.preview:
        pywal.colors.palette()
        exit(0)

    if args.m:
        file_list = files.get_file_list()
        if len(file_list) > 0:
            filename = random.choice(file_list)
            themer.set_theme(filename, filename, args.r)
            exit(0)
        else:
            logging.error("you have no themes")
            exit(1)

    if args.s:
        if len(args.s) == 1:
            themer.set_theme(args.s[0], args.s[0], args.r)
        elif len(args.s) == 2:
            themer.set_theme(args.s[0], args.s[1], args.r)
        exit(0)

    if args.l:
github deviantfero / wpgtk / wpgtk / __main__.py View on Github external
exit(0)

    if args.l:
        if args.t:
            templates = files.get_file_list(OPT_DIR, False)
            any(print(t) for t in templates if ".base" in t)
        else:
            print("\n".join(files.get_file_list()))
        exit(0)

    if args.version:
        print("current version: " + __version__)
        exit(0)

    if args.d:
        delete_action = files.delete_template if args.t \
                        else themer.delete_theme
        try:
            any(delete_action(x) for x in args.d)
        except IOError:
            logging.error("file not found")
            exit(1)

        exit(0)

    if args.a:
        add_action = files.add_template if args.t \
                     else themer.create_theme
        for x in args.a:
            if path.isfile(glob.glob(x)[0]):
                add_action(glob.glob(x)[0])
        exit(0)
github deviantfero / wpgtk / wpgtk / __main__.py View on Github external
sample.create_sample(cl, files.get_sample_path(args.brt[0]))
        exit(0)

    if args.theme and args.theme != "list":
        light = settings['light_theme'] == "true"
        themer.set_pywal_theme(args.theme, light)
        exit(0)

    if args.backend == "list":
        print("\n".join(pywal.colors.list_backends()))
        exit(0)

    if args.update:
        for arg in args.update:
            if arg.endswith(".base"):
                files.update_template(arg)
        exit(0)

    if args.noreload:
        settings["reload"] = "false"
github deviantfero / wpgtk / wpgtk / data / color.py View on Github external
is_light_theme = settings.getboolean("light_theme", False)

    if json:
        theme = pywal.util.read_file_json(filename)
    else:
        theme = get_pywal_dict(filename)

    if "color" in theme:
        color_list = theme["color"]
    else:
        color_list = list(theme["colors"].values())

    if is_new and not json:
        if is_auto_adjust or is_light_theme:
            color_list = auto_adjust(color_list)
        sample.create_sample(color_list, files.get_sample_path(filename))
        write_colors(filename, color_list)

    return color_list
github deviantfero / wpgtk / wpgtk / data / themer.py View on Github external
def set_fallback_theme(wallpaper):
    """fallback theme for when color generation fails"""
    theme = pywal.theme.file("random")

    color_list = list(theme["colors"].values())
    color.write_colors(wallpaper, color_list)
    sample.create_sample(color_list, files.get_sample_path(wallpaper))

    return color_list
github deviantfero / wpgtk / wpgtk / gui / color_grid.py View on Github external
def on_ok_click(self, widget):
        current_walls = files.get_file_list()
        if len(current_walls) > 0:
            x = self.option_combo.get_active()
            color.write_colors(current_walls[x], self.color_list)
            tmpfile = os.path.join(WALL_DIR, ".tmp.sample.png")
            if(os.path.isfile(tmpfile)):
                shutil.move(os.path.join(WALL_DIR, ".tmp.sample.png"),
                            files.get_sample_path(current_walls[x]))
                self.done_lbl.set_text("Changes saved")
                x = self.parent.colorscheme.get_active()
                sample_path = files.get_sample_path(self.selected_file)
                self.parent.pixbuf_sample = GdkPixbuf.Pixbuf\
                    .new_from_file_at_size(sample_path, width=500, height=300)
                self.parent.sample.set_from_pixbuf(self.pixbuf_sample)
github deviantfero / wpgtk / wpgtk / data / themer.py View on Github external
pywal.sequences.send(colors, WPG_DIR, vte_fix=use_vte)

    if not restore:
        pywal.export.every(colors, FORMAT_DIR)
        color.apply_colorscheme(colors)
        if reload_all:
            reload.all()
    else:
        reload.xrdb()

    if set_wall:
        filepath = path.join(WALL_DIR, wallpaper)
        set_wall = filepath if path.isfile(filepath) else colors["wallpaper"]
        pywal.wallpaper.change(set_wall)

    files.write_script(wallpaper, colorscheme)
    files.change_current(wallpaper)

    Popen(['chmod', '+x', path.join(WPG_DIR, "wp_init.sh")])

    if settings.getboolean('execute_cmd', False) and not restore:
        Popen(['bash', '-c', settings['command']])
github deviantfero / wpgtk / wpgtk / data / color.py View on Github external
def get_color_list(filename, json=False):
    """extract a list with 16 colors from a json or a pywal dict"""
    is_new = not os.path.isfile(files.get_cache_path(filename))
    is_auto_adjust = settings.getboolean("auto_adjust", True)
    is_light_theme = settings.getboolean("light_theme", False)

    if json:
        theme = pywal.util.read_file_json(filename)
    else:
        theme = get_pywal_dict(filename)

    if "color" in theme:
        color_list = theme["color"]
    else:
        color_list = list(theme["colors"].values())

    if is_new and not json:
        if is_auto_adjust or is_light_theme:
            color_list = auto_adjust(color_list)
github deviantfero / wpgtk / wpgtk / data / themer.py View on Github external
def set_pywal_theme(theme_name, light):
    """sets a pywal theme and applies it to wpgtk"""
    current = get_current()
    theme = pywal.theme.file(theme_name, light)

    color_list = list(theme["colors"].values())
    color.write_colors(current, color_list)
    sample.create_sample(color_list, files.get_sample_path(current))

    set_theme(current, current)