Preferences/ConfigurationPages/HelpWebBrowserPage.py

changeset 1337
95ceea538e4c
parent 1314
7e7b88c58fda
child 1338
4d0b50ef28cb
equal deleted inserted replaced
1335:60a540cabd68 1337:95ceea538e4c
7 Module implementing the Help web browser configuration page. 7 Module implementing the Help web browser configuration page.
8 """ 8 """
9 9
10 from PyQt4.QtCore import pyqtSlot, QLocale 10 from PyQt4.QtCore import pyqtSlot, QLocale
11 from PyQt4.QtNetwork import QNetworkRequest 11 from PyQt4.QtNetwork import QNetworkRequest
12 from PyQt4.QtWebKit import QWebSettings
12 13
13 from .ConfigurationPageBase import ConfigurationPageBase 14 from .ConfigurationPageBase import ConfigurationPageBase
14 from .Ui_HelpWebBrowserPage import Ui_HelpWebBrowserPage 15 from .Ui_HelpWebBrowserPage import Ui_HelpWebBrowserPage
15 16
16 import Preferences 17 import Preferences
119 self.languageCombo.insertSeparator(0) 120 self.languageCombo.insertSeparator(0)
120 self.languageCombo.insertItem(0, QLocale.languageToString(0), 0) 121 self.languageCombo.insertItem(0, QLocale.languageToString(0), 0)
121 index = self.languageCombo.findData(Preferences.getHelp("SearchLanguage")) 122 index = self.languageCombo.findData(Preferences.getHelp("SearchLanguage"))
122 if index > -1: 123 if index > -1:
123 self.languageCombo.setCurrentIndex(index) 124 self.languageCombo.setCurrentIndex(index)
125
126 if hasattr(QWebSettings, "SpatialNavigationEnabled"):
127 self.spatialCheckBox.setChecked(
128 Preferences.getHelp("SpatialNavigationEnabled"))
129 else:
130 self.spatialCheckBox.setEnabled(False)
131 if hasattr(QWebSettings, "LinksIncludedInFocusChain"):
132 self.linksInFocusChainCheckBox.setChecked(
133 Preferences.getHelp("LinksIncludedInFocusChain"))
134 else:
135 self.linksInFocusChainCheckBox.setEnabled(False)
124 136
125 def save(self): 137 def save(self):
126 """ 138 """
127 Public slot to save the Help Viewers configuration. 139 Public slot to save the Help Viewers configuration.
128 """ 140 """
197 language = self.languageCombo.itemData(languageIndex) 209 language = self.languageCombo.itemData(languageIndex)
198 else: 210 else:
199 # fall back to system default 211 # fall back to system default
200 language = QLocale.system().language() 212 language = QLocale.system().language()
201 Preferences.setHelp("SearchLanguage", language) 213 Preferences.setHelp("SearchLanguage", language)
214
215 if hasattr(QWebSettings, "SpatialNavigationEnabled"):
216 Preferences.setHelp("SpatialNavigationEnabled",
217 self.spatialCheckBox.isChecked())
218 if hasattr(QWebSettings, "LinksIncludedInFocusChain"):
219 Preferences.setHelp("LinksIncludedInFocusChain",
220 self.linksInFocusChainCheckBox.isChecked())
202 221
203 @pyqtSlot() 222 @pyqtSlot()
204 def on_setCurrentPageButton_clicked(self): 223 def on_setCurrentPageButton_clicked(self):
205 """ 224 """
206 Private slot to set the current page as the home page. 225 Private slot to set the current page as the home page.

eric ide

mercurial