Tikipeter / tikipeter.github.io

72 stars 13 forks source link

set_view_mode() question #47

Closed realcopacetic closed 2 months ago

realcopacetic commented 2 months ago

Hi @Tikipeter - I develop and maintain a skin (https://github.com/realcopacetic/skin.copacetic/)

A few people have complained when using my skin with Fen that the viewtype they choose reverts to list every time they enter a new page. (https://github.com/realcopacetic/skin.copacetic/issues/111#issuecomment-2191405520)

I was able to replicate this behaviour and isolate it to the set_view_mode() function in kodi_utils.py for Fen Light. Commenting out line 112 in kodi_utils.py - execute_builtin('Container.SetViewMode(%s)' % view_id)

Is this expected behaviour? And if so, is there a way to prevent this?

Thanks

Tikipeter commented 2 months ago

The code you commented out is to set the view for the container, based on the user's preference in Tools->Set Views.

Unfortunately, video addons have always had to handle setting views in their addons (if they want to do that).

When the user sets their view in the addon, xbmcgui.Window(xbmcgui.getCurrentWindowId()).getFocusId() is used to get the view's ID, and xbmc.getInfoLabel('Container.Viewmode')) is used to get the view name.

Unfortunately, for Copacetic's 2 available views, Thumbnails and Background, those two queries return an ID of 50 and a name of List for either view mode.

This means it is impossible using the current method of obtaining the current view ID and view name of a skin to ascertain which view mode out of Thumbnail or Background is the current choice of the user.

Do you know why your skin shows an ID of 50 and name of List independent of which view type the user chooses?

realcopacetic commented 2 months ago

Hi @Tikipeter thanks for getting back to me so quickly!

Just to clarify on the skin side, Thumbnails and Background are variants of the same view, LIst, hence the ID being the same. The other views first need to be enabled in Skin Settings under Settings > Copacetic > Views.

There are five in total: List (50) Billboard (501) Showcase (502) Strip (504) Grid (505)

Here's a quick video showing the issue: https://www.loom.com/share/67a3c845a76448dab2c4c203b54ea25f?sid=7abbf09d-8cc0-45bf-85ce-4ef1ded9850c

Basically if I'm in a section like Trending and set the view to Showcase or Grid, then back out, next time I go in, it reverts to List again. I'm not sure if this behaviour is due to something with how I've constructed my views, or is a desired behaviour.

Aside from the actual selected view mode, everything else is remembered correctly (e.g. Thumbnail/Background layout choice for list view, or any of the other customisations selected as you can see in the video. But these are just skin strings, so it should be).

It's just the actual view mode that is being changed.

realcopacetic commented 2 months ago

Re-reading your comment, it seems like the user with the issues should choose their preferred view in Tools->Set Views. I will share this information, hopefully it resolves the issue they are facing, thanks

realcopacetic commented 2 months ago

In fact, I just tested and it works great, thanks. Apologies for wasting your time a bit here. As I'm not familiar with your skin, I didn't realise how to access your settings. But now having set some views within the Tools menu, it's working great