Error with 'WindowDialog.setCoordinateResolution' function
#1
Hi,

Do anyone know why I get errro for this function that it's not implemented? (v18)

python:
xbmcgui.WindowDialog.setCoordinateResolution(0)  # 1920x1080

It located here:
python:
class PlayerWindow(xbmcgui.WindowDialog):
    def __init__(self):
        self.setCoordinateResolution(0)  # 1920x1080


php:
ERROR: EXCEPTION: not implemented.
ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                             - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                            Error Type: <type 'exceptions.RuntimeError'>
                                            Error Contents: not implemented.
                                            Traceback (most recent call last):
                                              File "D:\Program Files (x86)\Kodi v18.6 x64\portable_data\addons\script.100\addon.py", line 17, in <module>
                                                player_window = PlayerWindow()
                                              File "D:\Program Files (x86)\Kodi v18.6 x64\portable_data\addons\script.100\player.py", line 21, in __init__
                                                self.setCoordinateResolution(0)  # 1920x1080
                                            RuntimeError: not implemented.
                                            -->End of Python script error report<--


Thanks.
Reply
#2
that function was removed in Kodi 18.
https://github.com/xbmc/xbmc/pull/14264
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Reply
#3
Thanks @ronie 

So there is an alternative to this function in v18?

Because the addon looks bad without it, like this:
Image

Instead of like this:
Image
Reply
#4
hmm..  i've never very little experience with Window/WindowDialog classes, but what i did was this:
python:

        self.WINID = xbmcgui.getCurrentWindowId()
        self.win = xbmcgui.Window(self.WINID)
        width = self.win.getWidth()
        height = self.win.getHeight()

that will get you the width & height of the window.
and then dynamically calculate the size & position of all controls based on that info.

perhaps @Roman_V_M has a better idea.
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Reply
#5
Thread moved to addon development
|Banned add-ons (wiki)|Forum rules (wiki)|VPN policy (wiki)|First time user (wiki)|FAQs (wiki) Troubleshooting (wiki)|Add-ons (wiki)|Free content (wiki)|Debug Log (wiki)|

Kodi Blog Posts
Reply
#6
@ronie 
@Roman_V_M 

Basically all the controls size & position are already fixed and adjusted to 1920 X 1080.
Also the functions that you mentioned here give me this resolution of the window.

So I still don't understand why does it still show it differently
without using the 'WindowDialog.setCoordinateResolution' function which is not exist in v18 anymore.
Reply
#7
then i'm in the dark as well...
perhaps the skin you're using is 720p ?
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Reply
#8
@ronie 
Yes, you right! Thanks.
I made some resolution converting functions, I convert all the sizes & positions according to 1280 X 720 and it works, all the controls are in place.

But I still don't understand if the win.getWidth() and win.getHeight() functions give me 1080 X 1920, why the addon need to convert it to 1280 X 720?
Now I understand why this function was so important to be there:
python:
self.setCoordinateResolution(0) # 1920x1080

How I can get this resolution sizes dynamically for each skin? (Currently I told to convert it to 1280 X 720 fixed inside the code)

Also where can I check the skin resolution?
From what I know it 1080 (according to the folder in the skin addon folder, and as it shown in the Settings)
Reply
#9
(2020-08-31, 15:51)burekas Wrote: Also where can I check the skin resolution?

that is what my code is supposed to do (although i mistakenly said it returns the window size)

i just tested it in Confluence (a 720p skin) and the code correctly returns 1280 / 720
then tested it in Estuary (which is coded in 1080) and the code now returns 1920 / 1080
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Reply
#10
So it's strange.
My skin return 1080 resolution, but the addon still required to adjust the controls to 720 resolution, so the skin resolution has no affect on the addon coordinates.
in v17, this old function forced the addon to be 1080 so all the sizes and positions was set according to that.
Reply
#11
and which skin would that 'My skin' be?
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Reply
#12
Titan skin.
But I checkd it with the "Titan MOD" skin, because the original is not supported for v18.
https://forum.kodi.tv/showthread.php?tid=330749
Reply
#13
By default Window and WindowDialog classes operate on 1280x720 coordinate grid. It does not depend on the current skin or the actual display resolution.
Previously getWidth/getHeight returned the current display resolution which was confusing. Now they return the coordinate grid resolution. However, it looks like now we don't have a way to set a coordinate grid resolution that may be useful in some cases. I plan to fix it in the upcoming "Matrix" version as soon as I get some free time.
Reply
#14
@Roman_V_M 
Thank you for this detailed answer. 
Now it's clear.
Reply
#15
@Roman_V_M will this solution add possibility for script addons to change the aspect ratio / resolution of shiped skins? I can't find a useful way to scale my custom skins.

16:9

Image

21:9 Scaling is really bad.

Image
Reply

Logout Mark Read Team Forum Stats Members Help
Error with 'WindowDialog.setCoordinateResolution' function0