display verified status on snap list and snap info screen

This commit is contained in:
Michael Hudson-Doyle 2019-01-31 21:48:34 +13:00
parent 2587b6dd02
commit 7982a35433
3 changed files with 20 additions and 5 deletions

View File

@ -26,6 +26,7 @@ class SnapInfo:
name = attr.ib()
summary = attr.ib()
publisher = attr.ib()
verified = attr.ib()
description = attr.ib()
confinement = attr.ib()
channels = attr.ib(default=attr.Factory(list))
@ -63,6 +64,7 @@ class SnapListModel:
name=s['name'],
summary=s['summary'],
publisher=s['developer'],
verified=s['publisher']['validation'] == "verified",
description=s['description'],
confinement=s['confinement'],
)

View File

@ -61,6 +61,9 @@ STYLES = [
('progress_complete', 'fg', 'neutral'),
('scrollbar', 'brand', 'bg'),
('scrollbar focus', 'gray', 'bg'),
('verified', 'good', 'bg'),
('verified focus', 'good', 'gray'),
]

View File

@ -19,6 +19,7 @@ import os
import yaml
from urwid import (
AttrMap,
CheckBox,
LineBox,
ListBox as UrwidListBox,
@ -106,11 +107,13 @@ class SnapInfoView(WidgetWrap):
self.lb_channels = NoTabCyclingTableListBox(self.channels)
publisher = _("Publisher: {}").format(snap.publisher)
if snap.verified:
publisher = [publisher, ('verified', '\N{check mark}')]
title = Columns([
Text(snap.name),
('pack', Text(
_("Publisher: {}").format(snap.publisher),
align='right')),
('pack', Text(publisher, align='right')),
], dividechars=1)
contents = [
@ -378,12 +381,19 @@ class SnapListView(BaseView):
log.debug("not offering preseeded snap %r", snap.name)
continue
box = self.snap_boxes[snap.name] = SnapCheckBox(self, snap)
publisher = snap.publisher
if snap.verified:
publisher = [publisher, ('verified', '\N{check mark}')]
row = [
box,
Text(snap.publisher),
Text(publisher),
Text(snap.summary, wrap='clip'),
]
body.append(Color.menu_button(TableRow(row)))
body.append(AttrMap(
TableRow(row),
'menu_button',
{None: 'menu_button focus', 'verified': 'verified focus'},
))
table = NoTabCyclingTableListBox(
body,
colspecs={