On Nov 17, 2:54 pm, "Chris Nelson" <chris.nel...@sixnet.com> wrote:
> I'm trying to add local, SVG-based rendering (and other enhancements) to the 
> Estimating Tools plugin's Workload Chart.  ...

env.path was what I was missing.  I ended up with:

            resource = self.formatter.resource
            realm = resource.realm
            page = resource.id
            path = self.env.path + '/attachments/' + realm

            # Create a temporary file, write the SVG source to it, and
close it
            # NOTE: This has to be cleaned up later by an outside
process.
            fid, fname = tempfile.mkstemp(suffix='.svg',
                                          dir=path + '/' + page,
                                          text=True)
            os.write(fid, svg)
            os.close(fid)

            # Now set svg to include it
            context = self.formatter.context
            url = context.req.href('svg/attachments/%s' % realm,
                                   fname[len(path):])
            svg = ''
            svg += '<embed  type="image/svg+xml"'
            svg += '  style="margin: 0pt; padding: 0pt;" \n'
            svg += '  src="%s"\n' % url
            svg += '  width="%s" height="%s">\n' % (options['width'],
                                                  options['height'])
            svg += '</embed>'


-- 
You received this message because you are subscribed to the Google Groups "Trac 
Development" group.
To post to this group, send email to trac-...@googlegroups.com.
To unsubscribe from this group, send email to 
trac-dev+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/trac-dev?hl=en.

Reply via email to