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

View File

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

View File

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