Beispiel #1
0
 private void uninstallPyBtn_VisibleChanged(object sender, EventArgs e)
 {
     if (uninstallPyBtn.Visible)
     {
         uninstallPyBtn.Enabled = File.Exists(EmbeddedPython.GetEmbedPyPath());
     }
 }
        string GetEmbedPythonOutput()
        {
            Process py = OSUtils.NewProcess(true);

            py.StartInfo.Arguments = "\"/C\" " + EmbeddedPython.GetEmbedPyPath().Wrap() + " -V";
            Logger.Log("[DepCheck] CMD: " + py.StartInfo.Arguments);
            py.Start();
            py.WaitForExit();
            string output = py.StandardOutput.ReadToEnd();
            string err    = py.StandardError.ReadToEnd();

            if (!string.IsNullOrWhiteSpace(err))
            {
                output += "\n" + err;
            }
            return(output);
        }
Beispiel #3
0
        private async void SettingsForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            await Task.Delay(100);

            SaveSettings();
            EmbeddedPython.Init();
            if (Config.GetInt("pythonRuntime") == 1 && !File.Exists(EmbeddedPython.GetEmbedPyPath()))
            {
                MsgBox msg = Program.ShowMessage("You enabled the embedded Python runtime but haven't downloaded and installed it.\n" +
                                                 "You can download it in the Dependency Checker window.");
                while (DialogQueue.IsOpen(msg))
                {
                    await Task.Delay(50);
                }

                new DependencyCheckerForm(true).ShowDialog();
            }
        }
Beispiel #4
0
        private async void uninstallPyBtn_Click(object sender, EventArgs e)
        {
            try
            {
                DialogForm dialogForm = new DialogForm("Uninstalling Python Runtime...");
                await Task.Delay(50);

                Directory.Delete(EmbeddedPython.GetEmbedPyPath().GetParentDir(), true);
                dialogForm.Close();
                uninstallPyBtn.Enabled = false;

                Config.Set("pythonRuntime", "0");
                Config.LoadComboxIndex(pythonRuntime);
            }
            catch (Exception ex)
            {
                Program.CloseTempForms();
                Logger.ErrorMessage("Can't uninstall embedded Python runtime: ", ex);
            }
        }