Upload files to 'UI'

This commit is contained in:
Jeison Yehuda Amihud (Blender Dumbass) 2020-12-10 22:14:48 +00:00
parent 3ab060dc23
commit 9df649b3e1

View file

@ -196,7 +196,7 @@ def blur(surface, win, amount):
else:
return surface
def image(layer, win ,path, x, y, width=0, height=0, fit="crop"):
def image(layer, win ,path, x, y, width=0, height=0, fit="crop", cell=0):
# This module will handle drawing images to the layers. It's not that hard
# to do in cairo by default. But i'm doing it at every frame. And so it
@ -210,6 +210,9 @@ def image(layer, win ,path, x, y, width=0, height=0, fit="crop"):
# if it's not in a frame. Roughly speaking. Will see maybe I will make do
# something to make it better.
if cell not in win.images:
win.images[cell] = {}
if int(x) not in range(int(0-width ), int(win.current["w"])) or \
int(y) not in range(int(0-height), int(win.current["h"])) :
return
@ -221,9 +224,9 @@ def image(layer, win ,path, x, y, width=0, height=0, fit="crop"):
# I create a thread using GLib. Because I'm lazy. Which is loading the image.
# Basically the UI keeps working before all images are loaded.
if path not in win.images or win.images[path] == "LOADING-IMAGE":
if path not in win.images[cell] or win.images[cell][path] == "LOADING-IMAGE":
win.images[path] = "LOADING-IMAGE"
win.images[cell][path] = "LOADING-IMAGE"
if win.imageload < 10:
win.imageload += 1
@ -351,7 +354,7 @@ def image(layer, win ,path, x, y, width=0, height=0, fit="crop"):
imagesurface = cairo.ImageSurface(cairo.FORMAT_ARGB32, 10, 10)
# Saving it into the win.images
win.images[path] = imagesurface
win.images[cell][path] = imagesurface
win.imageload -= 1
#GLib.timeout_add(1, loadimage, layer, win ,path, x, y, width, height, fit)
@ -360,8 +363,8 @@ def image(layer, win ,path, x, y, width=0, height=0, fit="crop"):
#loading it back
else:
if win.images[path] != "LOADING-IMAGE":
imagesurface = win.images[path]
if win.images[cell][path] != "LOADING-IMAGE":
imagesurface = win.images[cell][path]
# Writting the image to the screen
layer.set_source_surface(imagesurface, x, y)
@ -438,6 +441,11 @@ def scroll_area(layer, win, name, x, y, width, height, maxlength,
if maxlength == 0:
maxlength = 1
x = int(x)
y = int(y)
width = int(width)
height = int(height)
# First let's set one up if it's not setup
if name not in win.scroll:
win.scroll[name] = 0
@ -572,7 +580,7 @@ def scroll_area(layer, win, name, x, y, width, height, maxlength,
def text(outlayer, win, name, x, y, width, height, set_text="", parse=False, fill=True,
editable=True, multiline=False , linebreak=False, centered=False):
editable=True, multiline=False , linebreak=False, centered=False, tip=""):
# This function will handle all the text writting in the software.
# I'm not sure about how parsing going to work for script files later.
@ -838,7 +846,8 @@ def text(outlayer, win, name, x, y, width, height, set_text="", parse=False, fil
height,
10,
fill=False,
button=do)
button=do,
tip=tip)
outlayer.stroke()
if win.textactive == name: