diff -r 24582cac737e -r d4e7f5a389e6 ProjectPyramid/ConfigurationPage/PyramidPage.py --- a/ProjectPyramid/ConfigurationPage/PyramidPage.py Thu Dec 30 12:17:44 2021 +0100 +++ b/ProjectPyramid/ConfigurationPage/PyramidPage.py Wed Sep 21 16:24:54 2022 +0200 @@ -12,9 +12,7 @@ from EricWidgets.EricApplication import ericApp from EricWidgets.EricPathPicker import EricPathPickerModes -from Preferences.ConfigurationPages.ConfigurationPageBase import ( - ConfigurationPageBase -) +from Preferences.ConfigurationPages.ConfigurationPageBase import ConfigurationPageBase from .Ui_PyramidPage import Ui_PyramidPage import UI.PixmapCache @@ -26,19 +24,20 @@ """ Class implementing the Pyramid configuration page. """ + def __init__(self, plugin): """ Constructor - + @param plugin reference to the plugin object @type ProjectPyramidPlugin """ super().__init__() self.setupUi(self) self.setObjectName("PyramidPage") - + self.__plugin = plugin - + consoleList = [] if isWindowsPlatform(): consoleList.append("cmd.exe /c") @@ -53,72 +52,78 @@ consoleList.append("xfce4-terminal -e") consoleList.append("xterm -e") self.consoleCommandCombo.addItems(consoleList) - + self.urlResetButton.setIcon(UI.PixmapCache.getIcon("editUndo")) - + self.py3ShellCombo.addItem(self.tr("Plain Python"), "python") self.py3ShellCombo.addItem(self.tr("IPython"), "ipython") self.py3ShellCombo.addItem(self.tr("bpython"), "bpython") - + venvManager = ericApp().getObject("VirtualEnvManager") - + self.py3VenvNameComboBox.addItems( - [""] + sorted(venvManager.getVirtualenvNames())) - - self.translationsEditorPicker.setMode( - EricPathPickerModes.OPEN_FILE_MODE) + [""] + sorted(venvManager.getVirtualenvNames()) + ) + + self.translationsEditorPicker.setMode(EricPathPickerModes.OPEN_FILE_MODE) self.translationsEditorPicker.setFilters(self.tr("All Files (*)")) - + # set initial values self.consoleCommandCombo.setEditText( - self.__plugin.getPreferences("ConsoleCommand")) - + self.__plugin.getPreferences("ConsoleCommand") + ) + self.externalBrowserCheckBox.setChecked( - self.__plugin.getPreferences("UseExternalBrowser")) - - venvName = self.__plugin.getPreferences( - "VirtualEnvironmentNamePy3") + self.__plugin.getPreferences("UseExternalBrowser") + ) + + venvName = self.__plugin.getPreferences("VirtualEnvironmentNamePy3") if venvName: index = self.py3VenvNameComboBox.findText(venvName) if index < 0: index = 0 self.py3VenvNameComboBox.setCurrentIndex(index) - self.py3ShellCombo.setCurrentIndex(self.py3ShellCombo.findData( - self.__plugin.getPreferences("Python3ConsoleType"))) - - self.urlEdit.setText( - self.__plugin.getPreferences("PyramidDocUrl")) - + self.py3ShellCombo.setCurrentIndex( + self.py3ShellCombo.findData( + self.__plugin.getPreferences("Python3ConsoleType") + ) + ) + + self.urlEdit.setText(self.__plugin.getPreferences("PyramidDocUrl")) + self.translationsEditorPicker.setText( - self.__plugin.getPreferences("TranslationsEditor")) - + self.__plugin.getPreferences("TranslationsEditor") + ) + def save(self): """ Public slot to save the Pyramid configuration. """ self.__plugin.setPreferences( - "ConsoleCommand", self.consoleCommandCombo.currentText()) - + "ConsoleCommand", self.consoleCommandCombo.currentText() + ) + self.__plugin.setPreferences( - "UseExternalBrowser", self.externalBrowserCheckBox.isChecked()) - + "UseExternalBrowser", self.externalBrowserCheckBox.isChecked() + ) + self.__plugin.setPreferences( - "VirtualEnvironmentNamePy3", - self.py3VenvNameComboBox.currentText()) + "VirtualEnvironmentNamePy3", self.py3VenvNameComboBox.currentText() + ) self.__plugin.setPreferences( "Python3ConsoleType", - self.py3ShellCombo.itemData(self.py3ShellCombo.currentIndex())) - + self.py3ShellCombo.itemData(self.py3ShellCombo.currentIndex()), + ) + + self.__plugin.setPreferences("PyramidDocUrl", self.urlEdit.text()) + self.__plugin.setPreferences( - "PyramidDocUrl", self.urlEdit.text()) - - self.__plugin.setPreferences( - "TranslationsEditor", self.translationsEditorPicker.text()) - + "TranslationsEditor", self.translationsEditorPicker.text() + ) + @pyqtSlot() def on_urlResetButton_clicked(self): """ Private slot to reset the Pyramid documentation URL. """ - self.urlEdit.setText( - self.__plugin.getDefaultPreference("PyramidDocUrl")) + self.urlEdit.setText(self.__plugin.getDefaultPreference("PyramidDocUrl"))