Make owner name in change screen a search

When you select the owner name in the change screen, perform a
search for all open changes owned by that user.

Change-Id: I77540bb478bebe0b56d3373b30c708e0d0b4ca59
This commit is contained in:
James E. Blair 2014-10-31 16:48:32 -07:00
parent 4aec66f5bb
commit c44f5f3bf5
2 changed files with 13 additions and 4 deletions

View File

@ -44,7 +44,8 @@ DEFAULT_PALETTE={
'line-number': ['dark gray', ''],
'focused-line-number': ['dark gray,standout', ''],
# Change view
'change-data': ['light cyan', ''],
'change-data': ['dark cyan', ''],
'focused-change-data': ['light cyan', ''],
'change-header': ['light blue', ''],
'revision-name': ['light blue', ''],
'revision-commit': ['dark blue', ''],
@ -86,6 +87,7 @@ LIGHT_PALETTE = {
'focused-subscribed-project': ['dark gray,standout', ''],
'focused-unsubscribed-project': ['dark gray,standout', ''],
'change-data': ['dark blue,bold', ''],
'focused-change-data': ['dark blue,standout', ''],
'reviewer-name': ['brown', ''],
'change-message-name': ['brown', ''],
'change-message-header': ['black', ''],

View File

@ -424,7 +424,7 @@ class ChangeView(urwid.WidgetWrap):
self.last_revision_key = None
self.hide_comments = True
self.change_id_label = urwid.Text(u'', wrap='clip')
self.owner_label = urwid.Text(u'', wrap='clip')
self.owner_label = mywid.TextButton(u'', on_press=self.searchOwner)
self.project_label = urwid.Text(u'', wrap='clip')
self.branch_label = urwid.Text(u'', wrap='clip')
self.topic_label = urwid.Text(u'', wrap='clip')
@ -432,8 +432,11 @@ class ChangeView(urwid.WidgetWrap):
self.updated_label = urwid.Text(u'', wrap='clip')
self.status_label = urwid.Text(u'', wrap='clip')
change_info = []
change_info_map={'change-data': 'focused-change-data'}
for l, v in [("Change-Id", self.change_id_label),
("Owner", self.owner_label),
("Owner", urwid.Padding(urwid.AttrMap(self.owner_label, None,
focus_map=change_info_map),
width='pack')),
("Project", self.project_label),
("Branch", self.branch_label),
("Topic", self.topic_label),
@ -525,9 +528,10 @@ class ChangeView(urwid.WidgetWrap):
self.app.status.update(title=self.title)
self.project_key = change.project.key
self.change_rest_id = change.id
self.owner_email = change.owner.email
self.change_id_label.set_text(('change-data', change.change_id))
self.owner_label.set_text(('change-data', change.owner_name))
self.owner_label.text.set_text(('change-data', change.owner_name))
self.project_label.set_text(('change-data', change.project.name))
self.branch_label.set_text(('change-data', change.branch))
self.topic_label.set_text(('change-data', self.topic))
@ -959,6 +963,9 @@ class ChangeView(urwid.WidgetWrap):
self.app.backScreen()
self.refresh()
def searchOwner(self, widget):
self.app.doSearch("status:open owner:%s" % (self.owner_email,))
def reviewKey(self, reviewkey):
approvals = {}
for a in reviewkey['approvals']: