Beispiel #1
0
        private void buttonAccept_Click(object sender, EventArgs e)
        {
            string pythonVersion;

            //verify if user input is user's choice is valid
            if (textBoxPythonApp.Visible == false && listBoxPythonApp.SelectedIndex == -1)
            {
                return;
            }
            else if (textBoxPythonApp.Visible == true && (textBoxPythonApp.Text == "" || textBoxPythonApp.Text == "Insert here the full name of pythonw executable"))
            {
                return;
            }

            //save the settings.ini file and copy .alaexa_ide folder
            if (textBoxPythonApp.Visible == true)
            {
                pythonVersion = textBoxPythonApp.Text;
                //ninja uses double slash to separate python dir and subdirs
                pythonVersion = pythonVersion.Replace("\\", "/");
                AlexaIDE.SavePythonVersionConfigured(pythonVersion);
            }
            else
            {
                pythonVersion = listBoxPythonApp.Items[listBoxPythonApp.SelectedIndex].ToString();
                //ninja uses double slash to separate python dir and subdirs
                pythonVersion = pythonVersion.Replace("\\", "/");
                AlexaIDE.SavePythonVersionConfigured(pythonVersion);
            }

            AlexaIDE.RunIde(pythonVersion.Replace("/", "\\").Replace("\\python.exe", ""));
            this.Close();
        }
Beispiel #2
0
        static void Main()
        {
            if (AlexaIDE.PythonVersionConfigured() == false)
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                Application.Run(new Form1());
            }
            else
            {
                //string path = AlexaIDE.GetIdePath();
                string   alexaSettingFile = Environment.ExpandEnvironmentVariables("%USERPROFILE%") + @"\.alexa_ide\settings.ini";
                string[] lines            = File.ReadAllLines(alexaSettingFile);
                string   pythonpath       = "";

                //get the pythonPath=
                foreach (string line in lines)
                {
                    if (line.IndexOf("execution\\pythonPath=") != -1)
                    {
                        pythonpath = line.Replace("execution\\pythonPath=", "");
                        pythonpath = pythonpath.Replace("/", "\\").Replace("\\python.exe", "");
                    }
                }

                AlexaIDE.RunIde(pythonpath);
            }
        }