612 QWebEngineSettings.ErrorPageEnabled, |
600 QWebEngineSettings.ErrorPageEnabled, |
613 Preferences.getWebBrowser("ErrorPageEnabled")) |
601 Preferences.getWebBrowser("ErrorPageEnabled")) |
614 settings.setAttribute( |
602 settings.setAttribute( |
615 QWebEngineSettings.FullScreenSupportEnabled, |
603 QWebEngineSettings.FullScreenSupportEnabled, |
616 Preferences.getWebBrowser("FullScreenSupportEnabled")) |
604 Preferences.getWebBrowser("FullScreenSupportEnabled")) |
617 |
605 settings.setAttribute( |
618 try: |
606 QWebEngineSettings.ScreenCaptureEnabled, |
619 # Qt 5.7 |
607 Preferences.getWebBrowser("ScreenCaptureEnabled")) |
620 settings.setAttribute( |
608 settings.setAttribute( |
621 QWebEngineSettings.ScreenCaptureEnabled, |
609 QWebEngineSettings.WebGLEnabled, |
622 Preferences.getWebBrowser("ScreenCaptureEnabled")) |
610 Preferences.getWebBrowser("WebGLEnabled")) |
623 settings.setAttribute( |
611 settings.setAttribute( |
624 QWebEngineSettings.WebGLEnabled, |
612 QWebEngineSettings.FocusOnNavigationEnabled, |
625 Preferences.getWebBrowser("WebGLEnabled")) |
613 Preferences.getWebBrowser("FocusOnNavigationEnabled")) |
626 except (AttributeError, KeyError): |
614 settings.setAttribute( |
627 pass |
615 QWebEngineSettings.PrintElementBackgrounds, |
628 |
616 Preferences.getWebBrowser("PrintElementBackgrounds")) |
629 try: |
617 settings.setAttribute( |
630 # Qt 5.8 |
618 QWebEngineSettings.AllowRunningInsecureContent, |
631 settings.setAttribute( |
619 Preferences.getWebBrowser("AllowRunningInsecureContent")) |
632 QWebEngineSettings.FocusOnNavigationEnabled, |
620 settings.setAttribute( |
633 Preferences.getWebBrowser("FocusOnNavigationEnabled")) |
621 QWebEngineSettings.AllowGeolocationOnInsecureOrigins, |
634 settings.setAttribute( |
622 Preferences.getWebBrowser("AllowGeolocationOnInsecureOrigins")) |
635 QWebEngineSettings.PrintElementBackgrounds, |
623 settings.setAttribute( |
636 Preferences.getWebBrowser("PrintElementBackgrounds")) |
624 QWebEngineSettings.AllowWindowActivationFromJavaScript, |
637 settings.setAttribute( |
625 Preferences.getWebBrowser( |
638 QWebEngineSettings.AllowRunningInsecureContent, |
626 "AllowWindowActivationFromJavaScript")) |
639 Preferences.getWebBrowser("AllowRunningInsecureContent")) |
627 settings.setAttribute( |
640 except (AttributeError, KeyError): |
628 QWebEngineSettings.ShowScrollBars, |
641 pass |
629 Preferences.getWebBrowser("ShowScrollBars")) |
642 |
630 settings.setAttribute( |
643 try: |
631 QWebEngineSettings.PlaybackRequiresUserGesture, |
644 # Qt 5.9 |
632 Preferences.getWebBrowser( |
645 settings.setAttribute( |
633 "PlaybackRequiresUserGesture")) |
646 QWebEngineSettings.AllowGeolocationOnInsecureOrigins, |
634 settings.setAttribute( |
647 Preferences.getWebBrowser("AllowGeolocationOnInsecureOrigins")) |
635 QWebEngineSettings.JavascriptCanPaste, |
648 except (AttributeError, KeyError): |
636 Preferences.getWebBrowser( |
649 pass |
637 "JavaScriptCanPaste")) |
650 |
638 settings.setAttribute( |
651 try: |
639 QWebEngineSettings.WebRTCPublicInterfacesOnly, |
652 # Qt 5.10 |
640 Preferences.getWebBrowser( |
653 settings.setAttribute( |
641 "WebRTCPublicInterfacesOnly")) |
654 QWebEngineSettings.AllowWindowActivationFromJavaScript, |
642 settings.setAttribute( |
655 Preferences.getWebBrowser( |
643 QWebEngineSettings.DnsPrefetchEnabled, |
656 "AllowWindowActivationFromJavaScript")) |
644 Preferences.getWebBrowser( |
657 settings.setAttribute( |
645 "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 |
646 |
689 try: |
647 try: |
690 # Qt 5.13 |
648 # Qt 5.13 |
691 settings.setAttribute( |
649 settings.setAttribute( |
692 QWebEngineSettings.PdfViewerEnabled, |
650 QWebEngineSettings.PdfViewerEnabled, |
2604 chromeVersion, webengineVersion = ( |
2562 chromeVersion, webengineVersion = ( |
2605 WebBrowserTools.getWebEngineVersions() |
2563 WebBrowserTools.getWebEngineVersions() |
2606 ) |
2564 ) |
2607 E5MessageBox.about( |
2565 E5MessageBox.about( |
2608 self, |
2566 self, |
2609 self.tr("eric6 Web Browser"), |
2567 self.tr("eric Web Browser"), |
2610 self.tr( |
2568 self.tr( |
2611 """<b>eric6 Web Browser - {0}</b>""" |
2569 """<b>eric Web Browser - {0}</b>""" |
2612 """<p>The eric6 Web Browser is a combined help file and HTML""" |
2570 """<p>The eric Web Browser is a combined help file and HTML""" |
2613 """ browser. It is part of the eric6 development""" |
2571 """ browser. It is part of the eric development""" |
2614 """ toolset.</p>""" |
2572 """ toolset.</p>""" |
2615 """<p>It is based on QtWebEngine {1} and Chrome {2}.</p>""" |
2573 """<p>It is based on QtWebEngine {1} and Chrome {2}.</p>""" |
2616 ).format(Version, webengineVersion, chromeVersion)) |
2574 ).format(Version, webengineVersion, chromeVersion)) |
2617 |
2575 |
2618 def __aboutQt(self): |
2576 def __aboutQt(self): |
2619 """ |
2577 """ |
2620 Private slot to show info about Qt. |
2578 Private slot to show info about Qt. |
2621 """ |
2579 """ |
2622 E5MessageBox.aboutQt(self, self.tr("eric6 Web Browser")) |
2580 E5MessageBox.aboutQt(self, self.tr("eric Web Browser")) |
2623 |
2581 |
2624 def setBackwardAvailable(self, b): |
2582 def setBackwardAvailable(self, b): |
2625 """ |
2583 """ |
2626 Public slot called when backward references are available. |
2584 Public slot called when backward references are available. |
2627 |
2585 |
4759 ########################################## |
4717 ########################################## |
4760 ## Support for desktop notifications below |
4718 ## Support for desktop notifications below |
4761 ########################################## |
4719 ########################################## |
4762 |
4720 |
4763 @classmethod |
4721 @classmethod |
4764 def showNotification(cls, icon, heading, text, timeout=None): |
4722 def showNotification(cls, icon, heading, text, |
|
4723 kind=NotificationTypes.Information, timeout=None): |
4765 """ |
4724 """ |
4766 Class method to show a desktop notification. |
4725 Class method to show a desktop notification. |
4767 |
4726 |
4768 @param icon icon to be shown in the notification |
4727 @param icon icon to be shown in the notification |
4769 @type QPixmap |
4728 @type QPixmap |
4770 @param heading heading of the notification |
4729 @param heading heading of the notification |
4771 @type str |
4730 @type str |
4772 @param text text of the notification |
4731 @param text text of the notification |
4773 @type str |
4732 @type str |
|
4733 @param kind kind of notification to be shown |
|
4734 @type NotificationTypes |
4774 @param timeout time in seconds the notification should be shown |
4735 @param timeout time in seconds the notification should be shown |
4775 (None = use configured timeout, 0 = indefinitely) |
4736 (None = use configured timeout, 0 = indefinitely) |
4776 @type int |
4737 @type int |
4777 """ |
4738 """ |
4778 if Preferences.getUI("NotificationsEnabled"): |
4739 if cls._notification is None: |
4779 if cls._notification is None: |
4740 from UI.NotificationWidget import NotificationWidget |
4780 from UI.NotificationWidget import NotificationWidget |
4741 cls._notification = NotificationWidget() |
4781 cls._notification = NotificationWidget() |
4742 |
4782 cls._notification.setPixmap(icon) |
4743 if timeout is None: |
4783 cls._notification.setHeading(heading) |
4744 timeout = Preferences.getUI("NotificationTimeout") |
4784 cls._notification.setText(text) |
4745 cls._notification.showNotification( |
4785 if timeout is None: |
4746 icon, heading, text, kind=kind, timeout=timeout) |
4786 timeout = Preferences.getUI("NotificationTimeout") |
|
4787 cls._notification.setTimeout(timeout) |
|
4788 cls._notification.move( |
|
4789 Preferences.getUI("NotificationPosition")) |
|
4790 cls._notification.show() |
|
4791 |
|
4792 @classmethod |
|
4793 def notificationsEnabled(cls): |
|
4794 """ |
|
4795 Class method to check, if notifications are enabled. |
|
4796 |
|
4797 @return flag indicating, if notifications are enabled (boolean) |
|
4798 """ |
|
4799 return Preferences.getUI("NotificationsEnabled") |
|
4800 |
4747 |
4801 ###################################### |
4748 ###################################### |
4802 ## Support for global status bar below |
4749 ## Support for global status bar below |
4803 ###################################### |
4750 ###################################### |
4804 |
4751 |