aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Kernozhitsky <[email protected]>2018-12-26 19:34:35 +0300
committerAlexander Kernozhitsky <[email protected]>2018-12-26 19:34:35 +0300
commit8660e97873df5adc5ff4d0a632694f2f1540c5da (patch)
tree952e9ece2d1e1f91de0b14e39262927fa960ca85
parent3f82a073a3fee302e04d6e16edeaa95a9e5fd14a (diff)
Remove hard-coded assets location
-rwxr-xr-xsrc/build_theme.sh3
-rw-r--r--src/render_assets.py13
2 files changed, 10 insertions, 6 deletions
diff --git a/src/build_theme.sh b/src/build_theme.sh
index 1af5e05..3fdf309 100755
--- a/src/build_theme.sh
+++ b/src/build_theme.sh
@@ -37,11 +37,10 @@ install_theme () {
}
render_theme () {
- python3 render_assets.py "$1"
create_folders "$2"
+ python3 render_assets.py "$1" "$2/assets"
build_sass gtk318/gtk.scss "$2/gtk-3.18/gtk.css"
build_sass gtk320/gtk.scss "$2/gtk-3.20/gtk.css"
- mv assets "$2/"
cp -R gtk2/* "$2/gtk-2.0/"
install_theme "$2" "$3"
}
diff --git a/src/render_assets.py b/src/render_assets.py
index 3ec95d4..a7b8207 100644
--- a/src/render_assets.py
+++ b/src/render_assets.py
@@ -157,7 +157,7 @@ class Assets(object):
if filename == 'png':
self.surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, scl*width, scl*height)
else:
- self.surface = cairo.SVGSurface('assets/' + filename, scl*width, scl*height)
+ self.surface = cairo.SVGSurface(os.path.join(assets_path, filename), scl*width, scl*height)
cr = self.cr = cairo.Context(self.surface)
if rotation != 0:
cr.translate(scl*width/2,scl*height/2)
@@ -328,7 +328,7 @@ class Assets(object):
self.cr.stroke()
def save(self, filename):
- self.surface.write_to_png('assets/' + filename)
+ self.surface.write_to_png(os.path.join(assets_path, filename))
def check_items(color1,color2,state,alpha=1.0):
@@ -654,12 +654,17 @@ def mix(color, mix_color, amount):
return (r,g,b)
#___________________________________________________________________________________
-if len(sys.argv) == 2:
+if len(sys.argv) >= 2:
filename = sys.argv[1]
else:
filename = '/usr/share/color-schemes/Breeze.colors'
-make_sure_path_exists('assets')
+if len(sys.argv) >= 3:
+ assets_path = sys.argv[2]
+else:
+ assets_path = 'assets'
+
+make_sure_path_exists(assets_path)
_colors = ReadKdeGlobals().read_globals(filename)