def __init__(self, *args, **kwargs):
xbmcgui.WindowXML.__init__(self, *args, **kwargs)
#xbmcgui.WindowXMLDialog.__init__(self, *args, **kwargs) #<--- what's the difference? WindowXMLDialog animations are more system-demanding but can have transparent background.
self.subreddits_file = kwargs.get("subreddits_file")
self.listing = kwargs.get("listing")
self.main_control_id = kwargs.get("id")
self.title_bar_text = kwargs.get("title")
#log( str(args) )
#log(sys.argv[1])
python类WindowXML()的实例源码
def __init__(self, *args, **kwargs):
xbmcgui.WindowXML.__init__(self, *args, **kwargs)
self.listing = kwargs.get("listing")
self.title_bar_text=kwargs.get("title")
self.poster=kwargs.get("poster")
self.main_control_id = None #not used, left here so that we can use the base class methods without error. onClick()
self.exit_monitor = ExitMonitor(self.close_gui)#monitors for abortRequested and calls close on the gui
#can't dynamically create an auto-height textbox inside a grouplist
# so we make x of them in the xml and hope they're enough
# these are their id's
self.x_controls=[x for x in range(1000, 1021)]
def setProperty(self, key, value):
if self._closing:
return
if not self._winID:
self._winID = xbmcgui.getCurrentWindowId()
try:
xbmcgui.Window(self._winID).setProperty(key, value)
xbmcgui.WindowXML.setProperty(self, key, value)
except RuntimeError:
xbmc.log('kodigui.BaseWindow.setProperty: Missing window', xbmc.LOGDEBUG)
def show(self):
self._closing = False
self.isOpen = True
xbmcgui.WindowXML.show(self)
def __init__(self, *args, **kwargs):
xbmcgui.WindowXML.__init__(self, *args, **kwargs)
#xbmcgui.WindowXMLDialog.__init__(self, *args, **kwargs) #<--- what's the difference?
self.subreddits_file = kwargs.get("subreddits_file")
self.listing = kwargs.get("listing")
self.main_control_id = kwargs.get("id")
#self.gui_listbox.addItems(self.listing)
listing_generator=generator(self.listing)
tlc_id=0 #create id's for top-level-comments
self.child_lists[:] = [] #a collection of child comments (non-tlc) tlc_children
tlc_children=[]
#for listing in self.listing:
for listing in listing_generator:
depth=int(listing.getProperty('comment_depth'))
#add root comments and links on the listbox
if not listing.getProperty('link_url'):
if depth==0:
tlc_id+=1
listing.setProperty('tlc_id',str(tlc_id)) #assign an id to this top-level-comment
self.items_for_listbox.append(listing) #this post will be on the listbox
#log('tlc: '+listing.getProperty('plot'))
#save the set of comments from previous top level comment
self.child_lists.append(tlc_children)
#begin a new list of child comments(this does not clear the old refernces)
tlc_children=[]
tlc_children.append( self.get_post_text_tuple(listing) ) #save the post_text of the top level comment
else:
#collect the child comments. when depth=0 again, this list is reset.
child_comment=listing
#log(' : '+child_comment.getProperty('plot'))
tlc_children.append( self.get_post_text_tuple(child_comment) )
else: #link in tlc
if depth>0:
listing.setProperty('tlc_id',str(tlc_id))
listing.setProperty('non_tlc_link','true')
listing.setProperty('tlc_id',str(tlc_id))
self.items_for_listbox.append(listing)
#don't forget to add the children of the last tlc
self.child_lists.append(tlc_children)
#log(pprint.pformat(self.child_lists))
self.exit_monitor = ExitMonitor(self.close_gui)#monitors for abortRequested and calls close on the gui
#can't dynamically create an auto-height textbox inside a grouplist
# so we make x of them in the xml and hope they're enough
# these are their id's
self.x_controls=[x for x in range(1000, 1071)]