1
0
mirror of https://github.com/upscayl/upscayl.git synced 2024-11-27 17:00:52 +01:00

addressed issue #18, and check for invalid GPU

This commit is contained in:
Suvojit Ghosh 2022-08-25 18:05:38 +05:30
parent 05d7e87853
commit e1922a781a
4 changed files with 66 additions and 17 deletions

View File

@ -131,19 +131,24 @@ ipcMain.on(commands.UPSCAYL, async (event, payload) => {
detached: false,
}
);
let failed = false;
upscayl.stderr.on("data", (stderr) => {
console.log(stderr.toString());
stderr = stderr.toString();
if (stderr.includes("invalid gpu")) {
failed = true;
}
mainWindow.webContents.send(commands.UPSCAYL_PROGRESS, stderr.toString());
});
upscayl.on("close", (code) => {
console.log("Done upscaling");
mainWindow.webContents.send(
commands.UPSCAYL_DONE,
outputDir + "/" + fileName + "_upscayled_" + scale + "x" + fileExt
);
if (failed !== true) {
console.log("Done upscaling");
mainWindow.webContents.send(
commands.UPSCAYL_DONE,
outputDir + "/" + fileName + "_upscayled_" + scale + "x" + fileExt
);
}
});
});

View File

@ -97,6 +97,7 @@
"electron-updater": "^5.2.1",
"image-size": "^1.0.2",
"react-compare-slider": "^2.2.0",
"react-dropzone": "^14.2.2",
"sharp": "^0.30.7",
"tailwind-scrollbar": "^1.3.1"
}

View File

@ -1,4 +1,4 @@
import { useState, useEffect, useRef } from "react";
import { useState, useEffect, useRef, useCallback } from "react";
import commands from "../../main/commands";
import {
ReactCompareSlider,
@ -26,7 +26,10 @@ const Home = () => {
setLoaded(true);
window.electron.on(commands.UPSCAYL_PROGRESS, (_, data) => {
if (data.length > 0 && data.length < 10) setProgress(data);
if (data.includes("invalid gpu")){
alert("Error!!! Please make sure your GPU supports vulkan")
}
else if (data.length > 0 && data.length < 10) setProgress(data);
});
window.electron.on(commands.UPSCAYL_DONE, (_, data) => {
@ -61,14 +64,19 @@ const Home = () => {
};
const upscaylHandler = async () => {
setUpscaledImagePath("");
setProgress("Hold on...");
await window.electron.send(commands.UPSCAYL, {
scaleFactor,
imagePath,
outputPath,
model,
});
if (imagePath !== "") {
setUpscaledImagePath("");
setProgress("Hold on...");
await window.electron.send(commands.UPSCAYL, {
scaleFactor,
imagePath,
outputPath,
model,
});
}
else {
alert("Please select an image!!!")
}
};
return (

View File

@ -422,6 +422,11 @@ at-least-node@^1.0.0:
resolved "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz"
integrity sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==
attr-accept@^2.2.2:
version "2.2.2"
resolved "https://registry.yarnpkg.com/attr-accept/-/attr-accept-2.2.2.tgz#646613809660110749e92f2c10833b70968d929b"
integrity sha512-7prDjvt9HmqiZ0cl5CRjtS84sEyhsHP2coDkaZKRKVfCDo9s7iw7ChVmar78Gu9pC4SoR/28wFu/G5JJhTnqEg==
autoprefixer@^10.4.8:
version "10.4.8"
resolved "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.4.8.tgz"
@ -1158,6 +1163,13 @@ fd-slicer@~1.1.0:
dependencies:
pend "~1.2.0"
file-selector@^0.6.0:
version "0.6.0"
resolved "https://registry.yarnpkg.com/file-selector/-/file-selector-0.6.0.tgz#fa0a8d9007b829504db4d07dd4de0310b65287dc"
integrity sha512-QlZ5yJC0VxHxQQsQhXvBaC7VRJ2uaxTf+Tfpu4Z/OcVQJVpZO+DGU0rkoVW5ce2SccxugvpBJoMvUs59iILYdw==
dependencies:
tslib "^2.4.0"
filelist@^1.0.1:
version "1.0.4"
resolved "https://registry.npmjs.org/filelist/-/filelist-1.0.4.tgz"
@ -1683,7 +1695,7 @@ lodash@^4.17.10, lodash@^4.17.15:
resolved "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz"
integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==
loose-envify@^1.1.0:
loose-envify@^1.1.0, loose-envify@^1.4.0:
version "1.4.0"
resolved "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz"
integrity sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==
@ -2088,6 +2100,15 @@ progress@^2.0.3:
resolved "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz"
integrity sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==
prop-types@^15.8.1:
version "15.8.1"
resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.8.1.tgz#67d87bf1a694f48435cf332c24af10214a3140b5"
integrity sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==
dependencies:
loose-envify "^1.4.0"
object-assign "^4.1.1"
react-is "^16.13.1"
proto-list@~1.2.1:
version "1.2.4"
resolved "https://registry.npmjs.org/proto-list/-/proto-list-1.2.4.tgz"
@ -2154,6 +2175,20 @@ react-dom@^17.0.2:
object-assign "^4.1.1"
scheduler "^0.20.2"
react-dropzone@^14.2.2:
version "14.2.2"
resolved "https://registry.yarnpkg.com/react-dropzone/-/react-dropzone-14.2.2.tgz#a75a0676055fe9e2cb78578df4dedb4c42b54f98"
integrity sha512-5oyGN/B5rNhop2ggUnxztXBQ6q6zii+OMEftPzsxAR2hhpVWz0nAV+3Ktxo2h5bZzdcCKrpd8bfWAVsveIBM+w==
dependencies:
attr-accept "^2.2.2"
file-selector "^0.6.0"
prop-types "^15.8.1"
react-is@^16.13.1:
version "16.13.1"
resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4"
integrity sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==
react@^17.0.2:
version "17.0.2"
resolved "https://registry.npmjs.org/react/-/react-17.0.2.tgz"