Upload files to 'UI'
This commit is contained in:
parent
3ab060dc23
commit
9df649b3e1
1 changed files with 17 additions and 8 deletions
|
@ -196,7 +196,7 @@ def blur(surface, win, amount):
|
||||||
else:
|
else:
|
||||||
return surface
|
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
|
# 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
|
# 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
|
# if it's not in a frame. Roughly speaking. Will see maybe I will make do
|
||||||
# something to make it better.
|
# 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 \
|
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"])) :
|
int(y) not in range(int(0-height), int(win.current["h"])) :
|
||||||
return
|
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.
|
# 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.
|
# 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:
|
if win.imageload < 10:
|
||||||
win.imageload += 1
|
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)
|
imagesurface = cairo.ImageSurface(cairo.FORMAT_ARGB32, 10, 10)
|
||||||
|
|
||||||
# Saving it into the win.images
|
# Saving it into the win.images
|
||||||
win.images[path] = imagesurface
|
win.images[cell][path] = imagesurface
|
||||||
win.imageload -= 1
|
win.imageload -= 1
|
||||||
|
|
||||||
#GLib.timeout_add(1, loadimage, layer, win ,path, x, y, width, height, fit)
|
#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
|
#loading it back
|
||||||
else:
|
else:
|
||||||
if win.images[path] != "LOADING-IMAGE":
|
if win.images[cell][path] != "LOADING-IMAGE":
|
||||||
imagesurface = win.images[path]
|
imagesurface = win.images[cell][path]
|
||||||
|
|
||||||
# Writting the image to the screen
|
# Writting the image to the screen
|
||||||
layer.set_source_surface(imagesurface, x, y)
|
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:
|
if maxlength == 0:
|
||||||
maxlength = 1
|
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
|
# First let's set one up if it's not setup
|
||||||
if name not in win.scroll:
|
if name not in win.scroll:
|
||||||
win.scroll[name] = 0
|
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,
|
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.
|
# 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.
|
# 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,
|
height,
|
||||||
10,
|
10,
|
||||||
fill=False,
|
fill=False,
|
||||||
button=do)
|
button=do,
|
||||||
|
tip=tip)
|
||||||
outlayer.stroke()
|
outlayer.stroke()
|
||||||
|
|
||||||
if win.textactive == name:
|
if win.textactive == name:
|
||||||
|
|
Loading…
Reference in a new issue