[Solved] Show Image with Script called in Settings Dialog
#1
For my addon service.watchedlist, I want to run a script in the settings dialog, that shows an image with a QR-code on the screen (containing a dropbox authorization URL).
Unfortunately, the image is not shown.
I tried the approach from the Notify-addon using json rpc (link to implementation in my code). This worked since there was no other open window in the notify-addon when the image is shown.

Code:
xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "Player.Open", "params": { "item": {"file":"' + tmp_file + '"} }, "id": 1}')

The approach with xbmcgui did not work

Code:
window = xbmcgui.Window()
        image = xbmcgui.ControlImage(0, 0, 800, 600, tmp_file)
        window.addControl(image)
        window.show()
        xbmc.sleep(4000)
        window.close()

The error message was

Quote:13:37:47 T:1912 DEBUG: Activating window ID: 13001
13:37:47 T:1912 INFO: Activate of window '13001' refused because there are active modal dialogs

The active modal dialog seems to be the settings dialog of the addon.
Also using window.doModal() did not work.

Using an ok-dialog at the same place did show up.

Code:
dialog = xbmcgui.Dialog()
        dialog.ok('Test1', 'Test2')

The issue seems to be discussed as a bug for some time now.
Further Info:
I use Kodi 16.0 and Confluence as skin.

How can I show the image?
Reply
#2
you could probably kill the settings dialog before opening your new window with xbmc.executebuiltin("Dialog.Close(all, true)")
When done. you could re-open it again with xbmcaddon.openSettings()
Donate: https://kodi.tv/contribute/donate (foundation), 146Gr48FqHM7TPB9q33HHv6uWpgQqdz1yk (BTC personal)
Estuary: Kodis new default skin - ExtendedInfo Script - KodiDevKit
Reply
#3
or use a dialog for your qr code instead of a window.
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
#4
(2016-02-29, 02:39)ronie Wrote: or use a dialog for your qr code instead of a window.

That is indeed the more clever way.
Donate: https://kodi.tv/contribute/donate (foundation), 146Gr48FqHM7TPB9q33HHv6uWpgQqdz1yk (BTC personal)
Estuary: Kodis new default skin - ExtendedInfo Script - KodiDevKit
Reply
#5
(2016-02-29, 02:39)ronie Wrote: or use a dialog for your qr code instead of a window.

The solution was to use a xbmcgui.WindowDialog (as xbmcgui.Dialog can not display images).
I moved the code to a new class as I did not see any possibility to handle the onAction() handle when having the windowdialog created in a subfunction in my code.
Here is the new code: script.module.dropbox/authenticate.py.
Reply

Logout Mark Read Team Forum Stats Members Help
[Solved] Show Image with Script called in Settings Dialog0