def webView_decidePolicyForNavigationAction_request_frame_decisionListener_(self, view, action_info, request, frame, listener): url = request.URL().absoluteString() if urlparse.editable_file(url): path, line = urlparse.path_and_line_from(url) self._open_source_file(path, line) listener.ignore() else: listener.use()
def _navigation_requested_cb(self, view, frame, networkRequest): url = networkRequest.get_uri() opener = os.environ.get('EDITOR', 'gnome-open') if not urlparse.editable_file(url): return 0 path, line = urlparse.path_and_line_from(url) subprocess.Popen([opener, path]) # return 1 to stop any other handlers running return 1
def _navigation_requested_cb(self, view, frame, networkRequest): url = networkRequest.get_uri() if url.startswith(self.URI_BASE + "#"): test_id = url.split('#',1)[1] self.mainloop.run_just(test_id) return 1 opener = os.environ.get('EDITOR', 'gnome-open') #log.info("navigation requested: %s" % (url,)) if not urlparse.editable_file(url): return 0 path, line = urlparse.path_and_line_from(url) subprocess.Popen([opener, path]) # return 1 to stop any other handlers running return 1