Highlight own name on change screen

Highlight the user's name in the review box and messages so that
when revisiting a review, it is easy to see one's own vote or any
messages that the user has previously left, or in case the user
forgets their own name.

Change-Id: Idf08e98b3d287376b0e2c8a3f0a1c38b3c30f698
This commit is contained in:
James E. Blair 2015-04-07 09:13:05 -07:00
parent cdd6bd2399
commit a4133c2560
2 changed files with 20 additions and 4 deletions

View File

@ -60,13 +60,16 @@ DEFAULT_PALETTE={
'focused-revision-comments': ['default,standout', ''],
'focused-revision-drafts': ['dark red,standout', ''],
'change-message-name': ['yellow', ''],
'change-message-own-name': ['light cyan', ''],
'change-message-header': ['brown', ''],
'change-message-own-header': ['dark cyan', ''],
'change-message-draft': ['dark red', ''],
'revision-button': ['dark magenta', ''],
'focused-revision-button': ['light magenta', ''],
'lines-added': ['light green', ''],
'lines-removed': ['light red', ''],
'reviewer-name': ['yellow', ''],
'reviewer-own-name': ['light cyan', ''],
# project list
'unreviewed-project': ['white', ''],
'subscribed-project': ['default', ''],
@ -97,8 +100,11 @@ LIGHT_PALETTE = {
'change-data': ['dark blue,bold', ''],
'focused-change-data': ['dark blue,standout', ''],
'reviewer-name': ['brown', ''],
'reviewer-own-name': ['dark blue,bold', ''],
'change-message-name': ['brown', ''],
'change-message-own-name': ['dark blue,bold', ''],
'change-message-header': ['black', ''],
'change-message-own-header': ['black,bold', ''],
'focused-link': ['dark blue,bold', ''],
'filename': ['dark cyan', ''],
}

View File

@ -347,9 +347,15 @@ class ChangeMessageBox(mywid.HyperText):
if message.draft:
lines.insert(0, '')
lines.insert(0, 'Patch Set %s:' % (message.revision.number,))
text = [('change-message-name', message.author_name),
('change-message-header', ': '+lines.pop(0)),
('change-message-header',
if message.author.username == self.app.config.username:
name_style = 'change-message-own-name'
header_style = 'change-message-own-header'
else:
name_style = 'change-message-name'
header_style = 'change-message-header'
text = [(name_style, message.author_name),
(header_style, ': '+lines.pop(0)),
(header_style,
created.strftime(' (%Y-%m-%d %H:%M:%S%z)'))]
if message.draft and not message.pending:
text.append(('change-message-draft', ' (draft)'))
@ -588,7 +594,11 @@ class ChangeView(urwid.WidgetWrap):
if not approvals:
approvals = {}
row = []
row.append(urwid.Text(('reviewer-name', approval.reviewer.name)))
if approval.reviewer.username == self.app.config.username:
style = 'reviewer-own-name'
else:
style = 'reviewer-name'
row.append(urwid.Text((style, approval.reviewer.name)))
for i, category in enumerate(categories):
w = urwid.Text(u'', align=urwid.CENTER)
approvals[category] = w