possible fix for " super-class ... Preferences was never called"

Can't reproduce the issue, but it seems the user was able to open the
preferences screen when no collection was loaded. If an error was
caught in loadCollection() the main window was not being hidden, so
perhaps a timing issue was preventing the profiles screen from taking
modal focus.

Removed the check in the prefs init - it is hopefully no longer
necessary, and returning before QDialog.__init__() was called was
causing the problem.

Caught exception:
  File "aqt/webview.py", line 27, in cmd
  File "aqt/webview.py", line 85, in _onCmd
  File "aqt/webview.py", line 360, in _onBridgeCmd
  File "aqt/toolbar.py", line 56, in _linkHandler
  File "aqt/toolbar.py", line 80, in _syncLinkHandler
  File "aqt/main.py", line 669, in onSync
  File "aqt/main.py", line 365, in unloadCollection
  File "aqt/main.py", line 611, in closeAllWindows
  File "aqt/__init__.py", line 110, in closeAll
<class 'RuntimeError'>: super-class __init__() of type Preferences was never called
This commit is contained in:
Damien Elmes 2019-04-21 19:02:03 +10:00
parent 623926e8f9
commit 9cc99cdced
2 changed files with 1 additions and 3 deletions

View file

@ -356,6 +356,7 @@ Debug info:
self.col = None self.col = None
# return to profile manager # return to profile manager
self.hide()
self.showProfileManager() self.showProfileManager()
return False return False

View file

@ -12,9 +12,6 @@ from anki.lang import _
class Preferences(QDialog): class Preferences(QDialog):
def __init__(self, mw): def __init__(self, mw):
if not mw.col:
showInfo(_("Please open a profile first."))
return
QDialog.__init__(self, mw, Qt.Window) QDialog.__init__(self, mw, Qt.Window)
self.mw = mw self.mw = mw
self.prof = self.mw.pm.profile self.prof = self.mw.pm.profile