Skip to content

Commit

Permalink
Merge pull request #3551 from spyder-ide/fixes_issue_3489
Browse files Browse the repository at this point in the history
Add option to set/unset dpi scaling for screens that are not high resolution
  • Loading branch information
ccordoba12 authored Oct 24, 2016
2 parents 041f33e + 78a5a12 commit f09e70c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
12 changes: 9 additions & 3 deletions spyder/app/mainwindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,15 @@

#==============================================================================
# Proper high DPI scaling is available in Qt >= 5.6.0. This attibute must
# be set before creating the application
# be set before creating the application.
#==============================================================================
from spyder.config.main import CONF
if CONF.get('main', 'high_dpi_scaling'):
high_dpi_scaling = True
else:
high_dpi_scaling = False
if hasattr(Qt, 'AA_EnableHighDpiScaling'):
QCoreApplication.setAttribute(Qt.AA_EnableHighDpiScaling, True)
QCoreApplication.setAttribute(Qt.AA_EnableHighDpiScaling, high_dpi_scaling)


#==============================================================================
Expand Down Expand Up @@ -131,7 +136,7 @@
debug_print, MAC_APP_NAME, get_home_dir,
running_in_mac_app, get_module_path,
reset_config_files)
from spyder.config.main import CONF, OPEN_FILES_PORT
from spyder.config.main import OPEN_FILES_PORT
from spyder.config.utils import IMPORT_EXT, is_gtk_desktop
from spyder.app.cli_options import get_options
from spyder import dependencies
Expand Down Expand Up @@ -261,6 +266,7 @@ def __init__(self, options=None):

qapp = QApplication.instance()
if PYQT5:
# Enabling scaling for high dpi
qapp.setAttribute(Qt.AA_UseHighDpiPixmaps)
self.default_style = str(qapp.style().objectName())

Expand Down
1 change: 1 addition & 0 deletions spyder/config/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
'single_instance': True,
'open_files_port': OPEN_FILES_PORT,
'tear_off_menus': False,
'high_dpi_scaling': False,
'vertical_dockwidget_titlebars': False,
'vertical_tabs': False,
'animated_docks': True,
Expand Down
4 changes: 4 additions & 0 deletions spyder/plugins/configdialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -860,6 +860,9 @@ def setup_page(self):
tear_off_box = newcb(_("Tear off menus"), 'tear_off_menus',
tip=_("Set this to detach any<br> "
"menu from the main window"))
high_dpi_scaling_box = newcb(_("Enable high DPI scaling"),
'high_dpi_scaling',
tip=_("Set this for high DPI displays"))
margin_box = newcb(_("Custom margin for panes:"),
'use_custom_margin')
margin_spin = self.create_spinbox("", _("pixels"), 'custom_margin',
Expand All @@ -886,6 +889,7 @@ def setup_page(self):
interface_layout.addWidget(verttabs_box)
interface_layout.addWidget(animated_box)
interface_layout.addWidget(tear_off_box)
interface_layout.addWidget(high_dpi_scaling_box)
interface_layout.addLayout(margins_layout)
interface_group.setLayout(interface_layout)

Expand Down

0 comments on commit f09e70c

Please sign in to comment.