Commit 082984ab authored by LIGNEUL CLEMENT's avatar LIGNEUL CLEMENT
Browse files

display runs in progress + adjust sensible-browser command to macOS

parent dbb41f14
......@@ -2,4 +2,5 @@
dist/
deploy/
node_modules/
package-lock.json
\ No newline at end of file
package-lock.json
plotting/
\ No newline at end of file
......@@ -7,8 +7,8 @@ import * as util from './utilities';
import { QMenuBar, QAction, QGridLayout } from "@nodegui/nodegui";
import { Plot_result } from './plot_tab';
import fs from 'fs';
import os from 'os';
import { exit } from 'process';
import { EventWidget } from '@nodegui/nodegui/dist/lib/core/EventWidget';
// array of running child processes
export let running_proc: ChildProcess[] = [];
......@@ -32,15 +32,24 @@ const sub_menu = new QMenu();
sub_menu.setTitle('Help');
const help_action = new QAction();
help_action.setText('Instruction manual')
help_action.setText('Documentation')
help_action.addEventListener('triggered', ()=>{
spawn('sensible-browser', ['https://git.unistra.fr/ligneul/easea-compiler-app'], {detached:true});
if(os.type() === 'Linux'){
spawn('sensible-browser', ['https://git.unistra.fr/ligneul/easea-compiler-app'], {detached:true});
} else if (os.type() === 'Darwin'){
spawn('open', ['https://git.unistra.fr/ligneul/easea-compiler-app'], {detached:true});
}
});
const EASEA_action = new QAction();
EASEA_action.setText('EASEA website');
EASEA_action.addEventListener('triggered', ()=>{
spawn('sensible-browser', ['http://easea.unistra.fr/index.php/EASEA_platform'], {detached:true});
if(os.type() === 'Linux'){
spawn('sensible-browser', ['http://easea.unistra.fr/index.php/EASEA_platform'], {detached:true});
} else if (os.type() === 'Darwin'){
spawn('open', ['http://easea.unistra.fr/index.php/EASEA_platform'], {detached:true});
}
});
sub_menu.addAction(help_action);
......
......@@ -4,6 +4,7 @@ import { exec, execSync, spawnSync, spawn, ChildProcess } from "child_process";
import * as util from './utilities';
import { running_plot, running_proc } from "./index";
import { run_obj } from './index'
import os from 'os'
import { Win_alert } from "./win_alert";
export class Plot_result {
......@@ -168,7 +169,11 @@ export class Plot_result {
this.image_label.setText('No graph to display');
this.image_label.addEventListener(WidgetEventTypes.MouseButtonDblClick, () => {
spawn('sensible-browser', ['plotting/fig.html']);
if(os.type() === 'Linux'){
spawn('sensible-browser', ['plotting/fig.html']);
} else if (os.type() === 'Darwin'){
spawn('open', ['plotting/fig.html']);
}
})
this.scroll_image.setWidget(this.image_label);
......
......@@ -236,7 +236,7 @@ export class Pseudo_term{
} else {
running_proc.splice(index, 1);
}
}
}
if(code !== 0)
return;
......@@ -246,6 +246,7 @@ export class Pseudo_term{
plot_obj.update_plot(process.cwd() + '/plotting/fig.svg', plot_size);
// console.log(process.cwd() + '/' + plot_generation.data_csv);
console.log("child process terminated with code " + code);
run_obj.finished_label.setText('Completed Runs : ' + (run_obj.batch_size - running_proc.length)+ '/' + run_obj.batch_size);
})
running_proc.push(child);
......
......@@ -543,7 +543,7 @@ export class Run_options {
}
var gen = Number(nb_gen.text_edit.text());
if(isNaN(gen) || gen <= 0){
if(isNaN(gen) || (gen <= 0 && nb_gen.text_edit.text() !== '')){
ok = 0;
errors.push('Nb Generations');
}
......
This diff is collapsed.
import { QCheckBox, QGridLayout } from "@nodegui/nodegui";
import { ChildProcess } from "child_process";
import { ConcatenationScope } from "webpack";
import { running_plot } from "./index";
import { running_plot, running_proc, run_obj } from "./index";
import { Win_alert } from "./win_alert";
// sleep function equivalent (async call)
......@@ -67,7 +67,7 @@ export function kill_all(child_array: ChildProcess[]){
} else {
console.log('error : child not killed : ' + i);
}
}
}
}
export function print_errors(errors: string[]){
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment