Preferences/ConfigurationPages/InterfacePage.py

changeset 7
c679fb30c8f3
parent 0
de9c2efb9d02
child 12
1d8dd9706f46
equal deleted inserted replaced
6:52e8c820d0dd 7:c679fb30c8f3
8 """ 8 """
9 9
10 import glob 10 import glob
11 import os 11 import os
12 12
13 from PyQt4.QtCore import pyqtSlot, QVariant, QTranslator, qVersion 13 from PyQt4.QtCore import pyqtSlot, QTranslator, qVersion
14 from PyQt4.QtGui import QStyleFactory, QFileDialog 14 from PyQt4.QtGui import QStyleFactory, QFileDialog
15 15
16 from E4Gui.E4Completers import E4FileCompleter 16 from E4Gui.E4Completers import E4FileCompleter
17 17
18 from ConfigurationPageBase import ConfigurationPageBase 18 from ConfigurationPageBase import ConfigurationPageBase
115 """ 115 """
116 Public slot to save the Interface configuration. 116 Public slot to save the Interface configuration.
117 """ 117 """
118 # save the style settings 118 # save the style settings
119 styleIndex = self.styleComboBox.currentIndex() 119 styleIndex = self.styleComboBox.currentIndex()
120 style = self.styleComboBox.itemData(styleIndex).toString() 120 style = self.styleComboBox.itemData(styleIndex)
121 Preferences.setUI("Style", style) 121 Preferences.setUI("Style", style)
122 122
123 # save the other UI related settings 123 # save the other UI related settings
124 Preferences.setUI("BrowsersListFoldersFirst", 124 Preferences.setUI("BrowsersListFoldersFirst",
125 int(self.uiBrowsersListFoldersFirstCheckBox.isChecked())) 125 self.uiBrowsersListFoldersFirstCheckBox.isChecked())
126 Preferences.setUI("BrowsersHideNonPublic", 126 Preferences.setUI("BrowsersHideNonPublic",
127 int(self.uiBrowsersHideNonPublicCheckBox.isChecked())) 127 self.uiBrowsersHideNonPublicCheckBox.isChecked())
128 Preferences.setUI("BrowsersListContentsByOccurrence", 128 Preferences.setUI("BrowsersListContentsByOccurrence",
129 int(self.uiBrowsersSortByOccurrenceCheckBox.isChecked())) 129 self.uiBrowsersSortByOccurrenceCheckBox.isChecked())
130 Preferences.setUI("LogViewerAutoRaise", 130 Preferences.setUI("LogViewerAutoRaise",
131 int(self.lvAutoRaiseCheckBox.isChecked())) 131 self.lvAutoRaiseCheckBox.isChecked())
132 Preferences.setUI("CaptionShowsFilename", 132 Preferences.setUI("CaptionShowsFilename",
133 int(self.uiCaptionShowsFilenameGroupBox.isChecked())) 133 self.uiCaptionShowsFilenameGroupBox.isChecked())
134 Preferences.setUI("CaptionFilenameLength", 134 Preferences.setUI("CaptionFilenameLength",
135 self.filenameLengthSpinBox.value()) 135 self.filenameLengthSpinBox.value())
136 Preferences.setUI("StyleSheet", 136 Preferences.setUI("StyleSheet",
137 self.styleSheetEdit.text()) 137 self.styleSheetEdit.text())
138 138
139 # save the dockarea corner settings 139 # save the dockarea corner settings
140 Preferences.setUI("TopLeftByLeft", 140 Preferences.setUI("TopLeftByLeft",
141 int(self.tlLeftButton.isChecked())) 141 self.tlLeftButton.isChecked())
142 Preferences.setUI("BottomLeftByLeft", 142 Preferences.setUI("BottomLeftByLeft",
143 int(self.blLeftButton.isChecked())) 143 self.blLeftButton.isChecked())
144 Preferences.setUI("TopRightByRight", 144 Preferences.setUI("TopRightByRight",
145 int(self.trRightButton.isChecked())) 145 self.trRightButton.isChecked())
146 Preferences.setUI("BottomRightByRight", 146 Preferences.setUI("BottomRightByRight",
147 int(self.brRightButton.isChecked())) 147 self.brRightButton.isChecked())
148 148
149 # save the language settings 149 # save the language settings
150 uiLanguageIndex = self.languageComboBox.currentIndex() 150 uiLanguageIndex = self.languageComboBox.currentIndex()
151 if uiLanguageIndex: 151 if uiLanguageIndex:
152 uiLanguage = \ 152 uiLanguage = \
153 self.languageComboBox.itemData(uiLanguageIndex).toString() 153 self.languageComboBox.itemData(uiLanguageIndex)
154 else: 154 else:
155 uiLanguage = None 155 uiLanguage = None
156 Preferences.setUILanguage(uiLanguage) 156 Preferences.setUILanguage(uiLanguage)
157 157
158 # save the interface layout settings 158 # save the interface layout settings
178 layout1 = "Sidebars" # just in case 178 layout1 = "Sidebars" # just in case
179 layout = (layout1, layout2, layout3) 179 layout = (layout1, layout2, layout3)
180 Preferences.setUILayout(layout) 180 Preferences.setUILayout(layout)
181 181
182 Preferences.setUI("SingleCloseButton", 182 Preferences.setUI("SingleCloseButton",
183 int(self.tabsCloseButtonCheckBox.isChecked())) 183 self.tabsCloseButtonCheckBox.isChecked())
184 184
185 for key in self.uiColours.keys(): 185 for key in self.uiColours.keys():
186 Preferences.setUI(key, self.uiColours[key]) 186 Preferences.setUI(key, self.uiColours[key])
187 187
188 def __populateStyleCombo(self): 188 def __populateStyleCombo(self):
190 Private method to populate the style combo box. 190 Private method to populate the style combo box.
191 """ 191 """
192 curStyle = Preferences.getUI("Style") 192 curStyle = Preferences.getUI("Style")
193 styles = QStyleFactory.keys() 193 styles = QStyleFactory.keys()
194 styles.sort() 194 styles.sort()
195 self.styleComboBox.addItem(self.trUtf8('System'), QVariant("System")) 195 self.styleComboBox.addItem(self.trUtf8('System'), "System")
196 for style in styles: 196 for style in styles:
197 self.styleComboBox.addItem(style, QVariant(style)) 197 self.styleComboBox.addItem(style, style)
198 currentIndex = self.styleComboBox.findData(QVariant(curStyle)) 198 currentIndex = self.styleComboBox.findData(curStyle)
199 if currentIndex == -1: 199 if currentIndex == -1:
200 currentIndex = 0 200 currentIndex = 0
201 self.styleComboBox.setCurrentIndex(currentIndex) 201 self.styleComboBox.setCurrentIndex(currentIndex)
202 202
203 def __populateLanguageCombo(self): 203 def __populateLanguageCombo(self):
233 currentIndex = localeList.index(uiLanguage) + 2 233 currentIndex = localeList.index(uiLanguage) + 2
234 except ValueError: 234 except ValueError:
235 currentIndex = 0 235 currentIndex = 0
236 self.languageComboBox.clear() 236 self.languageComboBox.clear()
237 237
238 self.languageComboBox.addItem("English (default)", QVariant("None")) 238 self.languageComboBox.addItem("English (default)", "None")
239 self.languageComboBox.addItem(self.trUtf8('System'), QVariant("System")) 239 self.languageComboBox.addItem(self.trUtf8('System'), "System")
240 for locale in localeList: 240 for locale in localeList:
241 self.languageComboBox.addItem(locales[locale], QVariant(locale)) 241 self.languageComboBox.addItem(locales[locale], locale)
242 self.languageComboBox.setCurrentIndex(currentIndex) 242 self.languageComboBox.setCurrentIndex(currentIndex)
243 243
244 @pyqtSlot() 244 @pyqtSlot()
245 def on_styleSheetButton_clicked(self): 245 def on_styleSheetButton_clicked(self):
246 """ 246 """

eric ide

mercurial