Add logging for #1484

This commit is contained in:
Florian Bruhin 2016-05-24 21:35:48 +02:00
parent 0fb6e508e6
commit ea1d8902d5

View File

@ -31,7 +31,7 @@ import atexit
import datetime import datetime
import tokenize import tokenize
from PyQt5.QtWidgets import QApplication from PyQt5.QtWidgets import QApplication, QWidget
from PyQt5.QtWebKit import QWebSettings from PyQt5.QtWebKit import QWebSettings
from PyQt5.QtGui import QDesktopServices, QPixmap, QIcon, QCursor, QWindow from PyQt5.QtGui import QDesktopServices, QPixmap, QIcon, QCursor, QWindow
from PyQt5.QtCore import (pyqtSlot, qInstallMessageHandler, QTimer, QUrl, from PyQt5.QtCore import (pyqtSlot, qInstallMessageHandler, QTimer, QUrl,
@ -343,6 +343,10 @@ def _save_version():
@pyqtSlot('QWidget*', 'QWidget*') @pyqtSlot('QWidget*', 'QWidget*')
def on_focus_changed(_old, new): def on_focus_changed(_old, new):
"""Register currently focused main window in the object registry.""" """Register currently focused main window in the object registry."""
if not isinstance(new, QWidget):
log.misc.debug("on_focus_changed called with non-QWidget {!r}".format(
new))
if new is None or not isinstance(new, mainwindow.MainWindow): if new is None or not isinstance(new, mainwindow.MainWindow):
try: try:
objreg.delete('last-focused-main-window') objreg.delete('last-focused-main-window')