1
0
mirror of https://github.com/upscayl/upscayl.git synced 2025-01-31 12:13:43 +01:00
This commit is contained in:
Nayam Amarshe 2022-09-25 16:45:43 +05:30
parent 98e52e512b
commit 1954dcf990
5 changed files with 19 additions and 7 deletions

View File

@ -6,18 +6,20 @@
const { join, dirname, resolve } = require("path");
const { getPlatform } = require("./getPlatform");
const appRootDir = require("app-root-dir");
const isDev = require("electron-is-dev");
const { app } = require("electron");
const appRootDir = app.getAppPath();
const binariesPath = isDev
? join(appRootDir.get(), "resources", getPlatform(), "bin")
: join(dirname(appRootDir.get()), "bin");
? join(appRootDir, "resources", getPlatform(), "bin")
: join(dirname(appRootDir), "bin");
const execPath = (execName) =>
resolve(join(binariesPath, `./upscayl-${execName}`));
const modelsPath = isDev
? resolve(join(appRootDir.get(), "resources", "models"))
: resolve(join(dirname(appRootDir.get()), "models"));
? resolve(join(appRootDir, "resources", "models"))
: resolve(join(dirname(appRootDir), "models"));
module.exports = { execPath, modelsPath };

View File

@ -18,6 +18,7 @@ const {
ipcRenderer,
shell,
} = require("electron");
const isDev = require("electron-is-dev");
const prepareNext = require("electron-next");
const commands = require("./commands");
@ -75,6 +76,8 @@ app.on("ready", async () => {
// Quit the app once all windows are closed
app.on("window-all-closed", app.quit);
console.log(app.getAppPath());
//------------------------Select File-----------------------------//
// ! DONT FORGET TO RESTART THE APP WHEN YOU CHANGE CODE HERE
ipcMain.handle(commands.SELECT_FILE, async () => {
const { canceled, filePaths } = await dialog.showOpenDialog({
@ -91,6 +94,7 @@ ipcMain.handle(commands.SELECT_FILE, async () => {
}
});
//------------------------Select Folder-----------------------------//
ipcMain.handle(commands.SELECT_FOLDER, async (event, message) => {
const { canceled, filePaths } = await dialog.showOpenDialog({
properties: ["openDirectory"],

View File

@ -1,7 +1,7 @@
{
"name": "upscayl",
"private": true,
"version": "1.5.0",
"version": "1.5.5",
"productName": "Upscayl",
"homepage": "https://github.com/TGS963/upscayl",
"contributors": [

View File

@ -53,7 +53,7 @@ function LeftPaneSteps(props) {
<select
name="select-model"
onDrop={(e) => props.handleDrop(e)}
className="animate bg-gradient-white block cursor-pointer rounded-lg p-3 font-medium text-black/90 outline-none hover:bg-slate-200 focus-visible:shadow-lg focus-visible:shadow-white"
className="animate bg-gradient-white block cursor-pointer rounded-lg p-3 font-medium text-black/90 outline-none hover:bg-slate-200 focus-visible:ring-2 focus-visible:ring-slate-400"
onChange={props.handleModelChange}
>
<option value="realesrgan-x4plus">General Photo</option>

View File

@ -128,6 +128,9 @@ const Home = () => {
const handleModelChange = (e) => {
setModel(e.target.value);
if (e.target.value === "models-DF2K") {
setDoubleUpscayl(false);
}
};
const handleDragEnter = (e) => {
@ -216,6 +219,7 @@ const Home = () => {
model,
});
} else if (batchMode) {
setDoubleUpscayl(false);
await window.electron.send(commands.FOLDER_UPSCAYL, {
scaleFactor,
batchFolderPath,
@ -339,6 +343,7 @@ const Home = () => {
style={{
objectFit: "contain",
}}
className="bg-[#1d1c23]"
/>
</>
}
@ -353,6 +358,7 @@ const Home = () => {
style={{
objectFit: "contain",
}}
className="bg-[#1d1c23]"
/>
</>
}