More theming Support

This commit is contained in:
Jeison Yehuda Amihud (Blender Dumbass) 2021-01-03 13:47:00 +00:00
parent 9a69445782
commit c0b2ea678c
2 changed files with 52 additions and 12 deletions

View file

@ -229,6 +229,8 @@ def loadimage(layer, win ,path, x, y, width, height, fit, cell=0):
# an image file. Like png or jpeg. Either a video file. Or a blend file
# each with it's own loading problems.
# While cairo can read pngs directly. It's not the best way of doing it
# since it's not capable of reading jpegs and other files. So let's do
# something about it.
@ -250,7 +252,10 @@ def loadimage(layer, win ,path, x, y, width, height, fit, cell=0):
try:
load1 = GdkPixbuf.Pixbuf.new_from_file(path)
except:
try:
load1 = GdkPixbuf.Pixbuf.new_from_file("settings/themes/"+win.settings["Theme"]+"/icons/image.png")
except:
load1 = GdkPixbuf.Pixbuf.new_from_file("settings/themes/Default/icons/image.png")
# VIDEOFILES
for f in fileformats.videos:
@ -283,8 +288,10 @@ def loadimage(layer, win ,path, x, y, width, height, fit, cell=0):
pass
except:
try:
load1 = GdkPixbuf.Pixbuf.new_from_file("settings/themes/"+win.settings["Theme"]+"/icons/video.png")
except:
load1 = GdkPixbuf.Pixbuf.new_from_file("settings/themes/Default/icons/video.png")
# BLEND FILES
for f in ["blend", "blend1"]:
@ -324,13 +331,21 @@ def loadimage(layer, win ,path, x, y, width, height, fit, cell=0):
pass
except:
load1 = GdkPixbuf.Pixbuf.new_from_file("settings/themes/"+win.settings["Theme"]+"/icons/blender.png")
try:
load1 = GdkPixbuf.Pixbuf.new_from_file("settings/themes/"+win.settings["Theme"]+"/icons/blender.png")
except:
load1 = GdkPixbuf.Pixbuf.new_from_file("settings/themes/Default/icons/blender.png")
if not foundformat:
# If you can't find any format. Just use the file icon then
try:
load1 = GdkPixbuf.Pixbuf.new_from_file("settings/themes/"+win.settings["Theme"]+"/icons/file.png")
except:
load1 = GdkPixbuf.Pixbuf.new_from_file("settings/themes/Default/icons/file.png")
# Then to convert the pixbuf to a cairo surface
Px = load1.get_width()
@ -373,7 +388,8 @@ def loadimage(layer, win ,path, x, y, width, height, fit, cell=0):
dx = (width/2)/factor -(load2.get_width() /2)
dy = (height/2)/factor -(load2.get_height()/2)
# Let's make an ability for theme makers to simply color the standard
# icons into any shade.
imagedraw.set_source_surface(load2, dx, dy)
imagedraw.paint()
@ -433,6 +449,12 @@ def image(layer, win ,path, x, y, width=0, height=0, fit="crop", cell=0):
# that on a special redraw call. We are going to check hashes storred with
# those from the file. And only if a file really changed. Then update the image.
# First the icon might not exist in the icon pack. Since I want to make
# packs using
if win.settings["Theme"] in path and not os.path.exists(path):
path = path.replace(win.settings["Theme"], "Default")
if path not in win.images[cell] or win.images[cell][path]["loading"]:
# If this is the first time this image is draw we want to create it a data
@ -467,6 +489,20 @@ def image(layer, win ,path, x, y, width=0, height=0, fit="crop", cell=0):
imagesurface = win.images[cell][path]["image"]
# Writting the image to the screen
if "icons" in win.color and "settings/themes/" in path:
UI_color.set(layer, win, "icons")
layer.rectangle(x,y,0,0)
layer.fill()
layer.mask_surface(imagesurface, x, y)
UI_color.set(layer, win, "icons")
layer.fill()
else:
layer.set_source_surface(imagesurface, x, y)
layer.paint()

View file

@ -168,6 +168,10 @@ def layer(win, call):
talk.text("documentation_render"):[
["scene", "https://notabug.org/jyamihud/VCStudio/wiki/Documenation+%7C+Rendering+%7C+Version+20.128"],
["update", "https://notabug.org/jyamihud/VCStudio/wiki/Version+20.1266+%28+Rendering+Of+Shots+%29"]
],
talk.text("documentation_multiuser"):[
["scene", "https://notabug.org/jyamihud/VCStudio/wiki/Documenation+%7C+Multiuser+%7C+Version+21.1"],
["update", "https://notabug.org/jyamihud/VCStudio/wiki/Version+21.0"]
]
}