Commit 74484824 authored by LIGNEUL CLEMENT's avatar LIGNEUL CLEMENT
Browse files

change style + replace QTextEdit by QLine

parent f05b6664
import { QBoxLayout, QLabel, QTextEdit, QWidget } from "@nodegui/nodegui";
import { QBoxLayout, QLabel, QLineEdit, QWidget } from "@nodegui/nodegui";
export class Advanced_option_widget{
......@@ -7,13 +7,12 @@ export class Advanced_option_widget{
place_holder: string;
widget: QWidget;
layout: QBoxLayout;
text_edit: QTextEdit;
text_edit: QLineEdit;
constructor(txt: string, alignement: number, place_hold?: string){
this.text_edit = new QTextEdit();
this.text_edit = new QLineEdit();
this.text_edit.setFixedSize(95,30);
this.text_edit.setTabChangesFocus(true);
this.label_text = txt;
......
......@@ -145,7 +145,7 @@ export class Compile {
// compile button
const compile_btn = new QPushButton();
compile_btn.setText("Compile");
compile_btn.setFixedSize(100, 25);
compile_btn.setFixedSize(120,30);
compile_btn.addEventListener('clicked', () => {
if (this.ez_file_address === '') {
new Win_alert("Please load a file");
......@@ -242,7 +242,7 @@ export class Compile {
// make clean button
const make_clean_btn = new QPushButton();
make_clean_btn.setText("Make clean");
make_clean_btn.setFixedSize(100, 25);
make_clean_btn.setFixedSize(120,30);
make_clean_btn.addEventListener('clicked', () => {
if (this.ez_file_address === '') {
new Win_alert("Please load a file");
......@@ -271,7 +271,7 @@ export class Compile {
// load file dialog
const file_select = new QPushButton();
file_select.setText("Load a file");
file_select.setFixedSize(100, 25);
file_select.setFixedSize(120,30);
file_select.addEventListener('clicked', () => {
const fileDialog = new QFileDialog();
fileDialog.setFileMode(0); // load an existing file
......@@ -288,7 +288,7 @@ export class Compile {
}
}
console.log(this.ez_file_address);
// console.log(this.ez_file_address);
});
// load file box
......
......@@ -55,7 +55,7 @@ export class Island_options_win{
const proba_migration = new Advanced_option_widget('Migration Probability :', 0);
proba_migration.text_edit.addEventListener('textChanged', ()=>{
var text = proba_migration.text_edit.toPlainText();
var text = proba_migration.text_edit.text();
var val = Number(text);
if(text === ''){
......@@ -69,7 +69,7 @@ export class Island_options_win{
const server_port = new Advanced_option_widget('Server Port :', 0);
server_port.text_edit.addEventListener('textChanged', ()=>{
var text = server_port.text_edit.toPlainText();
var text = server_port.text_edit.text();
var val = Number(text);
if(text === ''){
......@@ -92,12 +92,12 @@ export class Island_options_win{
var errors = [];
var ok = 1;
if(isNaN(Number(proba_migration.text_edit.toPlainText()))){
if(isNaN(Number(proba_migration.text_edit.text()))){
ok = 0;
errors.push('Migration Probability');
}
if(isNaN(Number(server_port.text_edit.toPlainText()))){
if(isNaN(Number(server_port.text_edit.text()))){
ok = 0;
errors.push('Server Port');
}
......
import { Direction, QBoxLayout, QComboBox, QDialog, QPushButton, QWidget, WindowType } from "@nodegui/nodegui";
import { Advanced_option_widget } from "./advanced_option_widget";
import { general_css } from "./style";
import { print_errors } from "./utilities";
export class Offspring_options_win{
......@@ -25,7 +26,7 @@ export class Offspring_options_win{
const nb_off = new Advanced_option_widget('Offspring Size :', 0);
nb_off.text_edit.addEventListener('textChanged', ()=>{
var text = nb_off.text_edit.toPlainText();
var text = nb_off.text_edit.text();
var val = Number(text);
if(text === ''){
......@@ -39,7 +40,7 @@ export class Offspring_options_win{
const surviving_offspring = new Advanced_option_widget('Surviving Offspring :', 0);
surviving_offspring.text_edit.addEventListener('textChanged', ()=>{
var text = surviving_offspring.text_edit.toPlainText();
var text = surviving_offspring.text_edit.text();
var val = Number(text);
if(text === ''){
......@@ -62,7 +63,7 @@ export class Offspring_options_win{
const reduce_off_op = new Advanced_option_widget('Reduce Operator :', 0, 'Tournament');
reduce_off_op.text_edit.addEventListener('textChanged', ()=>{
var text = reduce_off_op.text_edit.toPlainText().toLowerCase();
var text = reduce_off_op.text_edit.text().toLowerCase();
if(text === 'tournament' || text === ''){
reduce_off_pressure.widget.setEnabled(true);
......@@ -71,7 +72,7 @@ export class Offspring_options_win{
reduce_off_pressure.text_edit.setText('');
}
text = reduce_off_op.text_edit.toPlainText();
text = reduce_off_op.text_edit.text();
if(text === ''){
this.reduce_op = 'Tournament';
......@@ -82,7 +83,7 @@ export class Offspring_options_win{
const reduce_off_pressure = new Advanced_option_widget('Reduce Pressure :', 0, '2.0');
reduce_off_pressure.text_edit.addEventListener('textChanged', ()=>{
var text = reduce_off_pressure.text_edit.toPlainText();
var text = reduce_off_pressure.text_edit.text();
var val = Number(text);
if(text === ''){
......@@ -105,7 +106,7 @@ export class Offspring_options_win{
var errors = [];
var ok = 1;
var pressure = Number(reduce_off_pressure.text_edit.toPlainText());
var pressure = Number(reduce_off_pressure.text_edit.text());
if(isNaN(pressure)){
ok = 0;
errors.push('Reduce Pressure');
......@@ -120,12 +121,12 @@ export class Offspring_options_win{
errors.push('Reduce Pressure : should be an integer if \u2265 2');
}
if(isNaN(Number(surviving_offspring.text_edit.toPlainText()))){
if(isNaN(Number(surviving_offspring.text_edit.text()))){
ok = 0;
errors.push('Surviving Offspring');
}
if(isNaN(Number(nb_off.text_edit.toPlainText()))){
if(isNaN(Number(nb_off.text_edit.text()))){
ok = 0;
errors.push('Offspring Size');
}
......@@ -162,6 +163,7 @@ export class Offspring_options_win{
main_layout.addWidget(btn_widget);
this.window.setLayout(main_layout);
this.window.setStyleSheet(general_css);
this.window.adjustSize();
this.window.setFixedSize(this.window.size().width(), this.window.size().height());
}
......
import { Direction, QBoxLayout, QComboBox, QDialog, QPushButton, QWidget, WindowType } from "@nodegui/nodegui";
import { Advanced_option_widget } from "./advanced_option_widget";
import { general_css } from "./style";
import * as util from './utilities';
export class Parent_options_win{
......@@ -32,7 +33,7 @@ export class Parent_options_win{
surviving_parent.layout.addWidget(surviving_parent_type);
surviving_parent.text_edit.addEventListener('textChanged', ()=>{
var text = surviving_parent.text_edit.toPlainText();
var text = surviving_parent.text_edit.text();
var val = Number(text);
if(text === ''){
......@@ -46,7 +47,7 @@ export class Parent_options_win{
const reduce_parent_op = new Advanced_option_widget('Reduction Operator :', 0, 'Tournament');
reduce_parent_op.text_edit.addEventListener('textChanged', ()=>{
var text = reduce_parent_op.text_edit.toPlainText().toLowerCase();
var text = reduce_parent_op.text_edit.text().toLowerCase();
if(text === 'tournament' || text === ''){
reduce_parent_pressure.widget.setEnabled(true);
......@@ -55,7 +56,7 @@ export class Parent_options_win{
reduce_parent_pressure.text_edit.setText('');
}
text = reduce_parent_op.text_edit.toPlainText();
text = reduce_parent_op.text_edit.text();
if(text === ''){
this.reduce_op = 'Tournament';
......@@ -66,7 +67,7 @@ export class Parent_options_win{
const reduce_parent_pressure = new Advanced_option_widget('Reduce pressure :', 0, '2.0');
reduce_parent_pressure.text_edit.addEventListener('textChanged', ()=>{
var text = reduce_parent_pressure.text_edit.toPlainText();
var text = reduce_parent_pressure.text_edit.text();
var val = Number(text);
if(text === ''){
......@@ -89,12 +90,12 @@ export class Parent_options_win{
var errors = [];
var ok = 1;
if(isNaN(Number(surviving_parent.text_edit.toPlainText()))){
if(isNaN(Number(surviving_parent.text_edit.text()))){
ok = 0;
errors.push('Surviving Parents');
}
var pressure = Number(reduce_parent_pressure.text_edit.toPlainText());
var pressure = Number(reduce_parent_pressure.text_edit.text());
if(isNaN(pressure)){
ok = 0;
errors.push('Reduce Pressure');
......@@ -137,6 +138,7 @@ export class Parent_options_win{
main_layout.addWidget(btn_widget);
this.window.setLayout(main_layout);
this.window.setStyleSheet(general_css);
this.window.adjustSize();
this.window.setFixedSize(this.window.size().width(), this.window.size().height());
}
......
......@@ -57,7 +57,7 @@ for i in range(nb_plots):
y=df["BEST_FIT"] [df["GEN"] < (i * treshold)][df["GEN"] >= treshold * (i-1)],
fillcolor="red",
line_color="black",
name= '<' + str((i+1)*treshold)
name= '\u2264' + str((i+1)*treshold)
)
)
......
import { QBoxLayout, QLabel, QTextEdit, QWidget } from "@nodegui/nodegui";
import { QBoxLayout, QLabel, QLineEdit, QTextEdit, QWidget } from "@nodegui/nodegui";
export class Processus{
proc_widget: QWidget;
proc_label: QLabel;
proc_layout: QBoxLayout;
seed_text: QTextEdit;
seed_text: QLineEdit;
rang: number;
run_options: string;
seed_value: number;
......@@ -15,7 +15,7 @@ export class Processus{
this.rang = num;
this.proc_widget = new QWidget();
this.proc_layout = new QBoxLayout(0);
this.seed_text = new QTextEdit;
this.seed_text = new QLineEdit();
this.proc_label = new QLabel();
this.seed_value = NaN;
......@@ -24,7 +24,6 @@ export class Processus{
this.seed_text.setPlaceholderText('Default if empty');
this.seed_text.setFixedSize(130,30);
this.seed_text.setTabChangesFocus(true);
this.proc_layout.addWidget(this.proc_label);
this.proc_layout.addWidget(this.seed_text);
......@@ -32,13 +31,13 @@ export class Processus{
this.proc_widget.setLayout(this.proc_layout);
this.seed_text.addEventListener('textChanged', ()=>{
var seed = Number(this.seed_text.toPlainText());
var seed = Number(this.seed_text.text());
if(!isNaN(seed) && seed > 0 && !this.seed_text.isReadOnly()){
this.seed_value = seed;
}
if(this.seed_text.toPlainText() === ''){
if(this.seed_text.text() === ''){
this.seed_value = NaN;
}
});
......
const { QGridLayout } = require("@nodegui/nodegui");
import { QFileDialog, QDialog, QTextEdit, QWidget, QLabel, QPushButton, QTableWidgetItem, QBoxLayout, QCheckBox, QTableWidget, QScrollArea, QComboBox, Direction, AlignmentFlag, ToolButtonPopupMode, WindowType } from '@nodegui/nodegui';
import { QFileDialog, QDialog, QTextEdit, QWidget, QLabel, QPushButton, QTableWidgetItem, QBoxLayout, QCheckBox, QTableWidget, QScrollArea, QComboBox, Direction, AlignmentFlag, ToolButtonPopupMode, WindowType, QLineEdit } from '@nodegui/nodegui';
import { Win_alert } from './win_alert';
import { Processus } from './processus';
import { Advanced_option_widget } from './advanced_option_widget';
......@@ -66,9 +66,8 @@ export class Run_options {
batch_label.setText("Batch Size : ");
batch_label.setFixedSize(80,20);
const batch_edit = new QTextEdit();
const batch_edit = new QLineEdit();
batch_edit.setText('1');
batch_edit.setTabChangesFocus(true);
batch_edit.setFixedSize(70,30);
batch_layout.addWidget(batch_label);
......@@ -82,9 +81,8 @@ export class Run_options {
thread_label.setText("Number Of Threads : ");
thread_label.setFixedSize(150,20);
const thread_edit = new QTextEdit();
const thread_edit = new QLineEdit();
thread_edit.setText('1');
thread_edit.setTabChangesFocus(true);
thread_edit.setFixedSize(70,30);
thread_layout.addWidget(thread_label);
......@@ -96,19 +94,18 @@ export class Run_options {
const seed_layout = new QBoxLayout(2);
const seed_widget = new QWidget();
const seed_label = new QLabel();
const seed_text = new QTextEdit();
const seed_text = new QLineEdit();
seed_text.setPlaceholderText('Default if empty');
seed_text.setFixedSize(130,30);
seed_text.setTabChangesFocus(true);
seed_text.addEventListener('textChanged', ()=>{
const seed = Number(seed_text.toPlainText());
const seed = Number(seed_text.text());
if(!isNaN(seed))
this.seed = seed;
if(seed_text.toPlainText() === '')
if(seed_text.text() === '')
this.seed = NaN;
});
......@@ -130,7 +127,7 @@ export class Run_options {
const compression_arg = new Advanced_option_widget('Compression :', 2);
compression_arg.text_edit.addEventListener('textChanged', ()=>{
var text = compression_arg.text_edit.toPlainText();
var text = compression_arg.text_edit.text();
var val = Number(text);
if(text === ''){
this.compression = NaN;
......@@ -143,7 +140,7 @@ export class Run_options {
const popu_size = new Advanced_option_widget('Population Size :', 2);
popu_size.text_edit.addEventListener('textChanged', ()=>{
var text = popu_size.text_edit.toPlainText();
var text = popu_size.text_edit.text();
var val = Number(text);
if(text === ''){
this.pop_size = NaN;
......@@ -177,7 +174,7 @@ export class Run_options {
const nb_elite = new Advanced_option_widget('Elite Size :', 2, '0');
nb_elite.text_edit.addEventListener('textChanged', ()=>{
var text = nb_elite.text_edit.toPlainText();
var text = nb_elite.text_edit.text();
var val = Number(text);
if(text === ''){
......@@ -194,7 +191,7 @@ export class Run_options {
const nb_gen = new Advanced_option_widget('Nb Generations :', 2);
nb_gen.text_edit.addEventListener('textChanged', ()=>{
var text = nb_gen.text_edit.toPlainText();
var text = nb_gen.text_edit.text();
var val = Number(text);
if(text === ''){
this.nb_gen = NaN;
......@@ -207,7 +204,7 @@ export class Run_options {
const time_limit = new Advanced_option_widget('Time Limit :', 2);
time_limit.text_edit.addEventListener('textChanged', ()=>{
var text = time_limit.text_edit.toPlainText();
var text = time_limit.text_edit.text();
var val = Number(text);
if(text === ''){
this.time_limit = NaN;
......@@ -220,19 +217,19 @@ export class Run_options {
const select_op = new Advanced_option_widget('Selection Operator :', 2, 'Tournament')
select_op.text_edit.addEventListener('textChanged', ()=>{
var text = select_op.text_edit.toPlainText().toLowerCase();
var text = select_op.text_edit.text().toLowerCase();
if(text === 'tournament' || text === ''){
select_pressure.widget.setEnabled(true);
} else {
select_pressure.widget.setEnabled(false);
select_pressure.text_edit.setText('');
}
this.select_op = select_op.text_edit.toPlainText();
this.select_op = select_op.text_edit.text();
});
const select_pressure = new Advanced_option_widget('Selection Pressure :', 2, '2.0');
select_pressure.text_edit.addEventListener('textChanged', ()=>{
var text = select_pressure.text_edit.toPlainText();
var text = select_pressure.text_edit.text();
var val = Number(text);
if(text === ''){
this.select_pressure = NaN;
......@@ -246,19 +243,19 @@ export class Run_options {
const reduce_final_op = new Advanced_option_widget('Reduce Final Operator : ', 2, 'Tournament');
reduce_final_op.text_edit.addEventListener('textChanged', ()=>{
var text = reduce_final_op.text_edit.toPlainText().toLowerCase();
var text = reduce_final_op.text_edit.text().toLowerCase();
if(text === 'tournament' || text === ''){
reduce_final_pressure.widget.setEnabled(true);
} else {
reduce_final_pressure.widget.setEnabled(false);
reduce_final_pressure.text_edit.setText('');
}
this.reduce_final_op = reduce_final_op.text_edit.toPlainText();
this.reduce_final_op = reduce_final_op.text_edit.text();
});
const reduce_final_pressure = new Advanced_option_widget('Reduce Final Pressure :', 2, '2.0');
reduce_final_pressure.text_edit.addEventListener('textChanged', ()=>{
var text = reduce_final_pressure.text_edit.toPlainText();
var text = reduce_final_pressure.text_edit.text();
var val = Number(text);
if(text === ''){
this.reduce_final_pressure = NaN;
......@@ -271,7 +268,7 @@ export class Run_options {
const opti_it = new Advanced_option_widget('Optimize Iteration :', 2, '100');
opti_it.text_edit.addEventListener('textChanged', ()=>{
var text = opti_it.text_edit.toPlainText();
var text = opti_it.text_edit.text();
var val = Number(text);
if(text === ''){
this.optimize_it = NaN;
......@@ -284,7 +281,7 @@ export class Run_options {
const baldwinism = new Advanced_option_widget('Baldwinism :', 2, '0');
baldwinism.text_edit.addEventListener('textChanged', ()=>{
var text = opti_it.text_edit.toPlainText();
var text = opti_it.text_edit.text();
var val = Number(text);
if(text === ''){
this.optimize_it = NaN;
......@@ -297,7 +294,7 @@ export class Run_options {
const output_filename = new Advanced_option_widget('Ouput File :', 2, 'None');
output_filename.text_edit.addEventListener('textChanged', ()=>{
this.output_file = output_filename.text_edit.toPlainText();
this.output_file = output_filename.text_edit.text();
});
const input_file_widget = new QWidget();
......@@ -373,7 +370,7 @@ export class Run_options {
const fstgpu = new Advanced_option_widget('Number of the first \nGPU used for computation :', 2);
fstgpu.text_edit.addEventListener('textChanged', ()=>{
var text = fstgpu.text_edit.toPlainText();
var text = fstgpu.text_edit.text();
var val = Number(text);
if(text === ''){
this.fstgpu_param = NaN;
......@@ -386,7 +383,7 @@ export class Run_options {
const lstgpu = new Advanced_option_widget('Number of the first \nGPU NOT used for computation :', 2);
lstgpu.text_edit.addEventListener('textChanged', ()=>{
var text = lstgpu.text_edit.toPlainText();
var text = lstgpu.text_edit.text();
var val = Number(text);
if(text === ''){
this.lstgpu_param = NaN;
......@@ -411,31 +408,31 @@ export class Run_options {
var u1 = new Advanced_option_widget('User parameter 1', 2);
user_param_layout.addWidget(u1.widget);
u1.text_edit.addEventListener('textChanged', ()=>{
this.u1 = u1.text_edit.toPlainText();
this.u1 = u1.text_edit.text();
});
var u2 = new Advanced_option_widget('User parameter 2', 2);
user_param_layout.addWidget(u2.widget);
u2.text_edit.addEventListener('textChanged', ()=>{
this.u2 = u2.text_edit.toPlainText();
this.u2 = u2.text_edit.text();
});
var u3 = new Advanced_option_widget('User parameter 3', 2);
user_param_layout.addWidget(u3.widget);
u3.text_edit.addEventListener('textChanged', ()=>{
this.u3 = u3.text_edit.toPlainText();
this.u3 = u3.text_edit.text();
});
var u4 = new Advanced_option_widget('User parameter 4', 2);
user_param_layout.addWidget(u4.widget);
u4.text_edit.addEventListener('textChanged', ()=>{
this.u4 = u4.text_edit.toPlainText();
this.u4 = u4.text_edit.text();
});
var u5 = new Advanced_option_widget('User parameter 5', 2);
user_param_layout.addWidget(u5.widget);
u5.text_edit.addEventListener('textChanged', ()=>{
this.u5 = u5.text_edit.toPlainText();
this.u5 = u5.text_edit.text();
});
user_param_scroll.setWidget(user_param_widget);
......@@ -464,7 +461,7 @@ export class Run_options {
proc_seed_widget.setMinimumSize(180, 140);
batch_edit.addEventListener('textChanged', ()=>{
var batch_size = Number(batch_edit.toPlainText());
var batch_size = Number(batch_edit.text());
if(isNaN(batch_size) || batch_size > 30 || batch_size <= 0){
return;
......@@ -500,9 +497,9 @@ export class Run_options {
save_btn.addEventListener('clicked', ()=>{
var errors = [];
var ok = 1;
const input = Number(batch_edit.toPlainText());
const thread = Number(thread_edit.toPlainText());
const seed = Number(seed_text.toPlainText());
const input = Number(batch_edit.text());
const thread = Number(thread_edit.text());
const seed = Number(seed_text.text());
if(!Number.isInteger(input) || input <= 0 || input > 30 || isNaN(input)){
ok = 0;
......@@ -511,7 +508,7 @@ export class Run_options {
this.batch_size = input;
for(var i = 0; i < this.batch_size; i++){
var val = Number(this.proc_tab[i].seed_text.toPlainText());
var val = Number(this.proc_tab[i].seed_text.text());
if(isNaN(val)){
ok = 0;
errors.push('Seed for run ' + (i+1));
......@@ -529,32 +526,32 @@ export class Run_options {
errors.push('First Seed');
}
if(isNaN(Number(compression_arg.text_edit.toPlainText()))){
if(isNaN(Number(compression_arg.text_edit.text()))){
ok = 0;
errors.push('Compression');
}
if(isNaN(Number(nb_elite.text_edit.toPlainText()))){
if(isNaN(Number(nb_elite.text_edit.text()))){
ok = 0;
errors.push('Elite Size');
}
if(isNaN(Number(popu_size.text_edit.toPlainText()))){
if(isNaN(Number(popu_size.text_edit.text()))){
ok = 0;
errors.push('Population Size');
}
if(isNaN(Number(nb_gen.text_edit.toPlainText()))){
if(isNaN(Number(nb_gen.text_edit.text()))){
ok = 0;
errors.push('Nb Generations');
}
if(isNaN(Number(time_limit.text_edit.toPlainText()))){
if(isNaN(Number(time_limit.text_edit.text()))){
ok = 0;
errors.push('Time Limit');
}
var pressure = Number(select_pressure.text_edit.toPlainText());
var pressure = Number(select_pressure.text_edit.text());
if(isNaN(pressure)){
ok = 0;
errors.push('Selection Pressure');
......@@ -569,7 +566,7 @@ export class Run_options {
errors.push('Selection Pressure : should be an integer if \u2265 2');
}
var final_pressure = Number(reduce_final_pressure.text_edit.toPlainText());
var final_pressure = Number(reduce_final_pressure.text_edit.text());
if(isNaN(final_pressure)){
ok = 0;
errors.push('Reduce Final Pressure');
......@@ -584,22 +581,22 @@ export class Run_options {
errors.push('Reduce Final Pressure : should be an integer if \u2265 2');
}
if(isNaN(Number(opti_it.text_edit.toPlainText()))){
if(isNaN(Number(opti_it.text_edit.text()))){
ok = 0;
errors.push('Optimize Iteration');
}
if(isNaN(Number(baldwinism.text_edit.toPlainText()))){
if(isNaN(Number(baldwinism.text_edit.text()))){
ok = 0;
errors.push('Baldwinism');
}
if(isNaN(Number(fstgpu.text_edit.toPlainText()))){
if(isNaN(Number(fstgpu.text_edit.text()))){
ok = 0;
errors.push('First GPU used for computation');