diff --git a/examples/snaps/v2-find-name=mosquitto.json b/examples/snaps/v2-find-name=mosquitto.json index e1ba3849..76d0f911 100644 --- a/examples/snaps/v2-find-name=mosquitto.json +++ b/examples/snaps/v2-find-name=mosquitto.json @@ -15,7 +15,7 @@ "id": "l5m6dy7O2H7mosoJSwmhRa2ZA0H6yGt1", "username": "ralight", "display-name": "Roger Light", - "validation": "unproven" + "validation": "starred" }, "developer": "ralight", "status": "available", diff --git a/examples/snaps/v2-find-name=prometheus.json b/examples/snaps/v2-find-name=prometheus.json index 2fbe1bd5..1bd07c70 100644 --- a/examples/snaps/v2-find-name=prometheus.json +++ b/examples/snaps/v2-find-name=prometheus.json @@ -14,7 +14,7 @@ "id": "IJ1Iesv3hhEPHuegj7b3zvPLOh8wZs34", "username": "jacek", "display-name": "Jacek Nykis", - "validation": "unproven" + "validation": "starred" }, "developer": "jacek", "status": "available", diff --git a/examples/snaps/v2-find-section=server.json b/examples/snaps/v2-find-section=server.json index e5f55c43..9bfea99d 100644 --- a/examples/snaps/v2-find-section=server.json +++ b/examples/snaps/v2-find-section=server.json @@ -1527,7 +1527,7 @@ "id": "l5m6dy7O2H7mosoJSwmhRa2ZA0H6yGt1", "username": "ralight", "display-name": "Roger Light", - "validation": "unproven" + "validation": "starred" }, "developer": "ralight", "status": "available", @@ -2213,7 +2213,7 @@ "id": "IJ1Iesv3hhEPHuegj7b3zvPLOh8wZs34", "username": "jacek", "display-name": "Jacek Nykis", - "validation": "unproven" + "validation": "starred" }, "developer": "jacek", "status": "available", diff --git a/subiquity/common/types.py b/subiquity/common/types.py index bafc7ed9..76c44aee 100644 --- a/subiquity/common/types.py +++ b/subiquity/common/types.py @@ -385,6 +385,7 @@ class SnapInfo: summary: str = '' publisher: str = '' verified: bool = False + starred: bool = False description: str = '' confinement: str = '' license: str = '' diff --git a/subiquity/models/snaplist.py b/subiquity/models/snaplist.py index 47ba1d7c..953b2feb 100644 --- a/subiquity/models/snaplist.py +++ b/subiquity/models/snaplist.py @@ -54,6 +54,7 @@ class SnapListModel: snap.summary = data['summary'] snap.publisher = data['developer'] snap.verified = data['publisher']['validation'] == "verified" + snap.starred = data['publisher']['validation'] == "starred" snap.description = data['description'] snap.confinement = data['confinement'] snap.license = data['license'] diff --git a/subiquity/ui/views/snaplist.py b/subiquity/ui/views/snaplist.py index 61c0ffda..8e249c72 100644 --- a/subiquity/ui/views/snaplist.py +++ b/subiquity/ui/views/snaplist.py @@ -182,7 +182,11 @@ class SnapInfoView(WidgetWrap): publisher = [('info_minor', _("by: ")), snap.publisher] if snap.verified: - publisher.append(('verified', ' \N{check mark}')) + # Check extend_dec_special_charmap for the meaning of the + # narrow non-breakable space here. + publisher.append(('verified', ' \N{check mark}\N{NNBSP}')) + elif snap.starred: + publisher.append(' \N{circled white star}') title = Columns([ Text(snap.name), @@ -433,9 +437,13 @@ class SnapListView(BaseView): continue box = self.snap_boxes[snap.name] = SnapCheckBox( self, snap, snap.name in self.selections_by_name) - publisher = snap.publisher + publisher = [snap.publisher] if snap.verified: - publisher = [publisher, ('verified', '\N{check mark}')] + # Check extend_dec_special_charmap for the meaning of the + # narrow non-breakable space here. + publisher.append(('verified', '\N{check mark}\N{NNBSP}')) + elif snap.starred: + publisher.append('\N{circled white star}') row = [ box, Text(publisher), diff --git a/subiquitycore/tui.py b/subiquitycore/tui.py index edd0d89a..ccc003e8 100644 --- a/subiquitycore/tui.py +++ b/subiquitycore/tui.py @@ -46,12 +46,18 @@ def extend_dec_special_charmap(): ord('\N{BLACK LEFT-POINTING SMALL TRIANGLE}'): '<', ord('\N{BLACK DOWN-POINTING SMALL TRIANGLE}'): 'v', ord('\N{BLACK UP-POINTING SMALL TRIANGLE}'): '^', - ord('\N{check mark}'): '+', + ord('\N{check mark}'): '*', + ord('\N{circled white star}'): '*', ord('\N{bullet}'): '*', ord('\N{lower half block}'): '=', ord('\N{upper half block}'): '=', ord('\N{FULL BLOCK}'): urwid.escape.DEC_SPECIAL_CHARMAP[ ord('\N{BOX DRAWINGS LIGHT VERTICAL}')], + # XXX: Hack to show the verified snap publishers with two stars when + # unicode is not supported. In rich mode, we display ✪ followed by a + # mostly invisible character (i.e., NNBSP). In basic mode, + # both characters get translated to a star, resulting in two stars. + ord('\N{NNBSP}'): '*', })