예제 #1
0
 def _loadCardGroup( self, groupName, records, parent = None ):
     if ( not groupName ):
         groupName = 'None'
     
     cards  = self.cardWidget()
     factory = self.factory()
     
     # create the group item
     group_item = QTreeWidgetItem(parent, [groupName])
     font = group_item.font(0)
     font.setBold(True)
     font.setPointSize(font.pointSize() + 2)
     group_item.setFont(0, font)
     group_item.setFlags(Qt.ItemIsEnabled)
     
     # load sub-groups
     if ( type(records) == dict ):
         for subgroup, records in sorted(records.items()):
             self._loadCardGroup(subgroup, records, group_item)
     else:
         for record in records:
             widget = factory.createCard(cards, record)
             if ( not widget ):
                 continue
             
             widget.adjustSize()
             
             # create the card item
             item = QTreeWidgetItem(group_item)
             item.setSizeHint(0, QSize(0, widget.height()))
             cards.setItemWidget(item, 0, widget)
     
     group_item.setExpanded(True)
예제 #2
0
    def _loadCardGroup(self, groupName, records, parent=None):
        if not groupName:
            groupName = "None"

        cards = self.cardWidget()
        factory = self.factory()

        # create the group item
        group_item = QTreeWidgetItem(parent, [groupName])
        font = group_item.font(0)
        font.setBold(True)
        font.setPointSize(font.pointSize() + 2)
        group_item.setFont(0, font)
        group_item.setFlags(Qt.ItemIsEnabled)

        # load sub-groups
        if type(records) == dict:
            for subgroup, records in sorted(records.items()):
                self._loadCardGroup(subgroup, records, group_item)
        else:
            for record in records:
                widget = factory.createCard(cards, record)
                if not widget:
                    continue

                widget.adjustSize()

                # create the card item
                item = QTreeWidgetItem(group_item)
                item.setSizeHint(0, QSize(0, widget.height()))
                cards.setItemWidget(item, 0, widget)

        group_item.setExpanded(True)
예제 #3
0
 def createSeparatorItem( self ):
     """
     Creates a new separator item.
     
     :return     <QTreeWidgetItem>
     """
     item = QTreeWidgetItem(['                                    '])
     font = item.font(0)
     font.setStrikeOut(True)
     item.setFont(0, font)
     item.setData(0, Qt.UserRole, wrapVariant('separator'))
     flags = item.flags()
     flags ^= Qt.ItemIsDropEnabled
     item.setFlags(flags)
     
     return item
예제 #4
0
    def createSeparatorItem(self):
        """
        Creates a new separator item.
        
        :return     <QTreeWidgetItem>
        """
        item = QTreeWidgetItem(['                                    '])
        font = item.font(0)
        font.setStrikeOut(True)
        item.setFont(0, font)
        item.setData(0, Qt.UserRole, wrapVariant('separator'))
        flags = item.flags()
        flags ^= Qt.ItemIsDropEnabled
        item.setFlags(flags)

        return item