Returns True if the display is a high DPI display.
()
| 52 | |
| 53 | |
| 54 | def _has_high_dpi() -> bool: |
| 55 | """Returns True if the display is a high DPI display.""" |
| 56 | if sys.platform == 'darwin': |
| 57 | # On macOS, we can use the system_profiler command to determine if the |
| 58 | # display is retina. |
| 59 | return subprocess.call( |
| 60 | 'system_profiler SPDisplaysDataType | grep -i "retina"', |
| 61 | shell=True, |
| 62 | stdout=subprocess.DEVNULL, |
| 63 | stderr=subprocess.DEVNULL |
| 64 | ) == 0 |
| 65 | # TODO(zakka): Figure out how to detect high DPI displays on Linux. |
| 66 | return False |
| 67 | |
| 68 | |
| 69 | class BaseRenderer(metaclass=abc.ABCMeta): |