Fix :inspect

This commit is contained in:
Florian Bruhin 2016-07-04 17:49:25 +02:00
parent 675f95a2e4
commit 0937a64f1c
3 changed files with 10 additions and 10 deletions

View File

@ -1124,24 +1124,24 @@ class CommandDispatcher:
Note: Due a bug in Qt, the inspector will show incorrect request
headers in the network tab.
"""
cur = self._current_widget()
if cur.inspector is None:
tab = self._current_widget()
if tab.data.inspector is None:
if not config.get('general', 'developer-extras'):
raise cmdexc.CommandError(
"Please enable developer-extras before using the "
"webinspector!")
cur.inspector = inspector.WebInspector()
cur.inspector.setPage(cur.page())
cur.inspector.show()
elif cur.inspector.isVisible():
cur.inspector.hide()
tab.data.inspector = inspector.WebInspector()
tab.data.inspector.setPage(tab._widget.page())
tab.data.inspector.show()
elif tab.data.inspector.isVisible():
tab.data.inspector.hide()
else:
if not config.get('general', 'developer-extras'):
raise cmdexc.CommandError(
"Please enable developer-extras before using the "
"webinspector!")
else:
cur.inspector.show()
tab.data.inspector.show()
@cmdutils.register(instance='command-dispatcher', scope='window')
@cmdutils.argument('dest_old', hide=True)

View File

@ -70,12 +70,14 @@ class TabData(QObject):
Attributes:
keep_icon: Whether the (e.g. cloned) icon should not be cleared on page
load.
inspector: The QWebInspector used for this webview.
"""
def __init__(self):
self._data = {
'keep_icon': False,
'viewing_source': False,
'inspector': None,
}
def __getattr__(self, attr):

View File

@ -48,7 +48,6 @@ class WebView(QWebView):
progress: loading progress of this page.
scroll_pos: The current scroll position as (x%, y%) tuple.
statusbar_message: The current javascript statusbar message.
inspector: The QWebInspector used for this webview.
load_status: loading status of this page (index into LoadStatus)
registry: The ObjectRegistry associated with this tab.
win_id: The window ID of the view.
@ -90,7 +89,6 @@ class WebView(QWebView):
self.win_id = win_id
self.load_status = usertypes.LoadStatus.none
self._check_insertmode = False
self.inspector = None
self.scroll_pos = (-1, -1)
self.statusbar_message = ''
self._old_scroll_pos = (-1, -1)