Skip to content

Commit

Permalink
Fix api error message, fix subprocess not starting, remove set image …
Browse files Browse the repository at this point in the history
…bc of translation bug
  • Loading branch information
fribbels committed Jan 8, 2022
1 parent 9e1766c commit c59137c
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 30 deletions.
5 changes: 3 additions & 2 deletions app/js/lib/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -334,9 +334,10 @@ function post(api, request) {
resolve(response.data);
})
.catch(error => {
if (error && error.includes("aparapi") && error.includes("Ensure that OpenCL is in your PATH (windows) or in LD_LIBRARY_PATH (linux).")) {
var errStr = error.toString() + error.stack
if (errStr && errStr.includes("aparapi") && errStr.includes("Ensure that OpenCL is in your PATH (windows) or in LD_LIBRARY_PATH (linux).")) {

} else if (error && error.includes("aparapi")) {
} else if (errStr && errStr.includes("aparapi")) {
console.error("Java process failed. If you are using GPU acceleration, try disabling it on the settings tab. Please try restarting your app and check that you've installed the correct version of Java.", api, request, error);
Notifier.error("Java process failed. If you are using GPU acceleration, try disabling it on the settings tab. Please try restarting your app and check that you've installed the correct version of Java");
reject(error);
Expand Down
31 changes: 16 additions & 15 deletions app/js/lib/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,23 @@ module.exports = {
// hideOptgroupCheckboxes: true,
minimumCountSelected: 99,
displayTitle: true,
displayValues: true,
selectAll: false,
textTemplate: function (el) {
const val = el.html();
const assetKey = val + "Set";

if (Object.keys(assetsBySet).includes(assetKey)) {
const asset = assetsBySet[assetKey];
return `<div class="selectorSetContainer"><img class="selectorSetImage" src="${asset}"></img><div class="selectorSetText">${el.html()}</div></div>`
}

return el.html()
},
styler: function (row) {
return '';
}
// textTemplate: function (el) {
// const val = el.html();
// const enValue = el.val();
// const fixedHtml = el.html().replace(enValue, i18next.t(enValue))
// const assetKey = enValue + "Set";

// if (Object.keys(assetsBySet).includes(assetKey)) {
// const asset = assetsBySet[assetKey];
// return `<div class="selectorSetContainer"><img class="selectorSetImage" src="${asset}"></img><div class="selectorSetText">${fixedHtml}</div></div>`
// }

// return fixedHtml
// },
// styler: function (row) {
// return '';
// }
};
const enhanceOptions = {
maxHeight: 500,
Expand Down
32 changes: 19 additions & 13 deletions app/js/lib/subprocess.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const electron = require('electron');
const ipc = electron.ipcRenderer;

const { killPortProcess } = require('kill-port-process');
const { default: i18next } = require('i18next');
// const { default: i18next } = require('i18next');

var errors = "";
var killed = false;
Expand Down Expand Up @@ -70,7 +70,24 @@ module.exports = {
})
pid = child.pid;

console.log("Child PID: ", pid)
console.log("Child PID: ", pid, initialized)

child.stdout.on('data', (data) => {
if (!initialized) {
initialized = true;
callback()
var str = data.toString();
console.log(str);
} else {

}
});

setInterval(() => {
if (child) {
child.stdout.write("");
}
}, 100)

child.on('close', (code) => {
console.log(`Java child process exited with code ${code}`);
Expand Down Expand Up @@ -102,17 +119,6 @@ module.exports = {
errors += data.toString();
})

child.stdout.on('data', (data) => {
if (!initialized) {
initialized = true;
callback()
var str = data.toString();
console.log(str);
} else {

}
});

ipc.on('app-close', _ => {
killed = true;
treekill(child.pid, 'SIGTERM', () => {
Expand Down

0 comments on commit c59137c

Please sign in to comment.