eric6/WebBrowser/StatusBar/JavaScriptSettingsDialog.py

Sat, 27 Feb 2021 12:08:23 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 27 Feb 2021 12:08:23 +0100
changeset 8138
169e65a6787c
parent 7945
76daafe10009
child 8218
7c09585bd960
permissions
-rw-r--r--

Shell: added functionality to show a prompt when the main client process has exited (e.g. a script ended).

4964
a894e8c92369 Implemented the JavaScript status bar icon.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
a894e8c92369 Implemented the JavaScript status bar icon.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2
7923
91e843545d9a Updated copyright for 2021.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7781
diff changeset
3 # Copyright (c) 2016 - 2021 Detlev Offenbach <detlev@die-offenbachs.de>
4964
a894e8c92369 Implemented the JavaScript status bar icon.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
4 #
a894e8c92369 Implemented the JavaScript status bar icon.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5
a894e8c92369 Implemented the JavaScript status bar icon.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6 """
a894e8c92369 Implemented the JavaScript status bar icon.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
7 Module implementing the JavaScript settings dialog.
a894e8c92369 Implemented the JavaScript status bar icon.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
8 """
a894e8c92369 Implemented the JavaScript status bar icon.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9
a894e8c92369 Implemented the JavaScript status bar icon.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
10 from PyQt5.QtCore import pyqtSlot
a894e8c92369 Implemented the JavaScript status bar icon.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
11 from PyQt5.QtWidgets import QDialog
a894e8c92369 Implemented the JavaScript status bar icon.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
12
a894e8c92369 Implemented the JavaScript status bar icon.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
13 from .Ui_JavaScriptSettingsDialog import Ui_JavaScriptSettingsDialog
a894e8c92369 Implemented the JavaScript status bar icon.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
14
a894e8c92369 Implemented the JavaScript status bar icon.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
15 import Preferences
a894e8c92369 Implemented the JavaScript status bar icon.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
16
a894e8c92369 Implemented the JavaScript status bar icon.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
17
a894e8c92369 Implemented the JavaScript status bar icon.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
18 class JavaScriptSettingsDialog(QDialog, Ui_JavaScriptSettingsDialog):
a894e8c92369 Implemented the JavaScript status bar icon.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
19 """
a894e8c92369 Implemented the JavaScript status bar icon.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
20 Class implementing the JavaScript settings dialog.
a894e8c92369 Implemented the JavaScript status bar icon.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
21
a894e8c92369 Implemented the JavaScript status bar icon.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
22 Note: it contains the JavaScript part of the web browser configuration
a894e8c92369 Implemented the JavaScript status bar icon.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
23 dialog.
a894e8c92369 Implemented the JavaScript status bar icon.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
24 """
a894e8c92369 Implemented the JavaScript status bar icon.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
25 def __init__(self, parent=None):
a894e8c92369 Implemented the JavaScript status bar icon.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
26 """
a894e8c92369 Implemented the JavaScript status bar icon.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
27 Constructor
a894e8c92369 Implemented the JavaScript status bar icon.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
28
a894e8c92369 Implemented the JavaScript status bar icon.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
29 @param parent reference to the parent widget
a894e8c92369 Implemented the JavaScript status bar icon.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
30 @type QWidget
a894e8c92369 Implemented the JavaScript status bar icon.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
31 """
a894e8c92369 Implemented the JavaScript status bar icon.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
32 super(JavaScriptSettingsDialog, self).__init__(parent)
a894e8c92369 Implemented the JavaScript status bar icon.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
33 self.setupUi(self)
a894e8c92369 Implemented the JavaScript status bar icon.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
34
6151
29564aad2f97 JavaScriptEnabled: Added a configuration option to globally disable/enable JavaScript support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
35 self.javaScriptGroup.setChecked(
29564aad2f97 JavaScriptEnabled: Added a configuration option to globally disable/enable JavaScript support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
36 Preferences.getWebBrowser("JavaScriptEnabled"))
4964
a894e8c92369 Implemented the JavaScript status bar icon.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
37 self.jsOpenWindowsCheckBox.setChecked(
a894e8c92369 Implemented the JavaScript status bar icon.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
38 Preferences.getWebBrowser("JavaScriptCanOpenWindows"))
7945
76daafe10009 Removed code dealing with Qt versions less than the required one and removed use of QDesktopWidget or QApplication.desktop().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
39 self.jsActivateWindowsCheckBox.setChecked(
76daafe10009 Removed code dealing with Qt versions less than the required one and removed use of QDesktopWidget or QApplication.desktop().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
40 Preferences.getWebBrowser(
76daafe10009 Removed code dealing with Qt versions less than the required one and removed use of QDesktopWidget or QApplication.desktop().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
41 "AllowWindowActivationFromJavaScript"))
4964
a894e8c92369 Implemented the JavaScript status bar icon.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
42 self.jsClipboardCheckBox.setChecked(
a894e8c92369 Implemented the JavaScript status bar icon.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
43 Preferences.getWebBrowser("JavaScriptCanAccessClipboard"))
7945
76daafe10009 Removed code dealing with Qt versions less than the required one and removed use of QDesktopWidget or QApplication.desktop().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
44 self.jsPasteCheckBox.setChecked(
76daafe10009 Removed code dealing with Qt versions less than the required one and removed use of QDesktopWidget or QApplication.desktop().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
45 Preferences.getWebBrowser("JavaScriptCanPaste"))
4964
a894e8c92369 Implemented the JavaScript status bar icon.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
46
4965
a9a4b632fe48 Some enhancements for the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4964
diff changeset
47 msh = self.minimumSizeHint()
a9a4b632fe48 Some enhancements for the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4964
diff changeset
48 self.resize(max(self.width(), msh.width()), msh.height())
4964
a894e8c92369 Implemented the JavaScript status bar icon.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
49
a894e8c92369 Implemented the JavaScript status bar icon.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
50 @pyqtSlot()
a894e8c92369 Implemented the JavaScript status bar icon.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
51 def accept(self):
a894e8c92369 Implemented the JavaScript status bar icon.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
52 """
a894e8c92369 Implemented the JavaScript status bar icon.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
53 Public slot to accept the dialog.
a894e8c92369 Implemented the JavaScript status bar icon.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
54 """
a894e8c92369 Implemented the JavaScript status bar icon.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
55 Preferences.setWebBrowser(
6151
29564aad2f97 JavaScriptEnabled: Added a configuration option to globally disable/enable JavaScript support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
56 "JavaScriptEnabled",
29564aad2f97 JavaScriptEnabled: Added a configuration option to globally disable/enable JavaScript support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
57 self.javaScriptGroup.isChecked())
29564aad2f97 JavaScriptEnabled: Added a configuration option to globally disable/enable JavaScript support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
58 Preferences.setWebBrowser(
4964
a894e8c92369 Implemented the JavaScript status bar icon.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
59 "JavaScriptCanOpenWindows",
a894e8c92369 Implemented the JavaScript status bar icon.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
60 self.jsOpenWindowsCheckBox.isChecked())
6151
29564aad2f97 JavaScriptEnabled: Added a configuration option to globally disable/enable JavaScript support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
61 if self.jsActivateWindowsCheckBox.isEnabled():
29564aad2f97 JavaScriptEnabled: Added a configuration option to globally disable/enable JavaScript support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
62 Preferences.setWebBrowser(
29564aad2f97 JavaScriptEnabled: Added a configuration option to globally disable/enable JavaScript support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
63 "AllowWindowActivationFromJavaScript",
29564aad2f97 JavaScriptEnabled: Added a configuration option to globally disable/enable JavaScript support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
64 self.jsActivateWindowsCheckBox.isChecked())
4964
a894e8c92369 Implemented the JavaScript status bar icon.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
65 Preferences.setWebBrowser(
a894e8c92369 Implemented the JavaScript status bar icon.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
66 "JavaScriptCanAccessClipboard",
a894e8c92369 Implemented the JavaScript status bar icon.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
67 self.jsClipboardCheckBox.isChecked())
6398
caf724f53840 Webbrowser: continued upgrading to Qt 5.11.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6397
diff changeset
68 if self.jsPasteCheckBox.isEnabled():
caf724f53840 Webbrowser: continued upgrading to Qt 5.11.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6397
diff changeset
69 Preferences.setWebBrowser(
caf724f53840 Webbrowser: continued upgrading to Qt 5.11.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6397
diff changeset
70 "JavaScriptCanPaste",
caf724f53840 Webbrowser: continued upgrading to Qt 5.11.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6397
diff changeset
71 self.jsPasteCheckBox.isChecked())
4964
a894e8c92369 Implemented the JavaScript status bar icon.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
72
a894e8c92369 Implemented the JavaScript status bar icon.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
73 Preferences.syncPreferences()
a894e8c92369 Implemented the JavaScript status bar icon.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
74
a894e8c92369 Implemented the JavaScript status bar icon.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
75 super(JavaScriptSettingsDialog, self).accept()

eric ide

mercurial