open-cogsci / OpenSesame

Graphical experiment builder for the social sciences
http://osdoc.cogsci.nl/
GNU General Public License v3.0
236 stars 112 forks source link

Call high DPI enabling functions before creating core app #676

Open dschreij opened 4 years ago

dschreij commented 4 years ago

Just placing this here to keep it on my radar, so I can fix it when the time comes. With newer versions of Qt, OpenSesame fails to start with the error message

Attribute Qt::AA_EnableHighDpiScaling must be set before QCoreApplication is created.
AttributeError: __getattribute__

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "opensesame", line 25, in <module>
    __main__.opensesame()
  File "/Users/daniel/Git/OpenSesame/libqtopensesame/__main__.py", line 111, in opensesame
    opensesame.resume_init()
  File "/Users/daniel/Git/OpenSesame/libqtopensesame/qtopensesame.py", line 192, in resume_init
    self.ui.pool_widget = pool_widget(self)
  File "/Users/daniel/Git/OpenSesame/libqtopensesame/widgets/pool_widget.py", line 54, in __init__
    ui=u'widgets.pool_widget')
  File "/Users/daniel/Git/OpenSesame/libqtopensesame/widgets/base_widget.py", line 53, in __init__
    self.setup(main_window, ui=ui)
  File "/Users/daniel/Git/OpenSesame/libqtopensesame/misc/base_component.py", line 57, in setup
    self.load_ui(ui)
  File "/Users/daniel/Git/OpenSesame/libqtopensesame/misc/base_component.py", line 92, in load_ui
    self.ui = uic.loadUi(fd, self)
  File "/usr/local/lib/python3.7/site-packages/PyQt5/uic/__init__.py", line 226, in loadUi
    return DynamicUILoader(package).loadUi(uifile, baseinstance, resource_suffix)
  File "/usr/local/lib/python3.7/site-packages/PyQt5/uic/Loader/loader.py", line 72, in loadUi
    return self.parse(filename, resource_suffix, basedir)
  File "/usr/local/lib/python3.7/site-packages/PyQt5/uic/uiparser.py", line 1021, in parse
    actor(elem)
  File "/usr/local/lib/python3.7/site-packages/PyQt5/uic/uiparser.py", line 942, in createConnections
    QtCore.QMetaObject.connectSlotsByName(self.toplevelWidget)
SystemError: <built-in function connectSlotsByName> returned a result with an error set

This is likely solved by moving https://github.com/smathot/OpenSesame/blob/koffka/libqtopensesame/__main__.py#L93-L98 to an earlier point in the init script.

smathot commented 4 years ago

Thanks!