Preferences/ConfigurationDialog.py

changeset 1791
3e946bfda98a
parent 1789
ebf61384cfdb
child 1964
6a6a53f2d086
child 2303
0ed4ed026c16
equal deleted inserted replaced
1789:ebf61384cfdb 1791:3e946bfda98a
60 Class implementing a dialog for the configuration of eric5. 60 Class implementing a dialog for the configuration of eric5.
61 61
62 @signal preferencesChanged() emitted after settings have been changed 62 @signal preferencesChanged() emitted after settings have been changed
63 @signal masterPasswordChanged(str, str) emitted after the master 63 @signal masterPasswordChanged(str, str) emitted after the master
64 password has been changed with the old and the new password 64 password has been changed with the old and the new password
65 @signal accepted() emitted to indicate acceptance of the changes
66 @signal rejected() emitted to indicate rejection of the changes
65 """ 67 """
66 preferencesChanged = pyqtSignal() 68 preferencesChanged = pyqtSignal()
67 masterPasswordChanged = pyqtSignal(str, str) 69 masterPasswordChanged = pyqtSignal(str, str)
70 accepted = pyqtSignal()
71 rejected = pyqtSignal()
68 72
69 DefaultMode = 0 73 DefaultMode = 0
70 HelpBrowserMode = 1 74 HelpBrowserMode = 1
71 TrayStarterMode = 2 75 TrayStarterMode = 2
72 76
356 # set the initial size of the splitter 360 # set the initial size of the splitter
357 self.configSplitter.setSizes([200, 600]) 361 self.configSplitter.setSizes([200, 600])
358 362
359 self.configList.itemActivated.connect(self.__showConfigurationPage) 363 self.configList.itemActivated.connect(self.__showConfigurationPage)
360 self.configList.itemClicked.connect(self.__showConfigurationPage) 364 self.configList.itemClicked.connect(self.__showConfigurationPage)
365 self.buttonBox.accepted.connect(self.accept)
366 self.buttonBox.rejected.connect(self.rejected)
361 367
362 if displayMode != ConfigurationWidget.TrayStarterMode: 368 if displayMode != ConfigurationWidget.TrayStarterMode:
363 self.__initLexers() 369 self.__initLexers()
370
371 def accept(self):
372 """
373 Public slot to accept the buttonBox accept signal.
374 """
375 wdg = self.focusWidget()
376 if wdg == self.configList:
377 return
378
379 self.accepted.emit()
364 380
365 def __setupUi(self): 381 def __setupUi(self):
366 """ 382 """
367 Private method to perform the general setup of the configuration widget. 383 Private method to perform the general setup of the configuration widget.
368 """ 384 """
687 displayMode=displayMode) 703 displayMode=displayMode)
688 size = self.cw.size() 704 size = self.cw.size()
689 self.layout.addWidget(self.cw) 705 self.layout.addWidget(self.cw)
690 self.resize(size) 706 self.resize(size)
691 707
692 self.cw.buttonBox.accepted[()].connect(self.accept) 708 self.cw.accepted[()].connect(self.accept)
693 self.cw.buttonBox.rejected[()].connect(self.reject) 709 self.cw.rejected[()].connect(self.reject)
694 self.cw.preferencesChanged.connect(self.__preferencesChanged) 710 self.cw.preferencesChanged.connect(self.__preferencesChanged)
695 self.cw.masterPasswordChanged.connect(self.__masterPasswordChanged) 711 self.cw.masterPasswordChanged.connect(self.__masterPasswordChanged)
696 712
697 def __preferencesChanged(self): 713 def __preferencesChanged(self):
698 """ 714 """
728 def setPreferences(self): 744 def setPreferences(self):
729 """ 745 """
730 Public method called to store the selected values into the preferences storage. 746 Public method called to store the selected values into the preferences storage.
731 """ 747 """
732 self.cw.setPreferences() 748 self.cw.setPreferences()
749
750 def accept(self):
751 super().accept()
733 752
734 753
735 class ConfigurationWindow(QMainWindow): 754 class ConfigurationWindow(QMainWindow):
736 """ 755 """
737 Main window class for the standalone dialog. 756 Main window class for the standalone dialog.
747 self.cw = ConfigurationWidget(self, fromEric=False) 766 self.cw = ConfigurationWidget(self, fromEric=False)
748 size = self.cw.size() 767 size = self.cw.size()
749 self.setCentralWidget(self.cw) 768 self.setCentralWidget(self.cw)
750 self.resize(size) 769 self.resize(size)
751 770
752 self.cw.buttonBox.accepted[()].connect(self.accept) 771 self.cw.accepted[()].connect(self.accept)
753 self.cw.buttonBox.rejected[()].connect(self.close) 772 self.cw.rejected[()].connect(self.close)
754 773
755 def showConfigurationPageByName(self, pageName): 774 def showConfigurationPageByName(self, pageName):
756 """ 775 """
757 Public slot to show a named configuration page. 776 Public slot to show a named configuration page.
758 777

eric ide

mercurial