예제 #1
0
 def populateItem(self, parentItem, repopulate=False):
     """
     Public method to populate an item's subtree.
     
     @param parentItem reference to the item to be populated
     @param repopulate flag indicating a repopulation (boolean)
     """
     if parentItem.type() == ProjectBrowserItemSimpleDirectory:
         return  # nothing to do
     elif parentItem.type() == ProjectBrowserItemDirectory:
         self.populateProjectDirectoryItem(parentItem, repopulate)
     elif parentItem.type() == ProjectBrowserItemFile:
         self.populateFileItem(parentItem, repopulate)
     else:
         BrowserModel.populateItem(self, parentItem, repopulate)
예제 #2
0
 def populateItem(self, parentItem, repopulate=False):
     """
     Public method to populate an item's subtree.
     
     @param parentItem reference to the item to be populated
     @param repopulate flag indicating a repopulation (boolean)
     """
     if parentItem.type() == ProjectBrowserItemSimpleDirectory:
         return  # nothing to do
     elif parentItem.type() == ProjectBrowserItemDirectory:
         self.populateProjectDirectoryItem(parentItem, repopulate)
     elif parentItem.type() == ProjectBrowserItemFile:
         self.populateFileItem(parentItem, repopulate)
     else:
         BrowserModel.populateItem(self, parentItem, repopulate)
예제 #3
0
    def data(self, index, role):
        """
        Public method to get data of an item.
        
        @param index index of the data to retrieve (QModelIndex)
        @param role role of data (Qt.ItemDataRole)
        @return requested data
        """
        if not index.isValid():
            return None

        if role == Qt.TextColorRole:
            if index.column() == 0:
                try:
                    return index.internalPointer().getTextColor()
                except AttributeError:
                    return None
        elif role == Qt.BackgroundColorRole:
            try:
                col = self.itemBackgroundColors[
                    index.internalPointer().vcsState]
                if col.isValid():
                    return col
                else:
                    return None
            except AttributeError:
                return None
            except KeyError:
                return None

        return BrowserModel.data(self, index, role)
예제 #4
0
 def data(self, index, role):
     """
     Public method to get data of an item.
     
     @param index index of the data to retrieve (QModelIndex)
     @param role role of data (Qt.ItemDataRole)
     @return requested data
     """
     if not index.isValid():
         return None
     
     if role == Qt.TextColorRole:
         if index.column() == 0:
             try:
                 return index.internalPointer().getTextColor()
             except AttributeError:
                 return None
     elif role == Qt.BackgroundColorRole:
         try:
             col = self.itemBackgroundColors[
                 index.internalPointer().vcsState]
             if col.isValid():
                 return col
             else:
                 return None
         except AttributeError:
             return None
         except KeyError:
             return None
     
     return BrowserModel.data(self, index, role)