def __filterItems(self, 
                      terms, 
                      caseSensitive=False):
        """
        Filters the items in this tree based on the inputed keywords.
        
        :param      terms           | {<str> dataType: [<str> term, ..], ..}
                    caseSensitive   | <bool>
        
        :return     <bool> | found
        """
        found = False
        items = []
        
        # collect the items to process
        for i in range(self.count()):
            items.append(self.item(i))
        
        for item in items:
            if not isinstance(item, XListWidgetItem):
                continue
            
            # if there is no filter keywords, then all items will be visible
            if not any(terms.values()):
                found = True
                item.setHidden(False)
            
            else:
                # match all generic keywords
                generic         = terms.get('*', [])
                generic_found   = dict((key, False) for key in generic)
                
                # match all specific keywords
                dtype_found  = dict((col, False) for col in terms if col != '*')
                
                # look for any matches for any data type
                mfound = False
                
                for dataType in self._filteredDataTypes:
                    # determine the check text based on case sensitivity
                    if caseSensitive:
                        check = nativestring(item.filterData(dataType))
                    else:
                        check = nativestring(item.filterData(dataType)).lower()
                    
                    specific = terms.get(dataType, [])
                    
                    # make sure all the keywords match
                    for key in generic + specific:
                        if not key:
                            continue
                        
                        # look for exact keywords
                        elif key.startswith('"') and key.endswith('"'):
                            if key.strip('"') == check:
                                if key in generic:
                                    generic_found[key] = True
                                
                                if key in specific:
                                    dtype_found[dataType] = True
                        
                        # look for ending keywords
                        elif key.startswith('*') and not key.endswith('*'):
                            if check.endswith(key.strip('*')):
                                if key in generic:
                                    generic_found[key] = True
                                if key in specific:
                                    dtype_found[dataType] = True
                        
                        # look for starting keywords
                        elif key.endswith('*') and not key.startswith('*'):
                            if check.startswith(key.strip('*')):
                                if key in generic:
                                    generic_found[key] = True
                                if key in specific:
                                    dtype_found[dataType] = True
                        
                        # look for generic keywords
                        elif key.strip('*') in check:
                            if key in generic:
                                generic_found[key] = True
                            if key in specific:
                                dtype_found[dataType] = True
                    
                    mfound = all(dtype_found.values()) and \
                             all(generic_found.values())
                    if mfound:
                        break
                
                item.setHidden(not mfound)
                
                if mfound:
                    found = True
        
        return found
def __filterItems ( self , terms , caseSensitive = False ) : found = False items = [ ] for i in range ( self . count ( ) ) : items . append ( self . item ( i ) ) for item in items : if not isinstance ( item , XListWidgetItem ) : continue if not any ( terms . values ( ) ) : found = True item . setHidden ( False ) else : generic = terms . get ( '*' , [ ] ) generic_found = dict ( ( key , False ) for key in generic ) dtype_found = dict ( ( col , False ) for col in terms if col != '*' ) mfound = False for dataType in self . _filteredDataTypes : if caseSensitive : check = nativestring ( item . filterData ( dataType ) ) else : check = nativestring ( item . filterData ( dataType ) ) . lower ( ) specific = terms . get ( dataType , [ ] ) for key in generic + specific : if not key : continue elif key . startswith ( '"' ) and key . endswith ( '"' ) : if key . strip ( '"' ) == check : if key in generic : generic_found [ key ] = True if key in specific : dtype_found [ dataType ] = True elif key . startswith ( '*' ) and not key . endswith ( '*' ) : if check . endswith ( key . strip ( '*' ) ) : if key in generic : generic_found [ key ] = True if key in specific : dtype_found [ dataType ] = True elif key . endswith ( '*' ) and not key . startswith ( '*' ) : if check . startswith ( key . strip ( '*' ) ) : if key in generic : generic_found [ key ] = True if key in specific : dtype_found [ dataType ] = True elif key . strip ( '*' ) in check : if key in generic : generic_found [ key ] = True if key in specific : dtype_found [ dataType ] = True mfound = all ( dtype_found . values ( ) ) and all ( generic_found . values ( ) ) if mfound : break item . setHidden ( not mfound ) if mfound : found = True return found
Filters the items in this tree based on the inputed keywords.
        
        :param      terms           | {<str> dataType: [<str> term, ..], ..}
                    caseSensitive   | <bool>
        
        :return     <bool> | found