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)
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)
def createActionItem( self, key ): """ Creates a new action item for the inputed key. :param key | <str> :return <QTreeWidgetItem> """ action = self._actions.get(key) if ( not action ): text = 'Missing Action: %s' % key item = QTreeWidgetItem([text]) ico = projexui.resources.find('img/log/warning.png') item.setIcon(0, QIcon(ico)) else: item = QTreeWidgetItem([nativestring(action.text()).replace('&', '')]) item.setIcon(0, action.icon()) item.setSizeHint(0, QSize(120, 20)) item.setData(0, Qt.UserRole, wrapVariant(key)) flags = item.flags() flags ^= Qt.ItemIsDropEnabled item.setFlags(flags) return item
def createActionItem(self, key): """ Creates a new action item for the inputed key. :param key | <str> :return <QTreeWidgetItem> """ action = self._actions.get(key) if (not action): text = 'Missing Action: %s' % key item = QTreeWidgetItem([text]) ico = projexui.resources.find('img/log/warning.png') item.setIcon(0, QIcon(ico)) else: item = QTreeWidgetItem( [nativestring(action.text()).replace('&', '')]) item.setIcon(0, action.icon()) item.setSizeHint(0, QSize(120, 20)) item.setData(0, Qt.UserRole, wrapVariant(key)) flags = item.flags() flags ^= Qt.ItemIsDropEnabled item.setFlags(flags) return item
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
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