plugin with GUI
#1
Hello,

I made a plugin which uses the native GUI of Kodi (by ListItems) and I added GUI of my own.
The GUI I made supposed to be opened if the user clicks on a ListItem (ListItem configured as isFolder=False). It works, but when the user press 'Esc' to exit the GUI window, the native GUI of Kodi appears and it shows an empty screen with 0 items instead of all the ListItems it supposed to show.
How can I fix it so when exiting my GUI, it will return to the display of ListItems?

Here is the structure of simplified version of my code:

Code:
base_url = sys.argv[0]                     # arguments from the addon
addon_handle = int(sys.argv[1])
args = urlparse.parse_qs(sys.argv[2][1:])

class MyClass(xbmcgui.Window):
    pass # (This is my GUI)

xbmcplugin.setContent(addon_handle, 'movies')

def build_url(query):
    return base_url + '?' + urllib.urlencode(query)

mode = args.get('mode', None)

if mode is None:
    url = build_url({'mode': 'folder', 'foldername': 'Movies'})
    li = xbmcgui.ListItem('Movies', iconImage='DefaultFolder.png')
    xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li, isFolder=True)
    xbmcplugin.endOfDirectory(addon_handle)

elif mode[0] == 'folder':
    if args['foldername'][0] == 'Movies':
        movies_map = plc('MOV')    # request for movies from server

        for item in movies_map.iteritems():
            url = build_url({'mode': 'item', 'itemnumber': 'movieItem' + item[0]})    
            li = xbmcgui.ListItem(item[0], iconImage=str(item[1][0]))      
            xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li, isFolder=False)
        xbmcplugin.endOfDirectory(addon_handle)

elif mode[0] == 'item':
    item_title = args['itemnumber'][0][9:]
    mydisplay = MyClass(item_name=item_title)
    mydisplay.doModal()
    del mydisplay


I want that MyClass() will be activated when clicking on a movie item and when closed it will return to the folder of movies to show all movies' ListItems.
Very appreciate your comments and opinion.

Thanks.
Reply
#2
it should work if you you make the item that opens your window a *file* (ie isFolder=false), yet do not mark it as playable. it does look like that is what you are doing, so i'm a bit confused right now.
Reply
#3
(2017-06-01, 15:08)ironic_monkey Wrote: it should work if you you make the item that opens your window a *file* (ie isFolder=false), yet do not mark it as playable. it does look like that is what you are doing, so i'm a bit confused right now.

Yes, I was thinking the same.
Will it be helpful if I upload the full code to GitHub and send a link here?
Reply
#4
yes. i can't promise when i find time to look into it, but i will eventually at that would make it much easier.
Reply
#5
(2017-06-01, 16:12)ironic_monkey Wrote: yes. i can't promise when i find time to look into it, but i will eventually at that would make it much easier.

OK, It will be great.

This is the link:
https://github.com/YarinLevy2/MovieTalk-Files

The code you are looking for is in plugin.video.movieTalk -> main.py

If you want to run the addon in order to see the problem just install plugin.video.movieTalk in Kodi, run the server and then go to programs in Kodi and MovieTalk will be there to run.

Let me know if you find somthing that can help. You can also send a pull request.

Thank you
Reply
#6
Problem fixed. There was an issue with the server but now it's ok.
Thanks anyway!
Reply
#7
awesome. so you blamed the wrong thing and the original assumption about how plugin item works was correct?
Reply
#8
(2017-06-02, 10:50)ironic_monkey Wrote: awesome. so you blamed the wrong thing and the original assumption about how plugin item works was correct?


Just right.
It was something with the connection to the server from MyClass().
Reply

Logout Mark Read Team Forum Stats Members Help
plugin with GUI0