diff --git a/CHANGELOG.md b/CHANGELOG.md index 2642cbb3..6194ee26 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### Fixes: - Snap - The application crashes due to Snap API checking when snap is not installed + +### UI: +- Displaying a **verified** green icon next to a verified publisher's name ## [0.7.1] 2019-10-25 ### Features diff --git a/bauh/gems/snap/model.py b/bauh/gems/snap/model.py index 6a48928d..0dd7441c 100644 --- a/bauh/gems/snap/model.py +++ b/bauh/gems/snap/model.py @@ -56,6 +56,9 @@ class SnapApplication(SoftwarePackage): def get_disk_cache_path(self): return super(SnapApplication, self).get_disk_cache_path() + '/installed/' + self.name + def is_trustable(self) -> bool: + return self.verified_publisher + def get_data_to_cache(self): return { "icon_url": self.icon_url, diff --git a/bauh/view/qt/apps_table.py b/bauh/view/qt/apps_table.py index c4c39a4a..7d354065 100644 --- a/bauh/view/qt/apps_table.py +++ b/bauh/view/qt/apps_table.py @@ -76,6 +76,7 @@ class AppsTable(QTableWidget): self.setHorizontalHeaderLabels(['' for _ in range(self.columnCount())]) self.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) self.icon_logo = QIcon(resource.get_path('img/logo.svg')) + self.pixmap_verified = QPixmap(resource.get_path('img/verified.svg')) self.network_man = QNetworkAccessManager() self.network_man.finished.connect(self._load_icon_and_cache) @@ -372,7 +373,9 @@ class AppsTable(QTableWidget): self.setItem(pkg.table_index, col, item) def _set_col_publisher(self, col: int, pkg: PackageView): - item = QLabel() + item = QWidget() + item.setLayout(QHBoxLayout()) + item.layout().setContentsMargins(1, 1, 1, 1) publisher = pkg.model.get_publisher() full_publisher = None @@ -384,22 +387,35 @@ class AppsTable(QTableWidget): if len(publisher) > PUBLISHER_MAX_SIZE: publisher = full_publisher[0: PUBLISHER_MAX_SIZE - 3] + '...' - if len(publisher) < PUBLISHER_MAX_SIZE: - publisher = publisher + ' ' * (PUBLISHER_MAX_SIZE - len(publisher)) - if not publisher: if not pkg.model.installed: item.setStyleSheet('QLabel { color: red; }') publisher = self.i18n['unknown'] - item.setText(' {} '.format(publisher)) + lb_name = QLabel(' {}'.format(publisher)) + lb_name.setStyleSheet('QLabel { margin-right: 0px}') + item.layout().addWidget(lb_name) if publisher and full_publisher: - item.setToolTip(self.i18n['publisher'].capitalize() + ((': ' + full_publisher) if full_publisher else '')) + lb_name.setToolTip(self.i18n['publisher'].capitalize() + ((': ' + full_publisher) if full_publisher else '')) + + if pkg.model.is_trustable(): + lb_verified = QLabel() + lb_verified.setPixmap(self.pixmap_verified) + lb_verified.setToolTip(self.i18n['publisher.verified'].capitalize()) + item.layout().addWidget(lb_verified) + else: + lb_name.setText(lb_name.text() + " ") self.setCellWidget(pkg.table_index, col, item) + def _set_col_verified(self, col: int, pkg: PackageView): + item = QTableWidgetItem() + + if pkg.model.is_trustable(): + item.setIcon() + def _set_col_settings(self, col: int, pkg: PackageView): item = QToolBar() diff --git a/bauh/view/resources/img/verified.svg b/bauh/view/resources/img/verified.svg new file mode 100644 index 00000000..4ad34e26 --- /dev/null +++ b/bauh/view/resources/img/verified.svg @@ -0,0 +1,62 @@ + + + + + + image/svg+xml + + + + + + + + + diff --git a/bauh/view/resources/locale/en b/bauh/view/resources/locale/en index fa38c609..0fde7161 100644 --- a/bauh/view/resources/locale/en +++ b/bauh/view/resources/locale/en @@ -147,4 +147,5 @@ screenshots.download.no_content=No content to display screenshots.download.no_response=Image not found continue=continue stable=stable -close=close \ No newline at end of file +close=close +publisher.verified=verified publisher \ No newline at end of file diff --git a/bauh/view/resources/locale/es b/bauh/view/resources/locale/es index 0b63510d..1c003847 100644 --- a/bauh/view/resources/locale/es +++ b/bauh/view/resources/locale/es @@ -192,3 +192,4 @@ screenshots.download.no_response=No se encontró la imagen continue=continuar stable=estable close=cerrar +publisher.verified=publicador verificado diff --git a/bauh/view/resources/locale/pt b/bauh/view/resources/locale/pt index 71399ae7..e15cb4b7 100644 --- a/bauh/view/resources/locale/pt +++ b/bauh/view/resources/locale/pt @@ -194,4 +194,5 @@ screenshots.download.no_content=Sem conteúdo para exibir screenshots.download.no_response=Imagem não encontrada continue=continuar stable=estável -close=fechar \ No newline at end of file +close=fechar +publisher.verified=publicador verificado \ No newline at end of file