From e6d847f4a2a3a79284646f44b3d014743630da71 Mon Sep 17 00:00:00 2001 From: brenda-br Date: Sat, 28 Jan 2023 00:01:12 +0530 Subject: Fix #32 Simulation window only shifts a little when closing dock widget Still shifting a bit but should work fine --- DockWidgets/DockWidget.py | 2 +- DockWidgets/DockWidgetCompoundSeparator.py | 2 +- DockWidgets/DockWidgetCompressorExpander.py | 2 +- DockWidgets/DockWidgetDistillationColumn.py | 2 +- DockWidgets/DockWidgetFlash.py | 2 +- DockWidgets/DockWidgetMaterialStream.py | 2 +- DockWidgets/DockWidgetMixer.py | 2 +- DockWidgets/DockWidgetShortcutColumn.py | 2 +- DockWidgets/DockWidgetSplitter.py | 2 +- .../DockWidgetMaterialStream.cpython-37.pyc | Bin 9127 -> 9114 bytes Undo.dat | Bin 115346 -> 3471 bytes 11 files changed, 9 insertions(+), 9 deletions(-) diff --git a/DockWidgets/DockWidget.py b/DockWidgets/DockWidget.py index cc222db..68404c7 100644 --- a/DockWidgets/DockWidget.py +++ b/DockWidgets/DockWidget.py @@ -155,4 +155,4 @@ class DockWidget(QDockWidget,ui_dialog): 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((scrollHVal+currentVal)/2) \ No newline at end of file + self.parent().container.graphics.graphicsView.horizontalScrollBar().setValue(currentVal-189) \ No newline at end of file diff --git a/DockWidgets/DockWidgetCompoundSeparator.py b/DockWidgets/DockWidgetCompoundSeparator.py index 8fcee39..710ba5e 100644 --- a/DockWidgets/DockWidgetCompoundSeparator.py +++ b/DockWidgets/DockWidgetCompoundSeparator.py @@ -120,4 +120,4 @@ class DockWidgetCompoundSeparator(QDockWidget,ui_dialog): 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((scrollHVal+currentVal)/2) \ No newline at end of file + self.parent().container.graphics.graphicsView.horizontalScrollBar().setValue(currentVal-189) \ No newline at end of file diff --git a/DockWidgets/DockWidgetCompressorExpander.py b/DockWidgets/DockWidgetCompressorExpander.py index cd0135c..47f463d 100644 --- a/DockWidgets/DockWidgetCompressorExpander.py +++ b/DockWidgets/DockWidgetCompressorExpander.py @@ -154,4 +154,4 @@ class DockWidgetCompressorExpander(QDockWidget,ui_dialog): 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((scrollHVal+currentVal)/2) \ No newline at end of file + self.parent().container.graphics.graphicsView.horizontalScrollBar().setValue(currentVal-189) \ No newline at end of file diff --git a/DockWidgets/DockWidgetDistillationColumn.py b/DockWidgets/DockWidgetDistillationColumn.py index 716cb1a..1c30309 100644 --- a/DockWidgets/DockWidgetDistillationColumn.py +++ b/DockWidgets/DockWidgetDistillationColumn.py @@ -361,4 +361,4 @@ class DockWidgetDistillationColumn(QDockWidget, ui_dialog): 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((scrollHVal+currentVal)/2) \ No newline at end of file + self.parent().container.graphics.graphicsView.horizontalScrollBar().setValue(currentVal-189) \ No newline at end of file diff --git a/DockWidgets/DockWidgetFlash.py b/DockWidgets/DockWidgetFlash.py index c288259..368a009 100644 --- a/DockWidgets/DockWidgetFlash.py +++ b/DockWidgets/DockWidgetFlash.py @@ -73,4 +73,4 @@ class DockWidgetFlash(QDockWidget,ui_dialog): 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((scrollHVal+currentVal)/2) \ No newline at end of file + self.parent().container.graphics.graphicsView.horizontalScrollBar().setValue(currentVal-189) \ No newline at end of file diff --git a/DockWidgets/DockWidgetMaterialStream.py b/DockWidgets/DockWidgetMaterialStream.py index 64545be..b9acc95 100644 --- a/DockWidgets/DockWidgetMaterialStream.py +++ b/DockWidgets/DockWidgetMaterialStream.py @@ -358,4 +358,4 @@ class DockWidgetMaterialStream(QDockWidget,ui_dialog): 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((scrollHVal+currentVal)/2) \ No newline at end of file + self.parent().container.graphics.graphicsView.horizontalScrollBar().setValue(currentVal-189) \ No newline at end of file diff --git a/DockWidgets/DockWidgetMixer.py b/DockWidgets/DockWidgetMixer.py index 748ef4f..c5f06fc 100644 --- a/DockWidgets/DockWidgetMixer.py +++ b/DockWidgets/DockWidgetMixer.py @@ -53,4 +53,4 @@ class DockWidgetMixer(QDockWidget,ui_dialog): 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((scrollHVal+currentVal)/2) \ No newline at end of file + self.parent().container.graphics.graphicsView.horizontalScrollBar().setValue(currentVal-189) \ No newline at end of file diff --git a/DockWidgets/DockWidgetShortcutColumn.py b/DockWidgets/DockWidgetShortcutColumn.py index efb044a..d07f323 100644 --- a/DockWidgets/DockWidgetShortcutColumn.py +++ b/DockWidgets/DockWidgetShortcutColumn.py @@ -135,4 +135,4 @@ class DockWidgetShortcutColumn(QDockWidget,ui_dialog): 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((scrollHVal+currentVal)/2) \ No newline at end of file + self.parent().container.graphics.graphicsView.horizontalScrollBar().setValue(currentVal-189) \ No newline at end of file diff --git a/DockWidgets/DockWidgetSplitter.py b/DockWidgets/DockWidgetSplitter.py index 05dfb0b..089b517 100644 --- a/DockWidgets/DockWidgetSplitter.py +++ b/DockWidgets/DockWidgetSplitter.py @@ -72,4 +72,4 @@ class DockWidgetSplitter(QDockWidget,ui_dialog): 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((scrollHVal+currentVal)/2) \ No newline at end of file + self.parent().container.graphics.graphicsView.horizontalScrollBar().setValue(currentVal-189) \ No newline at end of file diff --git a/DockWidgets/__pycache__/DockWidgetMaterialStream.cpython-37.pyc b/DockWidgets/__pycache__/DockWidgetMaterialStream.cpython-37.pyc index e5bba23..4bc5ca3 100644 Binary files a/DockWidgets/__pycache__/DockWidgetMaterialStream.cpython-37.pyc and b/DockWidgets/__pycache__/DockWidgetMaterialStream.cpython-37.pyc differ diff --git a/Undo.dat b/Undo.dat index 501e2fd..435cb62 100644 Binary files a/Undo.dat and b/Undo.dat differ -- cgit From b9df67134289c0b9d76f7f6462284d5cdf64c4d9 Mon Sep 17 00:00:00 2001 From: brenda-br Date: Sat, 28 Jan 2023 00:11:34 +0530 Subject: Fix #45 New File not created when cancelling Open File --- mainApp.py | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/mainApp.py b/mainApp.py index 1430960..7f44435 100644 --- a/mainApp.py +++ b/mainApp.py @@ -335,21 +335,21 @@ class MainApp(QMainWindow,ui): file_name, _ = QFileDialog.getOpenFileName(self, "Open As", initial_path, "%s Files (*.%s);; All Files (*)" % (file_format.upper(), file_format)) + if file_name: + self.undo_redo_helper() - self.undo_redo_helper() - - with open(file_name, 'rb') as f: - obj = pickle.load(f) - temp_result = obj[-1] - obj.pop() - compound_selected = obj[-1] - obj.pop() - self.comp.set_compounds(compound_selected) - for i in compound_selected: - self.comp.compound_selection(self.comp, i) - self.container.graphics.load_canvas(obj, self.container) - self.container.result = temp_result - DockWidget.show_result(dock_widget_lst) + with open(file_name, 'rb') as f: + obj = pickle.load(f) + temp_result = obj[-1] + obj.pop() + compound_selected = obj[-1] + obj.pop() + self.comp.set_compounds(compound_selected) + for i in compound_selected: + self.comp.compound_selection(self.comp, i) + self.container.graphics.load_canvas(obj, self.container) + self.container.result = temp_result + DockWidget.show_result(dock_widget_lst) except Exception as e: -- cgit From 9e587690ebf2a16f33d5a8ee4904e7a36844371d Mon Sep 17 00:00:00 2001 From: brenda-br Date: Sat, 28 Jan 2023 21:48:22 +0530 Subject: Fix #47 Tololtip Update with important variables after simulation --- Container.py | 6 ++--- DockWidgets/__pycache__/DockWidget.cpython-37.pyc | Bin 4849 -> 4845 bytes .../DockWidgetCompoundSeparator.cpython-37.pyc | Bin 4104 -> 4100 bytes .../DockWidgetDistillationColumn.cpython-37.pyc | Bin 10155 -> 10151 bytes .../__pycache__/DockWidgetFlash.cpython-37.pyc | Bin 3202 -> 3198 bytes .../DockWidgetMaterialStream.cpython-37.pyc | Bin 9114 -> 9123 bytes .../__pycache__/DockWidgetMixer.cpython-37.pyc | Bin 2388 -> 2384 bytes .../DockWidgetShortcutColumn.cpython-37.pyc | Bin 5350 -> 5346 bytes .../__pycache__/DockWidgetSplitter.cpython-37.pyc | Bin 3023 -> 3019 bytes Graphics.py | 8 +++++++ Streams.py | 25 +++++++++++++++++++++ Undo.dat | Bin 3471 -> 25570 bytes 12 files changed, 36 insertions(+), 3 deletions(-) diff --git a/Container.py b/Container.py index 443a8bd..a975bc9 100644 --- a/Container.py +++ b/Container.py @@ -157,9 +157,9 @@ class Container(): if(len(self.result)== 4): DockWidget.show_result(NodeItem.get_dock_widget()) - # for i in self.graphics.scene.items(): - # if (isinstance(i, NodeItem)): - # i.update_tooltip() + for i in self.graphics.scene.items(): + if (isinstance(i, NodeItem) and i.type == 'MaterialStream'): + i.update_tooltip_selectedVar() def flat_list(lst): flat_lst=[] diff --git a/DockWidgets/__pycache__/DockWidget.cpython-37.pyc b/DockWidgets/__pycache__/DockWidget.cpython-37.pyc index 5d0ec10..8ab3386 100644 Binary files a/DockWidgets/__pycache__/DockWidget.cpython-37.pyc and b/DockWidgets/__pycache__/DockWidget.cpython-37.pyc differ diff --git a/DockWidgets/__pycache__/DockWidgetCompoundSeparator.cpython-37.pyc b/DockWidgets/__pycache__/DockWidgetCompoundSeparator.cpython-37.pyc index f11f259..04890a9 100644 Binary files a/DockWidgets/__pycache__/DockWidgetCompoundSeparator.cpython-37.pyc and b/DockWidgets/__pycache__/DockWidgetCompoundSeparator.cpython-37.pyc differ diff --git a/DockWidgets/__pycache__/DockWidgetDistillationColumn.cpython-37.pyc b/DockWidgets/__pycache__/DockWidgetDistillationColumn.cpython-37.pyc index aa0f582..fb6c619 100644 Binary files a/DockWidgets/__pycache__/DockWidgetDistillationColumn.cpython-37.pyc and b/DockWidgets/__pycache__/DockWidgetDistillationColumn.cpython-37.pyc differ diff --git a/DockWidgets/__pycache__/DockWidgetFlash.cpython-37.pyc b/DockWidgets/__pycache__/DockWidgetFlash.cpython-37.pyc index 53d07bc..8ca0797 100644 Binary files a/DockWidgets/__pycache__/DockWidgetFlash.cpython-37.pyc and b/DockWidgets/__pycache__/DockWidgetFlash.cpython-37.pyc differ diff --git a/DockWidgets/__pycache__/DockWidgetMaterialStream.cpython-37.pyc b/DockWidgets/__pycache__/DockWidgetMaterialStream.cpython-37.pyc index 4bc5ca3..00acef9 100644 Binary files a/DockWidgets/__pycache__/DockWidgetMaterialStream.cpython-37.pyc and b/DockWidgets/__pycache__/DockWidgetMaterialStream.cpython-37.pyc differ diff --git a/DockWidgets/__pycache__/DockWidgetMixer.cpython-37.pyc b/DockWidgets/__pycache__/DockWidgetMixer.cpython-37.pyc index 58c8a9e..d5e0ab0 100644 Binary files a/DockWidgets/__pycache__/DockWidgetMixer.cpython-37.pyc and b/DockWidgets/__pycache__/DockWidgetMixer.cpython-37.pyc differ diff --git a/DockWidgets/__pycache__/DockWidgetShortcutColumn.cpython-37.pyc b/DockWidgets/__pycache__/DockWidgetShortcutColumn.cpython-37.pyc index dd67795..68769ee 100644 Binary files a/DockWidgets/__pycache__/DockWidgetShortcutColumn.cpython-37.pyc and b/DockWidgets/__pycache__/DockWidgetShortcutColumn.cpython-37.pyc differ diff --git a/DockWidgets/__pycache__/DockWidgetSplitter.cpython-37.pyc b/DockWidgets/__pycache__/DockWidgetSplitter.cpython-37.pyc index e19a9a3..88174db 100644 Binary files a/DockWidgets/__pycache__/DockWidgetSplitter.cpython-37.pyc and b/DockWidgets/__pycache__/DockWidgetSplitter.cpython-37.pyc differ diff --git a/Graphics.py b/Graphics.py index c527205..04bc7c8 100644 --- a/Graphics.py +++ b/Graphics.py @@ -591,6 +591,14 @@ class NodeItem(QtWidgets.QGraphicsItem): default_tooltip = default_tooltip + f" {i} : {j}\n" self.setToolTip(default_tooltip) + def update_tooltip_selectedVar(self): + default_tooltip = f"{self.name}\n\n" + default_tooltip_dict = self.obj.param_getter_tooltip_selectedVar() + for i, j in default_tooltip_dict.items(): + if j is not None: + default_tooltip = default_tooltip + f" {i} : {j}\n" + self.setToolTip(default_tooltip) + def update_compounds(self): try: self.obj.update_compounds() diff --git a/Streams.py b/Streams.py index 0559831..739010a 100644 --- a/Streams.py +++ b/Streams.py @@ -136,6 +136,31 @@ class MaterialStream(): dict[self.variables['x_pc']['name']] = str(self.variables['x_pc']['value'])+' '+self.variables['x_pc']['unit'] dict['Thermo Package'] = self.thermo_package return dict + + def param_getter_tooltip_selectedVar(self): + dict = {} + + var1_name = self.variables['P']['name'] + var1_val = self.variables['P']['value'] + var1_unit = self.variables['P']['unit'] + var2_name = self.variables['T']['name'] + var2_val = self.variables['T']['value'] + var2_unit = self.variables['T']['unit'] + var3_name = self.variables['H_p[1]']['name'] + var3_val = self.variables['H_p[1]']['value'] + var3_unit = self.variables['H_p[1]']['unit'] + var4_name = self.variables['S_p[1]']['name'] + var4_val = self.variables['S_p[1]']['value'] + var4_unit = self.variables['S_p[1]']['unit'] + var5_name = self.variables['xvap']['name'] + var5_val = self.variables['xvap']['value'] + var5_unit = self.variables['xvap']['unit'] + dict = {var1_name:str(var1_val)+' '+var1_unit, + var2_name:str(var2_val)+' '+var2_unit, + var3_name:str(var3_val)+' '+var3_unit, + var4_name:str(var4_val)+' '+var4_unit, + var5_name:str(var5_val)+' '+var5_unit, } + return dict def param_getter(self,mode): dict = {} diff --git a/Undo.dat b/Undo.dat index 435cb62..69c8455 100644 Binary files a/Undo.dat and b/Undo.dat differ -- cgit From 613060d6259ded571e137556c92ebdbac8950a54 Mon Sep 17 00:00:00 2001 From: brenda-br Date: Sun, 29 Jan 2023 10:52:16 +0530 Subject: Fix #44 Simulation running after reopening --- Redo.dat | Bin 0 -> 26458 bytes Undo.dat | Bin 25570 -> 0 bytes mainApp.py | 3 +++ 3 files changed, 3 insertions(+) diff --git a/Redo.dat b/Redo.dat index e69de29..0846630 100644 Binary files a/Redo.dat and b/Redo.dat differ diff --git a/Undo.dat b/Undo.dat index 69c8455..e69de29 100644 Binary files a/Undo.dat and b/Undo.dat differ diff --git a/mainApp.py b/mainApp.py index 7f44435..2252f5d 100644 --- a/mainApp.py +++ b/mainApp.py @@ -351,6 +351,9 @@ class MainApp(QMainWindow,ui): self.container.result = temp_result DockWidget.show_result(dock_widget_lst) + for i in dock_widget_lst: + i.param() + except Exception as e: print(e) -- cgit From 4a4f5e4248daeb6ad93f1101526bf53c1c24c8f6 Mon Sep 17 00:00:00 2001 From: brenda-br Date: Sun, 29 Jan 2023 11:45:16 +0530 Subject: Fix #32 Simulation window not shifting after submitting dock widget(More Fixes) --- DockWidgets/DockWidget.py | 6 ++++-- DockWidgets/DockWidgetCompoundSeparator.py | 3 +++ DockWidgets/DockWidgetCompressorExpander.py | 4 +++- DockWidgets/DockWidgetDistillationColumn.py | 3 +++ DockWidgets/DockWidgetFlash.py | 3 +++ DockWidgets/DockWidgetMaterialStream.py | 7 +++++-- DockWidgets/DockWidgetMixer.py | 3 +++ DockWidgets/DockWidgetShortcutColumn.py | 3 +++ DockWidgets/DockWidgetSplitter.py | 3 +++ .../DockWidgetMaterialStream.cpython-37.pyc | Bin 9123 -> 9230 bytes .../__pycache__/DockWidgetMixer.cpython-37.pyc | Bin 2384 -> 2384 bytes Redo.dat | Bin 26458 -> 0 bytes Undo.dat | Bin 0 -> 3471 bytes 13 files changed, 30 insertions(+), 5 deletions(-) diff --git a/DockWidgets/DockWidget.py b/DockWidgets/DockWidget.py index 68404c7..71e9624 100644 --- a/DockWidgets/DockWidget.py +++ b/DockWidgets/DockWidget.py @@ -90,7 +90,7 @@ class DockWidget(QDockWidget,ui_dialog): self.show_error() break - print("param ", self.dict) + #print("param ", self.dict) self.obj.param_setter(self.dict) for i in self.container.graphics.graphicsView.items(): try: @@ -98,7 +98,9 @@ class DockWidget(QDockWidget,ui_dialog): i.update_tooltip() except: pass - + 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: diff --git a/DockWidgets/DockWidgetCompoundSeparator.py b/DockWidgets/DockWidgetCompoundSeparator.py index 710ba5e..57b1339 100644 --- a/DockWidgets/DockWidgetCompoundSeparator.py +++ b/DockWidgets/DockWidgetCompoundSeparator.py @@ -113,6 +113,9 @@ class DockWidgetCompoundSeparator(QDockWidget,ui_dialog): 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: diff --git a/DockWidgets/DockWidgetCompressorExpander.py b/DockWidgets/DockWidgetCompressorExpander.py index 47f463d..e8e2b31 100644 --- a/DockWidgets/DockWidgetCompressorExpander.py +++ b/DockWidgets/DockWidgetCompressorExpander.py @@ -107,7 +107,9 @@ class DockWidgetCompressorExpander(QDockWidget,ui_dialog): i.update_tooltip() except: pass - + 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: diff --git a/DockWidgets/DockWidgetDistillationColumn.py b/DockWidgets/DockWidgetDistillationColumn.py index 1c30309..e2e1031 100644 --- a/DockWidgets/DockWidgetDistillationColumn.py +++ b/DockWidgets/DockWidgetDistillationColumn.py @@ -179,6 +179,9 @@ class DockWidgetDistillationColumn(QDockWidget, ui_dialog): 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: diff --git a/DockWidgets/DockWidgetFlash.py b/DockWidgets/DockWidgetFlash.py index 368a009..c75f950 100644 --- a/DockWidgets/DockWidgetFlash.py +++ b/DockWidgets/DockWidgetFlash.py @@ -65,6 +65,9 @@ class DockWidgetFlash(QDockWidget,ui_dialog): 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: diff --git a/DockWidgets/DockWidgetMaterialStream.py b/DockWidgets/DockWidgetMaterialStream.py index b9acc95..a7f06df 100644 --- a/DockWidgets/DockWidgetMaterialStream.py +++ b/DockWidgets/DockWidgetMaterialStream.py @@ -174,7 +174,9 @@ class DockWidgetMaterialStream(QDockWidget,ui_dialog): i.update_tooltip() except: pass - + 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: @@ -358,4 +360,5 @@ class DockWidgetMaterialStream(QDockWidget,ui_dialog): 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 + self.parent().container.graphics.graphicsView.horizontalScrollBar().setValue(currentVal-189) + \ No newline at end of file diff --git a/DockWidgets/DockWidgetMixer.py b/DockWidgets/DockWidgetMixer.py index c5f06fc..2d02f8c 100644 --- a/DockWidgets/DockWidgetMixer.py +++ b/DockWidgets/DockWidgetMixer.py @@ -46,6 +46,9 @@ class DockWidgetMixer(QDockWidget,ui_dialog): 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: diff --git a/DockWidgets/DockWidgetShortcutColumn.py b/DockWidgets/DockWidgetShortcutColumn.py index d07f323..9b65021 100644 --- a/DockWidgets/DockWidgetShortcutColumn.py +++ b/DockWidgets/DockWidgetShortcutColumn.py @@ -90,6 +90,9 @@ class DockWidgetShortcutColumn(QDockWidget,ui_dialog): self.input_dict[4].currentText(), float(self.input_dict[5].text()), float(self.input_dict[6].text()), float(self.input_dict[7].text()), self.input_dict[8].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: diff --git a/DockWidgets/DockWidgetSplitter.py b/DockWidgets/DockWidgetSplitter.py index 089b517..24a8ee2 100644 --- a/DockWidgets/DockWidgetSplitter.py +++ b/DockWidgets/DockWidgetSplitter.py @@ -65,6 +65,9 @@ class DockWidgetSplitter(QDockWidget,ui_dialog): self.dict={} self.dict = [int(self.input_dict[0].text()),self.input_dict[1].currentText(), float(self.input_dict[2].text()), float(self.input_dict[3].text())] 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) diff --git a/DockWidgets/__pycache__/DockWidgetMaterialStream.cpython-37.pyc b/DockWidgets/__pycache__/DockWidgetMaterialStream.cpython-37.pyc index 00acef9..85ed32e 100644 Binary files a/DockWidgets/__pycache__/DockWidgetMaterialStream.cpython-37.pyc and b/DockWidgets/__pycache__/DockWidgetMaterialStream.cpython-37.pyc differ diff --git a/DockWidgets/__pycache__/DockWidgetMixer.cpython-37.pyc b/DockWidgets/__pycache__/DockWidgetMixer.cpython-37.pyc index d5e0ab0..e2ca618 100644 Binary files a/DockWidgets/__pycache__/DockWidgetMixer.cpython-37.pyc and b/DockWidgets/__pycache__/DockWidgetMixer.cpython-37.pyc differ diff --git a/Redo.dat b/Redo.dat index 0846630..e69de29 100644 Binary files a/Redo.dat and b/Redo.dat differ diff --git a/Undo.dat b/Undo.dat index e69de29..435cb62 100644 Binary files a/Undo.dat and b/Undo.dat differ -- cgit From c5eb21ea4e02c6ab5138bdc77c739292f2b87ce6 Mon Sep 17 00:00:00 2001 From: brenda-br Date: Sun, 29 Jan 2023 15:17:49 +0530 Subject: Fix #31 Sensitivity of connectors increased --- DockWidgets/__pycache__/DockWidget.cpython-37.pyc | Bin 4845 -> 4932 bytes .../DockWidgetCompoundSeparator.cpython-37.pyc | Bin 4100 -> 4222 bytes .../DockWidgetDistillationColumn.cpython-37.pyc | Bin 10151 -> 10273 bytes .../__pycache__/DockWidgetFlash.cpython-37.pyc | Bin 3198 -> 3318 bytes .../DockWidgetMaterialStream.cpython-37.pyc | Bin 9230 -> 9230 bytes .../__pycache__/DockWidgetMixer.cpython-37.pyc | Bin 2384 -> 2504 bytes .../DockWidgetShortcutColumn.cpython-37.pyc | Bin 5346 -> 5468 bytes .../__pycache__/DockWidgetSplitter.cpython-37.pyc | Bin 3019 -> 3139 bytes Graphics.py | 42 +++++++++++++-------- Undo.dat | Bin 3471 -> 65412 bytes 10 files changed, 26 insertions(+), 16 deletions(-) diff --git a/DockWidgets/__pycache__/DockWidget.cpython-37.pyc b/DockWidgets/__pycache__/DockWidget.cpython-37.pyc index 8ab3386..51ca871 100644 Binary files a/DockWidgets/__pycache__/DockWidget.cpython-37.pyc and b/DockWidgets/__pycache__/DockWidget.cpython-37.pyc differ diff --git a/DockWidgets/__pycache__/DockWidgetCompoundSeparator.cpython-37.pyc b/DockWidgets/__pycache__/DockWidgetCompoundSeparator.cpython-37.pyc index 04890a9..ac95283 100644 Binary files a/DockWidgets/__pycache__/DockWidgetCompoundSeparator.cpython-37.pyc and b/DockWidgets/__pycache__/DockWidgetCompoundSeparator.cpython-37.pyc differ diff --git a/DockWidgets/__pycache__/DockWidgetDistillationColumn.cpython-37.pyc b/DockWidgets/__pycache__/DockWidgetDistillationColumn.cpython-37.pyc index fb6c619..9be19e9 100644 Binary files a/DockWidgets/__pycache__/DockWidgetDistillationColumn.cpython-37.pyc and b/DockWidgets/__pycache__/DockWidgetDistillationColumn.cpython-37.pyc differ diff --git a/DockWidgets/__pycache__/DockWidgetFlash.cpython-37.pyc b/DockWidgets/__pycache__/DockWidgetFlash.cpython-37.pyc index 8ca0797..53e426a 100644 Binary files a/DockWidgets/__pycache__/DockWidgetFlash.cpython-37.pyc and b/DockWidgets/__pycache__/DockWidgetFlash.cpython-37.pyc differ diff --git a/DockWidgets/__pycache__/DockWidgetMaterialStream.cpython-37.pyc b/DockWidgets/__pycache__/DockWidgetMaterialStream.cpython-37.pyc index 85ed32e..16c3008 100644 Binary files a/DockWidgets/__pycache__/DockWidgetMaterialStream.cpython-37.pyc and b/DockWidgets/__pycache__/DockWidgetMaterialStream.cpython-37.pyc differ diff --git a/DockWidgets/__pycache__/DockWidgetMixer.cpython-37.pyc b/DockWidgets/__pycache__/DockWidgetMixer.cpython-37.pyc index e2ca618..ce2d5af 100644 Binary files a/DockWidgets/__pycache__/DockWidgetMixer.cpython-37.pyc and b/DockWidgets/__pycache__/DockWidgetMixer.cpython-37.pyc differ diff --git a/DockWidgets/__pycache__/DockWidgetShortcutColumn.cpython-37.pyc b/DockWidgets/__pycache__/DockWidgetShortcutColumn.cpython-37.pyc index 68769ee..84d18de 100644 Binary files a/DockWidgets/__pycache__/DockWidgetShortcutColumn.cpython-37.pyc and b/DockWidgets/__pycache__/DockWidgetShortcutColumn.cpython-37.pyc differ diff --git a/DockWidgets/__pycache__/DockWidgetSplitter.cpython-37.pyc b/DockWidgets/__pycache__/DockWidgetSplitter.cpython-37.pyc index 88174db..2f45777 100644 Binary files a/DockWidgets/__pycache__/DockWidgetSplitter.cpython-37.pyc and b/DockWidgets/__pycache__/DockWidgetSplitter.cpython-37.pyc differ diff --git a/Graphics.py b/Graphics.py index 04bc7c8..be9909f 100644 --- a/Graphics.py +++ b/Graphics.py @@ -286,7 +286,17 @@ class NodeSocket(QtWidgets.QGraphicsItem): def paint(self, painter, option, widget): painter.setBrush(self.brush) painter.setPen(self.pen) - painter.drawEllipse(self.rect) + painter.drawEllipse(self.rect.x()-4,self.rect.y()-4,self.rect.height(),self.rect.width()) + painter.setBrush(QBrush(Qt.cyan,Qt.SolidPattern)) + painter.drawEllipse(self.rect.x()-2,self.rect.y()-2,(self.rect.height()/3)*2,(self.rect.width()/3)*2) + # painter.drawEllipse(self.rect.x(),self.rect.y(),self.rect.height()/3,self.rect.width()/3) + + + # grip_path = QPainterPath() + # #grip_path.addEllipse(self.rect.x(),self.rect.y(),self.rect.height()/3,self.rect.width()/3) + # grip_path.addEllipse(self.rect.x()-2,self.rect.y()-2,(self.rect.height()/3)*2,(self.rect.width()/3)*2) + # grip_path.addEllipse(self.rect.x()-4,self.rect.y()-4,self.rect.height(),self.rect.width()) + # painter.strokePath(grip_path.simplified(),QPen(Qt.black,1)) def mousePressEvent(self, event): cursor = QCursor( Qt.PointingHandCursor ) @@ -294,7 +304,7 @@ class NodeSocket(QtWidgets.QGraphicsItem): if self.type == 'op': rect = self.boundingRect() - pointA = QtCore.QPointF(rect.x() + rect.width()/2, rect.y() + rect.height()/2) + pointA = QtCore.QPointF(rect.x() + rect.width()/(2*3), rect.y() + rect.height()/(2*3)) pointA = self.mapToScene(pointA) pointB = self.mapToScene(event.pos()) self.new_line = NodeLine(pointA, pointB ,'op') @@ -303,7 +313,7 @@ class NodeSocket(QtWidgets.QGraphicsItem): elif self.type == 'in': rect = self.boundingRect() pointA = self.mapToScene(event.pos()) - pointB = QtCore.QPointF(rect.x() + rect.width()/2, rect.y() + rect.height()/2) + pointB = QtCore.QPointF(rect.x() + rect.width()/(2*3), rect.y() + rect.height()/(2*3)) pointB = self.mapToScene(pointB) self.new_line = NodeLine(pointA, pointB, 'in') self.in_lines.append(self.new_line) @@ -381,7 +391,7 @@ class NodeSocket(QtWidgets.QGraphicsItem): def get_center(self): rect = self.boundingRect() - center = QtCore.QPointF(rect.x() + rect.width()/2, rect.y() + rect.height()/2) + center = QtCore.QPointF(rect.x() + rect.width()/(2*3), rect.y() + rect.height()/(2*3)) center = self.mapToScene(center) return center @@ -533,28 +543,28 @@ class NodeItem(QtWidgets.QGraphicsItem): def initialize_sockets(self,type): if(self.type=="Flash" or self.type=="CompoundSeparator"): - input = [NodeSocket(QtCore.QRect(5,(self.rect.height()*x/(self.nin+1)-2),4,4), self, 'in', x) for x in range(1,self.nin+1) ] - output = [NodeSocket(QtCore.QRect(self.rect.width()-9,(self.rect.height()*x*1/(self.nop+1)),4,4), self, 'op', x) for x in range(1,self.nop+1)] + input = [NodeSocket(QtCore.QRect(5,(self.rect.height()*x/(self.nin+1)-2),4*3,4*3), self, 'in', x) for x in range(1,self.nin+1) ] + output = [NodeSocket(QtCore.QRect(self.rect.width()-9,(self.rect.height()*x*1/(self.nop+1)),4*3,4*3), self, 'op', x) for x in range(1,self.nop+1)] return input,output elif(self.type=="AdiabaticCompressor" or self.type=="AdiabaticExpander" or self.type =="Mixer" or self.type =="Splitter" or self.type =="Valve" ): - input = [NodeSocket(QtCore.QRect(-2.5, (self.rect.height()*x/(self.nin+1))-2,4,4), self, 'in', x) for x in range(1,self.nin+1) ] - output = [NodeSocket(QtCore.QRect(self.rect.width()-2.5,(self.rect.height()*x/(self.nop+1))-2,4,4), self, 'op', x) for x in range(1,self.nop+1)] + input = [NodeSocket(QtCore.QRect(-2.5, (self.rect.height()*x/(self.nin+1))-2,4*3,4*3), self, 'in', x) for x in range(1,self.nin+1) ] + output = [NodeSocket(QtCore.QRect(self.rect.width()-2.5,(self.rect.height()*x/(self.nop+1))-2,4*3,4*3), self, 'op', x) for x in range(1,self.nop+1)] return input,output elif(self.type=="Cooler" or self.type=="Heater"): - input = [NodeSocket(QtCore.QRect(3.5, (self.rect.height()*x/(self.nin+1))-2,4,4), self, 'in', x) for x in range(1,self.nin+1) ] - output = [NodeSocket(QtCore.QRect(self.rect.width()-8.0,(self.rect.height()*x/(self.nop+1))-2,4,4), self, 'op', x) for x in range(1,self.nop+1)] + input = [NodeSocket(QtCore.QRect(3.5, (self.rect.height()*x/(self.nin+1))-2,4*3,4*3), self, 'in', x) for x in range(1,self.nin+1) ] + output = [NodeSocket(QtCore.QRect(self.rect.width()-8.0,(self.rect.height()*x/(self.nop+1))-2,4*3,4*3), self, 'op', x) for x in range(1,self.nop+1)] return input,output elif(self.type=="CentrifugalPump"): - input = [NodeSocket(QtCore.QRect(-2.5,(self.rect.height()*x/(self.nin+1))-7, 4,4), self, 'in', x) for x in range(1,self.nin+1) ] - output = [NodeSocket(QtCore.QRect(self.rect.width()-2.5,-1.5,4,4), self, 'op', x) for x in range(1,self.nop+1)] + input = [NodeSocket(QtCore.QRect(-2.5,(self.rect.height()*x/(self.nin+1))-7, 4*3,4*3), self, 'in', x) for x in range(1,self.nin+1) ] + output = [NodeSocket(QtCore.QRect(self.rect.width()-2.5,-1.5,4*3,4*3), self, 'op', x) for x in range(1,self.nop+1)] return input,output elif(self.type=="DistillationColumn" or self.type=="ShortcutColumn"): - input = [NodeSocket(QtCore.QRect(-2.5,(self.rect.height()*x/(self.nin+1)),5,5), self, 'in', x) for x in range(1,self.nin+1) ] - output = [NodeSocket(QtCore.QRect(self.rect.width()-5.5,(self.rect.height()*1.44*x/(self.nop+1))-55,5,5), self, 'op', x) for x in range(1,self.nop+1)] + input = [NodeSocket(QtCore.QRect(-2.5,(self.rect.height()*x/(self.nin+1)),5*3,5*3), self, 'in', x) for x in range(1,self.nin+1) ] + output = [NodeSocket(QtCore.QRect(self.rect.width()-5.5,(self.rect.height()*1.44*x/(self.nop+1))-55,5*2,5*2), self, 'op', x) for x in range(1,self.nop+1)] return input,output elif(self.type=="MaterialStream"): - input = [NodeSocket(QtCore.QRect(-2.5,(self.rect.height()*x/(self.nin+1)-2),4,4), self, 'in', x) for x in range(1,self.nin+1) ] - output = [NodeSocket(QtCore.QRect(self.rect.width()-2.5,(self.rect.height()*x/(self.nin+1)-2),4,4), self, 'op', x) for x in range(1,self.nop+1)] + input = [NodeSocket(QtCore.QRect(-2.5,(self.rect.height()*x/(self.nin+1)-2),4*3,4*3), self, 'in', x) for x in range(1,self.nin+1) ] + output = [NodeSocket(QtCore.QRect(self.rect.width()-2.5,(self.rect.height()*x/(self.nin+1)-2),4*3,4*3), self, 'op', x) for x in range(1,self.nop+1)] return input,output def mouseMoveEvent(self, event): diff --git a/Undo.dat b/Undo.dat index 435cb62..a952858 100644 Binary files a/Undo.dat and b/Undo.dat differ -- cgit From 8e035dd412abaf4378e21e8461101313737a0ad9 Mon Sep 17 00:00:00 2001 From: brenda-br Date: Sun, 29 Jan 2023 19:15:19 +0530 Subject: Fix #27 Scaling Window --- Undo.dat | Bin 65412 -> 0 bytes main.ui | 4 ++-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Undo.dat b/Undo.dat index a952858..e69de29 100644 Binary files a/Undo.dat and b/Undo.dat differ diff --git a/main.ui b/main.ui index aa9350a..f707ba8 100644 --- a/main.ui +++ b/main.ui @@ -108,14 +108,14 @@ - + 0 0 - 109 + 0 150 -- cgit From 5f5ad56c8946a56eb049310e10ee212c96978ddb Mon Sep 17 00:00:00 2001 From: brenda-br Date: Sun, 29 Jan 2023 21:07:37 +0530 Subject: Fix #48 Node Sockets Beautified --- Graphics.py | 57 ++++++++++++++++++++++++++++++++++++--------------------- Undo.dat | Bin 0 -> 25575 bytes 2 files changed, 36 insertions(+), 21 deletions(-) diff --git a/Graphics.py b/Graphics.py index be9909f..f72ea10 100644 --- a/Graphics.py +++ b/Graphics.py @@ -263,14 +263,10 @@ class NodeSocket(QtWidgets.QGraphicsItem): self.other_line=None # Brush - self.brush = QtGui.QBrush() - self.brush.setStyle(QtCore.Qt.SolidPattern) - self.brush.setColor(QtGui.QColor(220,220,220,220)) + self.brush = QtGui.QBrush(Qt.transparent) # Pen - self.pen = QtGui.QPen() - self.pen.setStyle(QtCore.Qt.SolidLine) - self.pen.setWidth(1) - self.pen.setColor(QtGui.QColor(0,70,70,255)) + self.pen = QtGui.QPen(Qt.NoPen) + # Lines self.out_lines = [] self.in_lines = [] @@ -284,19 +280,11 @@ class NodeSocket(QtWidgets.QGraphicsItem): return QtCore.QRectF(self.rect) def paint(self, painter, option, widget): - painter.setBrush(self.brush) + painter.setPen(self.pen) painter.drawEllipse(self.rect.x()-4,self.rect.y()-4,self.rect.height(),self.rect.width()) - painter.setBrush(QBrush(Qt.cyan,Qt.SolidPattern)) + painter.setBrush(self.brush) painter.drawEllipse(self.rect.x()-2,self.rect.y()-2,(self.rect.height()/3)*2,(self.rect.width()/3)*2) - # painter.drawEllipse(self.rect.x(),self.rect.y(),self.rect.height()/3,self.rect.width()/3) - - - # grip_path = QPainterPath() - # #grip_path.addEllipse(self.rect.x(),self.rect.y(),self.rect.height()/3,self.rect.width()/3) - # grip_path.addEllipse(self.rect.x()-2,self.rect.y()-2,(self.rect.height()/3)*2,(self.rect.width()/3)*2) - # grip_path.addEllipse(self.rect.x()-4,self.rect.y()-4,self.rect.height(),self.rect.width()) - # painter.strokePath(grip_path.simplified(),QPen(Qt.black,1)) def mousePressEvent(self, event): cursor = QCursor( Qt.PointingHandCursor ) @@ -402,7 +390,17 @@ class NodeSocket(QtWidgets.QGraphicsItem): def hoverLeaveEvent(self, event): cursor = QCursor( Qt.ArrowCursor ) QApplication.instance().setOverrideCursor(cursor) - + + def show(self): + # set pen to show + self.pen = QPen(Qt.black, 1, Qt.SolidLine) + self.brush = QBrush(Qt.cyan) + + def hide(self): + # set pen to transparent + self.pen = QPen(Qt.NoPen) + self.brush = QBrush(Qt.transparent) + # all created node items will be put inside this list # it is used for recreating the node lines by returning the node item object based on unit operation object's name lst = [] @@ -428,7 +426,7 @@ class NodeItem(QtWidgets.QGraphicsItem): self.obj = unit_operation self.container = container self.graphicsView = graphicsView - + self.setAcceptHoverEvents(True) self.name = self.obj.name self.type = self.obj.type @@ -615,8 +613,25 @@ class NodeItem(QtWidgets.QGraphicsItem): self.dock_widget.update_compounds() except AttributeError: pass - - + + def hoverEnterEvent(self, event): + super(NodeItem,self).hoverEnterEvent(event) + for i in self.graphicsView.items(): + if(isinstance(i,NodeItem)): + for ip in i.input: + ip.show() + for op in i.output: + op.show() + + def hoverLeaveEvent(self, event): + super(NodeItem,self).hoverLeaveEvent(event) + for i in self.graphicsView.items(): + if(isinstance(i,NodeItem)): + for ip in i.input: + ip.hide() + for op in i.output: + op.hide() + def findMainWindow(self): ''' Global function to find the (open) QMainWindow in application diff --git a/Undo.dat b/Undo.dat index e69de29..113df8c 100644 Binary files a/Undo.dat and b/Undo.dat differ -- cgit From a9e09576c8e977e9fc838fabf2116d5e2cae9e7e Mon Sep 17 00:00:00 2001 From: brenda-br Date: Mon, 30 Jan 2023 14:06:22 +0530 Subject: Fix #49 Node Lines in center of the socket after reopening --- Graphics.py | 8 ++++---- Undo.dat | Bin 25575 -> 0 bytes 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Graphics.py b/Graphics.py index f72ea10..d87e8b8 100644 --- a/Graphics.py +++ b/Graphics.py @@ -66,11 +66,11 @@ class Graphics(QDialog, QtWidgets.QGraphicsItem): pointA = NodeItem.get_instances(v.name) pointB = NodeItem.get_instances(i.name) rect = pointA.output[0].boundingRect() - pointAA = QtCore.QPointF(rect.x() + rect.width()/2, rect.y() + rect.height()/2) + pointAA = QtCore.QPointF(rect.x() + rect.width()/(2*3), rect.y() + rect.height()/(2*3)) pointAA = pointA.output[0].mapToScene(pointAA) socketB = next((s for s in pointB.input if k == s.id)) rectB = socketB.boundingRect() - pointBB = QtCore.QPointF(rectB.x() + rectB.width()/2, rectB.y() + rectB.height()/2) + pointBB = QtCore.QPointF(rectB.x() + rectB.width()/(2*3), rectB.y() + rectB.height()/(2*3)) pointBB = socketB.mapToScene(pointBB) self.new_line = NodeLine(pointAA, pointBB, 'in') self.new_line.source = pointA.output[0] @@ -86,10 +86,10 @@ class Graphics(QDialog, QtWidgets.QGraphicsItem): pointB = NodeItem.get_instances(v.name) socketA = next(s for s in pointA.output if k == s.id) rect = socketA.boundingRect() - pointAA = QtCore.QPointF(rect.x() + rect.width()/2, rect.y() + rect.height()/2) + pointAA = QtCore.QPointF(rect.x() + rect.width()/(2*3), rect.y() + rect.height()/(2*3)) pointAA = socketA.mapToScene(pointAA) rectB = pointB.input[0].boundingRect() - pointBB = QtCore.QPointF(rectB.x() + rectB.width()/2, rectB.y() + rectB.height()/2) + pointBB = QtCore.QPointF(rectB.x() + rectB.width()/(2*3), rectB.y() + rectB.height()/(2*3)) pointBB = pointB.input[0].mapToScene(pointBB) self.new_line = NodeLine(pointAA, pointBB, 'out') self.new_line.source = socketA diff --git a/Undo.dat b/Undo.dat index 113df8c..e69de29 100644 Binary files a/Undo.dat and b/Undo.dat differ -- cgit From 239825064c3895910f7a800134179e456b897415 Mon Sep 17 00:00:00 2001 From: brenda-br Date: Mon, 30 Jan 2023 14:14:46 +0530 Subject: Update Streams.py --- Streams.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Streams.py b/Streams.py index 739010a..ef92f78 100644 --- a/Streams.py +++ b/Streams.py @@ -155,8 +155,17 @@ class MaterialStream(): var5_name = self.variables['xvap']['name'] var5_val = self.variables['xvap']['value'] var5_unit = self.variables['xvap']['unit'] + var6_name = self.variables['F_pc']['name'] + var6_val = self.variables['F_pc']['value'] + var6_unit = self.variables['F_pc']['unit'] + var7_name = self.variables['Fm_pc']['name'] + var7_val = self.variables['Fm_pc']['value'] + var7_unit = self.variables['Fm_pc']['unit'] + dict = {var1_name:str(var1_val)+' '+var1_unit, var2_name:str(var2_val)+' '+var2_unit, + var6_name:str(var6_val)+' '+var6_unit, + var7_name:str(var7_val)+' '+var7_unit, var3_name:str(var3_val)+' '+var3_unit, var4_name:str(var4_val)+' '+var4_unit, var5_name:str(var5_val)+' '+var5_unit, } -- cgit From 60f3a5a1d15274d43d2a929922b5f001fe7d9e51 Mon Sep 17 00:00:00 2001 From: brenda-br Date: Mon, 30 Jan 2023 23:57:17 +0530 Subject: Fix #50 Mixture Mass Flow Value added to phase properties tab in result --- DockWidgets/DockWidgetMaterialStream.py | 2 +- .../DockWidgetMaterialStream.cpython-37.pyc | Bin 9230 -> 9254 bytes Graphics.py | 12 ++-- OMChem/Flowsheet.py | 2 +- Streams.py | 72 ++++++++++++--------- 5 files changed, 50 insertions(+), 38 deletions(-) diff --git a/DockWidgets/DockWidgetMaterialStream.py b/DockWidgets/DockWidgetMaterialStream.py index a7f06df..a6396ef 100644 --- a/DockWidgets/DockWidgetMaterialStream.py +++ b/DockWidgets/DockWidgetMaterialStream.py @@ -211,7 +211,7 @@ class DockWidgetMaterialStream(QDockWidget,ui_dialog): klst = list(d.values()) p = {"Pressure":"P", "Temperature":"T","Vapour Phase Mole Fraction":"xvap", "Phase Molar Enthalpy":"H_p", - "Phase Molar Entropy":"S_p", "Molar Flow Rate":"F_p"} + "Phase Molar Entropy":"S_p", "Molar Flow Rate":"F_p","Mass Flow Rate":"Fm_p"} # Amounts Tab if obj.type == 'MaterialStream': diff --git a/DockWidgets/__pycache__/DockWidgetMaterialStream.cpython-37.pyc b/DockWidgets/__pycache__/DockWidgetMaterialStream.cpython-37.pyc index 16c3008..f523058 100644 Binary files a/DockWidgets/__pycache__/DockWidgetMaterialStream.cpython-37.pyc and b/DockWidgets/__pycache__/DockWidgetMaterialStream.cpython-37.pyc differ diff --git a/Graphics.py b/Graphics.py index d87e8b8..9969647 100644 --- a/Graphics.py +++ b/Graphics.py @@ -51,14 +51,15 @@ class Graphics(QDialog, QtWidgets.QGraphicsItem): else: self.unit_operations.append(i) type(i).counter += 1 - print(self.unit_operations) + #print(self.unit_operations) new_box = self.create_node_item(i, container) new_box.setPos(i.pos.toPoint().x(), i.pos.toPoint().y()) self.scene.addItem(new_box) for i in obj: if i.type == "MaterialStream": - print(eval(i.type)) + pass + #print(eval(i.type)) elif i.type not in stm: ip = i.input_stms op = i.output_stms @@ -336,7 +337,7 @@ class NodeSocket(QtWidgets.QGraphicsItem): self.new_line.target = item item.in_lines.append(self.new_line) self.new_line.pointB = item.get_center() - print(type(self.new_line.source)) + #print(type(self.new_line.source)) if self.new_line.source.parent.obj.type not in stm: self.new_line.source.parent.obj.add_connection(0, self.new_line.source.id, self.new_line.target.parent.obj) if self.new_line.target.parent.obj.type not in stm: @@ -347,7 +348,7 @@ class NodeSocket(QtWidgets.QGraphicsItem): self.new_line.target = self item.out_lines.append(self.new_line) self.new_line.pointA = item.get_center() - print(type(self.new_line.source)) + #print(type(self.new_line.source)) if self.new_line.source.parent.obj.type not in stm: self.new_line.source.parent.obj.add_connection(0, self.new_line.source.id, self.new_line.target.parent.obj) if self.new_line.target.parent.obj.type not in stm: @@ -482,7 +483,8 @@ class NodeItem(QtWidgets.QGraphicsItem): # updating input values if self.dock_widget.obj.type != 'MaterialStream': - print(self.dock_widget.obj.type) + pass + #print(self.dock_widget.obj.type) try: self.dock_widget.obj.param_setter(self.dock_widget.obj.param_getter(self.dock_widget.obj.mode)) except Exception as e: diff --git a/OMChem/Flowsheet.py b/OMChem/Flowsheet.py index ce0da55..c38b94e 100644 --- a/OMChem/Flowsheet.py +++ b/OMChem/Flowsheet.py @@ -152,7 +152,7 @@ class Flowsheet(): mosFile.write('loadFile(\"Flowsheet.mo\");\n') mosFile.write('simulate(Flowsheet, outputFormat=\"csv\", stopTime=1.0, numberOfIntervals=1);\n') - print('Initiating Simulation in Equation Oriented Mode') + #print('Initiating Simulation in Equation Oriented Mode') self.send_for_simulation_Eqn() diff --git a/Streams.py b/Streams.py index 739010a..f90546b 100644 --- a/Streams.py +++ b/Streams.py @@ -35,19 +35,20 @@ class MaterialStream(): self.variables = { 'P' : {'name':'Pressure', 'value':101325, 'unit':'Pa'}, 'T' : {'name':'Temperature', 'value':300, 'unit':'K'}, + + 'xvap' : {'name':'Vapour Mole Fraction', 'value':None, 'unit':''}, + 'H_p[1]' : {'name':'Mixture Molar Entalpy', 'value':None, 'unit':'J/mol'}, + 'S_p[1]' : {'name':'Mixture Molar Entropy', 'value':None, 'unit':'J/mol.K'}, + 'F_p[1]' : {'name':'Mixture Molar Flow', 'value':100, 'unit':'mol/s'}, + 'Fm_p[1]' : {'name':'Mixture Mass Flow', 'value':None, 'unit':'g/s'}, - 'xvap' : {'name':'Vapour Phase Mole Fraction', 'value':None, 'unit':''}, - 'H_p[1]' : {'name':'Mixture Phase Molar Entalpy', 'value':None, 'unit':'J/mol'}, - 'S_p[1]' : {'name':'Mixture Phase Molar Entropy', 'value':None, 'unit':'J/mol.K'}, - 'F_p[1]' : {'name':'Mixture Molar Flow Rate', 'value':100, 'unit':'mol/s'}, - - 'H_p[2]' : {'name':'Liquid Phase Molar Entalpy', 'value':None, 'unit':'J/mol'}, - 'S_p[2]' : {'name':'Liquid Phase Molar Entropy', 'value':None, 'unit':'J/mol.K'}, - 'F_p[2]' : {'name':'Liquid Molar Flow Rate', 'value':None, 'unit':'mol/s'}, + 'H_p[2]' : {'name':'Liquid Molar Entalpy', 'value':None, 'unit':'J/mol'}, + 'S_p[2]' : {'name':'Liquid Molar Entropy', 'value':None, 'unit':'J/mol.K'}, + 'F_p[2]' : {'name':'Liquid Molar Flow', 'value':None, 'unit':'mol/s'}, - 'H_p[3]' : {'name':'Vapour Phase Molar Entalpy', 'value':None, 'unit':'J/mol'}, - 'S_p[3]' : {'name':'Vapour Phase Molar Entropy', 'value':None, 'unit':'J/mol.K'}, - 'F_p[3]' : {'name':'Vapour Molar Flow Rate', 'value':None, 'unit':'mol/s'}, + 'H_p[3]' : {'name':'Vapour Molar Entalpy', 'value':None, 'unit':'J/mol'}, + 'S_p[3]' : {'name':'Vapour Molar Entropy', 'value':None, 'unit':'J/mol.K'}, + 'F_p[3]' : {'name':'Vapour Molar Flow', 'value':None, 'unit':'mol/s'}, 'x_pc' : {'name':'Mole Fraction', 'value':[], 'unit':''}, 'xm_pc' : {'name':'Mass Fraction', 'value':None, 'unit':''}, @@ -140,26 +141,35 @@ class MaterialStream(): def param_getter_tooltip_selectedVar(self): dict = {} - var1_name = self.variables['P']['name'] - var1_val = self.variables['P']['value'] - var1_unit = self.variables['P']['unit'] - var2_name = self.variables['T']['name'] - var2_val = self.variables['T']['value'] - var2_unit = self.variables['T']['unit'] - var3_name = self.variables['H_p[1]']['name'] - var3_val = self.variables['H_p[1]']['value'] - var3_unit = self.variables['H_p[1]']['unit'] - var4_name = self.variables['S_p[1]']['name'] - var4_val = self.variables['S_p[1]']['value'] - var4_unit = self.variables['S_p[1]']['unit'] - var5_name = self.variables['xvap']['name'] - var5_val = self.variables['xvap']['value'] - var5_unit = self.variables['xvap']['unit'] - dict = {var1_name:str(var1_val)+' '+var1_unit, - var2_name:str(var2_val)+' '+var2_unit, - var3_name:str(var3_val)+' '+var3_unit, - var4_name:str(var4_val)+' '+var4_unit, - var5_name:str(var5_val)+' '+var5_unit, } + pressure_name = self.variables['P']['name'] + pressure_val = self.variables['P']['value'] + pressure_unit = self.variables['P']['unit'] + temp_name = self.variables['T']['name'] + temp_val = self.variables['T']['value'] + temp_unit = self.variables['T']['unit'] + mixMolEntal_name = self.variables['H_p[1]']['name'] + mixMolEntal_val = round(float(self.variables['H_p[1]']['value']),2) + mixMolEntal_unit = self.variables['H_p[1]']['unit'] + mixMolEntro_name = self.variables['S_p[1]']['name'] + mixMolEntro_val = round(float(self.variables['S_p[1]']['value']),2) + mixMolEntro_unit = self.variables['S_p[1]']['unit'] + vapMolFrac_name = self.variables['xvap']['name'] + vapMolFrac_val = self.variables['xvap']['value'] + vapMolFrac_unit = self.variables['xvap']['unit'] + mixMolFlo_name = self.variables['F_pc']['name'] + mixMolFlo_val = self.variables['F_pc']['value'] + mixMolFlo_unit = self.variables['F_pc']['unit'] + mixMassFlo_name = self.variables['Fm_p[1]']['name'] + mixMassFlo_val = self.variables['Fm_p[1]']['value'] + mixMassFlo_unit = self.variables['Fm_p[1]']['unit'] + + dict = {pressure_name:str(pressure_val)+' '+pressure_unit, + temp_name:str(temp_val)+' '+temp_unit, + vapMolFrac_name:str(vapMolFrac_val)+' '+vapMolFrac_unit, + mixMolEntal_name:str(mixMolEntal_val)+' '+mixMolEntal_unit, + mixMolEntro_name:str(mixMolEntro_val)+' '+mixMolEntro_unit, + mixMolFlo_name:str(mixMolFlo_val)+' '+mixMolFlo_unit, + mixMassFlo_name:str(mixMassFlo_val)+' '+mixMassFlo_unit} return dict def param_getter(self,mode): -- cgit From 4a139cad51fbb7c3e8eed045e60545ef0330a187 Mon Sep 17 00:00:00 2001 From: brenda-br Date: Tue, 31 Jan 2023 15:49:43 +0530 Subject: Fix # Sensitivity of Node Sockets increased(Revised) --- .../DockWidgetMaterialStream.cpython-37.pyc | Bin 9254 -> 9254 bytes Graphics.py | 46 ++++++++++----------- Undo.dat | Bin 0 -> 25661 bytes 3 files changed, 23 insertions(+), 23 deletions(-) diff --git a/DockWidgets/__pycache__/DockWidgetMaterialStream.cpython-37.pyc b/DockWidgets/__pycache__/DockWidgetMaterialStream.cpython-37.pyc index f523058..193f8e9 100644 Binary files a/DockWidgets/__pycache__/DockWidgetMaterialStream.cpython-37.pyc and b/DockWidgets/__pycache__/DockWidgetMaterialStream.cpython-37.pyc differ diff --git a/Graphics.py b/Graphics.py index 9969647..8977ac3 100644 --- a/Graphics.py +++ b/Graphics.py @@ -67,11 +67,11 @@ class Graphics(QDialog, QtWidgets.QGraphicsItem): pointA = NodeItem.get_instances(v.name) pointB = NodeItem.get_instances(i.name) rect = pointA.output[0].boundingRect() - pointAA = QtCore.QPointF(rect.x() + rect.width()/(2*3), rect.y() + rect.height()/(2*3)) + pointAA = QtCore.QPointF(rect.x() + rect.width()/(2), rect.y() + rect.height()/(2)) pointAA = pointA.output[0].mapToScene(pointAA) socketB = next((s for s in pointB.input if k == s.id)) rectB = socketB.boundingRect() - pointBB = QtCore.QPointF(rectB.x() + rectB.width()/(2*3), rectB.y() + rectB.height()/(2*3)) + pointBB = QtCore.QPointF(rectB.x() + rectB.width()/(2), rectB.y() + rectB.height()/(2)) pointBB = socketB.mapToScene(pointBB) self.new_line = NodeLine(pointAA, pointBB, 'in') self.new_line.source = pointA.output[0] @@ -87,10 +87,10 @@ class Graphics(QDialog, QtWidgets.QGraphicsItem): pointB = NodeItem.get_instances(v.name) socketA = next(s for s in pointA.output if k == s.id) rect = socketA.boundingRect() - pointAA = QtCore.QPointF(rect.x() + rect.width()/(2*3), rect.y() + rect.height()/(2*3)) + pointAA = QtCore.QPointF(rect.x() + rect.width()/(2), rect.y() + rect.height()/(2)) pointAA = socketA.mapToScene(pointAA) rectB = pointB.input[0].boundingRect() - pointBB = QtCore.QPointF(rectB.x() + rectB.width()/(2*3), rectB.y() + rectB.height()/(2*3)) + pointBB = QtCore.QPointF(rectB.x() + rectB.width()/(2), rectB.y() + rectB.height()/(2)) pointBB = pointB.input[0].mapToScene(pointBB) self.new_line = NodeLine(pointAA, pointBB, 'out') self.new_line.source = socketA @@ -283,9 +283,9 @@ class NodeSocket(QtWidgets.QGraphicsItem): def paint(self, painter, option, widget): painter.setPen(self.pen) - painter.drawEllipse(self.rect.x()-4,self.rect.y()-4,self.rect.height(),self.rect.width()) + painter.drawEllipse(self.rect.x(),self.rect.y(),self.rect.height(),self.rect.width()) painter.setBrush(self.brush) - painter.drawEllipse(self.rect.x()-2,self.rect.y()-2,(self.rect.height()/3)*2,(self.rect.width()/3)*2) + painter.drawEllipse(self.rect.x()+2,self.rect.y()+2,(self.rect.height()/3)*2,(self.rect.width()/3)*2) def mousePressEvent(self, event): cursor = QCursor( Qt.PointingHandCursor ) @@ -293,7 +293,7 @@ class NodeSocket(QtWidgets.QGraphicsItem): if self.type == 'op': rect = self.boundingRect() - pointA = QtCore.QPointF(rect.x() + rect.width()/(2*3), rect.y() + rect.height()/(2*3)) + pointA = QtCore.QPointF(rect.x() + rect.width()/(2), rect.y() + rect.height()/(2)) pointA = self.mapToScene(pointA) pointB = self.mapToScene(event.pos()) self.new_line = NodeLine(pointA, pointB ,'op') @@ -302,7 +302,7 @@ class NodeSocket(QtWidgets.QGraphicsItem): elif self.type == 'in': rect = self.boundingRect() pointA = self.mapToScene(event.pos()) - pointB = QtCore.QPointF(rect.x() + rect.width()/(2*3), rect.y() + rect.height()/(2*3)) + pointB = QtCore.QPointF(rect.x() + rect.width()/(2), rect.y() + rect.height()/(2)) pointB = self.mapToScene(pointB) self.new_line = NodeLine(pointA, pointB, 'in') self.in_lines.append(self.new_line) @@ -380,7 +380,7 @@ class NodeSocket(QtWidgets.QGraphicsItem): def get_center(self): rect = self.boundingRect() - center = QtCore.QPointF(rect.x() + rect.width()/(2*3), rect.y() + rect.height()/(2*3)) + center = QtCore.QPointF(rect.x() + rect.width()/(2), rect.y() + rect.height()/(2)) center = self.mapToScene(center) return center @@ -394,8 +394,8 @@ class NodeSocket(QtWidgets.QGraphicsItem): def show(self): # set pen to show - self.pen = QPen(Qt.black, 1, Qt.SolidLine) - self.brush = QBrush(Qt.cyan) + self.pen = QPen(QtGui.QColor(0,70,70,220), 1, Qt.SolidLine) + self.brush = QBrush(QtGui.QColor(33,225,162,255)) def hide(self): # set pen to transparent @@ -543,28 +543,28 @@ class NodeItem(QtWidgets.QGraphicsItem): def initialize_sockets(self,type): if(self.type=="Flash" or self.type=="CompoundSeparator"): - input = [NodeSocket(QtCore.QRect(5,(self.rect.height()*x/(self.nin+1)-2),4*3,4*3), self, 'in', x) for x in range(1,self.nin+1) ] - output = [NodeSocket(QtCore.QRect(self.rect.width()-9,(self.rect.height()*x*1/(self.nop+1)),4*3,4*3), self, 'op', x) for x in range(1,self.nop+1)] + input = [NodeSocket(QtCore.QRect(1,(self.rect.height()*x/(self.nin+1)-6),4*3,4*3), self, 'in', x) for x in range(1,self.nin+1) ] + output = [NodeSocket(QtCore.QRect(self.rect.width()-13,(self.rect.height()*x*1/(self.nop+1))-4,4*3,4*3), self, 'op', x) for x in range(1,self.nop+1)] return input,output elif(self.type=="AdiabaticCompressor" or self.type=="AdiabaticExpander" or self.type =="Mixer" or self.type =="Splitter" or self.type =="Valve" ): - input = [NodeSocket(QtCore.QRect(-2.5, (self.rect.height()*x/(self.nin+1))-2,4*3,4*3), self, 'in', x) for x in range(1,self.nin+1) ] - output = [NodeSocket(QtCore.QRect(self.rect.width()-2.5,(self.rect.height()*x/(self.nop+1))-2,4*3,4*3), self, 'op', x) for x in range(1,self.nop+1)] + input = [NodeSocket(QtCore.QRect(-6.5, (self.rect.height()*x/(self.nin+1))-6,4*3,4*3), self, 'in', x) for x in range(1,self.nin+1) ] + output = [NodeSocket(QtCore.QRect(self.rect.width()-6.5,(self.rect.height()*x/(self.nop+1))-6,4*3,4*3), self, 'op', x) for x in range(1,self.nop+1)] return input,output elif(self.type=="Cooler" or self.type=="Heater"): - input = [NodeSocket(QtCore.QRect(3.5, (self.rect.height()*x/(self.nin+1))-2,4*3,4*3), self, 'in', x) for x in range(1,self.nin+1) ] - output = [NodeSocket(QtCore.QRect(self.rect.width()-8.0,(self.rect.height()*x/(self.nop+1))-2,4*3,4*3), self, 'op', x) for x in range(1,self.nop+1)] + input = [NodeSocket(QtCore.QRect(-0.5, (self.rect.height()*x/(self.nin+1))-6,4*3,4*3), self, 'in', x) for x in range(1,self.nin+1) ] + output = [NodeSocket(QtCore.QRect(self.rect.width()-12.0,(self.rect.height()*x/(self.nop+1))-6,4*3,4*3), self, 'op', x) for x in range(1,self.nop+1)] return input,output elif(self.type=="CentrifugalPump"): - input = [NodeSocket(QtCore.QRect(-2.5,(self.rect.height()*x/(self.nin+1))-7, 4*3,4*3), self, 'in', x) for x in range(1,self.nin+1) ] - output = [NodeSocket(QtCore.QRect(self.rect.width()-2.5,-1.5,4*3,4*3), self, 'op', x) for x in range(1,self.nop+1)] + input = [NodeSocket(QtCore.QRect(-6.5,(self.rect.height()*x/(self.nin+1))-11, 4*3,4*3), self, 'in', x) for x in range(1,self.nin+1) ] + output = [NodeSocket(QtCore.QRect(self.rect.width()-6.5,-5.5,4*3,4*3), self, 'op', x) for x in range(1,self.nop+1)] return input,output elif(self.type=="DistillationColumn" or self.type=="ShortcutColumn"): - input = [NodeSocket(QtCore.QRect(-2.5,(self.rect.height()*x/(self.nin+1)),5*3,5*3), self, 'in', x) for x in range(1,self.nin+1) ] - output = [NodeSocket(QtCore.QRect(self.rect.width()-5.5,(self.rect.height()*1.44*x/(self.nop+1))-55,5*2,5*2), self, 'op', x) for x in range(1,self.nop+1)] + input = [NodeSocket(QtCore.QRect(-6.5,(self.rect.height()*x/(self.nin+1)-4),5*3,5*3), self, 'in', x) for x in range(1,self.nin+1) ] + output = [NodeSocket(QtCore.QRect(self.rect.width()-9.5,(self.rect.height()*1.44*x/(self.nop+1))-59,5*2,5*2), self, 'op', x) for x in range(1,self.nop+1)] return input,output elif(self.type=="MaterialStream"): - input = [NodeSocket(QtCore.QRect(-2.5,(self.rect.height()*x/(self.nin+1)-2),4*3,4*3), self, 'in', x) for x in range(1,self.nin+1) ] - output = [NodeSocket(QtCore.QRect(self.rect.width()-2.5,(self.rect.height()*x/(self.nin+1)-2),4*3,4*3), self, 'op', x) for x in range(1,self.nop+1)] + input = [NodeSocket(QtCore.QRect(-6.5,(self.rect.height()*x/(self.nin+1)-6),4*3,4*3), self, 'in', x) for x in range(1,self.nin+1) ] + output = [NodeSocket(QtCore.QRect(self.rect.width()-6.5,(self.rect.height()*x/(self.nin+1)-6),4*3,4*3), self, 'op', x) for x in range(1,self.nop+1)] return input,output def mouseMoveEvent(self, event): diff --git a/Undo.dat b/Undo.dat index e69de29..c09868a 100644 Binary files a/Undo.dat and b/Undo.dat differ -- cgit From dd57c4eb39d10398400e8a9588c8b3091a9239eb Mon Sep 17 00:00:00 2001 From: brenda-br Date: Tue, 31 Jan 2023 15:51:08 +0530 Subject: Fix #31 Sensitivity of Node Sockets increased(Revised) --- .../DockWidgetMaterialStream.cpython-37.pyc | Bin 9254 -> 9254 bytes Graphics.py | 46 ++++++++++----------- Undo.dat | Bin 0 -> 25661 bytes 3 files changed, 23 insertions(+), 23 deletions(-) diff --git a/DockWidgets/__pycache__/DockWidgetMaterialStream.cpython-37.pyc b/DockWidgets/__pycache__/DockWidgetMaterialStream.cpython-37.pyc index f523058..193f8e9 100644 Binary files a/DockWidgets/__pycache__/DockWidgetMaterialStream.cpython-37.pyc and b/DockWidgets/__pycache__/DockWidgetMaterialStream.cpython-37.pyc differ diff --git a/Graphics.py b/Graphics.py index 9969647..8977ac3 100644 --- a/Graphics.py +++ b/Graphics.py @@ -67,11 +67,11 @@ class Graphics(QDialog, QtWidgets.QGraphicsItem): pointA = NodeItem.get_instances(v.name) pointB = NodeItem.get_instances(i.name) rect = pointA.output[0].boundingRect() - pointAA = QtCore.QPointF(rect.x() + rect.width()/(2*3), rect.y() + rect.height()/(2*3)) + pointAA = QtCore.QPointF(rect.x() + rect.width()/(2), rect.y() + rect.height()/(2)) pointAA = pointA.output[0].mapToScene(pointAA) socketB = next((s for s in pointB.input if k == s.id)) rectB = socketB.boundingRect() - pointBB = QtCore.QPointF(rectB.x() + rectB.width()/(2*3), rectB.y() + rectB.height()/(2*3)) + pointBB = QtCore.QPointF(rectB.x() + rectB.width()/(2), rectB.y() + rectB.height()/(2)) pointBB = socketB.mapToScene(pointBB) self.new_line = NodeLine(pointAA, pointBB, 'in') self.new_line.source = pointA.output[0] @@ -87,10 +87,10 @@ class Graphics(QDialog, QtWidgets.QGraphicsItem): pointB = NodeItem.get_instances(v.name) socketA = next(s for s in pointA.output if k == s.id) rect = socketA.boundingRect() - pointAA = QtCore.QPointF(rect.x() + rect.width()/(2*3), rect.y() + rect.height()/(2*3)) + pointAA = QtCore.QPointF(rect.x() + rect.width()/(2), rect.y() + rect.height()/(2)) pointAA = socketA.mapToScene(pointAA) rectB = pointB.input[0].boundingRect() - pointBB = QtCore.QPointF(rectB.x() + rectB.width()/(2*3), rectB.y() + rectB.height()/(2*3)) + pointBB = QtCore.QPointF(rectB.x() + rectB.width()/(2), rectB.y() + rectB.height()/(2)) pointBB = pointB.input[0].mapToScene(pointBB) self.new_line = NodeLine(pointAA, pointBB, 'out') self.new_line.source = socketA @@ -283,9 +283,9 @@ class NodeSocket(QtWidgets.QGraphicsItem): def paint(self, painter, option, widget): painter.setPen(self.pen) - painter.drawEllipse(self.rect.x()-4,self.rect.y()-4,self.rect.height(),self.rect.width()) + painter.drawEllipse(self.rect.x(),self.rect.y(),self.rect.height(),self.rect.width()) painter.setBrush(self.brush) - painter.drawEllipse(self.rect.x()-2,self.rect.y()-2,(self.rect.height()/3)*2,(self.rect.width()/3)*2) + painter.drawEllipse(self.rect.x()+2,self.rect.y()+2,(self.rect.height()/3)*2,(self.rect.width()/3)*2) def mousePressEvent(self, event): cursor = QCursor( Qt.PointingHandCursor ) @@ -293,7 +293,7 @@ class NodeSocket(QtWidgets.QGraphicsItem): if self.type == 'op': rect = self.boundingRect() - pointA = QtCore.QPointF(rect.x() + rect.width()/(2*3), rect.y() + rect.height()/(2*3)) + pointA = QtCore.QPointF(rect.x() + rect.width()/(2), rect.y() + rect.height()/(2)) pointA = self.mapToScene(pointA) pointB = self.mapToScene(event.pos()) self.new_line = NodeLine(pointA, pointB ,'op') @@ -302,7 +302,7 @@ class NodeSocket(QtWidgets.QGraphicsItem): elif self.type == 'in': rect = self.boundingRect() pointA = self.mapToScene(event.pos()) - pointB = QtCore.QPointF(rect.x() + rect.width()/(2*3), rect.y() + rect.height()/(2*3)) + pointB = QtCore.QPointF(rect.x() + rect.width()/(2), rect.y() + rect.height()/(2)) pointB = self.mapToScene(pointB) self.new_line = NodeLine(pointA, pointB, 'in') self.in_lines.append(self.new_line) @@ -380,7 +380,7 @@ class NodeSocket(QtWidgets.QGraphicsItem): def get_center(self): rect = self.boundingRect() - center = QtCore.QPointF(rect.x() + rect.width()/(2*3), rect.y() + rect.height()/(2*3)) + center = QtCore.QPointF(rect.x() + rect.width()/(2), rect.y() + rect.height()/(2)) center = self.mapToScene(center) return center @@ -394,8 +394,8 @@ class NodeSocket(QtWidgets.QGraphicsItem): def show(self): # set pen to show - self.pen = QPen(Qt.black, 1, Qt.SolidLine) - self.brush = QBrush(Qt.cyan) + self.pen = QPen(QtGui.QColor(0,70,70,220), 1, Qt.SolidLine) + self.brush = QBrush(QtGui.QColor(33,225,162,255)) def hide(self): # set pen to transparent @@ -543,28 +543,28 @@ class NodeItem(QtWidgets.QGraphicsItem): def initialize_sockets(self,type): if(self.type=="Flash" or self.type=="CompoundSeparator"): - input = [NodeSocket(QtCore.QRect(5,(self.rect.height()*x/(self.nin+1)-2),4*3,4*3), self, 'in', x) for x in range(1,self.nin+1) ] - output = [NodeSocket(QtCore.QRect(self.rect.width()-9,(self.rect.height()*x*1/(self.nop+1)),4*3,4*3), self, 'op', x) for x in range(1,self.nop+1)] + input = [NodeSocket(QtCore.QRect(1,(self.rect.height()*x/(self.nin+1)-6),4*3,4*3), self, 'in', x) for x in range(1,self.nin+1) ] + output = [NodeSocket(QtCore.QRect(self.rect.width()-13,(self.rect.height()*x*1/(self.nop+1))-4,4*3,4*3), self, 'op', x) for x in range(1,self.nop+1)] return input,output elif(self.type=="AdiabaticCompressor" or self.type=="AdiabaticExpander" or self.type =="Mixer" or self.type =="Splitter" or self.type =="Valve" ): - input = [NodeSocket(QtCore.QRect(-2.5, (self.rect.height()*x/(self.nin+1))-2,4*3,4*3), self, 'in', x) for x in range(1,self.nin+1) ] - output = [NodeSocket(QtCore.QRect(self.rect.width()-2.5,(self.rect.height()*x/(self.nop+1))-2,4*3,4*3), self, 'op', x) for x in range(1,self.nop+1)] + input = [NodeSocket(QtCore.QRect(-6.5, (self.rect.height()*x/(self.nin+1))-6,4*3,4*3), self, 'in', x) for x in range(1,self.nin+1) ] + output = [NodeSocket(QtCore.QRect(self.rect.width()-6.5,(self.rect.height()*x/(self.nop+1))-6,4*3,4*3), self, 'op', x) for x in range(1,self.nop+1)] return input,output elif(self.type=="Cooler" or self.type=="Heater"): - input = [NodeSocket(QtCore.QRect(3.5, (self.rect.height()*x/(self.nin+1))-2,4*3,4*3), self, 'in', x) for x in range(1,self.nin+1) ] - output = [NodeSocket(QtCore.QRect(self.rect.width()-8.0,(self.rect.height()*x/(self.nop+1))-2,4*3,4*3), self, 'op', x) for x in range(1,self.nop+1)] + input = [NodeSocket(QtCore.QRect(-0.5, (self.rect.height()*x/(self.nin+1))-6,4*3,4*3), self, 'in', x) for x in range(1,self.nin+1) ] + output = [NodeSocket(QtCore.QRect(self.rect.width()-12.0,(self.rect.height()*x/(self.nop+1))-6,4*3,4*3), self, 'op', x) for x in range(1,self.nop+1)] return input,output elif(self.type=="CentrifugalPump"): - input = [NodeSocket(QtCore.QRect(-2.5,(self.rect.height()*x/(self.nin+1))-7, 4*3,4*3), self, 'in', x) for x in range(1,self.nin+1) ] - output = [NodeSocket(QtCore.QRect(self.rect.width()-2.5,-1.5,4*3,4*3), self, 'op', x) for x in range(1,self.nop+1)] + input = [NodeSocket(QtCore.QRect(-6.5,(self.rect.height()*x/(self.nin+1))-11, 4*3,4*3), self, 'in', x) for x in range(1,self.nin+1) ] + output = [NodeSocket(QtCore.QRect(self.rect.width()-6.5,-5.5,4*3,4*3), self, 'op', x) for x in range(1,self.nop+1)] return input,output elif(self.type=="DistillationColumn" or self.type=="ShortcutColumn"): - input = [NodeSocket(QtCore.QRect(-2.5,(self.rect.height()*x/(self.nin+1)),5*3,5*3), self, 'in', x) for x in range(1,self.nin+1) ] - output = [NodeSocket(QtCore.QRect(self.rect.width()-5.5,(self.rect.height()*1.44*x/(self.nop+1))-55,5*2,5*2), self, 'op', x) for x in range(1,self.nop+1)] + input = [NodeSocket(QtCore.QRect(-6.5,(self.rect.height()*x/(self.nin+1)-4),5*3,5*3), self, 'in', x) for x in range(1,self.nin+1) ] + output = [NodeSocket(QtCore.QRect(self.rect.width()-9.5,(self.rect.height()*1.44*x/(self.nop+1))-59,5*2,5*2), self, 'op', x) for x in range(1,self.nop+1)] return input,output elif(self.type=="MaterialStream"): - input = [NodeSocket(QtCore.QRect(-2.5,(self.rect.height()*x/(self.nin+1)-2),4*3,4*3), self, 'in', x) for x in range(1,self.nin+1) ] - output = [NodeSocket(QtCore.QRect(self.rect.width()-2.5,(self.rect.height()*x/(self.nin+1)-2),4*3,4*3), self, 'op', x) for x in range(1,self.nop+1)] + input = [NodeSocket(QtCore.QRect(-6.5,(self.rect.height()*x/(self.nin+1)-6),4*3,4*3), self, 'in', x) for x in range(1,self.nin+1) ] + output = [NodeSocket(QtCore.QRect(self.rect.width()-6.5,(self.rect.height()*x/(self.nin+1)-6),4*3,4*3), self, 'op', x) for x in range(1,self.nop+1)] return input,output def mouseMoveEvent(self, event): diff --git a/Undo.dat b/Undo.dat index e69de29..c09868a 100644 Binary files a/Undo.dat and b/Undo.dat differ -- cgit From 52b559776a910a6b5db67d89f70002fc51229c06 Mon Sep 17 00:00:00 2001 From: brenda-br Date: Tue, 31 Jan 2023 22:20:20 +0530 Subject: Hide Compound Selector on reopening saved file --- Undo.dat | Bin 25661 -> 0 bytes mainApp.py | 1 + 2 files changed, 1 insertion(+) diff --git a/Undo.dat b/Undo.dat index c09868a..e69de29 100644 Binary files a/Undo.dat and b/Undo.dat differ diff --git a/mainApp.py b/mainApp.py index 2252f5d..32128ae 100644 --- a/mainApp.py +++ b/mainApp.py @@ -347,6 +347,7 @@ class MainApp(QMainWindow,ui): self.comp.set_compounds(compound_selected) for i in compound_selected: self.comp.compound_selection(self.comp, i) + self.comp.hide() self.container.graphics.load_canvas(obj, self.container) self.container.result = temp_result DockWidget.show_result(dock_widget_lst) -- cgit From f53af896c241d0628625452ef66f4a7255ec2846 Mon Sep 17 00:00:00 2001 From: brenda-br Date: Tue, 31 Jan 2023 23:38:58 +0530 Subject: Fix #31 Resize some node socket --- Graphics.py | 4 ++-- Undo.dat | Bin 0 -> 5449 bytes 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Graphics.py b/Graphics.py index 8977ac3..862845b 100644 --- a/Graphics.py +++ b/Graphics.py @@ -559,8 +559,8 @@ class NodeItem(QtWidgets.QGraphicsItem): output = [NodeSocket(QtCore.QRect(self.rect.width()-6.5,-5.5,4*3,4*3), self, 'op', x) for x in range(1,self.nop+1)] return input,output elif(self.type=="DistillationColumn" or self.type=="ShortcutColumn"): - input = [NodeSocket(QtCore.QRect(-6.5,(self.rect.height()*x/(self.nin+1)-4),5*3,5*3), self, 'in', x) for x in range(1,self.nin+1) ] - output = [NodeSocket(QtCore.QRect(self.rect.width()-9.5,(self.rect.height()*1.44*x/(self.nop+1))-59,5*2,5*2), self, 'op', x) for x in range(1,self.nop+1)] + input = [NodeSocket(QtCore.QRect(-6.5,(self.rect.height()*x/(self.nin+1)-4),4*3,4*3), self, 'in', x) for x in range(1,self.nin+1) ] + output = [NodeSocket(QtCore.QRect(self.rect.width()-9.5,(self.rect.height()*1.44*x/(self.nop+1))-59,4*3,4*3), self, 'op', x) for x in range(1,self.nop+1)] return input,output elif(self.type=="MaterialStream"): input = [NodeSocket(QtCore.QRect(-6.5,(self.rect.height()*x/(self.nin+1)-6),4*3,4*3), self, 'in', x) for x in range(1,self.nin+1) ] diff --git a/Undo.dat b/Undo.dat index e69de29..25d4faf 100644 Binary files a/Undo.dat and b/Undo.dat differ -- cgit