private async void MainForm_Load(object sender, EventArgs e) { // Left Panel UIHelpers.InitCombox(prevClipboardTypeCombox, 0); UIHelpers.InitCombox(preResizeScale, 1); UIHelpers.InitCombox(preResizeMode, 0); UIHelpers.FillEnumComboBox(preResizeFilter, typeof(Upscale.Filter), 0); // Right Panel UIHelpers.InitCombox(prevOverwriteCombox, 0); UIHelpers.InitCombox(prevOutputFormatCombox, 0); UIHelpers.FillEnumComboBox(prevOutputFormatCombox, typeof(Upscale.ExportFormats)); UIHelpers.InitCombox(postResizeScale, 1); UIHelpers.InitCombox(postResizeMode, 0); UIHelpers.FillEnumComboBox(postResizeFilter, typeof(Upscale.Filter), 0); // Batch Upscale UIHelpers.InitCombox(batchOutMode, 0); UIHelpers.InitCombox(preprocessMode, 0); await CheckInstallation(); EmbeddedPython.Init(); EsrganData.CheckModelDir(); EsrganData.ReloadModelList(); NvApi.Init(); if (OSUtils.IsUserAdministrator()) { Program.ShowMessage("Cupscale is running as administrator.\nThis will break Drag-n-Drop functionality.", "Warning"); } }
private void uninstallPyBtn_VisibleChanged(object sender, EventArgs e) { if (uninstallPyBtn.Visible) { uninstallPyBtn.Enabled = File.Exists(EmbeddedPython.GetEmbedPyPath()); } }
private async void MainForm_Load(object sender, EventArgs e) { if (!Directory.Exists(Path.Combine(Paths.GetExeDir(), "runtimes")) && Paths.GetExeDir().ToLower().Contains("temp")) { MessageBox.Show("You seem to be running Flowframes out of an archive.\nPlease extract the whole archive first!", "Error"); IOUtils.TryDeleteIfExists(Paths.GetDataPath()); Application.Exit(); } // Left Panel UIHelpers.InitCombox(prevClipboardTypeCombox, 0); UIHelpers.InitCombox(preResizeScale, 1); UIHelpers.InitCombox(preResizeMode, 0); UIHelpers.FillEnumComboBox(preResizeFilter, typeof(Upscale.Filter), 0); // Right Panel UIHelpers.InitCombox(prevOverwriteCombox, 0); UIHelpers.InitCombox(imageOutputFormat, 0); UIHelpers.FillEnumComboBox(imageOutputFormat, typeof(Upscale.ImgExportMode)); UIHelpers.FillEnumComboBox(videoOutputFormat, typeof(Upscale.VidExportMode)); UIHelpers.InitCombox(postResizeScale, 1); UIHelpers.InitCombox(postResizeMode, 0); UIHelpers.FillEnumComboBox(postResizeFilter, typeof(Upscale.Filter), 0); // Batch Upscale UIHelpers.InitCombox(batchOutMode, 0); UIHelpers.InitCombox(preprocessMode, 0); UIHelpers.InitCombox(batchCacheSplitDepth, 0); // Video Upscale UIHelpers.InitCombox(videoPreprocessMode, 1); await CheckInstallation(); await EmbeddedPython.Init(); EsrganData.CheckModelDir(); EsrganData.ReloadModelList(); NvApi.Init(); if (OSUtils.IsUserAdministrator()) { Program.ShowMessage("Cupscale is running as administrator.\nThis will break Drag-n-Drop functionality.", "Warning"); } LoadEsrganOptions(); flowPanelLeft.AutoScroll = false; flowPanelLeft.HorizontalScroll.Maximum = 0; flowPanelLeft.VerticalScroll.Visible = false; flowPanelLeft.AutoScroll = true; flowPanelRight.AutoScroll = false; flowPanelRight.HorizontalScroll.Maximum = 0; flowPanelRight.VerticalScroll.Visible = false; flowPanelRight.AutoScroll = true; initialized = true; BusyCheckLoop(); }
private async void MainForm_Load(object sender, EventArgs e) { // Left Panel UIHelpers.InitCombox(prevClipboardTypeCombox, 0); UIHelpers.InitCombox(preResizeScale, 1); UIHelpers.InitCombox(preResizeMode, 0); UIHelpers.FillEnumComboBox(preResizeFilter, typeof(Upscale.Filter), 0); // Right Panel UIHelpers.InitCombox(prevOverwriteCombox, 0); UIHelpers.InitCombox(imageOutputFormat, 0); UIHelpers.FillEnumComboBox(imageOutputFormat, typeof(Upscale.ImgExportMode)); UIHelpers.FillEnumComboBox(videoOutputFormat, typeof(Upscale.VidExportMode)); UIHelpers.InitCombox(postResizeScale, 1); UIHelpers.InitCombox(postResizeMode, 0); UIHelpers.FillEnumComboBox(postResizeFilter, typeof(Upscale.Filter), 0); // Batch Upscale UIHelpers.InitCombox(batchOutMode, 0); UIHelpers.InitCombox(preprocessMode, 0); UIHelpers.InitCombox(batchCacheSplitDepth, 0); // Video Upscale UIHelpers.InitCombox(videoPreprocessMode, 1); await CheckInstallation(); await EmbeddedPython.Init(); EsrganData.CheckModelDir(); EsrganData.ReloadModelList(); NvApi.Init(); if (OSUtils.IsUserAdministrator()) { Program.ShowMessage("Cupscale is running as administrator.\nThis will break Drag-n-Drop functionality.", "Warning"); } LoadEsrganOptions(); flowPanelLeft.AutoScroll = false; flowPanelLeft.HorizontalScroll.Maximum = 0; flowPanelLeft.VerticalScroll.Visible = false; flowPanelLeft.AutoScroll = true; flowPanelRight.AutoScroll = false; flowPanelRight.HorizontalScroll.Maximum = 0; flowPanelRight.VerticalScroll.Visible = false; flowPanelRight.AutoScroll = true; initialized = true; BusyCheckLoop(); }
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); }
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(); } }
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); } }
string GetOpenCvVer() { try { Process py = OSUtils.NewProcess(true); py.StartInfo.Arguments = "\"/C\" " + EmbeddedPython.GetPyCmd() + " -c \"import cv2; print(cv2.__version__)\""; 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; } Logger.Log("[DepCheck] CV2 Check Output: " + output.Trim()); return(output); } catch { return(""); } }
private async void installBtn_Click(object sender, EventArgs e) { await EmbeddedPython.Download(installerLogBox, installBtn); }