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/DockWidgetMixer.py | 66 ++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 src/main/python/DockWidgets/DockWidgetMixer.py (limited to 'src/main/python/DockWidgets/DockWidgetMixer.py') diff --git a/src/main/python/DockWidgets/DockWidgetMixer.py b/src/main/python/DockWidgets/DockWidgetMixer.py new file mode 100644 index 0000000..5d89589 --- /dev/null +++ b/src/main/python/DockWidgets/DockWidgetMixer.py @@ -0,0 +1,66 @@ +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/DockWidgetMixer.ui') + +class DockWidgetMixer(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.x_pclist = [] + self.input_params_list() + self.btn.clicked.connect(self.param) + self.dict = {} + + # input data tab + def input_params_list(self): + try: + self.l1.setText(self.obj.variables['NI']['name']+":") + self.le1.setText(str(self.obj.variables['NI']['value'])) + self.u1.setText(self.obj.variables['NI']['unit']) + for i in self.obj.Pout_modes: + self.cb2.addItem(str(i)) + self.cb2.setCurrentText(self.obj.variables['outPress']['value']) + + self.l2.setText(self.obj.variables['outPress']['name']+":") + self.input_dict = [self.le1, self.cb2] + + except Exception as e: + print(e) + + def show_error(self): + QMessageBox.about(self, 'Important', "Please fill all fields with data") + + def param(self): + try: + self.dict={} + self.dict = [int(self.input_dict[0].text()), self.input_dict[1].currentText()] + 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 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/DockWidgetMixer.py | 66 -------------------------- 1 file changed, 66 deletions(-) delete mode 100644 src/main/python/DockWidgets/DockWidgetMixer.py (limited to 'src/main/python/DockWidgets/DockWidgetMixer.py') diff --git a/src/main/python/DockWidgets/DockWidgetMixer.py b/src/main/python/DockWidgets/DockWidgetMixer.py deleted file mode 100644 index 5d89589..0000000 --- a/src/main/python/DockWidgets/DockWidgetMixer.py +++ /dev/null @@ -1,66 +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/DockWidgetMixer.ui') - -class DockWidgetMixer(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.x_pclist = [] - self.input_params_list() - self.btn.clicked.connect(self.param) - self.dict = {} - - # input data tab - def input_params_list(self): - try: - self.l1.setText(self.obj.variables['NI']['name']+":") - self.le1.setText(str(self.obj.variables['NI']['value'])) - self.u1.setText(self.obj.variables['NI']['unit']) - for i in self.obj.Pout_modes: - self.cb2.addItem(str(i)) - self.cb2.setCurrentText(self.obj.variables['outPress']['value']) - - self.l2.setText(self.obj.variables['outPress']['name']+":") - self.input_dict = [self.le1, self.cb2] - - except Exception as e: - print(e) - - def show_error(self): - QMessageBox.about(self, 'Important', "Please fill all fields with data") - - def param(self): - try: - self.dict={} - self.dict = [int(self.input_dict[0].text()), self.input_dict[1].currentText()] - 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/DockWidgetMixer.py | 66 ++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 src/main/python/DockWidgets/DockWidgetMixer.py (limited to 'src/main/python/DockWidgets/DockWidgetMixer.py') diff --git a/src/main/python/DockWidgets/DockWidgetMixer.py b/src/main/python/DockWidgets/DockWidgetMixer.py new file mode 100644 index 0000000..5d89589 --- /dev/null +++ b/src/main/python/DockWidgets/DockWidgetMixer.py @@ -0,0 +1,66 @@ +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/DockWidgetMixer.ui') + +class DockWidgetMixer(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.x_pclist = [] + self.input_params_list() + self.btn.clicked.connect(self.param) + self.dict = {} + + # input data tab + def input_params_list(self): + try: + self.l1.setText(self.obj.variables['NI']['name']+":") + self.le1.setText(str(self.obj.variables['NI']['value'])) + self.u1.setText(self.obj.variables['NI']['unit']) + for i in self.obj.Pout_modes: + self.cb2.addItem(str(i)) + self.cb2.setCurrentText(self.obj.variables['outPress']['value']) + + self.l2.setText(self.obj.variables['outPress']['name']+":") + self.input_dict = [self.le1, self.cb2] + + except Exception as e: + print(e) + + def show_error(self): + QMessageBox.about(self, 'Important', "Please fill all fields with data") + + def param(self): + try: + self.dict={} + self.dict = [int(self.input_dict[0].text()), self.input_dict[1].currentText()] + 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