diff options
author | brenda-br | 2023-03-10 10:11:27 +0530 |
---|---|---|
committer | brenda-br | 2023-03-10 10:11:27 +0530 |
commit | a427629ff7f678f5e77f2c15edfa07b3d021c90f (patch) | |
tree | 526c2d622195077b83b2793a01ef66ed6461f4c2 /src | |
parent | 5432388bca86c6190e56beebdb6649b82298ba8f (diff) | |
download | Chemical-Simulator-GUI-a427629ff7f678f5e77f2c15edfa07b3d021c90f.tar.gz Chemical-Simulator-GUI-a427629ff7f678f5e77f2c15edfa07b3d021c90f.tar.bz2 Chemical-Simulator-GUI-a427629ff7f678f5e77f2c15edfa07b3d021c90f.zip |
Fix #66 Combo Box for Mixer and Distillation Column
Diffstat (limited to 'src')
-rw-r--r-- | src/main/python/utils/Graphics.py | 26 |
1 files changed, 9 insertions, 17 deletions
diff --git a/src/main/python/utils/Graphics.py b/src/main/python/utils/Graphics.py index e3eab7a..eb9b3b9 100644 --- a/src/main/python/utils/Graphics.py +++ b/src/main/python/utils/Graphics.py @@ -476,29 +476,21 @@ 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(2-4):', - echo=QLineEdit.Normal, text=str(self.obj.no_of_inputs)) - 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)) + combob_values = map(str,list(range(2,5))) + text, self.ok = QInputDialog.getItem(self.container.graphicsView, 'Mixer', 'Select number of inputs:', + combob_values, False) + if self.ok: self.nin = int(text) self.obj.no_of_inputs = self.nin self.obj.variables['NI']['value'] = self.nin + elif self.obj.type == 'DistillationColumn'and not self.obj.saved: - 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)) - 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)) + combob_values = map(str,list(range(1,9))) + text, self.ok = QInputDialog.getItem(self.container.graphicsView, 'DistillationColumn', 'Select number of input(s):', + combob_values, False) + if self.ok: self.nin = int(text) self.obj.no_of_inputs = self.nin |