2021-06-12, 14:55
The below worked fine on Leia, threading ran in background updating property and was reflected in Kodi live changing VAR colors (script.colorbox).
Now in Matrix, you only see the last color change after X amount of time (time being steps x sleep), Kodi runs as normal no freezes, but does not show the colors changing between steps (first color *sleep delay* last color). So threading is running, but property isn't getting changed until the sub returns, whereas before sub runs in background changing property no problems.
Cannot see what you have changed (security? xbmc.sleep (although this works fine in other non threaded subs))?
thanks!
Now in Matrix, you only see the last color change after X amount of time (time being steps x sleep), Kodi runs as normal no freezes, but does not show the colors changing between steps (first color *sleep delay* last color). So threading is running, but property isn't getting changed until the sub returns, whereas before sub runs in background changing property no problems.
Cannot see what you have changed (security? xbmc.sleep (although this works fine in other non threaded subs))?
thanks!
Code:
from threading import Thread
HOME = xbmcgui.Window(10000)
...
tmc = Thread(target=linear_gradient, args=(cname, HOME.getProperty(var3)[2:8], imagecolor[2:8], lgsteps, lgint, var3))
tmc.start()
...
def linear_gradient(cname, start_hex="000000", finish_hex="FFFFFF", n=10, sleep=50, s_thread_check=""):
if start_hex == '' or finish_hex == '':
return
s = hex_to_RGB('#' + start_hex)
f = hex_to_RGB('#' + finish_hex)
RGB_list = [s]
for t in range(1, n):
if HOME.getProperty(s_thread_check)[2:8] != start_hex:
return
curr_vector = [
int(s[j] + (float(t)//(n-1))*(f[j]-s[j]))
for j in range(3)
]
HOME.setProperty(cname, RGB_to_hex(curr_vector))
xbmc.sleep(sleep)
return