# HG changeset patch # User Björn Ricks # Date 1365185807 -7200 # Node ID 1b29cc99f45744ab898e5816df0206675da4ffe1 # Parent f8571308abefc6343986e88abba6849e499458bc Use ListWidget for EntryList and ProjectList diff -r f8571308abef -r 1b29cc99f457 getan/view.py --- a/getan/view.py Fri Apr 05 20:16:06 2013 +0200 +++ b/getan/view.py Fri Apr 05 20:16:47 2013 +0200 @@ -139,6 +139,8 @@ 3: "tree", } + node_class = ProjectNode + def __init__(self, controller, rows): self.selection = [] self.size = () @@ -167,7 +169,6 @@ self.rows = self.create_project_tree() else: self.rows = self.create_project_list() - self.listbox = urwid.ListBox(urwid.SimpleListWalker(self.rows)) def create_project_list(self): return [ProjectNode(x) for x in sorted(self.raw_rows, @@ -247,29 +248,13 @@ class EntryList(ListWidget): + node_class = EntryNode + def __init__(self, rows): - self.selection = [] - self.top = 0 - self.size = () - self.focused = 0 - self.rows = [EntryNode(x) for x in rows] - listbox = urwid.ListBox(urwid.SimpleListWalker(self.rows)) - self.body = urwid.LineBox(urwid.Padding(urwid.AttrWrap( - listbox, 'entry_body'), - ('fixed left', 1), ('fixed right', 1))) - self.header = urwid.LineBox(urwid.AttrWrap(urwid.Text( - "\n%s\n" - % _('Last entries')),'entry_header')) - self.footer = urwid.AttrWrap(urwid.Text(""), 'entry_footer') - self.frame = urwid.Frame(self.body, header=self.header, - footer=self.footer) + logger.debug("Init EntryList %s" % id(self)) + super(EntryList, self).__init__("Entries", rows) + self.set_footer_text("", "entry_footer") - def set_rows(self, rows): - if rows: - self.rows = [EntryNode(x) for x in rows] - else: - self.rows = [] - self._update_view() class GetanView(urwid.WidgetWrap):