I'm trying to add local, SVG-based rendering (and other enhancements) to the
Estimating Tools plugin's Workload Chart. I have an SVG-based chart working in
Firefox 4 (beta) but current browsers don't seem to render in-line SVG. I'm
reduced to:
svg = myRenderFunc(...)
if olderBrowser:
root = '/opt/trac/sandbox/attachments/wiki'
fid, fname = tempfile.mkstemp(suffix='.svg',
dir='%s/SVGTest' % root,
text=True)
url = formatter.req.href('svg/attachments/wiki', fname[len(root):])
os.write(fid, svg)
os.close(fid)
# Now set svg to include it
svg = ''
svg += '<embed type="image/svg+xml" '
svg += 'style="margin: 0pt; padding: 0pt;" \n'
svg += 'src="%s" ' % url
svg += 'width="%s" height="%s"> ' % (options['width'], options['height'])
svg += '</embed>'
Which works (or does in the original, I cleaned this up a little) but only on
the specific page. How can I create a temporary file unique to the macro
invocation and a URL that refers to it and not hard code the paths in my code?
I imagine the formatter is the key and I've read
http://trac.edgewall.org/wiki/TracDev/ApiChanges/0.11#IWikiMacroProvider,
resource.py and api.py but there are so many levels of indirection I'm lost.
Chris
--
Christopher Nelson, Software Engineering Manager
SIXNET - Solutions for Your Industrial Networking Challenges
331 Ushers Road, Ballston Lake, NY 12019
Tel: +1.518.877.5173, Fax: +1.518.877.8346 www.sixnet.com
--
You received this message because you are subscribed to the Google Groups "Trac
Development" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/trac-dev?hl=en.