Help comparer item with listitem
#1
hi all I want to compare item with listitem
If it was not there in the list enters
Code:
def onClick(self,controlId):
        i=0        
        if controlId==PRODUIT_LIST:    
            list = self.getControl( PRODUIT_LIST );
            item = list.getSelectedItem()
            mytitle = item.getProperty("MyTitle")
            mypric=item.getProperty("MyPrice")        
            listitem = xbmcgui.ListItem(label=mytitle,label2=mypric)            
            a=mypric.replace('DHS',"").replace(',',".")
            self.x=self.x+float(a)
            if self.getControl(LAPRODUIT).size()==0:
                self.getControl( LAPRODUIT ).addItem( listitem )    
                self.getControl(TOTAL).setLabel(str(self.x)+"DHS")                
            else:            
                while i < self.getControl(LAPRODUIT).size():
                    if mytitle!=self.getControl(LAPRODUIT).getListItem(i).getLabel():                
                       self.getControl( LAPRODUIT ).addItem( listitem )    
                       self.getControl(TOTAL).setLabel(str(self.x)+"DHS")
                    i=i+1
Condition is met for the first time
And then it starts repeating more than once
Reply

Logout Mark Read Team Forum Stats Members Help
Help comparer item with listitem0