diff options
author | brenda-br | 2023-02-14 21:23:26 +0530 |
---|---|---|
committer | brenda-br | 2023-02-14 21:23:26 +0530 |
commit | 1cd054c8a19bbb4d47c8515d844f2a7bd58da5e9 (patch) | |
tree | f1044b8ab112f07f1938e169c722ee45650ce2c8 | |
parent | 2a4621e4d7faa62e5df83f9d10feb3a5f72860f9 (diff) | |
download | Chemical-Simulator-GUI-1cd054c8a19bbb4d47c8515d844f2a7bd58da5e9.tar.gz Chemical-Simulator-GUI-1cd054c8a19bbb4d47c8515d844f2a7bd58da5e9.tar.bz2 Chemical-Simulator-GUI-1cd054c8a19bbb4d47c8515d844f2a7bd58da5e9.zip |
Setting Min and Max Input Ports for Mixer and Distillation Column
-rw-r--r-- | Graphics.py | 20 | ||||
-rw-r--r-- | Undo.dat | bin | 0 -> 869 bytes | |||
-rw-r--r-- | mainApp.py | 4 |
3 files changed, 18 insertions, 6 deletions
diff --git a/Graphics.py b/Graphics.py index 227ab38..9c55350 100644 --- a/Graphics.py +++ b/Graphics.py @@ -470,11 +470,19 @@ class NodeItem(QtWidgets.QGraphicsItem): default_tooltip = default_tooltip + f" {i} : {j}\n" self.setToolTip(default_tooltip) + dlg = QMessageBox() + dlg.setWindowTitle("Error") + dlg.setIcon(QMessageBox.Critical) + dlg.setText('Enter valid input value!') if self.obj.type == 'Mixer' and not self.obj.saved: - text, self.ok = QInputDialog.getText(self.container.graphicsView, 'Mixer', 'Enter number of input:', + text, self.ok = QInputDialog.getText(self.container.graphicsView, 'Mixer', 'Enter number of input(2-4):', echo=QLineEdit.Normal, text=str(self.obj.no_of_inputs)) - if self.ok and text: + while self.ok and (int(text)< 2 or int(text) > 4): + dlg.exec_() + text, self.ok = QInputDialog.getText(self.container.graphicsView, 'Mixer', 'Enter number of input(2-4):', + echo=QLineEdit.Normal, text=str(self.obj.no_of_inputs)) + if self.ok: self.nin = int(text) self.obj.no_of_inputs = self.nin self.obj.variables['NI']['value'] = self.nin @@ -485,9 +493,13 @@ class NodeItem(QtWidgets.QGraphicsItem): # self.obj.no_of_outputs = self.nop # self.obj.variables['No']['value'] = self.nop elif self.obj.type == 'DistillationColumn'and not self.obj.saved: - text, self.ok = QInputDialog.getText(self.container.graphicsView, 'DistillationColumn', 'Enter number of input:', + text, self.ok = QInputDialog.getText(self.container.graphicsView, 'DistillationColumn', 'Enter number of input(1-8):', echo=QLineEdit.Normal, text=str(self.obj.no_of_inputs)) - if self.ok and text: + while self.ok and (int(text)< 1 or int(text) > 8): + dlg.exec_() + text, self.ok = QInputDialog.getText(self.container.graphicsView, 'DistillationColumn', 'Enter number of input(1-8):', + echo=QLineEdit.Normal, text=str(self.obj.no_of_inputs)) + if self.ok: self.nin = int(text) self.obj.no_of_inputs = self.nin self.obj.variables['Ni']['value'] = self.nin Binary files differ@@ -322,7 +322,7 @@ class MainApp(QMainWindow,ui): with open(file_name, 'wb') as f: pickle.dump(data, f, pickle.HIGHEST_PROTOCOL) fileName = file_name.split('/')[-1].split('.')[0] - self.setWindowTitle(fileName+' - Chemical Simularot GUI') + self.setWindowTitle(fileName+' - Chemical Simulator GUI') except Exception as e: pass @@ -339,7 +339,7 @@ class MainApp(QMainWindow,ui): (file_format.upper(), file_format)) if file_name: fileName = file_name.split('/')[-1].split('.')[0] - self.setWindowTitle(fileName+' - Chemical Simularot GUI') + self.setWindowTitle(fileName+' - Chemical Simulator GUI') self.undo_redo_helper() |