From d476d2e053f937c0060f696312f301591e4f43ea Mon Sep 17 00:00:00 2001 From: brenda-br Date: Thu, 23 Feb 2023 22:14:39 +0530 Subject: Restructure Code -1 --- src/main/python/DockWidgets/DockWidgetFlash.py | 86 ++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 src/main/python/DockWidgets/DockWidgetFlash.py (limited to 'src/main/python/DockWidgets/DockWidgetFlash.py') diff --git a/src/main/python/DockWidgets/DockWidgetFlash.py b/src/main/python/DockWidgets/DockWidgetFlash.py new file mode 100644 index 0000000..7742e62 --- /dev/null +++ b/src/main/python/DockWidgets/DockWidgetFlash.py @@ -0,0 +1,86 @@ +import os, sys + +current = os.path.dirname(os.path.realpath(__file__)) +parent = os.path.dirname(current) +parentPath = os.path.dirname(parent) +sys.path.append(parentPath) + +from PyQt5.QtCore import * +from PyQt5.QtWidgets import * +from PyQt5.QtGui import * +from PyQt5.uic import loadUiType +from python.utils.ComponentSelector import * +from python.utils.Graphics import * + +ui_dialog,_ = loadUiType(parentPath+'/ui/DockWidgets/DockWidgetFlash.ui') + +class DockWidgetFlash(QDockWidget,ui_dialog): + + def __init__(self,name,comptype,obj,container,parent=None): + QDockWidget.__init__(self,parent) + self.setupUi(self) + self.setWindowTitle(obj.name) + self.name=name + self.obj=obj + self.type = comptype + self.input_dict = [] + self.input_params_list() + self.btn.clicked.connect(self.param) + self.dict = [] # a list + + def input_params_list(self): + try: + self.l1.setText(self.obj.variables['thermo_package']['name']+":") + self.lines = [line.rstrip('\n') for line in open('thermopackage.txt')] + for j in self.lines: + self.cb1.addItem(str(j)) + self.cb1.setCurrentText(self.obj.variables['thermo_package']['value']) + + self.check1.setText(self.obj.variables['Tdef']['name']+":") + self.le2.setText(str(self.obj.variables['Tdef']['value'])) + self.u2.setText(self.obj.variables['Tdef']['unit']) + self.check1.toggled.connect(self.fun) + self.check1.setChecked(self.obj.variables['BTdef']['value']) + self.check2.setText(self.obj.variables['Pdef']['name']+":") + self.le3.setText(str(self.obj.variables['Pdef']['value'])) + self.u3.setText(self.obj.variables['Pdef']['unit']) + self.check2.toggled.connect(self.fun) + self.check2.setChecked(self.obj.variables['BPdef']['value']) + + self.input_dict = [self.cb1, self.check1, self.le2, self.check2, self.le3] + + except Exception as e: + print(e) + + def fun(self): + if self.check1.isChecked(): + self.le2.setDisabled(False) + else: + self.le2.setDisabled(True) + if self.check2.isChecked(): + self.le3.setDisabled(False) + else: + self.le3.setDisabled(True) + + def show_error(self): + QMessageBox.about(self, 'Important', "Please fill all fields with data") + + def param(self): + try: + self.dict = [] + print("param.input_dict ", self.input_dict) + self.dict = [self.input_dict[0].currentText(),self.input_dict[1].isChecked(), float(self.input_dict[2].text()), self.input_dict[3].isChecked(), float(self.input_dict[4].text())] + print("param ", self.dict) + self.obj.param_setter(self.dict) + if(self.isVisible()): + currentVal = self.parent().container.graphics.graphicsView.horizontalScrollBar().value() + self.parent().container.graphics.graphicsView.horizontalScrollBar().setValue(currentVal-189) + self.hide() + + except Exception as e: + print(e) + + def closeEvent(self,event): + scrollHVal = self.parent().container.graphics.graphicsView.horizontalScrollBarVal + currentVal = self.parent().container.graphics.graphicsView.horizontalScrollBar().value() + self.parent().container.graphics.graphicsView.horizontalScrollBar().setValue(currentVal-189) \ No newline at end of file -- cgit From 2b94618c50110c38cd67564a5b58630aeeb2adc5 Mon Sep 17 00:00:00 2001 From: brenda-br Date: Fri, 24 Feb 2023 11:55:27 +0530 Subject: Fix #62 Remove Redundant Lines --- src/main/python/DockWidgets/DockWidgetFlash.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/main/python/DockWidgets/DockWidgetFlash.py') diff --git a/src/main/python/DockWidgets/DockWidgetFlash.py b/src/main/python/DockWidgets/DockWidgetFlash.py index 7742e62..a2abbeb 100644 --- a/src/main/python/DockWidgets/DockWidgetFlash.py +++ b/src/main/python/DockWidgets/DockWidgetFlash.py @@ -68,9 +68,9 @@ class DockWidgetFlash(QDockWidget,ui_dialog): def param(self): try: self.dict = [] - print("param.input_dict ", self.input_dict) + #print("param.input_dict ", self.input_dict) self.dict = [self.input_dict[0].currentText(),self.input_dict[1].isChecked(), float(self.input_dict[2].text()), self.input_dict[3].isChecked(), float(self.input_dict[4].text())] - print("param ", self.dict) + #print("param ", self.dict) self.obj.param_setter(self.dict) if(self.isVisible()): currentVal = self.parent().container.graphics.graphicsView.horizontalScrollBar().value() -- cgit From f85ca605c02f70fcd911547323ee1245265b83ab Mon Sep 17 00:00:00 2001 From: brenda-br Date: Wed, 1 Mar 2023 12:49:04 +0530 Subject: DockWidgets Realigning --- src/main/python/DockWidgets/DockWidgetFlash.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/main/python/DockWidgets/DockWidgetFlash.py') diff --git a/src/main/python/DockWidgets/DockWidgetFlash.py b/src/main/python/DockWidgets/DockWidgetFlash.py index a2abbeb..c001fe2 100644 --- a/src/main/python/DockWidgets/DockWidgetFlash.py +++ b/src/main/python/DockWidgets/DockWidgetFlash.py @@ -31,7 +31,7 @@ class DockWidgetFlash(QDockWidget,ui_dialog): def input_params_list(self): try: self.l1.setText(self.obj.variables['thermo_package']['name']+":") - self.lines = [line.rstrip('\n') for line in open('thermopackage.txt')] + self.lines = [line.rstrip('\n') for line in open(parentPath+'/python/utils/thermopackage.txt')] for j in self.lines: self.cb1.addItem(str(j)) self.cb1.setCurrentText(self.obj.variables['thermo_package']['value']) @@ -47,6 +47,10 @@ class DockWidgetFlash(QDockWidget,ui_dialog): self.check2.toggled.connect(self.fun) self.check2.setChecked(self.obj.variables['BPdef']['value']) + self.le2.setFixedWidth(80) + self.le3.setFixedWidth(80) + self.cb1.setFixedWidth(80) + self.input_dict = [self.cb1, self.check1, self.le2, self.check2, self.le3] except Exception as e: -- cgit From 7af3526e105cc330422f8742ec5edec1c4a0a98f Mon Sep 17 00:00:00 2001 From: brenda-br Date: Thu, 2 Mar 2023 15:49:11 +0530 Subject: Restructuring Finalized for App Bundling --- src/main/python/DockWidgets/DockWidgetFlash.py | 90 -------------------------- 1 file changed, 90 deletions(-) delete mode 100644 src/main/python/DockWidgets/DockWidgetFlash.py (limited to 'src/main/python/DockWidgets/DockWidgetFlash.py') diff --git a/src/main/python/DockWidgets/DockWidgetFlash.py b/src/main/python/DockWidgets/DockWidgetFlash.py deleted file mode 100644 index c001fe2..0000000 --- a/src/main/python/DockWidgets/DockWidgetFlash.py +++ /dev/null @@ -1,90 +0,0 @@ -import os, sys - -current = os.path.dirname(os.path.realpath(__file__)) -parent = os.path.dirname(current) -parentPath = os.path.dirname(parent) -sys.path.append(parentPath) - -from PyQt5.QtCore import * -from PyQt5.QtWidgets import * -from PyQt5.QtGui import * -from PyQt5.uic import loadUiType -from python.utils.ComponentSelector import * -from python.utils.Graphics import * - -ui_dialog,_ = loadUiType(parentPath+'/ui/DockWidgets/DockWidgetFlash.ui') - -class DockWidgetFlash(QDockWidget,ui_dialog): - - def __init__(self,name,comptype,obj,container,parent=None): - QDockWidget.__init__(self,parent) - self.setupUi(self) - self.setWindowTitle(obj.name) - self.name=name - self.obj=obj - self.type = comptype - self.input_dict = [] - self.input_params_list() - self.btn.clicked.connect(self.param) - self.dict = [] # a list - - def input_params_list(self): - try: - self.l1.setText(self.obj.variables['thermo_package']['name']+":") - self.lines = [line.rstrip('\n') for line in open(parentPath+'/python/utils/thermopackage.txt')] - for j in self.lines: - self.cb1.addItem(str(j)) - self.cb1.setCurrentText(self.obj.variables['thermo_package']['value']) - - self.check1.setText(self.obj.variables['Tdef']['name']+":") - self.le2.setText(str(self.obj.variables['Tdef']['value'])) - self.u2.setText(self.obj.variables['Tdef']['unit']) - self.check1.toggled.connect(self.fun) - self.check1.setChecked(self.obj.variables['BTdef']['value']) - self.check2.setText(self.obj.variables['Pdef']['name']+":") - self.le3.setText(str(self.obj.variables['Pdef']['value'])) - self.u3.setText(self.obj.variables['Pdef']['unit']) - self.check2.toggled.connect(self.fun) - self.check2.setChecked(self.obj.variables['BPdef']['value']) - - self.le2.setFixedWidth(80) - self.le3.setFixedWidth(80) - self.cb1.setFixedWidth(80) - - self.input_dict = [self.cb1, self.check1, self.le2, self.check2, self.le3] - - except Exception as e: - print(e) - - def fun(self): - if self.check1.isChecked(): - self.le2.setDisabled(False) - else: - self.le2.setDisabled(True) - if self.check2.isChecked(): - self.le3.setDisabled(False) - else: - self.le3.setDisabled(True) - - def show_error(self): - QMessageBox.about(self, 'Important', "Please fill all fields with data") - - def param(self): - try: - self.dict = [] - #print("param.input_dict ", self.input_dict) - self.dict = [self.input_dict[0].currentText(),self.input_dict[1].isChecked(), float(self.input_dict[2].text()), self.input_dict[3].isChecked(), float(self.input_dict[4].text())] - #print("param ", self.dict) - self.obj.param_setter(self.dict) - if(self.isVisible()): - currentVal = self.parent().container.graphics.graphicsView.horizontalScrollBar().value() - self.parent().container.graphics.graphicsView.horizontalScrollBar().setValue(currentVal-189) - self.hide() - - except Exception as e: - print(e) - - def closeEvent(self,event): - scrollHVal = self.parent().container.graphics.graphicsView.horizontalScrollBarVal - currentVal = self.parent().container.graphics.graphicsView.horizontalScrollBar().value() - self.parent().container.graphics.graphicsView.horizontalScrollBar().setValue(currentVal-189) \ No newline at end of file -- cgit From 3cbdd4238867bc860282f7cf702d73b5be6e3f86 Mon Sep 17 00:00:00 2001 From: brenda-br Date: Sat, 4 Mar 2023 11:32:15 +0530 Subject: Revert "Restructuring Finalized for App Bundling" This reverts commit 7af3526e105cc330422f8742ec5edec1c4a0a98f. --- src/main/python/DockWidgets/DockWidgetFlash.py | 90 ++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 src/main/python/DockWidgets/DockWidgetFlash.py (limited to 'src/main/python/DockWidgets/DockWidgetFlash.py') diff --git a/src/main/python/DockWidgets/DockWidgetFlash.py b/src/main/python/DockWidgets/DockWidgetFlash.py new file mode 100644 index 0000000..c001fe2 --- /dev/null +++ b/src/main/python/DockWidgets/DockWidgetFlash.py @@ -0,0 +1,90 @@ +import os, sys + +current = os.path.dirname(os.path.realpath(__file__)) +parent = os.path.dirname(current) +parentPath = os.path.dirname(parent) +sys.path.append(parentPath) + +from PyQt5.QtCore import * +from PyQt5.QtWidgets import * +from PyQt5.QtGui import * +from PyQt5.uic import loadUiType +from python.utils.ComponentSelector import * +from python.utils.Graphics import * + +ui_dialog,_ = loadUiType(parentPath+'/ui/DockWidgets/DockWidgetFlash.ui') + +class DockWidgetFlash(QDockWidget,ui_dialog): + + def __init__(self,name,comptype,obj,container,parent=None): + QDockWidget.__init__(self,parent) + self.setupUi(self) + self.setWindowTitle(obj.name) + self.name=name + self.obj=obj + self.type = comptype + self.input_dict = [] + self.input_params_list() + self.btn.clicked.connect(self.param) + self.dict = [] # a list + + def input_params_list(self): + try: + self.l1.setText(self.obj.variables['thermo_package']['name']+":") + self.lines = [line.rstrip('\n') for line in open(parentPath+'/python/utils/thermopackage.txt')] + for j in self.lines: + self.cb1.addItem(str(j)) + self.cb1.setCurrentText(self.obj.variables['thermo_package']['value']) + + self.check1.setText(self.obj.variables['Tdef']['name']+":") + self.le2.setText(str(self.obj.variables['Tdef']['value'])) + self.u2.setText(self.obj.variables['Tdef']['unit']) + self.check1.toggled.connect(self.fun) + self.check1.setChecked(self.obj.variables['BTdef']['value']) + self.check2.setText(self.obj.variables['Pdef']['name']+":") + self.le3.setText(str(self.obj.variables['Pdef']['value'])) + self.u3.setText(self.obj.variables['Pdef']['unit']) + self.check2.toggled.connect(self.fun) + self.check2.setChecked(self.obj.variables['BPdef']['value']) + + self.le2.setFixedWidth(80) + self.le3.setFixedWidth(80) + self.cb1.setFixedWidth(80) + + self.input_dict = [self.cb1, self.check1, self.le2, self.check2, self.le3] + + except Exception as e: + print(e) + + def fun(self): + if self.check1.isChecked(): + self.le2.setDisabled(False) + else: + self.le2.setDisabled(True) + if self.check2.isChecked(): + self.le3.setDisabled(False) + else: + self.le3.setDisabled(True) + + def show_error(self): + QMessageBox.about(self, 'Important', "Please fill all fields with data") + + def param(self): + try: + self.dict = [] + #print("param.input_dict ", self.input_dict) + self.dict = [self.input_dict[0].currentText(),self.input_dict[1].isChecked(), float(self.input_dict[2].text()), self.input_dict[3].isChecked(), float(self.input_dict[4].text())] + #print("param ", self.dict) + self.obj.param_setter(self.dict) + if(self.isVisible()): + currentVal = self.parent().container.graphics.graphicsView.horizontalScrollBar().value() + self.parent().container.graphics.graphicsView.horizontalScrollBar().setValue(currentVal-189) + self.hide() + + except Exception as e: + print(e) + + def closeEvent(self,event): + scrollHVal = self.parent().container.graphics.graphicsView.horizontalScrollBarVal + currentVal = self.parent().container.graphics.graphicsView.horizontalScrollBar().value() + self.parent().container.graphics.graphicsView.horizontalScrollBar().setValue(currentVal-189) \ No newline at end of file -- cgit