Author: eallen
Date: 2009-08-12 14:35:12 -0400 (Wed, 12 Aug 2009)
New Revision: 3568
Modified:
mgmt/trunk/cumin/python/cumin/widgets.py
Log:
Added ability to not show tasks in the summary area by setting task.navigable = False.
Added ability to truncate table column for non-sql tables.
Prevented formPages from including the deferred and update scripts twice.
Modified: mgmt/trunk/cumin/python/cumin/widgets.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/widgets.py 2009-08-12 18:33:08 UTC (rev 3567)
+++ mgmt/trunk/cumin/python/cumin/widgets.py 2009-08-12 18:35:12 UTC (rev 3568)
@@ -399,7 +399,7 @@
return [(x.get_href(session, object),
x.get_title(session),
True)
- for x in cls.tasks if not x.aggregate]
+ for x in cls.tasks if x.navigable and not x.aggregate]
class CuminDetails(Widget):
# XXX make the object arg mandatory
@@ -469,7 +469,7 @@
x.get_title(session),
x.is_enabled(session, object))
for x in cls.tasks
- if not x.aggregate and x.form]
+ if not x.aggregate and x.form and x.navigable]
class StateSwitch(ItemSet):
def __init__(self, app, name):
@@ -644,6 +644,12 @@
self.header_class = TopTableColumnHeader
self.col_percent = 60
+class TruncatableItemTable(ItemTable):
+ def render_extra_class(self, session, *args):
+ """ if any columns are truncate, table needs a fixed layout
"""
+ return True in [True for x in self.columns
+ if isinstance(x, ClientTruncateColumn)] and " truncate"
or ""
+
class TruncatableTable(SqlTable):
def render_extra_class(self, session, *args):
""" if any columns are truncate, table needs a fixed layout
"""
@@ -673,6 +679,20 @@
self.parent.count.set(session, count + 1)
return count
+class CuminItemTable(TruncatableItemTable):
+ def __init__(self, app, name):
+ super(CuminItemTable, self).__init__(app, name)
+
+ self.paginator = Paginator(app, "page")
+ self.add_child(self.paginator)
+
+ self.update_enabled = True
+
+ def do_process(self, session, *args):
+ super(CuminItemTable, self).do_process(session, *args)
+
+ self.paginator.set_count(session, self.get_item_count(session, *args))
+
class CuminTable(TruncatableTable):
def __init__(self, app, name):
super(CuminTable, self).__init__(app, name)
@@ -1239,9 +1259,9 @@
def __init__(self, app, name):
super(CuminFormPage, self).__init__(app, name)
- background = self.Background(app, "background")
- background.type = "text/html"
- self.add_child(background)
+ self.background = self.Background(app, "background")
+ self.background.type = "text/html"
+ self.add_child(self.background)
self.modes = ModeSet(app, "modes")
self.add_child(self.modes)
@@ -1250,6 +1270,14 @@
# for form in model tasks:
# self.add_mode(form)
+ def render_content(self, session):
+ writer = Writer()
+
+ writer.write(self.modes.render(session))
+ writer.write(self.background.render(session))
+
+ return writer.to_string()
+
class Background(BackgroundInclude):
def render_data(self, session):
form = self.parent.modes.mode.get(session)