guis.py 文件源码

python
阅读 32 收藏 0 点赞 0 评论 0

项目:script.reddit.reader 作者: gedisony 项目源码 文件源码
def onInit(self):
        xbmc.executebuiltin( "Dialog.Close(busydialog)" )
        #important to reset the listbox. when control comes back to this GUI(after calling another gui).
        #  kodi will "onInit" this GUI again. we end up adding items in gui_listbox
        #self.gui_listbox.reset()
        #self.exit_monitor = ExitMonitor(self.close_gui)#monitors for abortRequested and calls close on the gui

        if self.title_bar_text:
            self.ctl_title_bar = self.getControl(1)
            self.ctl_title_bar.setText(self.title_bar_text)

        if self.poster:
            #self.getControl(2).setImage(self.poster)
            self.getControl(3).setImage(self.poster)

        listing_generator=generator(self.listing)

        for control_id in self.x_controls:
            tx_control=self.getControl(control_id)
            bn_control=self.getControl(control_id+1000)
            img_control=self.getControl(control_id+2000)

            try:
                #gether the listitem properties and prepare to put them on the button
                li=listing_generator.next()
                link_url=li.getProperty('link_url')
                label=li.getLabel()
                label=label.replace(link_url, "")  #remove the http:... part to avoid it looking duplicated because it is already put as a label in button.
                thumb=li.getArt('thumb')
                log('item_type='+repr(li.getProperty('item_type')) )
                log('onClick_action='+repr(li.getProperty('onClick_action')) )
            except StopIteration:
                li=label=link_url=None

            if label:
                tx_control.setText(label)
                #xbmcgui.ControlButton object has no attribute 'setProperty'
                if link_url=='http://blank.padding':  #the regex generating this list is not perfect. a padding was added to make it work. we ignore it here.
                    bn_control.setVisible(False)
                else:
                    bn_control.setLabel(label=link_url)
            else:
                tx_control.setText(None)
                tx_control.setVisible(False)
                bn_control.setVisible(False)

            if thumb:
                img_control.setImage(thumb)
            else:
                img_control.setVisible(False) #hide the unused controls so they don't occupy 'space' in the grouplist
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号