CursorBuilder with tempdir

This commit is contained in:
ful1e5 2020-10-10 10:47:50 +05:30
parent 4aaf89ef08
commit 4d82790f80

View file

@ -1,6 +1,7 @@
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import tempfile
from .bundler import Bundler from .bundler import Bundler
from .config import ConfigProvider, hotspots, sizes, delay from .config import ConfigProvider, hotspots, sizes, delay
from clickgen import build_x11_cursor_theme, build_cursor_theme, build_win_cursor_theme from clickgen import build_x11_cursor_theme, build_cursor_theme, build_win_cursor_theme
@ -18,6 +19,7 @@ class CursorBuilder():
self.__name = name self.__name = name
self.__config = config self.__config = config
self.__bundler = Bundler(name, config) self.__bundler = Bundler(name, config)
self.tmpdir = tempfile.mkdtemp()
def build_x11_cursors(self) -> None: def build_x11_cursors(self) -> None:
""" """
@ -29,12 +31,12 @@ class CursorBuilder():
image_dir=self.__config.bitmaps_dir, image_dir=self.__config.bitmaps_dir,
cursor_sizes=sizes, cursor_sizes=sizes,
hotspots=hotspots, hotspots=hotspots,
out_path=self.__config.temp_out_dir, out_path=self.tmpdir,
archive=False, archive=False,
delay=delay delay=delay
) )
self.__bundler.x11_bundle() self.__bundler.x11_bundle(self.tmpdir)
def build_win_cursors(self) -> None: def build_win_cursors(self) -> None:
""" """
@ -46,27 +48,26 @@ class CursorBuilder():
image_dir=self.__config.bitmaps_dir, image_dir=self.__config.bitmaps_dir,
cursor_sizes=sizes, cursor_sizes=sizes,
hotspots=hotspots, hotspots=hotspots,
out_path=self.__config.temp_out_dir, out_path=self.tmpdir,
archive=False, archive=False,
delay=delay delay=delay
) )
self.__bundler.win_bundle() self.__bundler.win_bundle(self.tmpdir)
def build_cursors(self) -> None: def build_cursors(self) -> None:
""" """
docstring docstring
""" """
print('🌈 Building %s Theme ...' % self.__name) print('🌈 Building %s Theme ...' % self.__name)
build_cursor_theme( build_cursor_theme(
name=self.__name, name=self.__name,
image_dir=self.__config.bitmaps_dir, image_dir=self.__config.bitmaps_dir,
cursor_sizes=sizes, cursor_sizes=sizes,
hotspots=hotspots, hotspots=hotspots,
out_path=self.__config.temp_out_dir, out_path=self.tmpdir,
archive=False, archive=False,
delay=delay delay=delay
) )
self.__bundler.bundle() self.__bundler.bundle(self.tmpdir)