Skip to content

Commit

Permalink
Added environment settings and allowed variable scaling (#1978)
Browse files Browse the repository at this point in the history
  • Loading branch information
samtygier-stfc authored Nov 27, 2023
2 parents a621306 + 1299d90 commit 5150897
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions mantidimaging/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@
import argparse
import sys
import warnings
import os

from PyQt5.QtWidgets import QApplication
from PyQt5 import QtCore
from PyQt5.QtGui import QFont, QGuiApplication

import mantidimaging.core.parallel.manager as pm

Expand Down Expand Up @@ -52,11 +55,21 @@ def parse_args() -> argparse.Namespace:


def setup_application() -> QApplication:
QGuiApplication.setAttribute(QtCore.Qt.AA_EnableHighDpiScaling)
q_application = QApplication(sys.argv)
q_application.setStyle('Fusion')
q_application.setApplicationName("Mantid Imaging")
q_application.setOrganizationName("mantidproject")
q_application.setOrganizationDomain("mantidproject.org")
screens = q_application.screens()
if sys.platform == 'win32':
os.environ["QT_ENABLE_HIGHDPI_SCALING"] = "1"
os.environ["QT_AUTO_SCREEN_SCALE_FACTOR"] = "1"
os.environ["QT_SCALE_FACTOR"] = "1"
base_font_size = int(q_application.font().pointSize() * 0.8)
font_scale_factor = screens[0].physicalDotsPerInch() / 90
font = QFont(q_application.font().family(), int(font_scale_factor * base_font_size))
q_application.setFont(font)
return q_application


Expand Down

0 comments on commit 5150897

Please sign in to comment.