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

View File

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