xbmcgui Input issue ?
#1
I have some code where I am prompting the user to input a server IP address and port number.  I am using the same code for Kodi 18.4 and 19.  I am seeing the same issue with both versions when I prompt the user for the server port number the IP address appears as the default / prepopulated value even though I am declaring a default value.

    ipdialog = xbmcgui.Dialog()
    serverip = ipdialog.input(addon.getLocalizedString(30448), type=xbmcgui.INPUT_IPADDRESS)
    portdialog = xbmcgui.Dialog()
    serverport = portdialog.input(addon.getLocalizedString(30449), '53168', type=xbmcgui.INPUT_NUMERIC)

When the portdialog box comes up if I delete a character in the IP address the default port value appears as '5316' minus the last character, 8.  I've tried adding a "del ipdialog" line before the port dialog line.  I've tried reusing ipdialog as "serverport = ipdialog.input(addon.getLocalizedString(30449), '53168', type=xbmcgui.INPUT_NUMERIC)" instead of portdialog and I get the same results.

Is this a bug in Kodi  or am I doing something wrong?  If this is a bug, does anyone have a workaround ?


Thanks,

Jeff
Running with the Mezzmo Kodi addon.  The easier way to share your media with multiple Kodi clients.
Service.autostop , CBC Sports, Kodi Selective Cleaner and Mezzmo Kodi addon author.
Reply
#2
I came up with a solution but it seems a bit heavy handed, reloading the skin between input dialogs.

    ipdialog = xbmcgui.Dialog()
    serverip = ipdialog.input(addon.getLocalizedString(30448), type=xbmcgui.INPUT_IPADDRESS)
    xbmc.executebuiltin('ReloadSkin()')
    portdialog = xbmcgui.Dialog()
    serverport = portdialog.input(addon.getLocalizedString(30449), '53168', type=xbmcgui.INPUT_NUMERIC)

Maybe one of the Kodi developers can weigh in here as to the problem and my solution. 


Thanks,

Jeff
Running with the Mezzmo Kodi addon.  The easier way to share your media with multiple Kodi clients.
Service.autostop , CBC Sports, Kodi Selective Cleaner and Mezzmo Kodi addon author.
Reply
#3
I spoke too soon.  While reloading the skin fixes the default port number showing up properly it causes the portdialog heading not to appear in the numeric dialog box.


Jeff
Running with the Mezzmo Kodi addon.  The easier way to share your media with multiple Kodi clients.
Service.autostop , CBC Sports, Kodi Selective Cleaner and Mezzmo Kodi addon author.
Reply
#4
It looks like I have found a solution by adding a 1 second sleep after the reload skin.  It appears the skin was still reloading when the second serverport dialog input box was trying to display causing the header not to appear.  This code seems to be working, albeit it feels like a heavy handed approach:

    ipdialog = xbmcgui.Dialog()
    serverip = ipdialog.input(media.translate(30448), '0.0.0.0', type=xbmcgui.INPUT_IPADDRESS)
    xbmc.executebuiltin('ReloadSkin()')
    xbmc.sleep(1000)
    serverport = ipdialog.input(media.translate(30449), '53168', type=xbmcgui.INPUT_NUMERIC)
    del ipdialog

The other thing to note is that the issue with the IP address being displayed as a default in the serverport input dialog box would occur when the user attempted to add a second server / port.  If I stopped / restarted the addon it would work right the fist time without the skin reload but if the user tried to add a second server before RESTARTING the addon the IP address would appear in the serverport dialog box.  Reloading the skin and sleeping for 1 second seems to be a workaround.


Thanks,

Jeff
Running with the Mezzmo Kodi addon.  The easier way to share your media with multiple Kodi clients.
Service.autostop , CBC Sports, Kodi Selective Cleaner and Mezzmo Kodi addon author.
Reply

Logout Mark Read Team Forum Stats Members Help
xbmcgui Input issue ?0