From a608efce8b472296eed91594d13d46f7c75ab1b5 Mon Sep 17 00:00:00 2001 From: faush01 Date: Thu, 2 Oct 2014 14:50:42 +1000 Subject: [PATCH] experimental window --- default.py | 11 +- resources/lib/ArtworkLoader.py | 6 +- resources/lib/DisplayItems.py | 95 +++++++++++++++ resources/skins/default/720p/DisplayItems.xml | 114 ++++++++++++++++++ 4 files changed, 217 insertions(+), 9 deletions(-) create mode 100644 resources/lib/DisplayItems.py create mode 100644 resources/skins/default/720p/DisplayItems.xml diff --git a/default.py b/default.py index f5be63e..89e4bd2 100644 --- a/default.py +++ b/default.py @@ -62,6 +62,7 @@ from Utils import PlayUtils from ClientInformation import ClientInformation from PersonInfo import PersonInfo from SearchDialog import SearchDialog +from DisplayItems import DisplayItems ADDON_VERSION = ClientInformation().getVersion() @@ -1448,16 +1449,18 @@ def showItemInfo(pluginName, handle, params): del infoPage -def showSearch(pluginName, handle, params): +def showSearch(pluginName, handle, params): printDebug("showSearch Called" + str(params)) xbmcplugin.endOfDirectory(handle, cacheToDisc=False) - + searchDialog = SearchDialog("SearchDialog.xml", __cwd__, "default", "720p") - searchDialog.doModal() - del searchDialog + #items = DisplayItems("DisplayItems.xml", __cwd__, "default", "720p") + #items.doModal() + #del items + def showPersonInfo(pluginName, handle, params): printDebug("showPersonInfo Called" + str(params)) xbmcplugin.endOfDirectory(handle, cacheToDisc=False) diff --git a/resources/lib/ArtworkLoader.py b/resources/lib/ArtworkLoader.py index 1f8aa6b..f48dfae 100644 --- a/resources/lib/ArtworkLoader.py +++ b/resources/lib/ArtworkLoader.py @@ -158,10 +158,6 @@ class ArtworkRotationThread(threading.Thread): data = {} if(len(self.global_art_links) > 0): data["global"] = self.global_art_links[self.current_global_art] - #if(len(self.movie_art_links) > 0): - # data["movie"] = self.movie_art_links[self.current_movie_art] - #if(len(self.tv_art_links) > 0): - # data["tv"] = self.tv_art_links[self.current_tv_art] __addon__ = xbmcaddon.Addon(id='plugin.video.mbcon') __addondir__ = xbmc.translatePath( __addon__.getAddonInfo('profile') ) @@ -311,7 +307,7 @@ class ArtworkRotationThread(threading.Thread): parentid = result.get("Id") self.logMsg("updateCollectionArtLinks ParentID : " + str(parentid), 2) - userRootPath = "http://" + mb3Host + ":" + mb3Port + "/mediabrowser/Users/" + userid + "/items?ParentId=" + parentid + "&SortBy=SortName&Fields=CollectionType,Overview,RecursiveItemCount&format=json" + userRootPath = "http://" + mb3Host + ":" + mb3Port + "/mediabrowser/Users/" + userid + "/items?ParentId=" + parentid + "&SortBy=SortName&Fields=CollectionType,RecursiveItemCount&format=json" jsonData = downloadUtils.downloadUrl(userRootPath, suppress=False, popup=1 ) self.logMsg("updateCollectionArtLinks userRootPath : " + str(jsonData), 2) diff --git a/resources/lib/DisplayItems.py b/resources/lib/DisplayItems.py new file mode 100644 index 0000000..86b9783 --- /dev/null +++ b/resources/lib/DisplayItems.py @@ -0,0 +1,95 @@ +import xbmcplugin +import xbmcgui +import xbmcaddon +import xbmc +import threading +import sys + +class DisplayItems(xbmcgui.WindowXMLDialog): + + actionThread = None + + def __init__(self,strXMLname, strFallbackPath, strDefaultName, forceFallback): + # Changing the three varibles passed won't change, anything + # Doing strXMLname = "bah.xml" will not change anything. + # don't put GUI sensitive stuff here (as the xml hasn't been read yet + # Idea to initialize your variables here + + pass + + def onInit(self): + # Put your List Populating code/ and GUI startup stuff here + self.actionThread = BackgroundItemThread() + self.actionThread.setWindow(self) + self.actionThread.start() + + pass + + def onAction(self, action): + + aId = action.getId() + #xbmc.log("Windows Action : " + str(aId)) + + if aId == 10 or aId == 92: + self.close() + else: + pass + + def onClick(self, controlID): + """ + Notice: onClick not onControl + Notice: it gives the ID of the control not the control object + """ + pass + + def onFocus(self, controlID): + pass + +class BackgroundItemThread(threading.Thread): + + rootWindow = None + + def setWindow(self, window): + self.rootWindow = window + + def run(self): + xbmc.log("BackgroundItemThread Started") + + #self.rootWindow.setProperty('content','movies') + #xbmc.executebuiltin("Container.SetContent(movies)") + #xbmc.executebuiltin("Container.SetViewMode(522)") + + itemList = self.rootWindow.getControl(50) + + thumbPath = "http://192.168.0.27:8096/mediabrowser/Items/924b2d98a64ae17fc31417b3cce02783/Images/Primary/0/0e5801646b3f1b8361a8bc73ff86a9e4/original/10000/10000/0" + + for x in range(0, 500): + listItem = xbmcgui.ListItem(label="Test-" + str(x), label2="Test2-" + str(x), iconImage=thumbPath, thumbnailImage=thumbPath) + + infolabels = { "title": "My Movie-" + str(x), "Plot": "Some plot inof", "plotoutline": "short plot", "tvshowtitle": "My TV Title", "originaltitle": "Original Title"} + listItem.setInfo( type="movies", infoLabels=infolabels ) + listItem.setProperty('IsPlayable', 'true') + + #selected = itemList.getSelectedItem() + selected = itemList.getSelectedPosition() + xbmc.log("SELECTED 01: " + str(selected)) + + itemList.addItem(listItem) + + if(selected != -1): + #item = itemList.getListItem(selected) + #selected = itemList.getSelectedItem() + #xbmc.log("SELECTED 02: " + str(item)) + itemList.selectItem(selected) + #item.select(True) + + xbmc.sleep(200) + + + + + xbmc.log("BackgroundItemThread Exiting") + + + + \ No newline at end of file diff --git a/resources/skins/default/720p/DisplayItems.xml b/resources/skins/default/720p/DisplayItems.xml new file mode 100644 index 0000000..d1c0a1d --- /dev/null +++ b/resources/skins/default/720p/DisplayItems.xml @@ -0,0 +1,114 @@ + + + 50 + no + + + CommonBackground + + + + true + + 60 + 58 + 1200 + 576 + 2 + 759 + 522 + 522 + 759 + 200 + 2 + + + + + + 0 + 0 + 125 + 180 + button-nofocus.png + 5 + stretch + $VAR[PosterThumb] + + + 120 + 5 + 15 + 15 + keep + $INFO[ListItem.Overlay] + + + 5 + 170 + 115 + 5 + Progress\progress_$INFO[ListItem.Property(complete_percentage)].png + stretch + AAFFFFFF + !IsEmpty(ListItem.Property(complete_percentage)) + + + + + 0 + 0 + 125 + 180 + folder-focus.png + 5 + stretch + $VAR[PosterThumb] + + + 120 + 5 + 15 + 15 + keep + $INFO[ListItem.Overlay] + + + 5 + 170 + 115 + 5 + Progress\progress_$INFO[ListItem.Property(complete_percentage)].png + stretch + AAFFFFFF + !IsEmpty(ListItem.Property(complete_percentage)) + + + + + + + + 1235 + 50 + 25 + 600 + ScrollBarV.png + ScrollBarV_bar.png + ScrollBarV_bar_focus.png + ScrollBarNib.png + ScrollBarNib.png + 50 + 2 + false + vertical + true + + + + + + + + + \ No newline at end of file