Author: justi9
Date: 2007-10-13 13:59:35 -0400 (Sat, 13 Oct 2007)
New Revision: 1044
Removed:
mgmt/cumin/python/wooly/debug.py
Log:
Removes a file we no longer use.
Deleted: mgmt/cumin/python/wooly/debug.py
===================================================================
--- mgmt/cumin/python/wooly/debug.py 2007-10-13 16:46:50 UTC (rev 1043)
+++ mgmt/cumin/python/wooly/debug.py 2007-10-13 17:59:35 UTC (rev 1044)
@@ -1,158 +0,0 @@
-from wooly import *
-from wooly.widgets import *
-
-class WidgetInspector(Widget):
- css = """
- .WidgetInspector {
- background-color: white;
- padding: 1em;
- border: 1px solid #ccc;
- min-height: 60em;
- }
-
- .WidgetInspector .list {
- float: left;
- width: 20em;
- background-color: #f7f7f7;
- padding: 0.75em 1em;
- border: 1px dashed #ccc;
- margin: 0 1em 0 0;
- }
-
- """
-
- html = """
- <div class="WidgetInspector">
- <div class="list">{widgets}</div>
- {view}
- </div>
- """
-
- def __init__(self, app, name):
- super(WidgetInspector, self).__init__(app, name)
-
- self.widgets = WidgetList(app, "widgets")
- self.add_child(self.widgets)
-
- self.view = WidgetView(app, "view")
- self.add_child(self.view)
-
-class WidgetView(Widget):
- css = """
- """
-
- html = """
- <h2>{title}</h2>
- """
-
- def render_title(self, session, object):
- return self.parent.widgets.get_selected_widget(session).name
-
-class WidgetList(Widget):
- css = """
- .WidgetList ul {
- list-style: none;
- margin: 0;
- padding: 0 0 0 1.5em;
- }
-
- .WidgetList .selected {
- font-weight: bold;
- }
- """
-
- html = """
- <div class="WidgetList"><ul>{widgets}</ul></div>
- """
-
- def __init__(self, app, name):
- super(WidgetList, self).__init__(app, name)
-
- self.widget = Parameter(app, "widget")
- self.add_parameter(self.widget)
-
- self.item = self.WidgetItem(app, "item")
- self.add_child(self.item)
-
- def do_process(self, session, object):
- print "do_process"
-
- if not self.get_selected_widget(session):
- self.set_selected_widget(session, self.page())
-
- def get_selected_widget(self, session):
- return self.app.get_widget(self.widget.get(session))
-
- def set_selected_widget(self, session, widget):
- self.widget.set(session, widget.path())
-
- def render_title(self, session, object):
- return "Widgets"
-
- def render_widgets(self, session, object):
- return self.item.render(session, self.page())
-
- class WidgetItem(Widget):
- html = """
- <li class="{selected}">{class} <a
href="{href}">{name}</a></li>
- {children}
- """
-
- def render_selected(self, session, widget):
- if widget == self.parent.get_selected_widget(session):
- return "selected"
-
- def render_href(self, session, widget):
- branch = session.branch()
- self.parent.set_selected_widget(branch, widget)
- return branch.marshal()
-
- def render_class(self, session, widget):
- return widget.__class__.__name__
-
- def render_name(self, session, widget):
- return widget.name
-
- def render_children(self, session, widget):
- if len(widget.children):
- writer = Writer()
- writer.write("<ul>")
-
- for child in widget.children:
- writer.write(self.parent.item.render(session, child))
-
- writer.write("</ul>")
-
- return writer.to_string()
-
- def xxx_render_widget(self, session, widget, depth, writer):
- spacer = ". "
- indent = spacer * depth
-
- try:
- cum_time = session.render_times[widget] * 1000
- self_time = cum_time
- for child in widget.children:
- self_time -= session.render_times[child] * 1000
-
- if widget.parent and cum_time > 0.2 * session.render_times[widget.parent]
* 1000:
- hot = "hot"
- else:
- hot = ""
-
- stime = " (<span class='wooly debug timing %s'>%f,
%f</span>)" % \
- (hot, cum_time, self_time)
- except KeyError:
- stime = ""
-
- writer.write("%s%s <b>%s</b>%s\n" % \
- (indent, widget.__class__.__name__, widget.name, \
- stime))
-
- for param in widget.parameters:
- writer.write("%s<span class='wooly debug param'>param %s
<strong>%s</strong> = %s</span>\n" % \
- (indent + spacer, param.__class__.__name__, \
- param.name, param.get(session)))
-
- for child in widget.children:
- self.render_widget(session, child, depth + 1, writer)