mirror of
https://github.com/ful1e5/Bibata_Cursor.git
synced 2025-05-15 15:44:35 -04:00
🔧 Separate configs
This commit is contained in:
parent
4d82790f80
commit
b9ad8dbf6a
3 changed files with 33 additions and 30 deletions
|
@ -31,14 +31,15 @@ class Bundler():
|
|||
Create crisp package for Bibata Windows & X11 packages 📦.
|
||||
"""
|
||||
|
||||
def __init__(self, theme_name: str, config: ConfigProvider) -> None:
|
||||
def __init__(self, config: ConfigProvider) -> None:
|
||||
"""
|
||||
docsstring
|
||||
"""
|
||||
self.__name = theme_name
|
||||
self.__x11_dest = path.join(config.out_dir, theme_name)
|
||||
self.__win_dest = path.join(config.out_dir, theme_name + "-Windows")
|
||||
self.__content = config.get_windows_script(theme_name)
|
||||
self.__name = config.name
|
||||
self.__tmpdir = config.tmpdir
|
||||
self.__x11_dest = path.join(config.out_dir, self.__name)
|
||||
self.__win_dest = path.join(config.out_dir, self.__name + "-Windows")
|
||||
self.__content = config.get_windows_script()
|
||||
|
||||
def __save_win_install_script(self) -> None:
|
||||
"""
|
||||
|
@ -65,28 +66,28 @@ class Bundler():
|
|||
|
||||
self.__save_win_install_script()
|
||||
|
||||
def win_bundle(self, tempdir) -> None:
|
||||
def win_bundle(self) -> None:
|
||||
"""
|
||||
docstring
|
||||
"""
|
||||
src = path.join(tempdir, self.__name, "win")
|
||||
src = path.join(self.__tmpdir, self.__name, "win")
|
||||
shutil.copytree(src, self.__win_dest)
|
||||
self.__clean_win_bundle()
|
||||
|
||||
def x11_bundle(self, tempdir) -> None:
|
||||
def x11_bundle(self) -> None:
|
||||
"""
|
||||
docstring
|
||||
"""
|
||||
src = path.join(tempdir, self.__name, "x11")
|
||||
src = path.join(self.__tmpdir, self.__name, "x11")
|
||||
shutil.copytree(src, self.__x11_dest, symlinks=True)
|
||||
|
||||
def bundle(self, tempdir) -> None:
|
||||
def bundle(self) -> None:
|
||||
"""
|
||||
docstring
|
||||
"""
|
||||
x11_src = path.join(tempdir, self.__name, "x11")
|
||||
x11_src = path.join(self.__tmpdir, self.__name, "x11")
|
||||
shutil.copytree(x11_src, self.__x11_dest, symlinks=True)
|
||||
|
||||
win_src = path.join(tempdir, self.__name, "win")
|
||||
win_src = path.join(self.__tmpdir, self.__name, "win")
|
||||
shutil.copytree(win_src, self.__win_dest)
|
||||
self.__clean_win_bundle()
|
||||
|
|
|
@ -5,6 +5,7 @@ import sys
|
|||
import json
|
||||
import shutil
|
||||
from os import path, mkdir
|
||||
import tempfile
|
||||
|
||||
from . import __path__, __author__
|
||||
|
||||
|
@ -22,7 +23,7 @@ class ConfigProvider():
|
|||
Configure `Bibata` building process 🔧.
|
||||
"""
|
||||
|
||||
def __init__(self, bitmaps_dir: str, out_dir: str) -> None:
|
||||
def __init__(self, name: str, bitmaps_dir: str, out_dir: str) -> None:
|
||||
"""
|
||||
docsstring
|
||||
"""
|
||||
|
@ -38,16 +39,18 @@ class ConfigProvider():
|
|||
"⚠ BITMAPS NOT FOUND.\n\n`yarn install && yarn render` to Generates Bitmaps")
|
||||
sys.exit(1)
|
||||
|
||||
self.name: str = name
|
||||
self.bitmaps_dir: str = path.abspath(bitmaps_dir)
|
||||
self.tmpdir: str = tempfile.mkdtemp()
|
||||
self.out_dir: str = path.abspath(out_dir)
|
||||
|
||||
def get_windows_script(self, theme_name: str) -> str:
|
||||
def get_windows_script(self) -> str:
|
||||
"""
|
||||
docsstring
|
||||
"""
|
||||
with open(path.join(__path__[0], "windows.inf")) as f:
|
||||
data = f.read()
|
||||
inf_content = data.replace(
|
||||
"<inject_theme_name>", theme_name+" Cursors").replace("<inject_author_name>", __author__)
|
||||
"<inject_theme_name>", self.name+" Cursors").replace("<inject_author_name>", __author__)
|
||||
|
||||
return inf_content
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import tempfile
|
||||
from .bundler import Bundler
|
||||
from .config import ConfigProvider, hotspots, sizes, delay
|
||||
from clickgen import build_x11_cursor_theme, build_cursor_theme, build_win_cursor_theme
|
||||
|
@ -12,14 +11,14 @@ class CursorBuilder():
|
|||
Build Bibata Windows & X11 cursors 🚀.
|
||||
"""
|
||||
|
||||
def __init__(self, name: str, config: ConfigProvider) -> None:
|
||||
def __init__(self, config: ConfigProvider) -> None:
|
||||
"""
|
||||
docstring
|
||||
"""
|
||||
self.__name = name
|
||||
self.__config = config
|
||||
self.__bundler = Bundler(name, config)
|
||||
self.tmpdir = tempfile.mkdtemp()
|
||||
self.__name = config.name
|
||||
self.__bitmaps_dir = config.bitmaps_dir
|
||||
self.__bundler = Bundler(config)
|
||||
self.__tmpdir = config.tmpdir
|
||||
|
||||
def build_x11_cursors(self) -> None:
|
||||
"""
|
||||
|
@ -28,15 +27,15 @@ class CursorBuilder():
|
|||
print('🌈 Building %s Theme ...' % self.__name)
|
||||
build_x11_cursor_theme(
|
||||
name=self.__name,
|
||||
image_dir=self.__config.bitmaps_dir,
|
||||
image_dir=self.__bitmaps_dir,
|
||||
cursor_sizes=sizes,
|
||||
hotspots=hotspots,
|
||||
out_path=self.tmpdir,
|
||||
out_path=self.__tmpdir,
|
||||
archive=False,
|
||||
delay=delay
|
||||
)
|
||||
|
||||
self.__bundler.x11_bundle(self.tmpdir)
|
||||
self.__bundler.x11_bundle()
|
||||
|
||||
def build_win_cursors(self) -> None:
|
||||
"""
|
||||
|
@ -45,15 +44,15 @@ class CursorBuilder():
|
|||
print('🌈 Building %s Theme ...' % self.__name)
|
||||
build_win_cursor_theme(
|
||||
name=self.__name,
|
||||
image_dir=self.__config.bitmaps_dir,
|
||||
image_dir=self.__bitmaps_dir,
|
||||
cursor_sizes=sizes,
|
||||
hotspots=hotspots,
|
||||
out_path=self.tmpdir,
|
||||
out_path=self.__tmpdir,
|
||||
archive=False,
|
||||
delay=delay
|
||||
)
|
||||
|
||||
self.__bundler.win_bundle(self.tmpdir)
|
||||
self.__bundler.win_bundle()
|
||||
|
||||
def build_cursors(self) -> None:
|
||||
"""
|
||||
|
@ -62,12 +61,12 @@ class CursorBuilder():
|
|||
print('🌈 Building %s Theme ...' % self.__name)
|
||||
build_cursor_theme(
|
||||
name=self.__name,
|
||||
image_dir=self.__config.bitmaps_dir,
|
||||
image_dir=self.__bitmaps_dir,
|
||||
cursor_sizes=sizes,
|
||||
hotspots=hotspots,
|
||||
out_path=self.tmpdir,
|
||||
out_path=self.__tmpdir,
|
||||
archive=False,
|
||||
delay=delay
|
||||
)
|
||||
|
||||
self.__bundler.bundle(self.tmpdir)
|
||||
self.__bundler.bundle()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue