104 def __inspectorReplyFinished(self): |
104 def __inspectorReplyFinished(self): |
105 """ |
105 """ |
106 Private slot handling the reply. |
106 Private slot handling the reply. |
107 """ |
107 """ |
108 result = str(self.__reply.readAll(), encoding="utf8") |
108 result = str(self.__reply.readAll(), encoding="utf8") |
109 clients = json.loads(result) |
|
110 |
109 |
111 self.__reply.deleteLater() |
110 self.__reply.deleteLater() |
112 self.__replay = None |
111 self.__reply = None |
113 |
112 |
114 pageUrl = QUrl() |
113 pageUrl = QUrl() |
115 try: |
114 try: |
116 index = _VIEWS.index(self.__view) |
115 index = _VIEWS.index(self.__view) |
117 except ValueError: |
116 except ValueError: |
118 index = -1 |
117 index = -1 |
119 if len(clients) > index: |
118 try: |
120 port = Preferences.getWebBrowser("WebInspectorPort") |
119 clients = json.loads(result) |
121 inspectorUrl = QUrl("http://localhost:{0}".format(port)) |
120 if len(clients) > index: |
122 |
121 port = Preferences.getWebBrowser("WebInspectorPort") |
123 client = clients[index] |
122 inspectorUrl = QUrl("http://localhost:{0}".format(port)) |
124 pageUrl = inspectorUrl.resolved( |
123 |
125 QUrl(client["devtoolsFrontendUrl"])) |
124 client = clients[index] |
126 self.load(pageUrl) |
125 pageUrl = inspectorUrl.resolved( |
127 pushView(self) |
126 QUrl(client["devtoolsFrontendUrl"])) |
128 self.show() |
127 self.load(pageUrl) |
|
128 pushView(self) |
|
129 self.show() |
|
130 except json.JSONDecodeError: |
|
131 # ignore silently |
|
132 pass |
129 |
133 |
130 def inspectElement(self): |
134 def inspectElement(self): |
131 """ |
135 """ |
132 Public method to inspect an element. |
136 Public method to inspect an element. |
133 """ |
137 """ |