7 Module implementing the Web Browser configuration page. |
7 Module implementing the Web Browser configuration page. |
8 """ |
8 """ |
9 |
9 |
10 from __future__ import unicode_literals |
10 from __future__ import unicode_literals |
11 |
11 |
12 from PyQt5.QtCore import pyqtSlot |
12 from PyQt5.QtGui import QFont |
13 from PyQt5.QtWidgets import QFontDialog |
13 from PyQt5.QtWidgets import QFontDialog |
14 |
14 |
15 from E5Gui.E5PathPicker import E5PathPickerModes |
15 from E5Gui.E5PathPicker import E5PathPickerModes |
16 |
16 |
17 from .ConfigurationPageBase import ConfigurationPageBase |
17 from .ConfigurationPageBase import ConfigurationPageBase |
43 "Cascading Style Sheets (*.css);;All files (*)")) |
43 "Cascading Style Sheets (*.css);;All files (*)")) |
44 |
44 |
45 self.__displayMode = None |
45 self.__displayMode = None |
46 |
46 |
47 # set initial values |
47 # set initial values |
48 self.standardFont = Preferences.getWebBrowser("StandardFont") |
48 defaultFontSize = Preferences.getWebBrowser("DefaultFontSize") |
49 self.standardFontSample.setFont(self.standardFont) |
49 fixedFontSize = Preferences.getWebBrowser("DefaultFixedFontSize") |
50 self.standardFontSample.setText( |
50 self.defaultSizeSpinBox.setValue(defaultFontSize) |
51 "{0} {1}".format(self.standardFont.family(), |
51 self.fixedSizeSpinBox.setValue(fixedFontSize) |
52 self.standardFont.pointSize())) |
52 self.minSizeSpinBox.setValue( |
|
53 Preferences.getWebBrowser("MinimumFontSize")) |
|
54 self.minLogicalSizeSpinBox.setValue( |
|
55 Preferences.getWebBrowser("MinimumLogicalFontSize")) |
53 |
56 |
54 self.fixedFont = Preferences.getWebBrowser("FixedFont") |
57 self.standardFontCombo.setCurrentFont( |
55 self.fixedFontSample.setFont(self.fixedFont) |
58 QFont(Preferences.getWebBrowser("StandardFontFamily"), |
56 self.fixedFontSample.setText( |
59 defaultFontSize, QFont.Normal, False)) |
57 "{0} {1}".format(self.fixedFont.family(), |
60 self.fixedFontCombo.setCurrentFont( |
58 self.fixedFont.pointSize())) |
61 QFont(Preferences.getWebBrowser("FixedFontFamily"), |
|
62 fixedFontSize, QFont.Normal, False)) |
|
63 self.serifFontCombo.setCurrentFont( |
|
64 QFont(Preferences.getWebBrowser("SerifFontFamily"), |
|
65 defaultFontSize, QFont.Normal, False)) |
|
66 self.sansSerifFontCombo.setCurrentFont( |
|
67 QFont(Preferences.getWebBrowser("SansSerifFontFamily"), |
|
68 defaultFontSize, QFont.Normal, False)) |
|
69 self.cursiveFontCombo.setCurrentFont( |
|
70 QFont(Preferences.getWebBrowser("CursiveFontFamily"), |
|
71 defaultFontSize, QFont.Normal, True)) |
|
72 self.fantasyFontCombo.setCurrentFont( |
|
73 QFont(Preferences.getWebBrowser("FantasyFontFamily"), |
|
74 defaultFontSize, QFont.Normal, False)) |
59 |
75 |
60 self.initColour("SaveUrlColor", self.secureURLsColourButton, |
76 self.initColour("SaveUrlColor", self.secureURLsColourButton, |
61 Preferences.getWebBrowser) |
77 Preferences.getWebBrowser) |
62 |
78 |
63 self.autoLoadImagesCheckBox.setChecked( |
79 self.autoLoadImagesCheckBox.setChecked( |
92 |
108 |
93 def save(self): |
109 def save(self): |
94 """ |
110 """ |
95 Public slot to save the Help Viewers configuration. |
111 Public slot to save the Help Viewers configuration. |
96 """ |
112 """ |
97 Preferences.setWebBrowser("StandardFont", self.standardFont) |
113 Preferences.setWebBrowser( |
98 Preferences.setWebBrowser("FixedFont", self.fixedFont) |
114 "StandardFontFamily", |
|
115 self.standardFontCombo.currentFont().family()) |
|
116 Preferences.setWebBrowser( |
|
117 "FixedFontFamily", |
|
118 self.fixedFontCombo.currentFont().family()) |
|
119 Preferences.setWebBrowser( |
|
120 "SerifFontFamily", |
|
121 self.serifFontCombo.currentFont().family()) |
|
122 Preferences.setWebBrowser( |
|
123 "SansSerifFontFamily", |
|
124 self.sansSerifFontCombo.currentFont().family()) |
|
125 Preferences.setWebBrowser( |
|
126 "CursiveFontFamily", |
|
127 self.cursiveFontCombo.currentFont().family()) |
|
128 Preferences.setWebBrowser( |
|
129 "FantasyFontFamily", |
|
130 self.fantasyFontCombo.currentFont().family()) |
|
131 |
|
132 Preferences.setWebBrowser( |
|
133 "DefaultFontSize", |
|
134 self.defaultSizeSpinBox.value()) |
|
135 Preferences.setWebBrowser( |
|
136 "DefaultFixedFontSize", |
|
137 self.fixedSizeSpinBox.value()) |
|
138 Preferences.setWebBrowser( |
|
139 "MinimumFontSize", |
|
140 self.minSizeSpinBox.value()) |
|
141 Preferences.setWebBrowser( |
|
142 "MinimumLogicalFontSize", |
|
143 self.minLogicalSizeSpinBox.value()) |
99 |
144 |
100 Preferences.setWebBrowser( |
145 Preferences.setWebBrowser( |
101 "AutoLoadImages", |
146 "AutoLoadImages", |
102 self.autoLoadImagesCheckBox.isChecked()) |
147 self.autoLoadImagesCheckBox.isChecked()) |
103 |
148 |
115 |
160 |
116 Preferences.setWebBrowser( |
161 Preferences.setWebBrowser( |
117 "WarnOnMultipleClose", |
162 "WarnOnMultipleClose", |
118 self.warnOnMultipleCloseCheckBox.isChecked()) |
163 self.warnOnMultipleCloseCheckBox.isChecked()) |
119 |
164 |
120 @pyqtSlot() |
|
121 def on_standardFontButton_clicked(self): |
|
122 """ |
|
123 Private method used to select the standard font. |
|
124 """ |
|
125 self.standardFont = \ |
|
126 self.selectFont(self.standardFontSample, self.standardFont, True) |
|
127 |
|
128 @pyqtSlot() |
|
129 def on_fixedFontButton_clicked(self): |
|
130 """ |
|
131 Private method used to select the fixed-width font. |
|
132 """ |
|
133 self.fixedFont = self.selectFont( |
|
134 self.fixedFontSample, self.fixedFont, True, |
|
135 options=MonospacedFontsOption) |
|
136 |
|
137 |
165 |
138 def create(dlg): |
166 def create(dlg): |
139 """ |
167 """ |
140 Module function to create the configuration page. |
168 Module function to create the configuration page. |
141 |
169 |