76 rejected = pyqtSignal() |
76 rejected = pyqtSignal() |
77 |
77 |
78 DefaultMode = 0 |
78 DefaultMode = 0 |
79 HelpBrowserMode = 1 |
79 HelpBrowserMode = 1 |
80 TrayStarterMode = 2 |
80 TrayStarterMode = 2 |
|
81 HexEditorMode = 3 |
81 |
82 |
82 def __init__(self, parent=None, fromEric=True, displayMode=DefaultMode, |
83 def __init__(self, parent=None, fromEric=True, displayMode=DefaultMode, |
83 expandedEntries=[]): |
84 expandedEntries=[]): |
84 """ |
85 """ |
85 Constructor |
86 Constructor |
86 |
87 |
87 @param parent The parent widget of this dialog. (QWidget) |
88 @param parent The parent widget of this dialog. (QWidget) |
88 @keyparam fromEric flag indicating a dialog generation from within the |
89 @keyparam fromEric flag indicating a dialog generation from within the |
89 eric6 ide (boolean) |
90 eric6 ide (boolean) |
90 @keyparam displayMode mode of the configuration dialog |
91 @keyparam displayMode mode of the configuration dialog |
91 (DefaultMode, HelpBrowserMode, TrayStarterMode) |
92 (DefaultMode, HelpBrowserMode, TrayStarterMode, HexEditorMode) |
92 @exception RuntimeError raised to indicate an invalid dialog mode |
93 @exception RuntimeError raised to indicate an invalid dialog mode |
93 @keyparam expandedEntries list of entries to be shown expanded |
94 @keyparam expandedEntries list of entries to be shown expanded |
94 (list of strings) |
95 (list of strings) |
95 """ |
96 """ |
96 assert displayMode in ( |
97 assert displayMode in ( |
97 ConfigurationWidget.DefaultMode, |
98 ConfigurationWidget.DefaultMode, |
98 ConfigurationWidget.HelpBrowserMode, |
99 ConfigurationWidget.HelpBrowserMode, |
99 ConfigurationWidget.TrayStarterMode |
100 ConfigurationWidget.TrayStarterMode, |
|
101 ConfigurationWidget.HexEditorMode, |
100 ) |
102 ) |
101 |
103 |
102 super(ConfigurationWidget, self).__init__(parent) |
104 super(ConfigurationWidget, self).__init__(parent) |
103 self.fromEric = fromEric |
105 self.fromEric = fromEric |
104 self.displayMode = displayMode |
106 self.displayMode = displayMode |
136 [self.tr("Email"), "preferences-mail_generic.png", |
138 [self.tr("Email"), "preferences-mail_generic.png", |
137 "EmailPage", None, None], |
139 "EmailPage", None, None], |
138 "graphicsPage": |
140 "graphicsPage": |
139 [self.tr("Graphics"), "preferences-graphics.png", |
141 [self.tr("Graphics"), "preferences-graphics.png", |
140 "GraphicsPage", None, None], |
142 "GraphicsPage", None, None], |
|
143 "hexEditorPage": |
|
144 [self.tr("Hex Editor"), "hexEditor.png", |
|
145 "HexEditorPage", None, None], |
141 "iconsPage": |
146 "iconsPage": |
142 [self.tr("Icons"), "preferences-icons.png", |
147 [self.tr("Icons"), "preferences-icons.png", |
143 "IconsPage", None, None], |
148 "IconsPage", None, None], |
144 "ircPage": |
149 "ircPage": |
145 [self.tr("IRC"), "irc.png", |
150 [self.tr("IRC"), "irc.png", |
393 "trayStarterPage": |
398 "trayStarterPage": |
394 [self.tr("Tray Starter"), "erict.png", |
399 [self.tr("Tray Starter"), "erict.png", |
395 "TrayStarterPage", None, None], |
400 "TrayStarterPage", None, None], |
396 } |
401 } |
397 |
402 |
|
403 elif displayMode == ConfigurationWidget.HexEditorMode: |
|
404 self.configItems = { |
|
405 # key : [display string, pixmap name, dialog module name or |
|
406 # page creation function, parent key, |
|
407 # reference to configuration page (must always be last)] |
|
408 # The dialog module must have the module function 'create' to |
|
409 # create the configuration page. This must have the method |
|
410 # 'save' to save the settings. |
|
411 "hexEditorPage": |
|
412 [self.tr("Hex Editor"), "hexEditor.png", |
|
413 "HexEditorPage", None, None], |
|
414 } |
|
415 |
398 else: |
416 else: |
399 raise RuntimeError("Illegal mode value: {0}".format(displayMode)) |
417 raise RuntimeError("Illegal mode value: {0}".format(displayMode)) |
400 |
418 |
401 # generate the list entries |
419 # generate the list entries |
402 self.__expandedEntries = [] |
420 self.__expandedEntries = [] |
424 self.configList.itemActivated.connect(self.__showConfigurationPage) |
442 self.configList.itemActivated.connect(self.__showConfigurationPage) |
425 self.configList.itemClicked.connect(self.__showConfigurationPage) |
443 self.configList.itemClicked.connect(self.__showConfigurationPage) |
426 self.buttonBox.accepted.connect(self.accept) |
444 self.buttonBox.accepted.connect(self.accept) |
427 self.buttonBox.rejected.connect(self.rejected) |
445 self.buttonBox.rejected.connect(self.rejected) |
428 |
446 |
429 if displayMode != ConfigurationWidget.TrayStarterMode: |
447 if displayMode in [ConfigurationWidget.HelpBrowserMode, |
|
448 ConfigurationWidget.TrayStarterMode, |
|
449 ConfigurationWidget.HexEditorMode]: |
|
450 self.configListSearch.hide() |
|
451 |
|
452 if displayMode not in [ConfigurationWidget.TrayStarterMode, |
|
453 ConfigurationWidget.HexEditorMode]: |
430 self.__initLexers() |
454 self.__initLexers() |
431 |
455 |
432 def accept(self): |
456 def accept(self): |
433 """ |
457 """ |
434 Public slot to accept the buttonBox accept signal. |
458 Public slot to accept the buttonBox accept signal. |
762 savedState = page.saveState() |
786 savedState = page.saveState() |
763 page.save() |
787 page.save() |
764 self.preferencesChanged.emit() |
788 self.preferencesChanged.emit() |
765 if savedState is not None: |
789 if savedState is not None: |
766 page.setState(savedState) |
790 page.setState(savedState) |
|
791 page.polishPage() |
767 |
792 |
768 @pyqtSlot() |
793 @pyqtSlot() |
769 def on_resetButton_clicked(self): |
794 def on_resetButton_clicked(self): |
770 """ |
795 """ |
771 Private slot called to reset the settings of the current page. |
796 Private slot called to reset the settings of the current page. |
826 masterPasswordChanged = pyqtSignal(str, str) |
851 masterPasswordChanged = pyqtSignal(str, str) |
827 |
852 |
828 DefaultMode = ConfigurationWidget.DefaultMode |
853 DefaultMode = ConfigurationWidget.DefaultMode |
829 HelpBrowserMode = ConfigurationWidget.HelpBrowserMode |
854 HelpBrowserMode = ConfigurationWidget.HelpBrowserMode |
830 TrayStarterMode = ConfigurationWidget.TrayStarterMode |
855 TrayStarterMode = ConfigurationWidget.TrayStarterMode |
|
856 HexEditorMode = ConfigurationWidget.HexEditorMode |
831 |
857 |
832 def __init__(self, parent=None, name=None, modal=False, |
858 def __init__(self, parent=None, name=None, modal=False, |
833 fromEric=True, displayMode=ConfigurationWidget.DefaultMode, |
859 fromEric=True, displayMode=ConfigurationWidget.DefaultMode, |
834 expandedEntries=[]): |
860 expandedEntries=[]): |
835 """ |
861 """ |
839 @param name The name of this dialog. string |
865 @param name The name of this dialog. string |
840 @param modal Flag indicating a modal dialog. (boolean) |
866 @param modal Flag indicating a modal dialog. (boolean) |
841 @keyparam fromEric flag indicating a dialog generation from within the |
867 @keyparam fromEric flag indicating a dialog generation from within the |
842 eric6 ide (boolean) |
868 eric6 ide (boolean) |
843 @keyparam displayMode mode of the configuration dialog |
869 @keyparam displayMode mode of the configuration dialog |
844 (DefaultMode, HelpBrowserMode, TrayStarterMode) |
870 (DefaultMode, HelpBrowserMode, TrayStarterMode, HexEditorMode) |
845 @keyparam expandedEntries list of entries to be shown expanded |
871 @keyparam expandedEntries list of entries to be shown expanded |
846 (list of strings) |
872 (list of strings) |
847 """ |
873 """ |
848 super(ConfigurationDialog, self).__init__(parent) |
874 super(ConfigurationDialog, self).__init__(parent) |
849 if name: |
875 if name: |