ProjectFlask/ConfigurationPage/FlaskPage.py

changeset 9
79094fb72c18
parent 6
d491ccab7343
child 11
da6ef8ab8268
--- a/ProjectFlask/ConfigurationPage/FlaskPage.py	Fri Nov 13 19:51:28 2020 +0100
+++ b/ProjectFlask/ConfigurationPage/FlaskPage.py	Sat Nov 14 19:56:06 2020 +0100
@@ -18,10 +18,11 @@
 
 import UI.PixmapCache
 
+from Globals import isWindowsPlatform, isMacPlatform
+
 from .. import AnsiTools
 
 
-# TODO: add selection for the ANSI color scheme (see MicroPython)
 class FlaskPage(ConfigurationPageBase, Ui_FlaskPage):
     """
     Class implementing the Flask configuration page.
@@ -36,11 +37,25 @@
         self.setupUi(self)
         self.setObjectName("FlaskPage")
         
+        self.__plugin = plugin
+        
+        consoleList = []
+        if isWindowsPlatform():
+            consoleList.append("cmd.exe /c")
+        elif isMacPlatform():
+            consoleList.append("xterm -e")
+            consoleList.append("/opt/X11/bin/xterm -e")
+        else:
+            consoleList.append("konsole -e")
+            consoleList.append("gnome-terminal -e")
+            consoleList.append("mate-terminal -e")
+            consoleList.append("xfce4-terminal -e")
+            consoleList.append("xterm -e")
+        self.consoleCommandCombo.addItems(consoleList)
+        
         self.colorSchemeComboBox.addItems(
             sorted(AnsiTools.getAvailableColorSchemes()))
         
-        self.__plugin = plugin
-        
         self.urlResetButton.setIcon(
             UI.PixmapCache.getIcon("editUndo"))
         self.py3VenvNamesReloadButton.setIcon(
@@ -51,6 +66,9 @@
             [""] + sorted(venvManager.getVirtualenvNames()))
         
         # set initial values
+        self.consoleCommandCombo.setEditText(
+            self.__plugin.getPreferences("ConsoleCommand"))
+        
         self.externalBrowserCheckBox.setChecked(
             self.__plugin.getPreferences("UseExternalBrowser"))
         
@@ -74,6 +92,9 @@
         Public slot to save the Flask configuration.
         """
         self.__plugin.setPreferences(
+            "ConsoleCommand", self.consoleCommandCombo.currentText())
+        
+        self.__plugin.setPreferences(
             "UseExternalBrowser", self.externalBrowserCheckBox.isChecked())
         
         self.__plugin.setPreferences(

eric ide

mercurial