ProjectFlask/ConfigurationPage/FlaskPage.py

branch
eric7
changeset 70
22e1d0f69668
parent 66
0d3168d0e310
child 72
4557829a4acf
--- a/ProjectFlask/ConfigurationPage/FlaskPage.py	Thu Dec 30 12:13:22 2021 +0100
+++ b/ProjectFlask/ConfigurationPage/FlaskPage.py	Wed Sep 21 16:30:15 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_FlaskPage import Ui_FlaskPage
 
 import UI.PixmapCache
@@ -28,19 +26,20 @@
     """
     Class implementing the Flask configuration page.
     """
+
     def __init__(self, plugin):
         """
         Constructor
-        
+
         @param plugin reference to the plugin object
         @type ProjectFlaskPlugin
         """
         super().__init__()
         self.setupUi(self)
         self.setObjectName("FlaskPage")
-        
+
         self.__plugin = plugin
-        
+
         consoleList = []
         if isWindowsPlatform():
             consoleList.append("cmd.exe /c")
@@ -54,71 +53,72 @@
             consoleList.append("xfce4-terminal -e")
             consoleList.append("xterm -e")
         self.consoleCommandCombo.addItems(consoleList)
-        
-        self.colorSchemeComboBox.addItems(
-            sorted(AnsiTools.getAvailableColorSchemes()))
-        
-        self.urlResetButton.setIcon(
-            UI.PixmapCache.getIcon("editUndo"))
-        self.py3VenvNamesReloadButton.setIcon(
-            UI.PixmapCache.getIcon("reload"))
-        
+
+        self.colorSchemeComboBox.addItems(sorted(AnsiTools.getAvailableColorSchemes()))
+
+        self.urlResetButton.setIcon(UI.PixmapCache.getIcon("editUndo"))
+        self.py3VenvNamesReloadButton.setIcon(UI.PixmapCache.getIcon("reload"))
+
         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.colorSchemeComboBox.setCurrentText(
-            self.__plugin.getPreferences("AnsiColorScheme"))
-        
-        self.urlEdit.setText(
-            self.__plugin.getPreferences("FlaskDocUrl"))
-        
+            self.__plugin.getPreferences("AnsiColorScheme")
+        )
+
+        self.urlEdit.setText(self.__plugin.getPreferences("FlaskDocUrl"))
+
         self.translationsEditorPicker.setText(
-            self.__plugin.getPreferences("TranslationsEditor"))
-    
+            self.__plugin.getPreferences("TranslationsEditor")
+        )
+
     def save(self):
         """
         Public slot to save the Flask configuration.
         """
         self.__plugin.setPreferences(
-            "ConsoleCommand", self.consoleCommandCombo.currentText())
-        
+            "ConsoleCommand", self.consoleCommandCombo.currentText()
+        )
+
         self.__plugin.setPreferences(
-            "UseExternalBrowser", self.externalBrowserCheckBox.isChecked())
-        
-        self.__plugin.setPreferences(
-            "VirtualEnvironmentNamePy3",
-            self.py3VenvNameComboBox.currentText())
-        
+            "UseExternalBrowser", self.externalBrowserCheckBox.isChecked()
+        )
+
         self.__plugin.setPreferences(
-            "AnsiColorScheme",
-            self.colorSchemeComboBox.currentText())
-        
+            "VirtualEnvironmentNamePy3", self.py3VenvNameComboBox.currentText()
+        )
+
         self.__plugin.setPreferences(
-            "FlaskDocUrl", self.urlEdit.text())
-        
+            "AnsiColorScheme", self.colorSchemeComboBox.currentText()
+        )
+
+        self.__plugin.setPreferences("FlaskDocUrl", self.urlEdit.text())
+
         self.__plugin.setPreferences(
-            "TranslationsEditor", self.translationsEditorPicker.text())
-    
+            "TranslationsEditor", self.translationsEditorPicker.text()
+        )
+
     @pyqtSlot()
     def on_py3VenvNamesReloadButton_clicked(self):
         """
@@ -128,17 +128,17 @@
         self.py3VenvNameComboBox.clear()
         venvManager = ericApp().getObject("VirtualEnvManager")
         self.py3VenvNameComboBox.addItems(
-            [""] + sorted(venvManager.getVirtualenvNames()))
+            [""] + sorted(venvManager.getVirtualenvNames())
+        )
         if currentVenvName:
             index = self.py3VenvNameComboBox.findText(currentVenvName)
             if index < 0:
                 index = 0
             self.py3VenvNameComboBox.setCurrentIndex(index)
-    
+
     @pyqtSlot()
     def on_urlResetButton_clicked(self):
         """
         Private slot to reset the Flask documentation URL.
         """
-        self.urlEdit.setText(
-            self.__plugin.getDefaultPreference("FlaskDocUrl"))
+        self.urlEdit.setText(self.__plugin.getDefaultPreference("FlaskDocUrl"))

eric ide

mercurial