How to use the wpgtk.data.config.WALL_DIR 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 / data / files.py View on Github external
def get_cache_path(wallpaper, backend=None):
    """get a colorscheme cache path using a wallpaper name"""
    if not backend:
        backend = settings.get("backend", "wal")

    filepath = join(WALL_DIR, wallpaper)
    filename = cache_fname(filepath, backend, False, WPG_DIR)

    return join(*filename)
github deviantfero / wpgtk / wpgtk / gui / color_grid.py View on Github external
def render_sample(self):
        sample.create_sample(self.color_list)
        sample_path = os.path.join(WALL_DIR, ".tmp.sample.png")
        self.pixbuf_sample = GdkPixbuf.Pixbuf.new_from_file_at_size(
                str(sample_path),
                width=500,
                height=300)
        self.sample.set_from_pixbuf(self.pixbuf_sample)
github deviantfero / wpgtk / wpgtk / data / file_list.py View on Github external
def __init__(self, path):
        valid = re.compile('^[^\.](.*\.png$|.*\.jpg$|.*\.jpeg$|.*\.jpe$)')
        self.files = []
        self.file_names_only = []
        for(dirpath, dirnames, filenames) in walk(config.WALL_DIR):
            for f in filenames:
                self.files.append(f)
            break
        self.files = [elem for elem in self.files if valid.fullmatch(elem)]
        self.file_names_only = self.files
github deviantfero / wpgtk / wpgtk / data / color.py View on Github external
def write_colors(img, color_list):
    """write changes to a cache file to persist customizations"""
    full_path = os.path.join(WALL_DIR, img)
    color_dict = pywal.colors.colors_to_dict(color_list, full_path)
    cache_file = files.get_cache_path(img)

    pywal.export.color(color_dict, "json", cache_file)
github deviantfero / wpgtk / wpgtk / data / themer.py View on Github external
def set_theme(wallpaper, colorscheme, restore=False):
    """apply a given wallpaper and a given colorscheme"""
    use_vte = settings.getboolean("vte", False)
    is_file = path.isdir(colorscheme) or path.isfile(colorscheme)
    target = colorscheme if is_file else path.join(WALL_DIR, colorscheme)

    set_wall = settings.getboolean("set_wallpaper", True)
    reload_all = settings.getboolean("reload", True)
    colors = color.get_pywal_dict(target, is_file)
    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)
github deviantfero / wpgtk / wpgtk / data / sample.py View on Github external
def create_sample(colors, f=os.path.join(WALL_DIR, ".tmp.sample.png")):
    im = Image.new("RGB", (480, 50), "white")
    pix = im.load()
    width_sample = im.size[0]//(len(colors)//2)

    for i, c in enumerate(colors[:8]):
        for j in range(width_sample*i, width_sample*i+width_sample):
            for k in range(0, 25):
                pix[j, k] = pywal.util.hex_to_rgb(c)

    for i, c in enumerate(colors[8:16]):
        for j in range(width_sample*i, width_sample*i+width_sample):
            for k in range(25, 50):
                pix[j, k] = pywal.util.hex_to_rgb(c)

    im.save(f)
github deviantfero / wpgtk / wpgtk / data / files.py View on Github external
def change_current(filename):
    """update symlink to point to the current wallpaper"""
    os.symlink(join(WALL_DIR, filename), join(WPG_DIR, ".currentTmp"))
    os.rename(join(WPG_DIR, ".currentTmp"), join(WPG_DIR, ".current"))
github deviantfero / wpgtk / wpgtk / data / themer.py View on Github external
def create_theme(filepath):
    """create a colors-scheme from a filepath"""
    filepath = realpath(filepath)
    filename = basename(filepath).replace(" ", "_")
    tmplink = path.join(WALL_DIR, ".tmp.link")

    symlink(filepath, tmplink)
    shutil.move(tmplink, path.join(WALL_DIR, filename))

    try:
        return color.get_color_list(filename)
    except SystemExit:
        return set_fallback_theme(filename)