📚 Bibata builder docs added

This commit is contained in:
ful1e5 2020-10-15 08:25:11 +05:30
parent 7e452a4512
commit 31469678e8
6 changed files with 12 additions and 39 deletions

View file

@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- Skip **already rendered** Bitmaps in `bibata-core`
- Cursors `builder` docs
### Changed

View file

@ -27,6 +27,7 @@ def get_args_parser() -> ArgumentParser:
def build() -> None:
""" Build Bibata cursor """
parser = get_args_parser()
try:
args = parser.parse_args()

View file

@ -32,9 +32,6 @@ class Bundler():
"""
def __init__(self, config: ConfigProvider) -> None:
"""
docsstring
"""
self.__name = config.name
self.__tmpdir = config.tmpdir
self.__x11_dest = path.join(config.out_dir, self.__name)
@ -42,17 +39,13 @@ class Bundler():
self.__content = config.get_windows_script()
def __save_win_install_script(self) -> None:
"""
docstring
"""
""" Save `install.inf` file in windows cursor theme. """
file_path = path.join(self.__win_dest, "install.inf")
with open(file_path, "w") as file:
file.write(self.__content)
def __clean_win_bundle(self) -> None:
"""
docstring
"""
""" Remvoe unnecessary cursor from directory generated by `clickgen` """
# Remove & Rename cursors
# If Key found => Rename else Remove
for cursor in listdir(self.__win_dest):
@ -67,24 +60,18 @@ class Bundler():
self.__save_win_install_script()
def win_bundle(self) -> None:
"""
docstring
"""
""" Make cursor theme installable on `Windows OS`. """
src = path.join(self.__tmpdir, self.__name, "win")
shutil.copytree(src, self.__win_dest)
self.__clean_win_bundle()
def x11_bundle(self) -> None:
"""
docstring
"""
""" Make cursor theme installable on `x11`. """
src = path.join(self.__tmpdir, self.__name, "x11")
shutil.copytree(src, self.__x11_dest, symlinks=True)
def bundle(self) -> None:
"""
docstring
"""
""" Make cursor theme installable on `x11` & `Windows OS`. """
x11_src = path.join(self.__tmpdir, self.__name, "x11")
shutil.copytree(x11_src, self.__x11_dest, symlinks=True)

View file

@ -24,9 +24,6 @@ class ConfigProvider():
"""
def __init__(self, name: str, bitmaps_dir: str, out_dir: str) -> None:
"""
docsstring
"""
# cleanup old packages
if path.exists(out_dir):
shutil.rmtree(out_dir)
@ -45,9 +42,7 @@ class ConfigProvider():
self.out_dir: str = path.abspath(out_dir)
def get_windows_script(self) -> str:
"""
docsstring
"""
""" Get `install.inf` content for this cursor theme. """
with open(path.join(__path__[0], "windows.inf")) as f:
data = f.read()
inf_content = data.replace(

View file

@ -12,18 +12,13 @@ class CursorBuilder():
"""
def __init__(self, config: ConfigProvider) -> None:
"""
docstring
"""
self.__name = config.name
self.__bitmaps_dir = config.bitmaps_dir
self.__bundler = Bundler(config)
self.__tmpdir = config.tmpdir
def build_x11_cursors(self) -> None:
"""
docstring
"""
""" Build `x11` platform cursors. """
print('🌈 Building %s Theme ...' % self.__name)
build_x11_cursor_theme(
name=self.__name,
@ -38,9 +33,7 @@ class CursorBuilder():
self.__bundler.x11_bundle()
def build_win_cursors(self) -> None:
"""
docstring
"""
""" Build `Windows` platform cursors. """
print('🌈 Building %s Theme ...' % self.__name)
build_win_cursor_theme(
name=self.__name,
@ -55,9 +48,7 @@ class CursorBuilder():
self.__bundler.win_bundle()
def build_cursors(self) -> None:
"""
docstring
"""
""" Build `x11` & `Windows` platform cursors. """
print('🌈 Building %s Theme ...' % self.__name)
build_cursor_theme(
name=self.__name,

View file

@ -6,8 +6,6 @@ import os
def save_logs_to_file() -> None:
"""
Save `clickgen` logs to `build.log` in current working directory
"""
""" Save `clickgen` logs to `build.log` in current working directory. """
logging.basicConfig(filename='%s/build.log' % os.getcwd(), filemode='w',
format='%(name)s - %(levelname)s - %(message)s', level=logging.DEBUG)