Colorize some buttons
Change-Id: I76c1bc22b5f0edb5064ce69428f94a2084aa9d7f
This commit is contained in:
parent
5657a6d340
commit
ac295192e0
@ -32,6 +32,9 @@ palette=[('reversed', 'default,standout', ''),
|
||||
('error', 'light red', 'dark blue'),
|
||||
('table-header', 'white,bold', ''),
|
||||
# Diff
|
||||
('filename', 'light cyan', ''),
|
||||
('context-button', 'dark magenta', ''),
|
||||
('selected-context-button', 'light magenta', ''),
|
||||
('removed-line', 'dark red', ''),
|
||||
('removed-word', 'light red', ''),
|
||||
('added-line', 'dark green', ''),
|
||||
@ -58,6 +61,8 @@ palette=[('reversed', 'default,standout', ''),
|
||||
('reversed-revision-drafts', 'dark red,standout', ''),
|
||||
('change-message-name', 'light blue', ''),
|
||||
('change-message-header', 'dark blue', ''),
|
||||
('revision-button', 'dark magenta', ''),
|
||||
('selected-revision-button', 'light magenta', ''),
|
||||
# project list
|
||||
('unreviewed-project', 'white', ''),
|
||||
('subscribed-project', 'default', ''),
|
||||
|
@ -122,7 +122,7 @@ class ReviewDialog(urwid.WidgetWrap):
|
||||
|
||||
class ReviewButton(mywid.FixedButton):
|
||||
def __init__(self, revision_row):
|
||||
super(ReviewButton, self).__init__(u'Review')
|
||||
super(ReviewButton, self).__init__(('revision-button', u'Review'))
|
||||
self.revision_row = revision_row
|
||||
self.change_view = revision_row.change_view
|
||||
urwid.connect_signal(self, 'click',
|
||||
@ -190,11 +190,17 @@ class RevisionRow(urwid.WidgetWrap):
|
||||
(10, urwid.Text('+%s, -%s' % (total_added, total_removed))),
|
||||
]))
|
||||
table = urwid.Pile(rows)
|
||||
buttons = urwid.Columns([('pack', ReviewButton(self)),
|
||||
('pack', mywid.FixedButton("Diff", on_press=self.diff)),
|
||||
('pack', mywid.FixedButton("Checkout", on_press=self.checkout)),
|
||||
urwid.Text(''),
|
||||
], dividechars=2)
|
||||
|
||||
|
||||
focus_map={'revision-button':'selected-revision-button'}
|
||||
buttons = [ReviewButton(self),
|
||||
mywid.FixedButton(('revision-button', "Diff"),
|
||||
on_press=self.diff),
|
||||
mywid.FixedButton(('revision-button', "Checkout"),
|
||||
on_press=self.checkout)]
|
||||
buttons = [('pack', urwid.AttrMap(b, None, focus_map=focus_map)) for b in buttons]
|
||||
buttons = urwid.Columns(buttons + [urwid.Text('')], dividechars=2)
|
||||
buttons = urwid.AttrMap(buttons, 'revision-button')
|
||||
self.more = urwid.Pile([table, buttons])
|
||||
self.pile = urwid.Pile([self.title])
|
||||
self._w = urwid.AttrMap(self.pile, None, focus_map=self.revision_focus_map)
|
||||
|
@ -108,14 +108,18 @@ class DiffContextButton(urwid.WidgetWrap):
|
||||
return True
|
||||
|
||||
def __init__(self, view, diff, chunk):
|
||||
buttons = urwid.Columns([
|
||||
urwid.Text(''),
|
||||
('pack', mywid.FixedButton("Expand previous 10", on_press=self.prev)),
|
||||
('pack', mywid.FixedButton("Expand %s lines of context" % len(chunk.lines),
|
||||
on_press=self.all)),
|
||||
('pack', mywid.FixedButton("Expand next 10", on_press=self.next)),
|
||||
urwid.Text(''),
|
||||
], dividechars=4)
|
||||
focus_map={'context-button':'selected-context-button'}
|
||||
buttons = [mywid.FixedButton(('context-button', "Expand previous 10"),
|
||||
on_press=self.prev),
|
||||
mywid.FixedButton(('context-button',
|
||||
"Expand %s lines of context" % len(chunk.lines)),
|
||||
on_press=self.all),
|
||||
mywid.FixedButton(('context-button', "Expand next 10"),
|
||||
on_press=self.next)]
|
||||
buttons = [('pack', urwid.AttrMap(b, None, focus_map=focus_map)) for b in buttons]
|
||||
buttons = urwid.Columns([urwid.Text('')] + buttons + [urwid.Text('')],
|
||||
dividechars=4)
|
||||
buttons = urwid.AttrMap(buttons, 'context-button')
|
||||
super(DiffContextButton, self).__init__(buttons)
|
||||
self.view = view
|
||||
self.diff = diff
|
||||
@ -183,8 +187,8 @@ This Screen
|
||||
self.file_diffs[gitrepo.OLD][diff.oldname] = diff
|
||||
self.file_diffs[gitrepo.NEW][diff.newname] = diff
|
||||
lines.append(urwid.Columns([
|
||||
urwid.Text(diff.oldname),
|
||||
urwid.Text(diff.newname)]))
|
||||
urwid.Text(('filename', diff.oldname)),
|
||||
urwid.Text(('filename', diff.newname))]))
|
||||
for chunk in diff.chunks:
|
||||
if chunk.context:
|
||||
if not chunk.first:
|
||||
|
Loading…
x
Reference in New Issue
Block a user