Commit 3a968497 authored by Paul McCarthy's avatar Paul McCarthy 🚵
Browse files

Merge branch 'rel/0.34.2' into 'v0.34'

Rel/0.34.2

See merge request fsl/fsleyes/fsleyes!218
parents bcf343a6 36eacb3f
......@@ -9,6 +9,17 @@ This document contains the ``fsleyes`` release history in reverse
chronological order.
0.34.2 (Tuesday 14th July 2020)
-------------------------------
Fixed
^^^^^
* Added support for high-DPI scaling under macOS with wxPython >= 4.1.0 (!217).
0.34.1 (Monday 13th July 2020)
------------------------------
......
......@@ -15,6 +15,7 @@ import collections
import fsl.data.image as fslimage
import fsleyes_props as props
import fsleyes.controls.controlpanel as ctrlpanel
import fsleyes.gl as fslgl
import fsleyes.tooltips as fsltooltips
import fsleyes.strings as strings
......@@ -143,8 +144,8 @@ class CanvasSettingsPanel(ctrlpanel.SettingsPanel):
showLimits=False))))
# The highDpi setting is
# only relevant on macOS
if platform.system() != 'Darwin':
# not always relevant
if not fslgl.WXGLCanvasTarget.canToggleHighDPI():
sceneOptsProps.pop('highDpi')
def _displaySpaceOptionName(opt):
......
......@@ -938,6 +938,34 @@ class WXGLCanvasTarget(object):
"""
@staticmethod
def canToggleHighDPI():
"""Return ``True`` if high-DPI scaling can be toggled, ``False``
otherwise.
Under GTK, high DPI support is not possible with wxPython < 4.0.7, as
``wx.Window.GetContentScaleFactor`` always returns 1. Under GTK and
from wxPython 4.0.7 onwards, GL canvases are scaled automatically.
Under macOS and wxpython < 4.1.0, high DPI must be explicitly requested
for GL canvases via a Cocoa API call. This can be done via the
:meth:`EnableHighDPI` method.
Under macOS and with wxpython >= 4.1.0, GL canvases are scaled
automatically.
"""
import wx
if platform.system() != 'Darwin':
return False
wxver = getattr(wx, '__version__', '1.0.0')
wxver = [int(v) for v in wxver.split('.')[:3]]
return wxver < [4, 1, 0]
def __init__(self):
"""Create a ``WXGLCanvasTarget``. """
......@@ -963,12 +991,7 @@ class WXGLCanvasTarget(object):
self.__freezeSwapBuffers = False
self.__context = context
# Under macOS, high DPI must be explicitly
# requested for GL canvases. This can be
# done via the EnableHighDPI method. Under
# Linux, GL canvases are scaled the same as
# other windows.
if platform.system() == 'Darwin':
if WXGLCanvasTarget.canToggleHighDPI():
self.__dpiscale = 1.0
else:
self.__dpiscale = self.GetContentScaleFactor()
......@@ -1191,9 +1214,10 @@ class WXGLCanvasTarget(object):
"""Attempts to enable/disable high-resolution rendering.
"""
# Not relevant under linux -
# see note in __init__
if platform.system() != 'Darwin':
# We don't necessarily need to
# enable high-DPI support - see
# __init__.
if not WXGLCanvasTarget.canToggleHighDPI():
return
if not self._setGLContext():
......
......@@ -14,7 +14,7 @@ version number. See also the :mod:`fsl.version` module.
"""
__version__ = '0.34.1'
__version__ = '0.34.2'
"""Current version number, as a string. The FSLeyes version number consists
of three numbers, separated by a period, which roughly obeys the Semantic
Versioning conventions (http://semver.org/).
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment