Solved Custom window with WindowXML that get stuck on BusyDialog, help
#1
Hey

I'm learning about WindowXML
Im currently using Example from wiki. When I enter the new window created with example I end up seeing those two items, but they are converted with BusyDialog.xml
The only solution I found is to change WindowXML to WindowXMLDialog, but thats result in transparent background - but still that is just a workaround and Im unsure why its being "busy".
I can ESCAPE the busydialog, but thats now how it suppose to work, right ?

my calendar.xml file:
xml:

<?xml version="1.0" encoding="UTF-8"?>
<window>
    <views>50</views>
    <controls>
        <control type="list" id="50">
            <left>500</left>
            <top>200</top>
            <width>1000</width>
            <height>500</height>
            <viewtype label="535">list</viewtype>
            <itemlayout height="100" width="1000">
                <control type="label">
                    <left>20</left>
                    <top>0</top>
                    <height>50</height>
                    <width>960</width>
                    <font>font13</font>
                    <label>$INFO[ListItem.Label]</label>
                </control>
            </itemlayout>
            <focusedlayout height="100" width="1000">
                <control type="image">
                    <left>0</left>
                    <top>0</top>
                    <width>1000</width>
                    <height>50</height>
                    <texture>testwindow-focus.png</texture>
                </control>
                <control type="label">
                    <left>20</left>
                    <top>0</top>
                    <height>50</height>
                    <width>960</width>
                    <font>font13</font>
                    <label>$INFO[ListItem.Label]</label>
                    <textcolor>orange</textcolor>
                </control>
            </focusedlayout>
        </control>
    </controls>
</window>

I know I shouldn't see 'end' until I exit the window, and here is the log:
log:

10:59:17.187 T:5604   ERROR: ---> begin.....
10:59:17.190 T:5604 WARNING: CSkinInfo: failed to load skin settings
10:59:17.491 T:3604   DEBUG: ------ Window Init (DialogBusy.xml) ------
10:59:17.492 T:3604   DEBUG: Activating window ID: 13000
10:59:17.524 T:3604   DEBUG: ------ Window Deinit (MyVideoNav.xml) ------
10:59:17.537 T:3604   DEBUG: ------ Window Init (C:\Users\poppy\AppData\Roaming\Kodi\addons\plugin.video.poppy\resources\skins\default\1080i\calendar.xml) ------
10:59:17.537 T:3604    INFO: Loading skin file: C:\Users\poppy\AppData\Roaming\Kodi\addons\plugin.video.poppy\resources\skins\default\1080i\calendar.xml, load type: LOAD_ON_GUI_INIT
10:59:17.537 T:3604   DEBUG: CGUIMediaWindow::GetDirectory ()
10:59:17.537 T:3604   DEBUG:   ParentPath =

And when I close Kodi by hand it stuck in process until I kill it with Task Manager.

Edit: The smalles footprint I could go was this, still BusyDialog on entering...

poppy.py
python:

#!/usr/bin/env python
# -*- coding: utf-8 -*-

import xbmcplugin
import xbmcgui
import xbmc
import xbmcaddon
from urllib import unquote_plus
import sys


ADDON = xbmcaddon.Addon()
CWD = ADDON.getAddonInfo('path').decode('utf-8')

ACTION_PREVIOUS_MENU = 10
ACTION_NAV_BACK = 92


list_items =
handle = int(sys.argv[1])


class GUI(xbmcgui.WindowXML):
    # [optional] this function is only needed of you are passing optional data to your window
    def __init__(self, *args, **kwargs):
        # get the optional data and add it to a variable you can use elsewhere in your script
        self.data = 'test'

    # until now we have a blank window, the onInit function will parse your xml file
    def onInit(self):
        # select a view mode, '50' in our case, as defined in the skin file
        xbmc.executebuiltin('Container.SetViewMode(50)')
        # define a temporary list where we are going to add all the listitems to
        listitems =
        # this will be the first item in the list. 'my first item' will be the label that is shown in the list
        listitem1 = xbmcgui.ListItem('my first item')
        # add this item to our temporary list
        listitems.append(listitem1)
        # let's create another item
        listitem2 = xbmcgui.ListItem('my second item')
        # and add it to the temporary list as well
        listitems.append(listitem2)
        # by default the built-in container already contains one item, the 'up' (..) item, let's remove that one
        self.clearList()
        # now we are going to add all the items we have defined to the (built-in) container
        self.addItems(listitems)
        # give kodi a bit of (processing) time to add all items to the container
        xbmc.sleep(100)
        # this puts the focus on the top item of the container
        self.setFocusId(self.getCurrentContainerId())

    def onAction(self, action):
        if action == ACTION_PREVIOUS_MENU:
            self.close()
        if action == ACTION_NAV_BACK:
            self.close()


def my_window():
    ui = GUI('calendar.xml',
             CWD,
             'default',
             '1080i')
    ui.doModal()
    del ui


def parse_parameters(input_string):
    parameters = {}
    p1 = input_string.find('?')
    if p1 >= 0:
        split_parameters = input_string[p1 + 1:].split('&')
        for name_value_pair in split_parameters:
            # xbmc.log("parseParameter detected Value: " + str(name_value_pair))
            if (len(name_value_pair) > 0) & ("=" in name_value_pair):
                pair = name_value_pair.split('=')
                key = pair[0]
                value = unquote_plus(pair[1])
                parameters[key] = value
    return parameters


parameters = parse_parameters(sys.argv[2])
mode = parameters.get('mode', 0)

# xbmcgui.Dialog().ok(str(mode), str(parameters))

if mode == "1":
    xbmc.log('---> begin.....', xbmc.LOGERROR)
    my_window()
    xbmc.log('<--- end.....', xbmc.LOGERROR)
else:
    title = 'poppy'
    liz = xbmcgui.ListItem(label=title, label2=title)
    # liz.setInfo(type="Video", infoLabels={"Title": title, "Plot": title})
    u = sys.argv[0] + '?mode=1'
    list_items.append((u, liz, True))

    xbmcplugin.addDirectoryItems(handle, list_items, len(list_items))
    xbmcplugin.endOfDirectory(handle)


Reply
#2
if your addon requires a custom xml window, you will have to create a script type addon.
plugins can not use such functionality.
https://kodi.wiki/view/About_Add-ons#Pyt...us_scripts
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
edit: i'm assuming you've created a plugin since you import xbmcplugin

in case i'm wrong and you did create a script, you can't use xbmcplugin functionality in a script.
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
(2018-08-19, 12:07)ronie Wrote: if your addon requires a custom xml window, you will have to create a script type addon.
plugins can not use such functionality.
https://kodi.wiki/view/About_Add-ons#Pyt...us_scripts
 I moved all gui releated code to script.module.poppy
this is addon.xml
xml:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="script.module.poppy" name="poppy-script-module" version="1.0.0" provider-name="poppy">
    <requires>
        <import addon="xbmc.python" version="2.1.0"/>
    </requires>
    <extension point="xbmc.python.pluginsource">
        <provides></provides>
    </extension>
    <extension point="xbmc.python.module" library="lib" />
    <extension point="xbmc.addon.metadata">
        <platform>all</platform>
        <summary lang="en">poppy</summary>
        <description lang="en">poppy</description>
        <website></website>
        <source></source>
        <license>GNU GENERAL PUBLIC LICENSE. Version 2, June 1991</license>
        <news>
        </news>
    </extension>
    <assets>
        <icon></icon>
        <fanart></fanart>
        <screenshot></screenshot>
    </assets>
</addon>

I installed it and enabled,
added and change
python:

import gui
gui.my_window()

And still its not working
Reply
#5
(2018-08-19, 12:13)ronie Wrote: edit: i'm assuming you've created a plugin since you import xbmcplugin

in case i'm wrong and you did create a script, you can't use xbmcplugin functionality in a script.
I moved everything to script, so I should be able to call it from plugin, because I'm calling script ? or should I call it different way than importing function and use function ?

 
bash:

script.module.poppy/addon.xml
script.module.poppy/lib/gui/__init.py__
script.module.poppy/lib/gui/gui.py
script.module.poppy/resources/skins/Default/1080i/calendar.xml
script.module.poppy/resources/skins/Default/media/testwindow-focus.png

addon.xml
python:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="script.module.poppy" name="poppy-script-module" version="1.0.0" provider-name="poppy">
    <requires>
        <import addon="xbmc.python" version="2.1.0"/>
    </requires>
    <extension point="xbmc.python.pluginsource">
        <provides></provides>
    </extension>
    <extension point="xbmc.python.module" library="lib" />
    <extension point="xbmc.addon.metadata">
        <platform>all</platform>
        <summary lang="en">poppy</summary>
        <description lang="en">poppy</description>
        <website></website>
        <source></source>
        <license>GNU GENERAL PUBLIC LICENSE. Version 2, June 1991</license>
        <news>
        </news>
    </extension>
    <assets>
        <icon></icon>
        <fanart></fanart>
        <screenshot></screenshot>
    </assets>
</addon>

and the video plugin:
bash:

plugin.video.poppy/addon.xml
plugin.video.poppy/poppy.py

addon.xml
python:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="plugin.video.poppy" name="Poppy" version="1.0.0" provider-name="poppy">
    <requires>
        <import addon="script.module.poppy" version="1.0.0"/>
    </requires>
    <extension point="xbmc.python.pluginsource" library="poppy.py">
        <provides>video</provides>
    </extension>
    <extension point="xbmc.addon.metadata">
        <summary lang="en_GB">poppy is poppy</summary>
        <news>
        </news>
        <platform>all</platform>
        <language>en</language>
        <license>GNU GENERAL PUBLIC LICENSE. Version 2, June 1991</license>
        <website></website>
        <source></source>
        <email></email>
        <assets>
            <icon></icon>
            <fanart></fanart>
            <screenshot></screenshot>
            <screenshot></screenshot>
            <screenshot></screenshot>
        </assets>
    </extension>
</addon>

poppy.py
python:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import xbmcplugin
import xbmcgui
import xbmc
import xbmcaddon
from urllib import unquote_plus
import sys

import gui


list_items =
handle = int(sys.argv[1])


def parse_parameters(input_string):
    parameters = {}
    p1 = input_string.find('?')
    if p1 >= 0:
        split_parameters = input_string[p1 + 1:].split('&')
        for name_value_pair in split_parameters:
            if (len(name_value_pair) > 0) & ("=" in name_value_pair):
                pair = name_value_pair.split('=')
                key = pair[0]
                value = unquote_plus(pair[1])
                parameters[key] = value
    return parameters


parameters = parse_parameters(sys.argv[2])
mode = parameters.get('mode', 0)

if mode == "1":
    xbmc.log('---> begin.....', xbmc.LOGERROR)
    gui.my_window()
    xbmc.log('<--- end.....', xbmc.LOGERROR)
else:
    title = 'poppy'
    liz = xbmcgui.ListItem(label=title, label2=title)
    u = sys.argv[0] + '?mode=1'
    list_items.append((u, liz, True))

    xbmcplugin.addDirectoryItems(handle, list_items, len(list_items))
    xbmcplugin.endOfDirectory(handle)

Reply
#6
(2018-08-19, 12:07)ronie Wrote: if your addon requires a custom xml window, you will have to create a script type addon.
plugins can not use such functionality.
https://kodi.wiki/view/About_Add-ons#Pyt...us_scripts
 And it looks like I need to run it like this:
python:
xbmc.executebuiltin('RunScript(script.module.poppy)')
and tweak addon.xml to run it that way.
Yeah it works that way, like always thanks for shearing the knowledge
Reply
#7
Just a small note: "Shebang" string (the first string starting with "#!" that identifies the script interpreter) is needed only on *nix systems for standalone scripts that are meant to be run as console commands. You certainly don't need it in Kodi addons.
Reply
#8
(2018-08-19, 12:51)Roman_V_M Wrote: Just a small note: "Shebang" string (the first string starting with "#!" that identifies the script interpreter) is needed only on *nix systems for standalone scripts that are meant to be run as console commands. You certainly don't need it in Kodi addons.
 Hey,
Yes that is true.
It just an old habbit - will clean those
Reply
#9
(2018-08-19, 12:34)poppy_pl Wrote:
xml:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="script.module.poppy" name="poppy-script-module" version="1.0.0" provider-name="poppy">
    <requires>
        <import addon="xbmc.python" version="2.1.0"/>
    </requires>
    <extension point="xbmc.python.pluginsource">
        <provides></provides>
    </extension>
    <extension point="xbmc.python.module" library="lib" />
you should remove the "xbmc.python.pluginsource" extension point.
also, i think it would make more sense to use the "xbmc.python.library" instead of the "xbmc.python.module" extension point.
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
(2018-08-19, 19:18)ronie Wrote:
(2018-08-19, 12:34)poppy_pl Wrote:
xml:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="script.module.poppy" name="poppy-script-module" version="1.0.0" provider-name="poppy">
    <requires>
        <import addon="xbmc.python" version="2.1.0"/>
    </requires>
    <extension point="xbmc.python.pluginsource">
        <provides></provides>
    </extension>
    <extension point="xbmc.python.module" library="lib" />
you should remove the "xbmc.python.pluginsource" extension point.
also, i think it would make more sense to use the "xbmc.python.library" instead of the "xbmc.python.module" extension point. 
 You are right, but that plugin is a bit similar with script.extendedinfo;
I finally manage to overcome the problem with your help and a bit of fiddling with script.extendedinfo code;

Thank you very much, ronie.
Reply

Logout Mark Read Team Forum Stats Members Help
Custom window with WindowXML that get stuck on BusyDialog, help0