Port render_assets to python3

parent 8ee45356
......@@ -20,7 +20,7 @@ build_sass() {
}
render_theme () {
python render_assets.py $1
python3 render_assets.py $1
create_folders $2
build_sass gtk316/gtk.scss $2/gtk-3.0/gtk.css
build_sass gtk318/gtk.scss $2/gtk-3.18/gtk.css
......
#!/usr/bin/env python3
import cairo
import colorsys
from math import pi
......@@ -9,9 +10,9 @@ import re
def make_sure_path_exists(path):
try:
os.makedirs(path)
except OSError as exception:
if exception.errno != errno.EEXIST:
raise
except FileExistsError as exception:
pass
pass
class ReadKdeGlobals():
def __init__(self):
......@@ -42,13 +43,13 @@ class Color(object):
r = float(color.split(',')[0])
g = float(color.split(',')[1])
b = float(color.split(',')[2])
if not name2 == None:
if not name2 is None:
color2 = colordict[name2]
r = r * amount + float(color2.split(',')[0]) * (1 - amount)
g = g * amount + float(color2.split(',')[1]) * (1 - amount)
b = b * amount + float(color2.split(',')[2]) * (1 - amount)
self.rgb255 = (r,g,b)
self.rgb255 = (int(r),int(g),int(b))
self.rgb = (r/255,g/255,b/255)
self.html = '#%02x%02x%02x' % self.rgb255
self.insensitive = self._color_effect(self._intensity_effect(self.rgb,'Disabled'),'Disabled')
......@@ -132,7 +133,7 @@ class Color(object):
v = (1+amount)*v
r,g,b = colorsys.hsv_to_rgb(h,s,v)
self.rgb = (r,g,b)
self.rgb255 = (r*255,g*255,b*255)
self.rgb255 = (int(r*255),int(g*255),int(b*255))
def gradient(self,state='',alpha=1.0):
......@@ -644,7 +645,7 @@ def progressbar(color1, color2, state=''):
def html(color):
return '#%02x%02x%02x' % (color[0]*255,color[1]*255,color[2]*255)
return '#%02x%02x%02x' % (int(color[0]*255),int(color[1]*255),int(color[2]*255))
def mix(color, mix_color, amount):
r = color[0] * amount + mix_color[0] * (1 - amount)
......@@ -776,7 +777,7 @@ gtk2.write(
gtk2.close()
gtk3 = open('_global.scss', 'w')
for key in _colors:
for key in sorted(_colors):
if key == 'DisabledColor' or key == 'InactiveColor':
gtk3.write('${0}:rgb({1});\n'.format(key,_colors[key]))
elif 'Disabled' in key or 'Inactive' in key:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment