Preferences/ConfigurationPages/HelpWebBrowserPage.py

changeset 1109
9552b5e16a07
parent 952
cc3e2e5558e9
child 1127
b1802ebe0066
equal deleted inserted replaced
1106:3e57cd52e0f6 1109:9552b5e16a07
5 5
6 """ 6 """
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 10 from PyQt4.QtCore import pyqtSlot, QLocale
11 from PyQt4.QtWebKit import QWebSettings 11 from PyQt4.QtWebKit import QWebSettings
12 from PyQt4.QtNetwork import QNetworkRequest 12 from PyQt4.QtNetwork import QNetworkRequest
13 13
14 from .ConfigurationPageBase import ConfigurationPageBase 14 from .ConfigurationPageBase import ConfigurationPageBase
15 from .Ui_HelpWebBrowserPage import Ui_HelpWebBrowserPage 15 from .Ui_HelpWebBrowserPage import Ui_HelpWebBrowserPage
92 self.startupCombo.setCurrentIndex( 92 self.startupCombo.setCurrentIndex(
93 Preferences.getHelp("StartupBehavior")) 93 Preferences.getHelp("StartupBehavior"))
94 self.homePageEdit.setText( 94 self.homePageEdit.setText(
95 Preferences.getHelp("HomePage")) 95 Preferences.getHelp("HomePage"))
96 96
97 self.defaultSchemeCombo.setEditText( 97 self.defaultSchemeCombo.setCurrentIndex(
98 Preferences.getHelp("DefaultScheme")) 98 self.defaultSchemeCombo.findText(
99 Preferences.getHelp("DefaultScheme")))
99 100
100 historyLimit = Preferences.getHelp("HistoryLimit") 101 historyLimit = Preferences.getHelp("HistoryLimit")
101 idx = 0 102 idx = 0
102 if historyLimit == 1: 103 if historyLimit == 1:
103 idx = 0 104 idx = 0
115 idx = 6 116 idx = 6
116 else: 117 else:
117 idx = 5 118 idx = 5
118 self.expireHistory.setCurrentIndex(idx) 119 self.expireHistory.setCurrentIndex(idx)
119 120
121 for language in range(2, QLocale.LastLanguage + 1):
122 if len(QLocale.countriesForLanguage(language)) > 0:
123 self.languageCombo.addItem(QLocale.languageToString(language), language)
124 self.languageCombo.model().sort(0)
125 self.languageCombo.insertSeparator(0)
126 self.languageCombo.insertItem(0, QLocale.languageToString(0), 0)
127 index = self.languageCombo.findData(Preferences.getHelp("SearchLanguage"))
128 if index > -1:
129 self.languageCombo.setCurrentIndex(index)
130
120 def save(self): 131 def save(self):
121 """ 132 """
122 Public slot to save the Help Viewers configuration. 133 Public slot to save the Help Viewers configuration.
123 """ 134 """
124 Preferences.setHelp("SingleHelpWindow", 135 Preferences.setHelp("SingleHelpWindow",
188 elif idx == 5: 199 elif idx == 5:
189 historyLimit = -1 200 historyLimit = -1
190 elif idx == 6: 201 elif idx == 6:
191 historyLimit = -2 202 historyLimit = -2
192 Preferences.setHelp("HistoryLimit", historyLimit) 203 Preferences.setHelp("HistoryLimit", historyLimit)
204
205 languageIndex = self.languageCombo.currentIndex()
206 if languageIndex > -1:
207 language = self.languageCombo.itemData(languageIndex)
208 else:
209 # fall back to system default
210 language = QLocale.system().language()
211 Preferences.setHelp("SearchLanguage", language)
193 212
194 @pyqtSlot() 213 @pyqtSlot()
195 def on_setCurrentPageButton_clicked(self): 214 def on_setCurrentPageButton_clicked(self):
196 """ 215 """
197 Private slot to set the current page as the home page. 216 Private slot to set the current page as the home page.

eric ide

mercurial