changeset 220:54e8b355164c

Refactor ProjecList node initialisation
author Björn Ricks <bjoern.ricks@intevation.de>
date Fri, 05 Apr 2013 20:06:54 +0200
parents 71638dcc5a0f
children c3df6d26fce6
files getan/view.py
diffstat 1 files changed, 16 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/getan/view.py	Fri Apr 05 20:03:37 2013 +0200
+++ b/getan/view.py	Fri Apr 05 20:06:54 2013 +0200
@@ -200,29 +200,29 @@
     }
 
     def __init__(self, controller, rows):
-        self.selection    = []
-        self.focused      = 0
-        self.size         = ()
-        self.top          = 0
-        self.controller   = controller
+        self.selection = []
+        self.size = ()
+        self.top = 0
+        self.controller = controller
         self.project_mode = 0
-
-        self.load_rows(rows)
-        self.header    = urwid.LineBox(urwid.AttrWrap(urwid.Text("\n%s\n" %
-            _('List of registered projects')),'project_header'))
-        self.footer    = urwid.Edit()
-        self.body      = urwid.LineBox(urwid.Padding(urwid.AttrWrap(
-            self.listbox, 'entries'),('fixed left',1),('fixed right',1)))
-        self.frame     = urwid.Frame(self.body, header=self.header,
-                                    footer=self.footer)
-        self.update_focus(self.focused)
+        self.set_raw_rows(rows)
+        super(ProjectList, self).__init__("Projects", rows)
+        self.create_node_rows()
         self._total_time()
 
     def load_rows(self, rows):
-        self.raw_rows = rows
+        self.set_raw_rows(rows)
         self.update_rows()
 
+    def set_raw_rows(self, rows):
+        self.raw_rows = rows
+
     def update_rows(self):
+        self.create_node_rows()
+        self.set_node_rows(self.rows)
+
+    def create_node_rows(self):
+        """ Sets self.rows to node_class rows depending on the project_mode """
         if self.project_mode == 3:
             self.rows = self.create_project_tree()
         else:
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)