[table] displaying a 'verified' green icon next to a verified publisher's name

This commit is contained in:
Vinicius Moreira
2019-10-29 14:57:47 -03:00
parent ec514b99d9
commit 7c4095b1fb
7 changed files with 95 additions and 8 deletions

View File

@@ -16,6 +16,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Snap - Snap
- The application crashes due to Snap API checking when snap is not installed - 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 ## [0.7.1] 2019-10-25
### Features ### Features
- Snap: - Snap:

View File

@@ -56,6 +56,9 @@ class SnapApplication(SoftwarePackage):
def get_disk_cache_path(self): def get_disk_cache_path(self):
return super(SnapApplication, self).get_disk_cache_path() + '/installed/' + self.name 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): def get_data_to_cache(self):
return { return {
"icon_url": self.icon_url, "icon_url": self.icon_url,

View File

@@ -76,6 +76,7 @@ class AppsTable(QTableWidget):
self.setHorizontalHeaderLabels(['' for _ in range(self.columnCount())]) self.setHorizontalHeaderLabels(['' for _ in range(self.columnCount())])
self.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) self.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
self.icon_logo = QIcon(resource.get_path('img/logo.svg')) 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 = QNetworkAccessManager()
self.network_man.finished.connect(self._load_icon_and_cache) self.network_man.finished.connect(self._load_icon_and_cache)
@@ -372,7 +373,9 @@ class AppsTable(QTableWidget):
self.setItem(pkg.table_index, col, item) self.setItem(pkg.table_index, col, item)
def _set_col_publisher(self, col: int, pkg: PackageView): 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() publisher = pkg.model.get_publisher()
full_publisher = None full_publisher = None
@@ -384,22 +387,35 @@ class AppsTable(QTableWidget):
if len(publisher) > PUBLISHER_MAX_SIZE: if len(publisher) > PUBLISHER_MAX_SIZE:
publisher = full_publisher[0: PUBLISHER_MAX_SIZE - 3] + '...' 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 publisher:
if not pkg.model.installed: if not pkg.model.installed:
item.setStyleSheet('QLabel { color: red; }') item.setStyleSheet('QLabel { color: red; }')
publisher = self.i18n['unknown'] 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: 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) 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): def _set_col_settings(self, col: int, pkg: PackageView):
item = QToolBar() item = QToolBar()

View File

@@ -0,0 +1,62 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.1"
viewBox="0 0 12.000003 12"
enable-background="new 0 0 26 26"
id="svg817"
sodipodi:docname="verified.svg"
width="12.000003"
height="12"
inkscape:version="0.92.4 5da689c313, 2019-01-14">
<metadata
id="metadata823">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs821" />
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1920"
inkscape:window-height="1019"
id="namedview819"
showgrid="false"
showborder="false"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0"
inkscape:zoom="1.1923077"
inkscape:cx="-358.68351"
inkscape:cy="156.16568"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="svg817" />
<path
d="M 0.1384616,6.6 C 0.04615387,6.48 0,6.3 0,6.18 0,6.06 0.04615387,5.88 0.1384616,5.76 L 0.78461571,4.92 C 0.96923117,4.68 1.2461543,4.68 1.4307698,4.92 l 0.046153,0.06 2.5384625,3.54 c 0.092308,0.12 0.2307694,0.12 0.3230771,0 L 10.523082,0.18 h 0.04615 v 0 c 0.184616,-0.24 0.46154,-0.24 0.646154,0 l 0.646155,0.84 c 0.184616,0.24 0.184616,0.6 0,0.84 v 0 L 4.4769248,11.82 C 4.3846172,11.94 4.2923094,12 4.153848,12 4.0153861,12 3.9230786,11.94 3.8307707,11.82 L 0.23076932,6.78 Z"
id="path815"
inkscape:connector-curvature="0"
style="fill:#00aa00;stroke-width:0.52623492" />
</svg>

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@@ -148,3 +148,4 @@ screenshots.download.no_response=Image not found
continue=continue continue=continue
stable=stable stable=stable
close=close close=close
publisher.verified=verified publisher

View File

@@ -192,3 +192,4 @@ screenshots.download.no_response=No se encontró la imagen
continue=continuar continue=continuar
stable=estable stable=estable
close=cerrar close=cerrar
publisher.verified=publicador verificado

View File

@@ -195,3 +195,4 @@ screenshots.download.no_response=Imagem não encontrada
continue=continuar continue=continuar
stable=estável stable=estável
close=fechar close=fechar
publisher.verified=publicador verificado