eric6/WebBrowser/WebBrowserWindow.py

changeset 7945
76daafe10009
parent 7937
181d1160f617
child 7946
6901746220fc
equal deleted inserted replaced
7941:cf988a30ba47 7945:76daafe10009
43 import Preferences 43 import Preferences
44 from Preferences import Shortcuts 44 from Preferences import Shortcuts
45 45
46 import Utilities 46 import Utilities
47 import Globals 47 import Globals
48 from Globals import qVersionTuple
49 48
50 import UI.PixmapCache 49 import UI.PixmapCache
51 import UI.Config 50 import UI.Config
52 from UI.Info import Version 51 from UI.Info import Version
53 52
160 159
161 self.__shortcutsDialog = None 160 self.__shortcutsDialog = None
162 161
163 self.__eventMouseButtons = Qt.NoButton 162 self.__eventMouseButtons = Qt.NoButton
164 self.__eventKeyboardModifiers = Qt.NoModifier 163 self.__eventKeyboardModifiers = Qt.NoModifier
165
166 if (
167 qVersionTuple() < (5, 11, 0) and
168 Preferences.getWebBrowser("WebInspectorEnabled")
169 ):
170 os.environ["QTWEBENGINE_REMOTE_DEBUGGING"] = str(
171 Preferences.getWebBrowser("WebInspectorPort"))
172 164
173 WebBrowserWindow.setUseQtHelp(qthelp or bool(searchWord)) 165 WebBrowserWindow.setUseQtHelp(qthelp or bool(searchWord))
174 166
175 self.webProfile(private) 167 self.webProfile(private)
176 self.networkManager() 168 self.networkManager()
612 QWebEngineSettings.ErrorPageEnabled, 604 QWebEngineSettings.ErrorPageEnabled,
613 Preferences.getWebBrowser("ErrorPageEnabled")) 605 Preferences.getWebBrowser("ErrorPageEnabled"))
614 settings.setAttribute( 606 settings.setAttribute(
615 QWebEngineSettings.FullScreenSupportEnabled, 607 QWebEngineSettings.FullScreenSupportEnabled,
616 Preferences.getWebBrowser("FullScreenSupportEnabled")) 608 Preferences.getWebBrowser("FullScreenSupportEnabled"))
617 609 settings.setAttribute(
618 try: 610 QWebEngineSettings.ScreenCaptureEnabled,
619 # Qt 5.7 611 Preferences.getWebBrowser("ScreenCaptureEnabled"))
620 settings.setAttribute( 612 settings.setAttribute(
621 QWebEngineSettings.ScreenCaptureEnabled, 613 QWebEngineSettings.WebGLEnabled,
622 Preferences.getWebBrowser("ScreenCaptureEnabled")) 614 Preferences.getWebBrowser("WebGLEnabled"))
623 settings.setAttribute( 615 settings.setAttribute(
624 QWebEngineSettings.WebGLEnabled, 616 QWebEngineSettings.FocusOnNavigationEnabled,
625 Preferences.getWebBrowser("WebGLEnabled")) 617 Preferences.getWebBrowser("FocusOnNavigationEnabled"))
626 except (AttributeError, KeyError): 618 settings.setAttribute(
627 pass 619 QWebEngineSettings.PrintElementBackgrounds,
628 620 Preferences.getWebBrowser("PrintElementBackgrounds"))
629 try: 621 settings.setAttribute(
630 # Qt 5.8 622 QWebEngineSettings.AllowRunningInsecureContent,
631 settings.setAttribute( 623 Preferences.getWebBrowser("AllowRunningInsecureContent"))
632 QWebEngineSettings.FocusOnNavigationEnabled, 624 settings.setAttribute(
633 Preferences.getWebBrowser("FocusOnNavigationEnabled")) 625 QWebEngineSettings.AllowGeolocationOnInsecureOrigins,
634 settings.setAttribute( 626 Preferences.getWebBrowser("AllowGeolocationOnInsecureOrigins"))
635 QWebEngineSettings.PrintElementBackgrounds, 627 settings.setAttribute(
636 Preferences.getWebBrowser("PrintElementBackgrounds")) 628 QWebEngineSettings.AllowWindowActivationFromJavaScript,
637 settings.setAttribute( 629 Preferences.getWebBrowser(
638 QWebEngineSettings.AllowRunningInsecureContent, 630 "AllowWindowActivationFromJavaScript"))
639 Preferences.getWebBrowser("AllowRunningInsecureContent")) 631 settings.setAttribute(
640 except (AttributeError, KeyError): 632 QWebEngineSettings.ShowScrollBars,
641 pass 633 Preferences.getWebBrowser("ShowScrollBars"))
642 634 settings.setAttribute(
643 try: 635 QWebEngineSettings.PlaybackRequiresUserGesture,
644 # Qt 5.9 636 Preferences.getWebBrowser(
645 settings.setAttribute( 637 "PlaybackRequiresUserGesture"))
646 QWebEngineSettings.AllowGeolocationOnInsecureOrigins, 638 settings.setAttribute(
647 Preferences.getWebBrowser("AllowGeolocationOnInsecureOrigins")) 639 QWebEngineSettings.JavascriptCanPaste,
648 except (AttributeError, KeyError): 640 Preferences.getWebBrowser(
649 pass 641 "JavaScriptCanPaste"))
650 642 settings.setAttribute(
651 try: 643 QWebEngineSettings.WebRTCPublicInterfacesOnly,
652 # Qt 5.10 644 Preferences.getWebBrowser(
653 settings.setAttribute( 645 "WebRTCPublicInterfacesOnly"))
654 QWebEngineSettings.AllowWindowActivationFromJavaScript, 646 settings.setAttribute(
655 Preferences.getWebBrowser( 647 QWebEngineSettings.DnsPrefetchEnabled,
656 "AllowWindowActivationFromJavaScript")) 648 Preferences.getWebBrowser(
657 settings.setAttribute( 649 "DnsPrefetchEnabled"))
658 QWebEngineSettings.ShowScrollBars,
659 Preferences.getWebBrowser("ShowScrollBars"))
660 except (AttributeError, KeyError):
661 pass
662
663 try:
664 # Qt 5.11
665 settings.setAttribute(
666 QWebEngineSettings.PlaybackRequiresUserGesture,
667 Preferences.getWebBrowser(
668 "PlaybackRequiresUserGesture"))
669 settings.setAttribute(
670 QWebEngineSettings.JavascriptCanPaste,
671 Preferences.getWebBrowser(
672 "JavaScriptCanPaste"))
673 settings.setAttribute(
674 QWebEngineSettings.WebRTCPublicInterfacesOnly,
675 Preferences.getWebBrowser(
676 "WebRTCPublicInterfacesOnly"))
677 except (AttributeError, KeyError):
678 pass
679
680 try:
681 # Qt 5.12
682 settings.setAttribute(
683 QWebEngineSettings.DnsPrefetchEnabled,
684 Preferences.getWebBrowser(
685 "DnsPrefetchEnabled"))
686 except (AttributeError, KeyError):
687 pass
688 650
689 try: 651 try:
690 # Qt 5.13 652 # Qt 5.13
691 settings.setAttribute( 653 settings.setAttribute(
692 QWebEngineSettings.PdfViewerEnabled, 654 QWebEngineSettings.PdfViewerEnabled,

eric ide

mercurial