Author: justi9
Date: 2007-10-24 10:30:29 -0400 (Wed, 24 Oct 2007)
New Revision: 1153
Modified:
mgmt/cumin/python/wooly/widgets.py
mgmt/cumin/python/wooly/widgets.strings
mgmt/notes/Todo
Log:
Parks a first attempt at a more built up table widget that would
supporting sorting, disappeared columns, etc. This doesn't work yet.
Modified: mgmt/cumin/python/wooly/widgets.py
===================================================================
--- mgmt/cumin/python/wooly/widgets.py 2007-10-23 21:16:07 UTC (rev 1152)
+++ mgmt/cumin/python/wooly/widgets.py 2007-10-24 14:30:29 UTC (rev 1153)
@@ -126,6 +126,7 @@
return None
def do_render(self, session, object):
+ # XXX don't do this twice
items = self.get_items(session, object)
if items:
@@ -167,3 +168,55 @@
self.item_tmpl.render(session, child, writer)
return writer.to_string()
+
+class ItemTable(ItemSet):
+ def __init__(self, app, name):
+ super(ItemTable, self).__init__(app, name)
+
+ self.heading_tmpl = Template(self, "heading_html")
+ self.cell_tmpl = Template(self, "cell_html")
+
+ self.columns = list()
+
+ def add_column(self, column):
+ self.columns.append(column)
+ self.add_child(column)
+
+ def get_items(self, session, object):
+ return None
+
+ def render_headings(self, session, object):
+ writer = Writer()
+
+ for col in self.columns:
+ if col.visible.get(session):
+ col.render_heading(session, object, writer)
+
+ return writer.to_string()
+
+ def render_cells(self, session, item):
+ writer = Writer()
+
+ for col in self.columns:
+ if col.visible.get(session):
+ col.render_cell(session, item, writer)
+
+ return writer.to_string()
+
+ def render_none(self, session, object):
+ """For producing a message when the table is
empty"""
+
+ return None
+
+class ItemTableColumn(Widget):
+ def __init__(self, app, name):
+ super(ItemTableColumn, self).__init__(app, name)
+
+ self.visible = Attribute(app, "visible")
+ self.visible.set_default(True)
+ self.add_attribute(self.visible)
+
+ def render_cell_content(self, session, item):
+ pass
+
+
Modified: mgmt/cumin/python/wooly/widgets.strings
===================================================================
--- mgmt/cumin/python/wooly/widgets.strings 2007-10-23 21:16:07 UTC (rev 1152)
+++ mgmt/cumin/python/wooly/widgets.strings 2007-10-24 14:30:29 UTC (rev 1153)
@@ -72,3 +72,23 @@
[ItemTree.item_html]
<li>{item_content}</li>
<ul>{child_items}</ul>
+
+[ItemTable.html]
+<table>
+ <tr>
+ {headings}
+ </tr>
+
+ {items}
+</table>
+
+[ItemTable.heading_html]
+<th>{heading_content}</th>
+
+[ItemTable.item_html]
+<tr>
+ {cells}
+</tr>
+
+[ItemTable.cell_html]
+<td>{cell_content}</td>
Modified: mgmt/notes/Todo
===================================================================
--- mgmt/notes/Todo 2007-10-23 21:16:07 UTC (rev 1152)
+++ mgmt/notes/Todo 2007-10-24 14:30:29 UTC (rev 1153)
@@ -38,16 +38,8 @@
* Add favicon and a mapping in the server to serve it
- * Create a model.dtd
-
- * Add scalar get/setters to ModelObject
-
* Separate wooly stuff into its own devel subdir
- * Add creation dates to some objects
-
- * cumindev: add a cumin-test function and bind it to C-c C-c
-
* Consider having a cssclass set on widgets
* Use page attributes for session errors, redirect
@@ -55,9 +47,6 @@
* See if we can eliminate the attr/param distinction, and use whether
or not a param is added to a widget via add_param to do that
- * Add link disabling; use it for the server groups edit and remove
- links
-
* Add a parameter that takes a modelclass
* Servers tab
@@ -122,3 +111,5 @@
* model: get rid of the old *_count stat fields and use the new ones
* queue: distinguish trans. msg stats from trans. stats
+
+ * write up a designer work list