comparison getan/view.py @ 263:077c2ce02f93

Refactor ProjectList setting the total_time Devide _total_time into a method that calculates the current total time and a method that actually shows the total time in the footer.
author Björn Ricks <bjoern.ricks@intevation.de>
date Thu, 11 Apr 2013 12:39:25 +0200
parents e206ab753a26
children 915456b53f34
comparison
equal deleted inserted replaced
262:438f6ce81e3d 263:077c2ce02f93
151 self.controller = controller 151 self.controller = controller
152 self.project_mode = 0 152 self.project_mode = 0
153 self.set_raw_rows(rows) 153 self.set_raw_rows(rows)
154 super(ProjectList, self).__init__("Projects", rows) 154 super(ProjectList, self).__init__("Projects", rows)
155 self.create_node_rows() 155 self.create_node_rows()
156 self._total_time() 156 self.show_total_time()
157 157
158 def load_rows(self, rows): 158 def load_rows(self, rows):
159 self.set_raw_rows(rows) 159 self.set_raw_rows(rows)
160 self.update_rows() 160 self.update_rows()
161 161
192 return nodes 192 return nodes
193 193
194 def _get_project_sort_key(self, proj): 194 def _get_project_sort_key(self, proj):
195 return getattr(proj, self.PROJECT_MODES[self.project_mode]) 195 return getattr(proj, self.PROJECT_MODES[self.project_mode])
196 196
197 def _total_time(self): 197 def show_total_time(self):
198 self.total_time()
199 self.reset_footer()
200
201 def total_time(self):
198 if not self.rows: 202 if not self.rows:
199 self.set_footer_text("", "project_footer") 203 self.set_footer_text("", "project_footer")
200 return 204 return
201 logger.debug("ProjectList: update projects total time.") 205 logger.debug("ProjectList: update projects total time.")
202 total = 0 206 total = 0
209 "project_footer") 213 "project_footer")
210 214
211 def set_footer_info(self, text, attr): 215 def set_footer_info(self, text, attr):
212 logger.debug("ProjectList: set_footer_info to '%s'" % text) 216 logger.debug("ProjectList: set_footer_info to '%s'" % text)
213 self._footer_info = (text, attr) 217 self._footer_info = (text, attr)
214 self.set_footer_text(text, attr, False)
215 218
216 def reset_footer(self): 219 def reset_footer(self):
217 if not self.rows: 220 if not self.rows:
218 self.set_footer_text("", "project_footer") 221 self.set_footer_text("", "project_footer")
219 return 222 return
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)