Add some logging for #152

This commit is contained in:
Florian Bruhin 2014-10-29 07:09:43 +01:00
parent 0c8b9fe095
commit a1ba05ff08

View File

@ -20,9 +20,11 @@
"""A HintManager to draw hints over links.""" """A HintManager to draw hints over links."""
import math import math
import functools
import subprocess import subprocess
import collections import collections
import sip
from PyQt5.QtCore import pyqtSignal, pyqtSlot, QObject, QEvent, Qt, QUrl from PyQt5.QtCore import pyqtSignal, pyqtSlot, QObject, QEvent, Qt, QUrl
from PyQt5.QtGui import QMouseEvent, QClipboard from PyQt5.QtGui import QMouseEvent, QClipboard
from PyQt5.QtWidgets import QApplication from PyQt5.QtWidgets import QApplication
@ -158,6 +160,8 @@ class HintManager(QObject):
pass pass
for f in self._context.frames: for f in self._context.frames:
log.hints.debug("Disconnecting frame {}".format(f)) log.hints.debug("Disconnecting frame {}".format(f))
if objreg.get('args').debug:
sip.dump(f)
f.contentsSizeChanged.disconnect(self.on_contents_size_changed) f.contentsSizeChanged.disconnect(self.on_contents_size_changed)
log.hints.debug("Disconnected.") log.hints.debug("Disconnected.")
text = self.HINT_TEXTS[self._context.target] text = self.HINT_TEXTS[self._context.target]
@ -602,6 +606,8 @@ class HintManager(QObject):
self._context.target = target self._context.target = target
self._context.baseurl = tabbed_browser.current_url() self._context.baseurl = tabbed_browser.current_url()
self._context.frames = webelem.get_child_frames(mainframe) self._context.frames = webelem.get_child_frames(mainframe)
for frame in self._context.frames:
frame.destroyed.connect(self.on_frame_destroyed)
self._context.args = args self._context.args = args
self._init_elements(mainframe, group) self._init_elements(mainframe, group)
message_bridge = objreg.get('message-bridge', scope='window', message_bridge = objreg.get('message-bridge', scope='window',
@ -745,3 +751,8 @@ class HintManager(QObject):
# hinting. # hinting.
return return
self._cleanup() self._cleanup()
@pyqtSlot('QObject')
def on_frame_destroyed(self, obj):
"""Log when a frame got destroyed by Qt."""
log.hints.debug("frame destroyed: {}".format(obj))