Commit 575d4313 authored by LIGNEUL CLEMENT's avatar LIGNEUL CLEMENT
Browse files

add all options + display

parent 5b9c0213
import { QBoxLayout, QLabel, QTextEdit, QWidget } from "@nodegui/nodegui";
export class Advanced_option_widget{
label_text: string;
label: QLabel;
place_holder: string;
widget: QWidget;
layout: QBoxLayout;
text_edit: QTextEdit;
constructor(txt: string, alignement: number, place_hold?: string){
this.text_edit = new QTextEdit();
this.text_edit.setFixedSize(95,30);
this.text_edit.setTabChangesFocus(true);
this.label_text = txt;
this.label = new QLabel();
this.label.setText(this.label_text);
// this.label.setMaximumSize(150, 80);
this.widget = new QWidget();
this.layout = new QBoxLayout(alignement);
this.widget.setLayout(this.layout);
if(place_hold){
this.place_holder = place_hold;
} else {
this.place_holder = 'Default';
}
this.text_edit.setPlaceholderText(this.place_holder);
this.layout.addWidget(this.label);
this.layout.addWidget(this.text_edit);
this.widget.setMaximumSize(290, 100);
}
}
\ No newline at end of file
......@@ -295,8 +295,6 @@ export class Compile {
const hbox_comp = new QBoxLayout(0);
hbox_comp.addWidget(compile_btn);
hbox_comp.addWidget(make_clean_btn);
hbox_comp.setStretch(0, 10);
hbox_comp.setStretch(1, 40);
widget_comp.setLayout(hbox_comp);
global_layout.addWidget(widget_load);
......
......@@ -31,11 +31,11 @@ const general_layout = new QGridLayout();
centralWidget.setLayout(general_layout);
// top menu
const menu = new QMenuBar();
const action = new QAction();
action.setText('Du blabla');
menu.addAction(action);
global_win.setMenuBar(menu);
// const menu = new QMenuBar();
// const action = new QAction();
// action.setText('Du blabla');
// menu.addAction(action);
// global_win.setMenuBar(menu);
const compile = new QWidget();
export const compile_obj = new Compile('', '');
......
import { Direction, QBoxLayout, QDialog, QCheckBox, QPushButton, QWidget, QLabel, QFileDialog } from "@nodegui/nodegui";
import { Advanced_option_widget } from "./advanced_option_widget";
import * as util from './utilities';
export class Island_options_win{
window: QDialog;
reeavaluate: boolean;
ip_file: string;
migration_proba: number;
server_port: number;
constructor(){
this.window = new QDialog();
this.window.setWindowTitle('Islands Options');
this.reeavaluate = false;
this.server_port = NaN;
this.migration_proba = NaN;
this.ip_file = '';
const main_layout = new QBoxLayout(Direction.TopToBottom);
const reevaluate_im = new QCheckBox();
reevaluate_im.setText('Evaluate Immigrants');
// à mettre dans remote island
const ip_widget = new QWidget();
const ip_layout = new QBoxLayout(Direction.LeftToRight);
ip_widget.setLayout(ip_layout);
const ip_file_btn = new QPushButton();
const file_loaded = new QLabel();
file_loaded.setText('IP file :');
ip_file_btn.setText("Load IP file");
ip_file_btn.setFixedSize(100, 25);
ip_file_btn.addEventListener('clicked', ()=> {
const fileDialog = new QFileDialog();
fileDialog.setFileMode(0); // load an existing file
if(fileDialog.exec()){
this.ip_file = fileDialog.selectedFiles().toString();
}
file_loaded.setText('IP file : ' + util.get_file_name(this.ip_file));
});
ip_layout.addWidget(file_loaded);
ip_layout.addWidget(ip_file_btn);
const proba_migration = new Advanced_option_widget('Migration Proba :', 0);
const server_port = new Advanced_option_widget('Server Port :', 0);
// close and save buttons
const btn_layout = new QBoxLayout(Direction.LeftToRight);
const btn_widget = new QWidget();
btn_widget.setLayout(btn_layout);
const save_btn = new QPushButton();
save_btn.setText('Save');
save_btn.addEventListener('clicked', ()=>{
this.window.close();
});
save_btn.setFixedSize(100, 25);
const reset_btn = new QPushButton();
reset_btn.setText('Reset');
reset_btn.addEventListener('clicked', ()=>{
this.ip_file = '';
file_loaded.setText('IP file :');
this.migration_proba = NaN;
proba_migration.text_edit.setText('');
this.reeavaluate = false;
reevaluate_im.setChecked(false);
this.server_port = NaN;
server_port.text_edit.setText('');
});
reset_btn.setFixedSize(100, 25);
btn_layout.addWidget(save_btn);
btn_layout.addWidget(reset_btn);
main_layout.addWidget(reevaluate_im);
main_layout.addWidget(proba_migration.widget);
main_layout.addWidget(ip_widget);
main_layout.addWidget(server_port.widget);
main_layout.addWidget(btn_widget);
this.window.setLayout(main_layout);
this.window.adjustSize();
this.window.setFixedSize(this.window.size().width(), this.window.size().height());
}
execution(){
this.window.exec();
return this;
}
}
\ No newline at end of file
import { Direction, QBoxLayout, QDialog, QPushButton, QWidget } from "@nodegui/nodegui";
import { Advanced_option_widget } from "./advanced_option_widget";
export class Offspring_options_win{
window: QDialog
size_off: number;
surviving_off: number;
reduce_op: string;
reduce_pressure: number;
constructor(){
this.window = new QDialog();
this.window.setWindowTitle('Offspring Options');
this.surviving_off = NaN;
this.reduce_op = 'Tournament';
this.reduce_pressure = 2.0;
this.size_off = NaN;
const main_layout = new QBoxLayout(Direction.TopToBottom);
const nb_off = new Advanced_option_widget('Offspring Size :', 0);
const surviving_offspring = new Advanced_option_widget('Surviving Offspring :', 0);
const reduce_off_op = new Advanced_option_widget('Reduce Operator :', 0, 'Tournament');
const reduce_off_pressure = new Advanced_option_widget('Reduce Pressure :', 0, '2.0');
// close and save buttons
const btn_layout = new QBoxLayout(Direction.LeftToRight);
const btn_widget = new QWidget();
btn_widget.setLayout(btn_layout);
const save_btn = new QPushButton();
save_btn.setText('Save');
save_btn.addEventListener('clicked', ()=>{
this.window.close();
});
save_btn.setFixedSize(100, 25);
const reset_btn = new QPushButton();
reset_btn.setText('Reset');
reset_btn.addEventListener('clicked', ()=>{
this.reduce_op = 'Trounament';
reduce_off_op.text_edit.setText('');
this.reduce_pressure = 2.0;
reduce_off_pressure.text_edit.setText('');
this.size_off = NaN;
nb_off.text_edit.setText('');
this.surviving_off = NaN;
surviving_offspring.text_edit.setText('');
});
reset_btn.setFixedSize(100, 25);
btn_layout.addWidget(save_btn);
btn_layout.addWidget(reset_btn);
main_layout.addWidget(nb_off.widget);
main_layout.addWidget(surviving_offspring.widget);
main_layout.addWidget(reduce_off_op.widget);
main_layout.addWidget(reduce_off_pressure.widget);
main_layout.addWidget(btn_widget);
this.window.setLayout(main_layout);
this.window.adjustSize();
this.window.setFixedSize(this.window.size().width(), this.window.size().height());
}
execution(){
this.window.exec();
return this;
}
}
\ No newline at end of file
import { Direction, QBoxLayout, QDialog, QPushButton, QWidget } from "@nodegui/nodegui";
import { Advanced_option_widget } from "./advanced_option_widget";
export class Parent_options_win{
surviving: number;
reduce_op: string;
reduce_pressure: number;
nb_elite: number;
window: QDialog;
constructor(){
this.window = new QDialog();
this.window.setWindowTitle('Parents Options');
this.surviving = NaN;
this.reduce_op = 'Tournament';
this.reduce_pressure = 2.0;
this.nb_elite = NaN;
const main_layout = new QBoxLayout(Direction.TopToBottom);
const elite = new Advanced_option_widget('Elite Parents :', 0, '0');
const surviving_parent = new Advanced_option_widget('Surviving Parents :', 0)
const reduce_parent_op = new Advanced_option_widget('Reduction Operator :', 0, 'Tournament');
const reduce_parent_pressure = new Advanced_option_widget('Reduce pressure :', 0, '2.0');
// close and save buttons
const btn_layout = new QBoxLayout(Direction.LeftToRight);
const btn_widget = new QWidget();
btn_widget.setLayout(btn_layout);
const save_btn = new QPushButton();
save_btn.setText('Save');
save_btn.addEventListener('clicked', ()=>{
this.window.close();
});
save_btn.setFixedSize(100, 25);
const reset_btn = new QPushButton();
reset_btn.setText('Reset');
reset_btn.addEventListener('clicked', ()=>{
this.surviving = NaN;
surviving_parent.text_edit.setText('');
this.reduce_pressure = 2.0;
reduce_parent_pressure.text_edit.setText('');
this.reduce_op = 'Tournament';
reduce_parent_op.text_edit.setText('');
this.nb_elite = NaN;
elite.text_edit.setText('');
});
reset_btn.setFixedSize(100, 25);
btn_layout.addWidget(save_btn);
btn_layout.addWidget(reset_btn);
main_layout.addWidget(elite.widget);
main_layout.addWidget(surviving_parent.widget);
main_layout.addWidget(reduce_parent_op.widget);
main_layout.addWidget(reduce_parent_pressure.widget);
main_layout.addWidget(btn_widget);
this.window.setLayout(main_layout);
this.window.adjustSize();
this.window.setFixedSize(this.window.size().width(), this.window.size().height());
}
execution(){
this.window.exec();
return this;
}
}
\ No newline at end of file
const { QGridLayout } = require("@nodegui/nodegui");
import { QDialog, QTextEdit, QWidget, QLabel, QPushButton, QTableWidgetItem, QBoxLayout, QCheckBox, QTableWidget, QScrollArea } from '@nodegui/nodegui';
import { QFileDialog, QDialog, QTextEdit, QWidget, QLabel, QPushButton, QTableWidgetItem, QBoxLayout, QCheckBox, QTableWidget, QScrollArea, QComboBox, Direction, AlignmentFlag } from '@nodegui/nodegui';
import { Win_alert } from './win_alert';
import { Processus } from './processus';
import { Advanced_option_widget } from './advanced_option_widget';
import * as util from './utilities';
import { general_css } from './style';
export class Run_options {
run_options: string;
window: QDialog;
batch_size: Number;
thread_number: Number;
plot_stats: Boolean;
generate_csv: Boolean;
seed: number;
proc_tab: Processus[];
// all options
plot_stats: Boolean;
generate_csv: Boolean;
ip_file = '';
constructor(){
this.run_options = '';
this.window = new QDialog();
this.window.setWindowTitle("Options");
this.window.setWindowTitle("General Run Options");
this.batch_size = 1;
this.thread_number = 1;
this.plot_stats = true;
this.generate_csv = false;
this.seed = NaN;
this.proc_tab = [];
const global_layout = new QBoxLayout(2);
this.plot_stats = true;
this.generate_csv = false;
const global_layout = new QGridLayout();
const global_widget = new QWidget();
global_widget.setLayout(global_layout);
// batch size
const batch_widget = new QWidget();
const batch_layout = new QBoxLayout(0);
const batch_layout = new QBoxLayout(2);
const batch_label = new QLabel();
batch_label.setText("Batch size : ");
batch_label.setText("Batch Size : ");
batch_label.setFixedSize(80,20);
const batch_edit = new QTextEdit();
......@@ -45,9 +53,9 @@ export class Run_options {
// thread number
const thread_widget = new QWidget();
const thread_layout = new QBoxLayout(0);
const thread_layout = new QBoxLayout(2);
const thread_label = new QLabel();
thread_label.setText("Number of threads : ");
thread_label.setText("Number Of Threads : ");
thread_label.setFixedSize(150,20);
const thread_edit = new QTextEdit();
......@@ -59,12 +67,9 @@ export class Run_options {
thread_layout.addWidget(thread_edit);
thread_widget.setLayout(thread_layout);
global_layout.addWidget(batch_widget);
global_layout.addWidget(thread_widget);
// table of processes for seeds
const seed_layout = new QBoxLayout(0);
const seed_layout = new QBoxLayout(2);
const seed_widget = new QWidget();
const seed_label = new QLabel();
const seed_text = new QTextEdit();
......@@ -83,23 +88,19 @@ export class Run_options {
this.seed = NaN;
});
seed_label.setText('First seed : ');
seed_label.setText('First Seed : ');
seed_label.setFixedSize(90,30);
seed_layout.addWidget(seed_label);
seed_layout.addWidget(seed_text);
seed_widget.setLayout(seed_layout);
global_layout.addWidget(seed_widget);
// checkboxes of choices
const check_widget = new QWidget();
const check_layout = new QGridLayout();
check_widget.setLayout(check_layout);
// advanced options
// plot stats
const check_plot = new QCheckBox();
check_plot.setText('Plot stats');
check_plot.setText('Plot Stats');
check_plot.setChecked(true);
check_plot.addEventListener('stateChanged', ()=>{
if(this.plot_stats){
......@@ -108,7 +109,6 @@ export class Run_options {
this.plot_stats = true;
}
});
check_layout.addWidget(check_plot, 0,0);
// generate csv
const check_csv = new QCheckBox();
......@@ -120,17 +120,136 @@ export class Run_options {
this.generate_csv = true;
}
});
check_layout.addWidget(check_csv,0,1);
global_layout.addWidget(check_widget);
const compression_arg = new Advanced_option_widget('Compression :', 2);
const popu_size = new Advanced_option_widget('Population Size :', 2);
// elite type
const elite_layout = new QBoxLayout(2);
const elite_type_widget = new QWidget();
const elite_type_label = new QLabel();
elite_type_label.setText('Elite Type :');
elite_type_label.setFixedSize(150,30);
elite_type_widget.setLayout(elite_layout);
const combo_elite_type = new QComboBox();
combo_elite_type.setFixedSize(100,30);
combo_elite_type.addItem(undefined, 'Default');
combo_elite_type.addItem(undefined, 'Strong');
combo_elite_type.addItem(undefined, 'Weak');
elite_layout.addWidget(elite_type_label);
elite_layout.addWidget(combo_elite_type);
const nb_gen = new Advanced_option_widget('Nb Generations :', 2);
const time_limit = new Advanced_option_widget('Time Limit :', 2);
const select_op = new Advanced_option_widget('Selection Operator :', 2, 'Tournament')
const select_pressure = new Advanced_option_widget('Selection Pressure :', 2, '2.0');
const reduce_final_op = new Advanced_option_widget('Reduce Final Operator : ', 2, 'Tournament');
const reduce_final_pressure = new Advanced_option_widget('Reduce Final Pressure :', 2, '2.0');
const opti_it = new Advanced_option_widget('Optimize Iteration :', 2, '100');
const baldwinism = new Advanced_option_widget('Baldwinism :', 2, '0');
const output_filename = new Advanced_option_widget('Ouput File :', 2, 'None');
const input_file_widget = new QWidget();
const input_file_layout = new QBoxLayout(2);
input_file_widget.setLayout(input_file_layout);
const input_file_btn = new QPushButton();
const file_loaded = new QLabel();
file_loaded.setText('Initial Population :');
input_file_btn.setText("Load a file");
input_file_btn.setFixedSize(100, 25);
input_file_btn.addEventListener('clicked', ()=> {
const fileDialog = new QFileDialog();
fileDialog.setFileMode(0); // load an existing file
var file = '';
if(fileDialog.exec()){
file = fileDialog.selectedFiles().toString();
}
file_loaded.setText('Initial Population :\n' + util.get_file_name(file));
});
input_file_layout.addWidget(file_loaded);
input_file_layout.addWidget(input_file_btn);
const print_stats = new QCheckBox();
print_stats.setText('Print Stats');
print_stats.setChecked(true);
const csv_file = new QCheckBox();
csv_file.setText('Generate CSV File');
//
const plot_script = new QCheckBox();
plot_script.setText('Generate Plot Script');
const r_script = new QCheckBox();
r_script.setText('Generate R Script');
const print_init_pop = new QCheckBox();
print_init_pop.setText('Print Initial Population');
const print_final_pop = new QCheckBox();
print_final_pop.setText('Print Final Population');
const save_pop = new QCheckBox();
save_pop.setText('Save Population');
const start_from_file = new QCheckBox();
start_from_file.setText('Start From File (.pop)');
const fstgpu = new Advanced_option_widget('Number of the first \nGPU used for computation :', 2);
const lstgpu = new Advanced_option_widget('Number of the first \nGPU NOT used for computation :', 2);
// user params
const global_user_param_layout = new QBoxLayout(2);
const user_param_label = new QLabel();
user_param_label.setText('User parameters :');
const user_param_scroll = new QScrollArea();
const user_param_layout = new QBoxLayout(2);
const user_param_widget = new QWidget();
user_param_widget.setLayout(user_param_layout);
const user_var = [];
for(var i = 0; i < 5; i++){
user_var.push(new Advanced_option_widget('User parameter ' + (i+1), 2));
user_param_layout.addWidget(user_var[i].widget);
}
user_param_scroll.setWidget(user_param_widget);
user_param_scroll.setFixedSize(180, 140);
global_user_param_layout.addWidget(user_param_label);
global_user_param_layout.addWidget(user_param_scroll);
const user_param_global_widget = new QWidget();
user_param_global_widget.setLayout(global_user_param_layout);
// processess/seeds table
const global_seed_widget = new QWidget();
const global_seed_layout = new QBoxLayout(2);
global_seed_widget.setLayout(global_seed_layout);
const seed_text_label = new QLabel();
seed_text_label.setText('Seeds by run :');
global_seed_layout.addWidget(seed_text_label);
const proc_seed_area = new QScrollArea();
const proc_seed_widget = new QWidget();
const proc_seed_layout = new QBoxLayout(2);
proc_seed_widget.setLayout(proc_seed_layout);
proc_seed_widget.setMinimumSize(200, 300);
proc_seed_widget.setMinimumSize(180, 140);
batch_edit.addEventListener('textChanged', ()=>{
var batch_size = Number(batch_edit.toPlainText());
......@@ -158,9 +277,9 @@ export class Run_options {
}
proc_seed_area.setWidget(proc_seed_widget);
proc_seed_area.setFixedSize(270,200);
proc_seed_area.setFixedSize(270,140);
global_layout.addWidget(proc_seed_area);
global_seed_layout.addWidget(proc_seed_area);
// close and save buttons
const save_btn = new QPushButton();
......@@ -208,10 +327,10 @@ export class Run_options {
}
});
const close_btn = new QPushButton();
close_btn.setText('Reset');
close_btn.setFixedSize(100, 25);
close_btn<