Exemplo n.º 1
0
def write_html_obj(fp, obj, objs):
    if obj.value is None:
        value = u"None"
    else:
        value = html_escape(str(obj.value))
    attrs = dict(
        address=obj.address,
        size=strformat.strsize(obj.size),
        children=u",".join(get_children(obj, objs)),
        parents=u",".join(get_parents(obj, objs)),
        value=value,
    )
    fp.write(u"<tr><td>%(address)d</td><td>%(value)s</td><td>%(size)s</td><td>%(children)s</td></tr>\n" % attrs)
Exemplo n.º 2
0
def write_html_obj(fp, obj, objs):
    if obj.value is None:
        value = u"None"
    else:
        value = cgi.escape(str(obj.value))
    attrs = dict(
        address=obj.address,
        size=strformat.strsize(obj.size),
        children=u",".join(get_children(obj, objs)),
        parents=u",".join(get_parents(obj, objs)),
        value=value,
    )
    fp.write(u"<tr><td>%(address)d</td><td>%(value)s</td><td>%(size)s</td><td>%(children)s</td></tr>\n" % attrs)
Exemplo n.º 3
0
def set_properties (widget, data):
    """Write URL data values into widget text fields."""
    if data.base_url and data.url:
        widget.prop_url.setText(u'<a href="%(url)s">%(base_url)s</a>' % \
                              dict(url=data.url, base_url=data.base_url))
    else:
        widget.prop_url.setText(u"")
    widget.prop_name.setText(data.name)
    if data.parent_url:
        widget.prop_parenturl.setText(u'<a href="%(url)s">%(url)s</a>' % \
                              dict(url=data.parent_url))
    else:
        widget.prop_parenturl.setText(u"")
    widget.prop_base.setText(data.base_ref)
    widget.prop_checktime.setText(_("%.3f seconds") % data.checktime)
    if data.dltime >= 0:
        widget.prop_dltime.setText(_("%.3f seconds") % data.dltime)
    else:
        widget.prop_dltime.setText(u"")
    if data.size >= 0:
        widget.prop_size.setText(strformat.strsize(data.size))
    else:
        widget.prop_size.setText(u"")
    if data.modified:
        widget.prop_modified.setText(data.modified.isoformat(" "))
    else:
        widget.prop_modified.setText(u"")
    widget.prop_info.setText(wrap(data.info, 65))
    warning_msgs = [x[1] for x in data.warnings]
    widget.prop_warning.setText(wrap(warning_msgs, 65))
    if data.valid:
        result = u"Valid"
    else:
        result = u"Error"
    if data.result:
        result += u": %s" % data.result
    widget.prop_result.setText(result)
Exemplo n.º 4
0
def set_properties(widget, data):
    """Write URL data values into widget text fields."""
    if data.base_url and data.url:
        widget.prop_url.setText(u'<a href="%(url)s">%(base_url)s</a>' % \
                              dict(url=data.url, base_url=data.base_url))
    else:
        widget.prop_url.setText(u"")
    widget.prop_name.setText(data.name)
    if data.parent_url:
        widget.prop_parenturl.setText(u'<a href="%(url)s">%(url)s</a>' % \
                              dict(url=data.parent_url))
    else:
        widget.prop_parenturl.setText(u"")
    widget.prop_base.setText(data.base_ref)
    widget.prop_checktime.setText(_("%.3f seconds") % data.checktime)
    if data.dltime >= 0:
        widget.prop_dltime.setText(_("%.3f seconds") % data.dltime)
    else:
        widget.prop_dltime.setText(u"")
    if data.size >= 0:
        widget.prop_size.setText(strformat.strsize(data.size))
    else:
        widget.prop_size.setText(u"")
    if data.modified:
        widget.prop_modified.setText(data.modified.isoformat(" "))
    else:
        widget.prop_modified.setText(u"")
    widget.prop_info.setText(wrap(data.info, 65))
    warning_msgs = [x[1] for x in data.warnings]
    widget.prop_warning.setText(wrap(warning_msgs, 65))
    if data.valid:
        result = u"Valid"
    else:
        result = u"Error"
    if data.result:
        result += u": %s" % data.result
    widget.prop_result.setText(result)