pull request #3864, reverted webview changes, fixed regression

This commit is contained in:
Joakim Särehag 2018-05-09 18:28:52 +02:00
parent 72c2962908
commit dc7f39514d
2 changed files with 6 additions and 13 deletions

View File

@ -768,7 +768,9 @@ class WebEngineTab(browsertab.AbstractTab):
scripts.insert(new_script) scripts.insert(new_script)
def _install_event_filter(self): def _install_event_filter(self):
self._widget.focusProxy().installEventFilter(self._mouse_event_filter) fp = self._widget.focusProxy()
if fp is not None:
fp.installEventFilter(self._mouse_event_filter)
self._child_event_filter = mouse.ChildEventFilter( self._child_event_filter = mouse.ChildEventFilter(
eventfilter=self._mouse_event_filter, widget=self._widget, eventfilter=self._mouse_event_filter, widget=self._widget,
parent=self) parent=self)

View File

@ -48,7 +48,7 @@ class WebEngineView(QWebEngineView):
else: else:
profile = webenginesettings.default_profile profile = webenginesettings.default_profile
page = WebEnginePage(theme_color=theme_color, profile=profile, page = WebEnginePage(theme_color=theme_color, profile=profile,
parent=self, win_id=win_id) parent=self)
self.setPage(page) self.setPage(page)
def shutdown(self): def shutdown(self):
@ -130,7 +130,7 @@ class WebEnginePage(QWebEnginePage):
shutting_down = pyqtSignal() shutting_down = pyqtSignal()
navigation_request = pyqtSignal(usertypes.NavigationRequest) navigation_request = pyqtSignal(usertypes.NavigationRequest)
def __init__(self, *, theme_color, profile, win_id, parent=None): def __init__(self, *, theme_color, profile, parent=None):
super().__init__(profile, parent) super().__init__(profile, parent)
self._is_shutting_down = False self._is_shutting_down = False
self.featurePermissionRequested.connect( self.featurePermissionRequested.connect(
@ -138,7 +138,6 @@ class WebEnginePage(QWebEnginePage):
self._theme_color = theme_color self._theme_color = theme_color
self._set_bg_color() self._set_bg_color()
config.instance.changed.connect(self._set_bg_color) config.instance.changed.connect(self._set_bg_color)
self._win_id = win_id
self.urlChanged.connect(self._inject_userjs) self.urlChanged.connect(self._inject_userjs)
@config.change_filter('colors.webpage.bg') @config.change_filter('colors.webpage.bg')
@ -311,17 +310,9 @@ class WebEnginePage(QWebEnginePage):
QWebEnginePage.NavigationTypeOther: QWebEnginePage.NavigationTypeOther:
usertypes.NavigationRequest.Type.other, usertypes.NavigationRequest.Type.other,
} }
accept_request = True
if(url.scheme() == "qute" and url.path() == "print"):
command_dispatcher = objreg.get('command-dispatcher',
scope='window',
window=self._win_id)
command_dispatcher.printpage()
accept_request = False
navigation = usertypes.NavigationRequest(url=url, navigation = usertypes.NavigationRequest(url=url,
navigation_type=type_map[typ], navigation_type=type_map[typ],
is_main_frame=is_main_frame, is_main_frame=is_main_frame)
accepted=accept_request)
self.navigation_request.emit(navigation) self.navigation_request.emit(navigation)
return navigation.accepted return navigation.accepted