Merge pull request #1292 from ogayot/FR-2153
Add visual indication for starred snap developers
This commit is contained in:
commit
73250b0c95
|
@ -15,7 +15,7 @@
|
|||
"id": "l5m6dy7O2H7mosoJSwmhRa2ZA0H6yGt1",
|
||||
"username": "ralight",
|
||||
"display-name": "Roger Light",
|
||||
"validation": "unproven"
|
||||
"validation": "starred"
|
||||
},
|
||||
"developer": "ralight",
|
||||
"status": "available",
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
"id": "IJ1Iesv3hhEPHuegj7b3zvPLOh8wZs34",
|
||||
"username": "jacek",
|
||||
"display-name": "Jacek Nykis",
|
||||
"validation": "unproven"
|
||||
"validation": "starred"
|
||||
},
|
||||
"developer": "jacek",
|
||||
"status": "available",
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -12,7 +12,7 @@ FONT_DESCENT 2
|
|||
AVERAGE_WIDTH 80
|
||||
_GBDFED_INFO "Edited with gbdfed 1.6."
|
||||
ENDPROPERTIES
|
||||
CHARS 1
|
||||
CHARS 2
|
||||
STARTCHAR U+2713
|
||||
ENCODING 10003
|
||||
SWIDTH 480 0
|
||||
|
@ -29,4 +29,21 @@ CC
|
|||
30
|
||||
20
|
||||
ENDCHAR
|
||||
STARTCHAR U+272A
|
||||
ENCODING 10026
|
||||
SWIDTH 540 0
|
||||
DWIDTH 9 0
|
||||
BBX 8 10 1 0
|
||||
BITMAP
|
||||
FE
|
||||
EF
|
||||
EF
|
||||
C7
|
||||
00
|
||||
11
|
||||
83
|
||||
93
|
||||
39
|
||||
FE
|
||||
ENDCHAR
|
||||
ENDFONT
|
||||
|
|
Binary file not shown.
|
@ -7,3 +7,6 @@ U+2584
|
|||
U+2588
|
||||
# U+2588: FULL BLOCK
|
||||
U+258c
|
||||
# U+258C: LEFT HALF BLOCK
|
||||
U+272A
|
||||
# U+272A: CIRCLED WHITE STAR
|
||||
|
|
|
@ -385,6 +385,7 @@ class SnapInfo:
|
|||
summary: str = ''
|
||||
publisher: str = ''
|
||||
verified: bool = False
|
||||
starred: bool = False
|
||||
description: str = ''
|
||||
confinement: str = ''
|
||||
license: str = ''
|
||||
|
|
|
@ -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']
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
import asyncio
|
||||
import datetime
|
||||
import logging
|
||||
from typing import Tuple
|
||||
|
||||
import yaml
|
||||
|
||||
|
@ -104,6 +105,20 @@ def format_datetime(d):
|
|||
return _("{amount:2} {unit} ago").format(amount=amount, unit=unit)
|
||||
|
||||
|
||||
def check_mark() -> Tuple[Tuple[str, str], ...]:
|
||||
""" Return a tuple that can be passed to a urwid.Text() """
|
||||
|
||||
# We want a single check-mark "✓" in rich-mode but a double star "**" in
|
||||
# basic mode. Because we have a 1:1 mapping between a given unicode
|
||||
# character and its ASCII substitute, we use two check-marks and make one
|
||||
# invisible in rich-mode. In basic mode, they both get substituted with a
|
||||
# star.
|
||||
return (
|
||||
('verified', '\N{check mark}'),
|
||||
('verified invisible', '\N{check mark}'),
|
||||
)
|
||||
|
||||
|
||||
class SnapInfoView(WidgetWrap):
|
||||
|
||||
# This is mostly like a Pile but it tries to be a bit smart about
|
||||
|
@ -182,7 +197,10 @@ class SnapInfoView(WidgetWrap):
|
|||
|
||||
publisher = [('info_minor', _("by: ")), snap.publisher]
|
||||
if snap.verified:
|
||||
publisher.append(('verified', ' \N{check mark}'))
|
||||
publisher.append(" ")
|
||||
publisher.extend(check_mark())
|
||||
elif snap.starred:
|
||||
publisher.append(('starred', ' \N{circled white star}'))
|
||||
|
||||
title = Columns([
|
||||
Text(snap.name),
|
||||
|
@ -433,9 +451,11 @@ 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}')]
|
||||
publisher.extend(check_mark())
|
||||
elif snap.starred:
|
||||
publisher.append(('starred', '\N{circled white star}'))
|
||||
row = [
|
||||
box,
|
||||
Text(publisher),
|
||||
|
@ -445,7 +465,12 @@ class SnapListView(BaseView):
|
|||
body.append(AttrMap(
|
||||
TableRow(row),
|
||||
'menu_button',
|
||||
{None: 'menu_button focus', 'verified': 'verified focus'},
|
||||
{
|
||||
None: 'menu_button focus',
|
||||
'verified': 'verified focus',
|
||||
'verified invisible': 'verified inv focus',
|
||||
'starred': 'starred focus',
|
||||
},
|
||||
))
|
||||
table = NoTabCyclingTableListBox(
|
||||
body,
|
||||
|
|
|
@ -65,8 +65,12 @@ PALETTE_COLOR = [
|
|||
('scrollbar focus', 'gray', 'bg'),
|
||||
|
||||
('verified', 'good', 'bg'),
|
||||
('verified header', 'good', 'orange'),
|
||||
('verified focus', 'good', 'gray'),
|
||||
('verified invisible', 'bg', 'bg'),
|
||||
('verified inv focus', 'gray', 'gray'),
|
||||
|
||||
('starred', 'orange', 'bg'),
|
||||
('starred focus', 'orange', 'gray'),
|
||||
]
|
||||
|
||||
PALETTE_MONO = [
|
||||
|
@ -98,6 +102,14 @@ PALETTE_MONO = [
|
|||
('progress_complete', 'black', 'white'),
|
||||
('scrollbar_fg', 'white', 'black'),
|
||||
('scrollbar_bg', 'white', 'black'),
|
||||
|
||||
('verified', 'white', 'black'),
|
||||
('verified focus', 'black', 'white'),
|
||||
('verified invisible', 'white', 'black'),
|
||||
('verified inv focus', 'black', 'white'),
|
||||
|
||||
('starred', 'white', 'black'),
|
||||
('starred focus', 'black', 'white'),
|
||||
]
|
||||
|
||||
urwid_8_names = (
|
||||
|
|
|
@ -46,7 +46,8 @@ 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}'): '=',
|
||||
|
|
Loading…
Reference in New Issue