Skip to content

[WIP] SVGExporter: Write SVG viewbox size#1158

Closed
2xB wants to merge 1 commit intopyqtgraph:developfrom
2xB:2xb-fix-1157
Closed

[WIP] SVGExporter: Write SVG viewbox size#1158
2xB wants to merge 1 commit intopyqtgraph:developfrom
2xB:2xb-fix-1157

Conversation

@2xB
Copy link
Copy Markdown
Contributor

@2xB 2xB commented Apr 7, 2020

With this PR, exported SVG files have an associated viewbox size, so that their boundaries are known to renderers.
Current issue: pyqtgraph/exporters/test/test_svg.py fails with the following log:

self = <pyqtgraph.exporters.SVGExporter.SVGExporter object at 0x7f32ea2e4d00>

    def getSourceRect(self):
        if isinstance(self.item, GraphicsScene):
            w = self.item.getViewWidget()
            return w.viewportTransform().inverted()[0].mapRect(w.rect())
        else:
>           return self.item.sceneBoundingRect()
E           AttributeError: 'QGraphicsScene' object has no attribute 'sceneBoundingRect'

../Exporter.py:90: AttributeError

Note that if one replaces the SVGExporter with the ImageExporter and ".svg" file endings with ".png" file endings, a similar error occurs that has obviously nothing to do with this PR:

self = <pyqtgraph.exporters.ImageExporter.ImageExporter object at 0x7f846003ae20>

    def getTargetRect(self):
        if isinstance(self.item, GraphicsScene):
            return self.item.getViewWidget().rect()
        else:
>           return self.item.mapRectToDevice(self.item.boundingRect())
E           AttributeError: 'QGraphicsScene' object has no attribute 'mapRectToDevice'

../Exporter.py:96: AttributeError

If someone is interested, suggestions or Pull Requests to my branch "2xb-fix-1157" to fix this test are very welcome.

Fixes #1157

@2xB 2xB added the help wanted Assistance resolving this issue is wanted label Apr 7, 2020
@2xB 2xB changed the title WIP: SVGExporter: Write SVG viewbox size [WIP] SVGExporter: Write SVG viewbox size Apr 7, 2020
@2xB 2xB marked this pull request as draft May 6, 2020 08:33
@j9ac9k
Copy link
Copy Markdown
Member

j9ac9k commented May 30, 2020

going to re-trigger the CI run here as we've had some major CI issues.

@j9ac9k
Copy link
Copy Markdown
Member

j9ac9k commented Oct 28, 2020

Fixed with #1401

@j9ac9k j9ac9k closed this Oct 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

help wanted Assistance resolving this issue is wanted

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SVGExporter: Size of exported SVG image canvas is not set

2 participants