diff --git a/src/renderer/components/App.jsx b/src/renderer/components/App.jsx index 5cd09c0e..88e1ac3c 100644 --- a/src/renderer/components/App.jsx +++ b/src/renderer/components/App.jsx @@ -8,13 +8,13 @@ const {execSync} = require('child_process'); const path = require('path'); // vex-js imported globally in index.html, since we cannot access webpack config in electron-forge - const App = ({helmetUIVersion, versions, searchEMMEPython}) => { // Global settings const [isSettingsOpen, setSettingsOpen] = useState(false); // whether Settings -dialog is open const [isProjectRunning, setProjectRunning] = useState(false); // whether currently selected Project is running const [emmePythonPath, setEmmePythonPath] = useState(undefined); // file path to EMME python executable + const [emmePythonEnvs, setEmmePythonEnvs] = useState([]); // List of all discovered python executables const [helmetScriptsPath, setHelmetScriptsPath] = useState(undefined); // folder path to HELMET model system scripts const [projectPath, setProjectPath] = useState(undefined); // folder path to scenario configs, default homedir const [basedataPath, setBasedataPath] = useState(undefined); // folder path to base input data (subdirectories: 2016_zonedata, 2016_basematrices) @@ -30,6 +30,20 @@ const App = ({helmetUIVersion, versions, searchEMMEPython}) => { globalSettingsStore.current.set('emme_python_path', newPath); }; + const _setEMMEPythonEnvs = (newList) => { + setEmmePythonEnvs(newList); + globalSettingsStore.current.set('emme_python_envs', newList); + } + + const _removeFromEMMEPythonEnvs = (path) => { + const pythonEnvs = emmePythonEnvs.slice(); + const foundPath = pythonEnvs.indexOf(path); + if (foundPath > -1) { + pythonEnvs.splice(foundPath,1); + _setEMMEPythonEnvs(pythonEnvs); + } + } + const _setHelmetScriptsPath = (newPath) => { // Cannot use state variable since it'd be undefined at times const pythonPath = globalSettingsStore.current.get('emme_python_path'); @@ -121,11 +135,13 @@ const App = ({helmetUIVersion, versions, searchEMMEPython}) => { const existingProjectPath = globalSettingsStore.current.get('project_path'); const existingBasedataPath = globalSettingsStore.current.get('basedata_path'); const existingResultsPath = globalSettingsStore.current.get('resultdata_path'); + const existingPythonEnvs = globalSettingsStore.current.get('emme_python_envs'); setEmmePythonPath(existingEmmePythonPath); setHelmetScriptsPath(existingHelmetScriptsPath); setProjectPath(existingProjectPath); setBasedataPath(existingBasedataPath); setResultsPath(existingResultsPath); + setEmmePythonEnvs(existingPythonEnvs); // If project path is the initial (un-set), set it to homedir. Remember: state updates async so refer to existing. if (!existingProjectPath) { @@ -159,6 +175,7 @@ const App = ({helmetUIVersion, versions, searchEMMEPython}) => {
{envPath}
+ + +