def setup_widget(self, widget): super(StatisticsNode, self).setup_widget(widget) if self.get_depth() == 0: # Just expand the root node. widget.expand() return table = self.table if table is None: return on(widget, 'expanded', table._widget_expanded, widget) on(widget, 'collapsed', table._widget_collapsed, widget)
def __init__(self, viewer): self._expanded_stat_hashes = set() self.walker = StatisticsWalker(NullStatisticNode()) on(self.walker, "focus_changed", self._walker_focus_changed) tbody = StatisticsListBox(self.walker) thead = urwid.AttrMap( self.make_columns([urwid.Text(name, align, "clip") for name, align, __, __ in self.columns]), None ) header = urwid.Columns([]) widget = urwid.Frame(tbody, urwid.Pile([header, thead])) super(StatisticsTable, self).__init__(widget) self.viewer = viewer self.update_frame()
def __init__(self, viewer): self._expanded_stat_hashes = set() self.walker = StatisticsWalker(NullStatisticsNode()) on(self.walker, 'focus_changed', self._walker_focus_changed) tbody = StatisticsListBox(self.walker) thead = urwid.AttrMap(self.make_columns([ urwid.Text(name, align, 'clip') for name, align, __, __ in self.columns ]), None) header = urwid.Columns([]) widget = urwid.Frame(tbody, urwid.Pile([header, thead])) super(StatisticsTable, self).__init__(widget) self.viewer = viewer self.update_frame()