Preferences/ConfigurationDialog.py

changeset 0
de9c2efb9d02
child 7
c679fb30c8f3
equal deleted inserted replaced
-1:000000000000 0:de9c2efb9d02
1 # -*- coding: utf-8 -*-
2
3 # Copyright (c) 2002 - 2009 Detlev Offenbach <detlev@die-offenbachs.de>
4 #
5
6 """
7 Module implementing a dialog for the configuration of eric4.
8 """
9
10 import os
11 import types
12
13 from PyQt4.QtCore import *
14 from PyQt4.QtGui import *
15
16 from E4Gui.E4Application import e4App
17
18 import QScintilla.Lexers
19
20 import Preferences
21
22 from PreferencesLexer import PreferencesLexer, PreferencesLexerLanguageError
23 import UI.PixmapCache
24
25 from eric4config import getConfig
26
27 class ConfigurationPageItem(QTreeWidgetItem):
28 """
29 Class implementing a QTreeWidgetItem holding the configuration page data.
30 """
31 def __init__(self, parent, text, pageName, iconFile):
32 """
33 Constructor
34
35 @param parent parent widget of the item (QTreeWidget or QTreeWidgetItem)
36 @param text text to be displayed (string)
37 @param pageName name of the configuration page (string)
38 @param iconFile file name of the icon to be shown (string)
39 """
40 QTreeWidgetItem.__init__(self, parent, [text])
41 self.setIcon(0, UI.PixmapCache.getIcon(iconFile))
42
43 self.__pageName = pageName
44
45 def getPageName(self):
46 """
47 Public method to get the name of the associated configuration page.
48
49 @return name of the configuration page (string)
50 """
51 return self.__pageName
52
53 class ConfigurationWidget(QWidget):
54 """
55 Class implementing a dialog for the configuration of eric4.
56
57 @signal preferencesChanged emitted after settings have been changed
58 """
59 def __init__(self, parent = None, fromEric = True, helpBrowserMode = False):
60 """
61 Constructor
62
63 @param parent The parent widget of this dialog. (QWidget)
64 @keyparam fromEric flag indicating a dialog generation from within the
65 eric4 ide (boolean)
66 @keyparam helpBrowserMode flag indicating to show only help pages
67 for entries related to the help browser (boolean)
68 """
69 QWidget.__init__(self, parent)
70 self.fromEric = fromEric
71 self.helpBrowserMode = helpBrowserMode
72
73 self.__setupUi()
74
75 self.itmDict = {}
76
77 if not fromEric:
78 from PluginManager.PluginManager import PluginManager
79 try:
80 self.pluginManager = e4App().getObject("PluginManager")
81 except KeyError:
82 self.pluginManager = PluginManager(self)
83 e4App().registerObject("PluginManager", self.pluginManager)
84
85 if not helpBrowserMode:
86 self.configItems = {
87 # key : [display string, pixmap name, dialog module name or
88 # page creation function, parent key,
89 # reference to configuration page (must always be last)]
90 # The dialog module must have the module function create to create
91 # the configuration page. This must have the method save to save
92 # the settings.
93 "applicationPage" : \
94 [self.trUtf8("Application"), "preferences-application.png",
95 "ApplicationPage", None, None],
96 "corbaPage" : \
97 [self.trUtf8("CORBA"), "preferences-orbit.png",
98 "CorbaPage", None, None],
99 "emailPage" : \
100 [self.trUtf8("Email"), "preferences-mail_generic.png",
101 "EmailPage", None, None],
102 "graphicsPage" : \
103 [self.trUtf8("Graphics"), "preferences-graphics.png",
104 "GraphicsPage", None, None],
105 "iconsPage" : \
106 [self.trUtf8("Icons"), "preferences-icons.png",
107 "IconsPage", None, None],
108 "networkPage" : \
109 [self.trUtf8("Network"), "preferences-network.png",
110 "NetworkPage", None, None],
111 "pluginManagerPage" : \
112 [self.trUtf8("Plugin Manager"), "preferences-pluginmanager.png",
113 "PluginManagerPage", None, None],
114 "printerPage" : \
115 [self.trUtf8("Printer"), "preferences-printer.png",
116 "PrinterPage", None, None],
117 "pythonPage" : \
118 [self.trUtf8("Python"), "preferences-python.png",
119 "PythonPage", None, None],
120 "qtPage" : \
121 [self.trUtf8("Qt"), "preferences-qtlogo.png",
122 "QtPage", None, None],
123 "shellPage" : \
124 [self.trUtf8("Shell"), "preferences-shell.png",
125 "ShellPage", None, None],
126 "tasksPage" : \
127 [self.trUtf8("Tasks"), "task.png",
128 "TasksPage", None, None],
129 "templatesPage" : \
130 [self.trUtf8("Templates"), "preferences-template.png",
131 "TemplatesPage", None, None],
132 "terminalPage" : \
133 [self.trUtf8("Terminal"), "terminal.png",
134 "TerminalPage", None, None],
135 "vcsPage" : \
136 [self.trUtf8("Version Control Systems"), "preferences-vcs.png",
137 "VcsPage", None, None],
138
139 "0debuggerPage": \
140 [self.trUtf8("Debugger"), "preferences-debugger.png",
141 None, None, None],
142 "debuggerGeneralPage" : \
143 [self.trUtf8("General"), "preferences-debugger.png",
144 "DebuggerGeneralPage", "0debuggerPage", None],
145 "debuggerPythonPage" : \
146 [self.trUtf8("Python"), "preferences-pyDebugger.png",
147 "DebuggerPythonPage", "0debuggerPage", None],
148 "debuggerPython3Page" : \
149 [self.trUtf8("Python3"), "preferences-pyDebugger.png",
150 "DebuggerPython3Page", "0debuggerPage", None],
151 "debuggerRubyPage" : \
152 [self.trUtf8("Ruby"), "preferences-rbDebugger.png",
153 "DebuggerRubyPage", "0debuggerPage", None],
154
155 "0editorPage" : \
156 [self.trUtf8("Editor"), "preferences-editor.png",
157 None, None, None],
158 "editorAPIsPage" : \
159 [self.trUtf8("APIs"), "preferences-api.png",
160 "EditorAPIsPage", "0editorPage", None],
161 "editorAutocompletionPage" : \
162 [self.trUtf8("Autocompletion"), "preferences-autocompletion.png",
163 "EditorAutocompletionPage", "0editorPage", None],
164 "editorAutocompletionQScintillaPage" : \
165 [self.trUtf8("QScintilla"), "qscintilla.png",
166 "EditorAutocompletionQScintillaPage",
167 "editorAutocompletionPage", None],
168 "editorCalltipsPage" : \
169 [self.trUtf8("Calltips"), "preferences-calltips.png",
170 "EditorCalltipsPage", "0editorPage", None],
171 "editorCalltipsQScintillaPage" : \
172 [self.trUtf8("QScintilla"), "qscintilla.png",
173 "EditorCalltipsQScintillaPage", "editorCalltipsPage", None],
174 "editorGeneralPage" : \
175 [self.trUtf8("General"), "preferences-general.png",
176 "EditorGeneralPage", "0editorPage", None],
177 "editorFilePage" : \
178 [self.trUtf8("Filehandling"), "preferences-filehandling.png",
179 "EditorFilePage", "0editorPage", None],
180 "editorSearchPage" : \
181 [self.trUtf8("Searching"), "preferences-search.png",
182 "EditorSearchPage", "0editorPage", None],
183 "editorSpellCheckingPage" : \
184 [self.trUtf8("Spell checking"), "preferences-spellchecking.png",
185 "EditorSpellCheckingPage", "0editorPage", None],
186 "editorStylesPage" : \
187 [self.trUtf8("Style"), "preferences-styles.png",
188 "EditorStylesPage", "0editorPage", None],
189 "editorTypingPage" : \
190 [self.trUtf8("Typing"), "preferences-typing.png",
191 "EditorTypingPage", "0editorPage", None],
192 "editorExportersPage" : \
193 [self.trUtf8("Exporters"), "preferences-exporters.png",
194 "EditorExportersPage", "0editorPage", None],
195
196 "1editorLexerPage" : \
197 [self.trUtf8("Highlighters"), "preferences-highlighting-styles.png",
198 None, "0editorPage", None],
199 "editorHighlightersPage" : \
200 [self.trUtf8("Filetype Associations"),
201 "preferences-highlighter-association.png",
202 "EditorHighlightersPage", "1editorLexerPage", None],
203 "editorHighlightingStylesPage" : \
204 [self.trUtf8("Styles"),
205 "preferences-highlighting-styles.png",
206 "EditorHighlightingStylesPage", "1editorLexerPage", None],
207 "editorPropertiesPage" : \
208 [self.trUtf8("Properties"), "preferences-properties.png",
209 "EditorPropertiesPage", "1editorLexerPage", None],
210
211 "0helpPage" : \
212 [self.trUtf8("Help"), "preferences-help.png",
213 None, None, None],
214 "helpAppearancePage" : \
215 [self.trUtf8("Appearance"), "preferences-styles.png",
216 "HelpAppearancePage", "0helpPage", None],
217 "helpDocumentationPage" : \
218 [self.trUtf8("Help Documentation"),
219 "preferences-helpdocumentation.png",
220 "HelpDocumentationPage", "0helpPage", None],
221 "helpViewersPage" : \
222 [self.trUtf8("Help Viewers"), "preferences-helpviewers.png",
223 "HelpViewersPage", "0helpPage", None],
224 "helpWebBrowserPage" : \
225 [self.trUtf8("Eric Web Browser"), "ericWeb.png",
226 "HelpWebBrowserPage", "0helpPage", None],
227
228 "0projectPage" : \
229 [self.trUtf8("Project"), "preferences-project.png",
230 None, None, None],
231 "projectBrowserPage" : \
232 [self.trUtf8("Project Viewer"), "preferences-project.png",
233 "ProjectBrowserPage", "0projectPage", None],
234 "projectPage" : \
235 [self.trUtf8("Project"), "preferences-project.png",
236 "ProjectPage", "0projectPage", None],
237 "multiProjectPage" : \
238 [self.trUtf8("Multiproject"), "preferences-multiproject.png",
239 "MultiProjectPage", "0projectPage", None],
240
241 "0interfacePage" : \
242 [self.trUtf8("Interface"), "preferences-interface.png",
243 None, None, None],
244 "interfacePage" : \
245 [self.trUtf8("Interface"), "preferences-interface.png",
246 "InterfacePage", "0interfacePage", None],
247 "viewmanagerPage" : \
248 [self.trUtf8("Viewmanager"), "preferences-viewmanager.png",
249 "ViewmanagerPage", "0interfacePage", None],
250 }
251
252 self.configItems.update(
253 e4App().getObject("PluginManager").getPluginConfigData())
254 else:
255 self.configItems = {
256 # key : [display string, pixmap name, dialog module name or
257 # page creation function, parent key,
258 # reference to configuration page (must always be last)]
259 # The dialog module must have the module function create to create
260 # the configuration page. This must have the method save to save
261 # the settings.
262 "networkPage" : \
263 [self.trUtf8("Network"), "preferences-network.png",
264 "NetworkPage", None, None],
265 "pythonPage" : \
266 [self.trUtf8("Python"), "preferences-python.png",
267 "PythonPage", None, None],
268
269 "0helpPage" : \
270 [self.trUtf8("Help"), "preferences-help.png",
271 None, None, None],
272 "helpAppearancePage" : \
273 [self.trUtf8("Appearance"), "preferences-styles.png",
274 "HelpAppearancePage", "0helpPage", None],
275 "helpDocumentationPage" : \
276 [self.trUtf8("Help Documentation"),
277 "preferences-helpdocumentation.png",
278 "HelpDocumentationPage", "0helpPage", None],
279 "helpViewersPage" : \
280 [self.trUtf8("Help Viewers"), "preferences-helpviewers.png",
281 "HelpViewersPage", "0helpPage", None],
282 "helpWebBrowserPage" : \
283 [self.trUtf8("Eric Web Browser"), "ericWeb.png",
284 "HelpWebBrowserPage", "0helpPage", None],
285 }
286
287 # generate the list entries
288 itemsToExpand = []
289 for key in sorted(self.configItems.keys()):
290 pageData = self.configItems[key]
291 if pageData[3]:
292 pitm = self.itmDict[pageData[3]] # get the parent item
293 else:
294 pitm = self.configList
295 self.itmDict[key] = ConfigurationPageItem(pitm, pageData[0], key, pageData[1])
296 self.itmDict[key].setExpanded(True)
297 self.configList.sortByColumn(0, Qt.AscendingOrder)
298
299 # set the initial size of the splitter
300 self.configSplitter.setSizes([200, 600])
301
302 self.connect(self.configList, SIGNAL("itemActivated(QTreeWidgetItem *, int)"),
303 self.__showConfigurationPage)
304 self.connect(self.configList, SIGNAL("itemClicked(QTreeWidgetItem *, int)"),
305 self.__showConfigurationPage)
306
307 self.__initLexers()
308
309 def __setupUi(self):
310 """
311 Private method to perform the general setup of the configuration widget.
312 """
313 self.setObjectName("ConfigurationDialog")
314 self.resize(900, 650)
315 self.setProperty("sizeGripEnabled", QVariant(True))
316 self.verticalLayout_2 = QVBoxLayout(self)
317 self.verticalLayout_2.setSpacing(6)
318 self.verticalLayout_2.setMargin(6)
319 self.verticalLayout_2.setObjectName("verticalLayout_2")
320
321 self.configSplitter = QSplitter(self)
322 self.configSplitter.setOrientation(Qt.Horizontal)
323 self.configSplitter.setObjectName("configSplitter")
324
325 self.configList = QTreeWidget(self.configSplitter)
326 self.configList.setObjectName("configList")
327
328 self.scrollArea = QScrollArea(self.configSplitter)
329 self.scrollArea.setFrameShape(QFrame.NoFrame)
330 self.scrollArea.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn)
331 self.scrollArea.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOn)
332 self.scrollArea.setWidgetResizable(False)
333 self.scrollArea.setObjectName("scrollArea")
334
335 self.configStack = QStackedWidget()
336 self.configStack.setFrameShape(QFrame.Box)
337 self.configStack.setFrameShadow(QFrame.Sunken)
338 self.configStack.setObjectName("configStack")
339 self.scrollArea.setWidget(self.configStack)
340
341 self.emptyPage = QWidget()
342 self.emptyPage.setGeometry(QRect(0, 0, 372, 591))
343 self.emptyPage.setObjectName("emptyPage")
344 self.vboxlayout = QVBoxLayout(self.emptyPage)
345 self.vboxlayout.setSpacing(6)
346 self.vboxlayout.setMargin(6)
347 self.vboxlayout.setObjectName("vboxlayout")
348 spacerItem = QSpacerItem(20, 20, QSizePolicy.Minimum, QSizePolicy.Expanding)
349 self.vboxlayout.addItem(spacerItem)
350 self.emptyPagePixmap = QLabel(self.emptyPage)
351 self.emptyPagePixmap.setAlignment(Qt.AlignCenter)
352 self.emptyPagePixmap.setObjectName("emptyPagePixmap")
353 self.emptyPagePixmap.setPixmap(
354 QPixmap(os.path.join(getConfig('ericPixDir'), 'eric.png')))
355 self.vboxlayout.addWidget(self.emptyPagePixmap)
356 self.textLabel1 = QLabel(self.emptyPage)
357 self.textLabel1.setAlignment(Qt.AlignCenter)
358 self.textLabel1.setObjectName("textLabel1")
359 self.vboxlayout.addWidget(self.textLabel1)
360 spacerItem1 = QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding)
361 self.vboxlayout.addItem(spacerItem1)
362 self.configStack.addWidget(self.emptyPage)
363
364 self.verticalLayout_2.addWidget(self.configSplitter)
365
366 self.buttonBox = QDialogButtonBox(self)
367 self.buttonBox.setOrientation(Qt.Horizontal)
368 self.buttonBox.setStandardButtons(
369 QDialogButtonBox.Apply | QDialogButtonBox.Cancel | \
370 QDialogButtonBox.Ok | QDialogButtonBox.Reset)
371 self.buttonBox.setObjectName("buttonBox")
372 if not self.fromEric and not self.helpBrowserMode:
373 self.buttonBox.button(QDialogButtonBox.Apply).hide()
374 self.buttonBox.button(QDialogButtonBox.Apply).setEnabled(False)
375 self.buttonBox.button(QDialogButtonBox.Reset).setEnabled(False)
376 self.verticalLayout_2.addWidget(self.buttonBox)
377
378 self.setWindowTitle(self.trUtf8("Preferences"))
379
380 self.configList.header().hide()
381 self.configList.header().setSortIndicator(0, Qt.AscendingOrder)
382 self.configList.setSortingEnabled(True)
383 self.textLabel1.setText(self.trUtf8("Please select an entry of the list \n"
384 "to display the configuration page."))
385
386 QMetaObject.connectSlotsByName(self)
387 self.setTabOrder(self.configList, self.configStack)
388
389 self.configStack.setCurrentWidget(self.emptyPage)
390
391 def __initLexers(self):
392 """
393 Private method to initialize the dictionary of preferences lexers.
394 """
395 self.lexers = {}
396 for language in QScintilla.Lexers.getSupportedLanguages():
397 try:
398 self.lexers[language] = PreferencesLexer(language, self)
399 except PreferencesLexerLanguageError:
400 pass
401
402 def __importConfigurationPage(self, name):
403 """
404 Private method to import a configuration page module.
405
406 @param name name of the configuration page module (string)
407 @return reference to the configuration page module
408 """
409 modName = "Preferences.ConfigurationPages.%s" % name
410 try:
411 mod = __import__(modName)
412 components = modName.split('.')
413 for comp in components[1:]:
414 mod = getattr(mod, comp)
415 return mod
416 except ImportError:
417 QMessageBox.critical(None,
418 self.trUtf8("Configuration Page Error"),
419 self.trUtf8("""<p>The configuration page <b>{0}</b>"""
420 """ could not be loaded.</p>""").format(name))
421 return None
422
423 def __showConfigurationPage(self, itm, column):
424 """
425 Private slot to show a selected configuration page.
426
427 @param itm reference to the selected item (QTreeWidgetItem)
428 @param column column that was selected (integer) (ignored)
429 """
430 pageName = itm.getPageName()
431 self.showConfigurationPageByName(pageName)
432
433 def __initPage(self, pageData):
434 """
435 Private method to initialize a configuration page.
436
437 @param pageData data structure for the page to initialize
438 @return reference to the initialized page
439 """
440 page = None
441 if type(pageData[2] ) is types.FunctionType:
442 page = pageData[2](self)
443 else:
444 mod = self.__importConfigurationPage(pageData[2])
445 if mod:
446 page = mod.create(self)
447 if page is not None:
448 self.configStack.addWidget(page)
449 pageData[-1] = page
450 return page
451
452 def showConfigurationPageByName(self, pageName):
453 """
454 Public slot to show a named configuration page.
455
456 @param pageName name of the configuration page to show (string)
457 """
458 if pageName == "empty":
459 page = self.emptyPage
460 else:
461 pageData = self.configItems[pageName]
462 if pageData[-1] is None and pageData[2] is not None:
463 # the page was not loaded yet, create it
464 page = self.__initPage(pageData)
465 else:
466 page = pageData[-1]
467 if page is None:
468 page = self.emptyPage
469 self.configStack.setCurrentWidget(page)
470 ssize = self.scrollArea.size()
471 if self.scrollArea.horizontalScrollBar():
472 ssize.setHeight(
473 ssize.height() - self.scrollArea.horizontalScrollBar().height() - 2)
474 if self.scrollArea.verticalScrollBar():
475 ssize.setWidth(
476 ssize.width() - self.scrollArea.verticalScrollBar().width() - 2)
477 psize = page.minimumSizeHint()
478 self.configStack.resize(max(ssize.width(), psize.width()),
479 max(ssize.height(), psize.height()))
480
481 if page != self.emptyPage:
482 page.polishPage()
483 self.buttonBox.button(QDialogButtonBox.Apply).setEnabled(True)
484 self.buttonBox.button(QDialogButtonBox.Reset).setEnabled(True)
485 else:
486 self.buttonBox.button(QDialogButtonBox.Apply).setEnabled(False)
487 self.buttonBox.button(QDialogButtonBox.Reset).setEnabled(False)
488
489 # reset scrollbars
490 for sb in [self.scrollArea.horizontalScrollBar(),
491 self.scrollArea.verticalScrollBar()]:
492 if sb:
493 sb.setValue(0)
494
495 def calledFromEric(self):
496 """
497 Public method to check, if invoked from within eric.
498
499 @return flag indicating invocation from within eric (boolean)
500 """
501 return self.fromEric
502
503 def getPage(self, pageName):
504 """
505 Public method to get a reference to the named page.
506
507 @param pageName name of the configuration page (string)
508 @return reference to the page or None, indicating page was
509 not loaded yet
510 """
511 return self.configItems[pageName][-1]
512
513 def getLexers(self):
514 """
515 Public method to get a reference to the lexers dictionary.
516
517 @return reference to the lexers dictionary
518 """
519 return self.lexers
520
521 def setPreferences(self):
522 """
523 Public method called to store the selected values into the preferences storage.
524 """
525 for key, pageData in self.configItems.items():
526 if pageData[-1]:
527 pageData[-1].save()
528 # page was loaded (and possibly modified)
529 QApplication.processEvents() # ensure HMI is responsive
530
531 def on_buttonBox_clicked(self, button):
532 """
533 Private slot called by a button of the button box clicked.
534
535 @param button button that was clicked (QAbstractButton)
536 """
537 if button == self.buttonBox.button(QDialogButtonBox.Apply):
538 self.on_applyButton_clicked()
539 elif button == self.buttonBox.button(QDialogButtonBox.Reset):
540 self.on_resetButton_clicked()
541
542 @pyqtSlot()
543 def on_applyButton_clicked(self):
544 """
545 Private slot called to apply the settings of the current page.
546 """
547 if self.configStack.currentWidget() != self.emptyPage:
548 page = self.configStack.currentWidget()
549 savedState = page.saveState()
550 page.save()
551 self.emit(SIGNAL('preferencesChanged'))
552 if savedState is not None:
553 page.setState(savedState)
554
555 @pyqtSlot()
556 def on_resetButton_clicked(self):
557 """
558 Private slot called to reset the settings of the current page.
559 """
560 if self.configStack.currentWidget() != self.emptyPage:
561 currentPage = self.configStack.currentWidget()
562 savedState = currentPage.saveState()
563 pageName = self.configList.currentItem().getPageName()
564 self.configStack.removeWidget(currentPage)
565 if pageName == "editorHighlightingStylesPage":
566 self.__initLexers()
567 pageData = self.configItems[pageName]
568 pageData[-1] = None
569
570 self.showConfigurationPageByName(pageName)
571 if savedState is not None:
572 self.configStack.currentWidget().setState(savedState)
573
574 class ConfigurationDialog(QDialog):
575 """
576 Class for the dialog variant.
577
578 @signal preferencesChanged emitted after settings have been changed
579 """
580 def __init__(self, parent = None, name = None, modal = False,
581 fromEric = True, helpBrowserMode = False):
582 """
583 Constructor
584
585 @param parent The parent widget of this dialog. (QWidget)
586 @param name The name of this dialog. string
587 @param modal Flag indicating a modal dialog. (boolean)
588 @keyparam fromEric flag indicating a dialog generation from within the
589 eric4 ide (boolean)
590 @keyparam helpBrowserMode flag indicating to show only help pages
591 for entries related to the help browser (boolean)
592 """
593 QDialog.__init__(self, parent)
594 if name:
595 self.setObjectName(name)
596 self.setModal(modal)
597 self.layout = QVBoxLayout(self)
598 self.layout.setMargin(0)
599 self.layout.setSpacing(0)
600
601 self.cw = ConfigurationWidget(self, fromEric = fromEric,
602 helpBrowserMode = helpBrowserMode)
603 size = self.cw.size()
604 self.layout.addWidget(self.cw)
605 self.resize(size)
606
607 self.connect(self.cw.buttonBox, SIGNAL("accepted()"), self.accept)
608 self.connect(self.cw.buttonBox, SIGNAL("rejected()"), self.reject)
609 self.connect(self.cw, SIGNAL('preferencesChanged'),
610 self.__preferencesChanged)
611
612 def __preferencesChanged(self):
613 """
614 Private slot to handle a change of the preferences.
615 """
616 self.emit(SIGNAL('preferencesChanged'))
617
618 def showConfigurationPageByName(self, pageName):
619 """
620 Public slot to show a named configuration page.
621
622 @param pageName name of the configuration page to show (string)
623 """
624 self.cw.showConfigurationPageByName(pageName)
625
626 def setPreferences(self):
627 """
628 Public method called to store the selected values into the preferences storage.
629 """
630 self.cw.setPreferences()
631
632 class ConfigurationWindow(QMainWindow):
633 """
634 Main window class for the standalone dialog.
635 """
636 def __init__(self, parent = None):
637 """
638 Constructor
639
640 @param parent reference to the parent widget (QWidget)
641 """
642 QMainWindow.__init__(self, parent)
643
644 self.cw = ConfigurationWidget(self, fromEric = False)
645 size = self.cw.size()
646 self.setCentralWidget(self.cw)
647 self.resize(size)
648
649 self.connect(self.cw.buttonBox, SIGNAL("accepted()"), self.accept)
650 self.connect(self.cw.buttonBox, SIGNAL("rejected()"), self.close)
651
652 def showConfigurationPageByName(self, pageName):
653 """
654 Public slot to show a named configuration page.
655
656 @param pageName name of the configuration page to show (string)
657 """
658 self.cw.showConfigurationPageByName(pageName)
659
660 def accept(self):
661 """
662 Protected slot called by the Ok button.
663 """
664 self.cw.setPreferences()
665 Preferences.saveResetLayout()
666 Preferences.syncPreferences()
667 self.close()

eric ide

mercurial