def addCategory(self, title): item = QListWidgetItem(title) item.setBackground(QBrush(QColor(S.highlightLight))) item.setForeground(QBrush(QColor(S.highlightedTextDark))) item.setFlags(Qt.ItemIsEnabled) f = item.font() f.setBold(True) item.setFont(f) self.list.addItem(item)
def addCategory(self, title): item = QListWidgetItem(title) item.setBackground(QBrush(lightBlue())) item.setForeground(QBrush(Qt.darkBlue)) item.setFlags(Qt.ItemIsEnabled) f = item.font() f.setBold(True) item.setFont(f) self.list.addItem(item)
def _list_fill(self): self.list.clear() for i in range(len(self.main.list)): item = QListWidgetItem(self.main.get_timer_text(i), self.list) if self.main.list[i][3]: font = item.font() font.setBold(True) item.setFont(font) self.list.addItem(item)
def _decorateLoggerItem(self, item: QListWidgetItem, logger: logging.Logger) -> None: """Decorate an entry in the logger list reflecting the properties of the logger. """ item.setForeground(self._colorForLogLevel(logger.getEffectiveLevel())) font = item.font() font.setBold(bool(logger.level)) item.setFont(font) item.setBackground(Qt.lightGray if logger.disabled else Qt.white)
def refresh(self): """ Public slot to refresh the list of queues. """ self.queuesList.clear() queuesList, activeQueue = self.__getQueuesList() for queue in sorted(queuesList): itm = QListWidgetItem(queue, self.queuesList) if queue == activeQueue: font = itm.font() font.setBold(True) itm.setFont(font)
def add_no_found(self): #Load no results found message noFoundItem = QListWidgetItem( QIcon(resources.IMAGES['delete']), 'No results were found!') font = noFoundItem.font() font.setBold(True) noFoundItem.setSizeHint(QSize(20, 30)) noFoundItem.setBackground(QBrush(Qt.lightGray)) noFoundItem.setForeground(QBrush(Qt.black)) noFoundItem.setFont(font) self.listWidget.addItem(noFoundItem)
def _list_fill(self): self.list.clear() for info in manager.info.values(): try: item = QListWidgetItem(self.list) item.setIcon(info.ICON) item.setText(info.NAME) item.setToolTip(info.DESCRIPTION) if manager.config.is_placed(info.NAME): font = item.font() font.setBold(True) item.setFont(font) self.list.addItem(item) except: print_stack_trace()()
def _list_fill(self): self.w_list.clear() for name in self.manager.custom_widgets: try: if name not in self.manager.info: continue info = self.manager.info[name] item = QListWidgetItem(self.w_list) item.setIcon(info.ICON) item.setText(info.NAME) item.setToolTip(info.DESCRIPTION) if self.manager.config.is_placed(info.NAME): font = item.font() font.setBold(True) item.setFont(font) self.w_list.addItem(item) except: print_stack_trace()()
def _list_fill(self, checked=False): self._pool_ping() self.list.clear() for addr in self.servers: item = QListWidgetItem(self.list) try: if addr not in self.list_buffer: item.setText(addr) continue text, favicon, tooltip = json.loads(self.list_buffer[addr]) favicon = base64.b64decode(favicon) item.setIcon(QIcon(QPixmap.fromImage( QImage.fromData(favicon)))) item.setText(text) font = item.font() font.setPixelSize(10) font.setBold(True) item.setFont(font) item.setToolTip(tooltip) except: item.setText(addr) print_stack_trace()()
def _makeItem(self, layer): isDefault = layer is self._layerSet.defaultLayer name = layer.name color = layer.color item = QListWidgetItem() item.setText(name) if color: pixmap = QPixmap(100, 100) # change color pixmap.fill(QColor.fromRgbF(*color)) icon = QIcon(pixmap) else: icon = QIcon(":/resources/defaultColor.svg") item.setIcon(icon) if isDefault: font = item.font() font.setBold(True) item.setFont(font) item.setFlags(item.flags() | Qt.ItemIsEditable) return item;
def __init__(self, guards, activeGuards=None, listOnly=False, parent=None): """ Constructor @param guards list of guards to select from (list of strings) @keyparam activeGuards list of active guards (list of strings) @param listOnly flag indicating to only list the guards (boolean) @param parent reference to the parent widget (QWidget) """ super(HgQueuesGuardsSelectionDialog, self).__init__(parent) self.setupUi(self) for guard in guards: itm = QListWidgetItem(guard, self.guardsList) if activeGuards is not None and guard in activeGuards: font = itm.font() font.setBold(True) itm.setFont(font) self.guardsList.sortItems() if listOnly: self.buttonBox.button(QDialogButtonBox.Cancel).hide() self.guardsList.setSelectionMode(QAbstractItemView.NoSelection) self.setWindowTitle(self.tr("Active Guards"))
def add_help(self): #Load help fileItem = QListWidgetItem( QIcon(resources.IMAGES['locate-file']), '@\t(Filter only by Files)') font = fileItem.font() font.setBold(True) fileItem.setSizeHint(QSize(20, 30)) fileItem.setBackground(QBrush(Qt.lightGray)) fileItem.setForeground(QBrush(Qt.black)) fileItem.setFont(font) self.listWidget.addItem(fileItem) classItem = QListWidgetItem( QIcon(resources.IMAGES['locate-class']), '<\t(Filter only by Classes)') self.listWidget.addItem(classItem) classItem.setSizeHint(QSize(20, 30)) classItem.setBackground(QBrush(Qt.lightGray)) classItem.setForeground(QBrush(Qt.black)) classItem.setFont(font) methodItem = QListWidgetItem( QIcon(resources.IMAGES['locate-function']), '>\t(Filter only by Methods)') self.listWidget.addItem(methodItem) methodItem.setSizeHint(QSize(20, 30)) methodItem.setBackground(QBrush(Qt.lightGray)) methodItem.setForeground(QBrush(Qt.black)) methodItem.setFont(font) attributeItem = QListWidgetItem( QIcon(resources.IMAGES['locate-attributes']), '-\t(Filter only by Attributes)') self.listWidget.addItem(attributeItem) attributeItem.setSizeHint(QSize(20, 30)) attributeItem.setBackground(QBrush(Qt.lightGray)) attributeItem.setForeground(QBrush(Qt.black)) attributeItem.setFont(font) thisFileItem = QListWidgetItem( QIcon(resources.IMAGES['locate-on-this-file']), '.\t(Filter only by Classes and Methods in this File)') font = thisFileItem.font() font.setBold(True) thisFileItem.setSizeHint(QSize(20, 30)) thisFileItem.setBackground(QBrush(Qt.lightGray)) thisFileItem.setForeground(QBrush(Qt.black)) thisFileItem.setFont(font) self.listWidget.addItem(thisFileItem) tabsItem = QListWidgetItem( QIcon(resources.IMAGES['locate-tab']), '/\t(Filter only by the current Tabs)') font = tabsItem.font() font.setBold(True) tabsItem.setSizeHint(QSize(20, 30)) tabsItem.setBackground(QBrush(Qt.lightGray)) tabsItem.setForeground(QBrush(Qt.black)) tabsItem.setFont(font) self.listWidget.addItem(tabsItem) lineItem = QListWidgetItem( QIcon(resources.IMAGES['locate-line']), ':\t(Go to Line)') font = lineItem.font() font.setBold(True) lineItem.setSizeHint(QSize(20, 30)) lineItem.setBackground(QBrush(Qt.lightGray)) lineItem.setForeground(QBrush(Qt.black)) lineItem.setFont(font) self.listWidget.addItem(lineItem) nonPythonItem = QListWidgetItem( QIcon(resources.IMAGES['locate-nonpython']), '!\t(Filter only by Non Python Files)') self.listWidget.addItem(nonPythonItem) nonPythonItem.setSizeHint(QSize(20, 30)) nonPythonItem.setBackground(QBrush(Qt.lightGray)) nonPythonItem.setForeground(QBrush(Qt.black)) nonPythonItem.setFont(font)