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:
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.