Kodi Community Forum
v18 Container.SetViewMode and other gui related methods not working in onInit - 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)
+--- Thread: v18 Container.SetViewMode and other gui related methods not working in onInit (/showthread.php?tid=329208)



Container.SetViewMode and other gui related methods not working in onInit - malte - 2018-03-05

Hi,

I still have some issues to get my script using WindowXML and the builtin list to work with Kodi Leia. My WindowXML defines several views and the addon saves the last selected view in addon settings. On next load the addon should select this view using "Container.SetViewMode()". This works fine in Krypton and older versions but does not in Leia. Other methods like self.SetFocus() also don't work anymore when called in onInit. When I put the same calls in an onClick-Event of a button, they work as expected.

I created a simple test script to demonstrate the behaviour: dropbox link.

I think that I have covered all the new stuff like isMedia and setContent but I am still missing something. Any tips how to solve this issue?

Regards
Malte


RE: Container.SetViewMode and other gui related methods not working in onInit - ronie - 2018-03-05

strange, Container.SetViewMode() was working ok in leia builds up to a few weeks ago...
but i can confirm it's indeed broken now.


RE: Container.SetViewMode and other gui related methods not working in onInit - ronie - 2018-03-05

bug was introduced by https://github.com/xbmc/xbmc/pull/13542 as far as i can see.


RE: Container.SetViewMode and other gui related methods not working in onInit - malte - 2018-03-06

Ok, thanks a lot for looking into this.


RE: Container.SetViewMode and other gui related methods not working in onInit - jfcarroll - 2018-03-07

@malte Are you calling 'Update' on a WindowXML from your script?


RE: Container.SetViewMode and other gui related methods not working in onInit - ronie - 2018-03-07

@jfcarroll i'm having the same problem with Container.SetViewMode() in the GlobalSearch addon, i'm not calling Update.


RE: Container.SetViewMode and other gui related methods not working in onInit - malte - 2018-03-07

I'm also not calling Update.

Container.SetViewMode() is not completely broken. It works when you invoke it in onClick() after a button press. But it does not work in onInit() anymore.


RE: Container.SetViewMode and other gui related methods not working in onInit - malte - 2018-05-01

Sorry to bring this up again. Just wanted to know if this issue will be fixed in Kodi or if I should try to find a workaround in my addon.


RE: Container.SetViewMode and other gui related methods not working in onInit - malte - 2018-08-15

Any news on this?

@ronie: did you try to find a workaround in your Global Search addon?


RE: Container.SetViewMode and other gui related methods not working in onInit - CastagnaIT - 2019-01-07

Exists a workaround? is possible a fix in Leila final build? @jfcarroll

as i thought, i was wrong, now it works.


RE: Container.SetViewMode and other gui related methods not working in onInit - Mikewave - 2019-01-20

Is there a fix  for this? I can't get it to work! Any help on this would be great. I'm trying to invoke on onInit() but not working.


RE: Container.SetViewMode and other gui related methods not working in onInit - PX80 - 2019-02-19

(2018-03-07, 23:29)malte Wrote: I'm also not calling Update.

Container.SetViewMode() is not completely broken. It works when you invoke it in onClick() after a button press. But it does not work in onInit() anymore.
 Anyone found a workaround for this? Will this be fixed or is a new bug requried?


RE: Container.SetViewMode and other gui related methods not working in onInit - Amanda_B - 2019-06-26

(2019-01-07, 12:08)stefive83 Wrote: Exists a workaround? is possible a fix in Leila final build? @jfcarroll

as i thought, i was wrong, now it works.
I tried using Container.SetViewMode and it is not working yet. Any updates or work-arounds ?


RE: Container.SetViewMode and other gui related methods not working in onInit - malte - 2019-07-31

Ok, there seems to be a workaround. At least it works in my addon (Rom Collection Browser).

Just invoke Container.SetViewMode twice and it works again. Not nice, but until now the only option I found to solve this issue.

Thanks to @Royusmc for digging into this.