mirror of
https://github.com/LinoSchmidt/StickExporterTX.git
synced 2026-03-21 01:51:15 +01:00
Saving terminal state
This commit is contained in:
@@ -27,6 +27,7 @@ type JSONSettings = {
|
|||||||
profiles: JSONProfile[],
|
profiles: JSONProfile[],
|
||||||
logs: string[],
|
logs: string[],
|
||||||
output: string,
|
output: string,
|
||||||
|
showRenderTerminal: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
const defaultSettings:JSONSettings = {
|
const defaultSettings:JSONSettings = {
|
||||||
@@ -42,7 +43,8 @@ const defaultSettings:JSONSettings = {
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
logs: [],
|
logs: [],
|
||||||
output: defaultOutputPath
|
output: defaultOutputPath,
|
||||||
|
showRenderTerminal: false
|
||||||
};
|
};
|
||||||
|
|
||||||
function catchSetting(tryFunc:()=>string, catchFunc:()=>string) {
|
function catchSetting(tryFunc:()=>string, catchFunc:()=>string) {
|
||||||
@@ -126,7 +128,8 @@ const settingList = await fetch(SettingPath).then(function(response) {
|
|||||||
output: catchSetting(function() {return getXMLChild(xmlDoc, "output");},function() {
|
output: catchSetting(function() {return getXMLChild(xmlDoc, "output");},function() {
|
||||||
fetchFailed === "singleSetting"? fetchFailed = "multiSetting":fetchFailed = "singleSetting";
|
fetchFailed === "singleSetting"? fetchFailed = "multiSetting":fetchFailed = "singleSetting";
|
||||||
return defaultSettings.output;
|
return defaultSettings.output;
|
||||||
})
|
}),
|
||||||
|
showRenderTerminal: defaultSettings.showRenderTerminal
|
||||||
} as JSONSettings;
|
} as JSONSettings;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -195,7 +198,15 @@ const settingList = await fetch(SettingPath).then(function(response) {
|
|||||||
output: catchSetting(function() {return parsedData.output;},function() {
|
output: catchSetting(function() {return parsedData.output;},function() {
|
||||||
fetchFailed === "singleSetting"? fetchFailed = "multiSetting":fetchFailed = "singleSetting";
|
fetchFailed === "singleSetting"? fetchFailed = "multiSetting":fetchFailed = "singleSetting";
|
||||||
return defaultSettings.output;
|
return defaultSettings.output;
|
||||||
})
|
}),
|
||||||
|
showRenderTerminal: function() {
|
||||||
|
if(typeof parsedData.showRenderTerminal === "boolean") {
|
||||||
|
return parsedData.showRenderTerminal;
|
||||||
|
} else {
|
||||||
|
fetchFailed === "singleSetting"? fetchFailed = "multiSetting":fetchFailed = "singleSetting";
|
||||||
|
return defaultSettings.showRenderTerminal;
|
||||||
|
}
|
||||||
|
}()
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if(fetchFailed !== "") {
|
if(fetchFailed !== "") {
|
||||||
@@ -332,6 +343,14 @@ function getInOutSettings() {
|
|||||||
return {logs: settingList.logs, output: settingList.output};
|
return {logs: settingList.logs, output: settingList.output};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setShowRenderTerminal(show:boolean) {
|
||||||
|
settingList.showRenderTerminal = show;
|
||||||
|
writeSettings();
|
||||||
|
}
|
||||||
|
function getShowRenderTerminal() {
|
||||||
|
return settingList.showRenderTerminal;
|
||||||
|
}
|
||||||
|
|
||||||
function removeProfile(profileName?:string) {
|
function removeProfile(profileName?:string) {
|
||||||
if(profileName === undefined) {
|
if(profileName === undefined) {
|
||||||
profileName = getActiveProfile().profileName;
|
profileName = getActiveProfile().profileName;
|
||||||
@@ -498,6 +517,8 @@ export {
|
|||||||
getActiveProfile,
|
getActiveProfile,
|
||||||
setInOutSettings,
|
setInOutSettings,
|
||||||
getInOutSettings,
|
getInOutSettings,
|
||||||
|
setShowRenderTerminal,
|
||||||
|
getShowRenderTerminal,
|
||||||
getLogSize,
|
getLogSize,
|
||||||
importProfile,
|
importProfile,
|
||||||
exportProfile,
|
exportProfile,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import React, {useEffect, useRef, useState} from "react";
|
import React, {useEffect, useRef, useState} from "react";
|
||||||
import {getInOutSettings} from "../settings";
|
import {getInOutSettings, getShowRenderTerminal, setShowRenderTerminal} from "../settings";
|
||||||
import openFolder from "../openFolder";
|
import openFolder from "../openFolder";
|
||||||
import { blenderCmd, blender } from "../blenderController";
|
import { blenderCmd, blender } from "../blenderController";
|
||||||
|
|
||||||
@@ -14,7 +14,7 @@ let pastTimeNow = "0m 0s";
|
|||||||
let remainingTimeNow = "calculating...";
|
let remainingTimeNow = "calculating...";
|
||||||
|
|
||||||
function RenderingPage() {
|
function RenderingPage() {
|
||||||
const [terminalHidden, setTerminalHidden] = useState("none");
|
const [terminalHidden, setTerminalHidden] = useState(getShowRenderTerminal() ? "block" : "none");
|
||||||
const [terminalScroll, setTerminalScroll] = useState(true);
|
const [terminalScroll, setTerminalScroll] = useState(true);
|
||||||
const [scrollButtonText, setScrollButtonText] = useState("pause scroll");
|
const [scrollButtonText, setScrollButtonText] = useState("pause scroll");
|
||||||
const [logNumber, setLogNumberInner] = useState("0");
|
const [logNumber, setLogNumberInner] = useState("0");
|
||||||
@@ -93,10 +93,12 @@ function RenderingPage() {
|
|||||||
<button id="stopRenderButton" onClick={() => blender(blenderCmd.stopRendering)}>Stop</button>
|
<button id="stopRenderButton" onClick={() => blender(blenderCmd.stopRendering)}>Stop</button>
|
||||||
<button onClick={() => openFolder(getInOutSettings().output)}>Open Output Folder</button>
|
<button onClick={() => openFolder(getInOutSettings().output)}>Open Output Folder</button>
|
||||||
<button onClick={() => {
|
<button onClick={() => {
|
||||||
if (terminalHidden === "none") {
|
if (getShowRenderTerminal()) {
|
||||||
setTerminalHidden("block");
|
|
||||||
} else {
|
|
||||||
setTerminalHidden("none");
|
setTerminalHidden("none");
|
||||||
|
setShowRenderTerminal(false);
|
||||||
|
} else {
|
||||||
|
setTerminalHidden("block");
|
||||||
|
setShowRenderTerminal(true);
|
||||||
}
|
}
|
||||||
}} style={{marginLeft:"10px"}}>Details</button>
|
}} style={{marginLeft:"10px"}}>Details</button>
|
||||||
<div style={{display: terminalHidden}}>
|
<div style={{display: terminalHidden}}>
|
||||||
|
|||||||
Reference in New Issue
Block a user