

def __init__(self, app, context, old, new, callback=None):
    super(SideDiffLine, self).__init__('', on_press=callback)
    self.context = context
    self.text_widgets = []
    columns = []
    for (ln, action, line) in (old, new):
        if (ln is None):
            ln = ''
        else:
            ln = ('%*i' % ((LN_COL_WIDTH - 1), ln))
        ln_col = urwid.Text(('line-number', ln))
        ln_col.set_wrap_mode('clip')
        line_col = mywid.SearchableText(line)
        self.text_widgets.append(line_col)
        if (action == ''):
            line_col = urwid.AttrMap(line_col, 'nonexistent')
        columns += [(LN_COL_WIDTH, ln_col), line_col]
    col = urwid.Columns(columns)
    map = {
        None: 'focused',
        'added-line': 'focused-added-line',
        'added-word': 'focused-added-word',
        'removed-line': 'focused-removed-line',
        'removed-word': 'focused-removed-word',
        'nonexistent': 'focused-nonexistent',
        'line-number': 'focused-line-number',
    }
    self._w = urwid.AttrMap(col, None, focus_map=map)

dataset/ETHPy150Open openstack/gertty/gertty/view/side_diff.py SideDiffLine.__init__/original