Threading and HOME.setProperty changes? - Printable Version +- Kodi Community Forum (https://forum.kodi.tv) +-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32) +--- Forum: Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=26) +---- Forum: Python 3 migration (https://forum.kodi.tv/forumdisplay.php?fid=281) +---- Thread: Threading and HOME.setProperty changes? (/showthread.php?tid=363075) |
Threading and HOME.setProperty changes? - badaas - 2021-06-12 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! Code: from threading import Thread RE: Threading and HOME.setProperty changes? - Roman_V_M - 2021-06-12 What is HOME? RE: Threading and HOME.setProperty changes? - badaas - 2021-06-18 Sorry! Long time since I touched a python! I've added HOME. above. Code: HOME = xbmcgui.Window(10000) The default.py calls the utils.py (utils.py is threading), seems the utils.py can now not set HOME.property, as when it returns control to default.py, the HOME.property gets set there again before returning back to kodi. But all this worked fine in Leia.. RE: Threading and HOME.setProperty changes? - Roman_V_M - 2021-06-18 Can you try time.sleep instead of xbmc.sleep? RE: Threading and HOME.setProperty changes? - badaas - 2021-06-18 Tried, doesn't like it, script doesnt error but freezes thread it seems. When shutting down this error (using time.sleep): Code: 2021-06-18 09:02:09.879 T:13628 INFO <general>: CPythonInvoker(3, C:\Users\dan\AppData\Roaming\Kodi\addons\script.colorbox\default.py): script successfully run If I change 'HOME.setProperty(cname, RGB_to_hex(curr_vector))' to an actual skin var name like 'HOME.setProperty("ImageColorFIVE", RGB_to_hex(curr_vector))', then I can see the thread is running and changing the property as it flickers the color (but is erroring to default white). So it is running and updating property but not how it should... Grrrr, sorry not more descriptive, brain out of practice! RE: Threading and HOME.setProperty changes? - badaas - 2021-06-18 Also the thread is called by a thread (utils.Color_Only), but this was all fine, this default.py calling sub: Code: if not FIVE_daemon_set == '': RE: Threading and HOME.setProperty changes? - badaas - 2021-06-18 Ok, the property is updating, seems something is borked with the RGB to HEX loop or vice versa, I can change colors in thread by setting it to the color of the thread loop number, and it works (all be it the same color for everything, heh.)., Code: def RGB_to_hex(RGB): This seems to be the problem.. Python 3 implement different?? edit: nope, not it. following code doesnt change result 'return 'FF{:02x}{:02x}{:02x}'.format(RGB[0], RGB[1] , RGB[2])' something to do with curr_vector [...] Doesn't keep up with thread, or in thread gets lost Repo page here: https://github.com/BADMS/script.colorbox/blob/748098fdc0a7c386ae2404d7335c46ed2a4bdc0a/resources/lib/Utils.py RE: Threading and HOME.setProperty changes? - badaas - 2021-06-21 FIXED. Python 3 Floor Division changed.. Code: curr_vector = [ to Code: curr_vector = [ Just use normal division until I work out why or what etc. |