Add colors and adjust alignment to revision file table
Change-Id: I986bb04b31f1b7370bb561d520bfb39900409642
This commit is contained in:
parent
62dd4d9a07
commit
9de2c568df
@ -31,8 +31,8 @@ palette=[('focused', 'default,standout', ''),
|
||||
('header', 'white,bold', 'dark blue'),
|
||||
('error', 'light red', 'dark blue'),
|
||||
('table-header', 'white,bold', ''),
|
||||
# Diff
|
||||
('filename', 'light cyan', ''),
|
||||
# Diff
|
||||
('context-button', 'dark magenta', ''),
|
||||
('focused-context-button', 'light magenta', ''),
|
||||
('removed-line', 'dark red', ''),
|
||||
@ -63,6 +63,8 @@ palette=[('focused', 'default,standout', ''),
|
||||
('change-message-header', 'dark blue', ''),
|
||||
('revision-button', 'dark magenta', ''),
|
||||
('focused-revision-button', 'light magenta', ''),
|
||||
('lines-added', 'light green', ''),
|
||||
('lines-removed', 'light red', ''),
|
||||
# project list
|
||||
('unreviewed-project', 'white', ''),
|
||||
('subscribed-project', 'default', ''),
|
||||
|
@ -44,9 +44,13 @@ class TableColumn(urwid.Pile):
|
||||
return (mx+2, len(self.contents))
|
||||
|
||||
class Table(urwid.WidgetWrap):
|
||||
def __init__(self, headers=[]):
|
||||
def __init__(self, headers=[], columns=None):
|
||||
if columns is None:
|
||||
cols = [('pack', TableColumn([('pack', w)])) for w in headers]
|
||||
else:
|
||||
cols = [('pack', TableColumn([])) for x in range(columns)]
|
||||
super(Table, self).__init__(
|
||||
urwid.Columns([('pack', TableColumn([('pack', w)])) for w in headers]))
|
||||
urwid.Columns(cols))
|
||||
|
||||
def addRow(self, cells=[]):
|
||||
for i, widget in enumerate(cells):
|
||||
|
@ -163,7 +163,7 @@ class RevisionRow(urwid.WidgetWrap):
|
||||
self.commit_sha = revision.commit
|
||||
self.title = mywid.TextButton(u'', on_press = self.expandContract)
|
||||
stats = repo.diffstat(revision.parent, revision.commit)
|
||||
rows = []
|
||||
table = mywid.Table(columns=3)
|
||||
total_added = 0
|
||||
total_removed = 0
|
||||
for added, removed, filename in stats:
|
||||
@ -177,13 +177,15 @@ class RevisionRow(urwid.WidgetWrap):
|
||||
removed = 0
|
||||
total_added += added
|
||||
total_removed += removed
|
||||
rows.append(urwid.Columns([urwid.Text(filename),
|
||||
(10, urwid.Text('+%s, -%s' % (added, removed))),
|
||||
]))
|
||||
rows.append(urwid.Columns([urwid.Text(''),
|
||||
(10, urwid.Text('+%s, -%s' % (total_added, total_removed))),
|
||||
]))
|
||||
table = urwid.Pile(rows)
|
||||
table.addRow([urwid.Text(('filename', filename)),
|
||||
urwid.Text([('lines-added', '+%i' % (added,)), ', '],
|
||||
align=urwid.RIGHT),
|
||||
urwid.Text(('lines-removed', '-%i' % (removed,)))])
|
||||
table.addRow([urwid.Text(''),
|
||||
urwid.Text([('lines-added', '+%i' % (total_added,)), ', '],
|
||||
align=urwid.RIGHT),
|
||||
urwid.Text(('lines-removed', '-%i' % (total_removed,)))])
|
||||
table = urwid.Padding(table, width='pack')
|
||||
|
||||
focus_map={'revision-button': 'focused-revision-button'}
|
||||
self.review_button = ReviewButton(self)
|
||||
|
Loading…
x
Reference in New Issue
Block a user