def update_info(pkgv: PackageView, pkgs_info: dict): pkgs_info['available_types'][pkgv.model.get_type()] = { 'icon': pkgv.model.get_type_icon_path(), 'label': pkgv.get_type_label() } if pkgv.model.is_application(): pkgs_info['apps_count'] += 1 else: pkgs_info['napps_count'] += 1 if pkgv.model.update and not pkgv.model.is_update_ignored(): if pkgv.model.is_application(): pkgs_info['app_updates'] += 1 else: pkgs_info['napp_updates'] += 1 pkgs_info['updates'] += 1 if pkgv.model.categories: for c in pkgv.model.categories: if c: cat = c.lower().strip() if cat: pkgs_info['categories'].add(cat) pkgs_info['pkgs'].append(pkgv) pkgs_info['not_installed'] += 1 if not pkgv.model.installed else 0
def _set_col_type(self, col: int, pkg: PackageView): icon_data = self.cache_type_icon.get(pkg.model.get_type()) if icon_data is None: pixmap = QIcon(pkg.model.get_type_icon_path()).pixmap(QSize(16, 16)) icon_data = {'px': pixmap, 'tip': '{}: {}'.format(self.i18n['type'], pkg.get_type_label())} self.cache_type_icon[pkg.model.get_type()] = icon_data item = QLabel() item.setPixmap(icon_data['px']) item.setAlignment(Qt.AlignCenter) item.setToolTip(icon_data['tip']) self.setCellWidget(pkg.table_index, col, item)
def _set_col_type(self, col: int, pkg: PackageView): icon_data = self.cache_type_icon.get(pkg.model.get_type()) if icon_data is None: pixmap = QIcon(pkg.model.get_type_icon_path()).pixmap(self.icon_size()) icon_data = {'px': pixmap, 'tip': '{}: {}'.format(self.i18n['type'], pkg.get_type_label())} self.cache_type_icon[pkg.model.get_type()] = icon_data col_type_icon = QLabel() col_type_icon.setCursor(QCursor(Qt.WhatsThisCursor)) col_type_icon.setObjectName('app_type') col_type_icon.setProperty('icon', 'true') col_type_icon.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Preferred) col_type_icon.setPixmap(icon_data['px']) col_type_icon.setToolTip(icon_data['tip']) self.setCellWidget(pkg.table_index, col, col_type_icon)