Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] canvas/preview: Fix workflow preview rendering #2586

Merged
merged 1 commit into from
Sep 13, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions Orange/canvas/canvas/scene.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
from AnyQt.QtWidgets import QGraphicsScene, QGraphicsItem, QGraphicsObject
from AnyQt.QtGui import QPainter, QBrush, QColor, QFont
from AnyQt.QtCore import Qt, QPointF, QRectF, QSizeF, QLineF, QBuffer, \
QEvent, QObject, QSignalMapper

QEvent, QObject, QSignalMapper, QT_VERSION
from AnyQt.QtSvg import QSvgGenerator
from AnyQt.QtCore import pyqtSignal as Signal
try:
from AnyQt.QtCore import PYQT_VERSION
Expand Down Expand Up @@ -902,6 +902,17 @@ def font_from_dict(font_dict, font=None):
return font


if QT_VERSION >= 0x50900 and \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be pulled to the top of the file (after imports?)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer to keep it near grab_svgwhere it is used.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

QSvgGenerator().metric(QSvgGenerator.PdmDevicePixelRatioScaled) == 1:
# QTBUG-63159
class QSvgGenerator(QSvgGenerator):
def metric(self, metric):
if metric == QSvgGenerator.PdmDevicePixelRatioScaled:
return int(1 * QSvgGenerator.devicePixelRatioFScale())
else:
return super().metric(metric)


def grab_svg(scene):
"""
Return a SVG rendering of the scene contents.
Expand All @@ -911,7 +922,6 @@ def grab_svg(scene):
scene : :class:`CanvasScene`

"""
from AnyQt.QtSvg import QSvgGenerator
svg_buffer = QBuffer()
gen = QSvgGenerator()
gen.setOutputDevice(svg_buffer)
Expand Down