diff options
author | pravindalve | 2023-01-19 10:29:08 +0530 |
---|---|---|
committer | GitHub | 2023-01-19 10:29:08 +0530 |
commit | 22e16e822e952664b55a39bbc69dd15e2e55fe74 (patch) | |
tree | 6fb4fc041e513a3d61ab44f78e594c8d10cb5234 | |
parent | e65657bc794c50422248d5add590c5c85b1affc5 (diff) | |
parent | 4b65f30c2874f014d533dce9841d13b04b924d9a (diff) | |
download | Chemical-Simulator-GUI-22e16e822e952664b55a39bbc69dd15e2e55fe74.tar.gz Chemical-Simulator-GUI-22e16e822e952664b55a39bbc69dd15e2e55fe74.tar.bz2 Chemical-Simulator-GUI-22e16e822e952664b55a39bbc69dd15e2e55fe74.zip |
Merge pull request #37 from brenda-br/b_version_1
Fix-32,33
19 files changed, 63 insertions, 20 deletions
diff --git a/DockWidgets/DockWidget.py b/DockWidgets/DockWidget.py index 97ac7c8..e7e5b8b 100644 --- a/DockWidgets/DockWidget.py +++ b/DockWidgets/DockWidget.py @@ -8,7 +8,7 @@ from Graphics import * ui_dialog,_ = loadUiType('DockWidgets/DockWidget.ui') class DockWidget(QDockWidget,ui_dialog): - + def __init__(self,name,comptype,obj,container, parent=None): QDockWidget.__init__(self,parent) self.setupUi(self) @@ -145,3 +145,7 @@ class DockWidget(QDockWidget,ui_dialog): 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((scrollHVal+currentVal)/2)
\ No newline at end of file diff --git a/DockWidgets/DockWidgetCompoundSeparator.py b/DockWidgets/DockWidgetCompoundSeparator.py index 5a80f84..69b2770 100644 --- a/DockWidgets/DockWidgetCompoundSeparator.py +++ b/DockWidgets/DockWidgetCompoundSeparator.py @@ -97,3 +97,7 @@ class DockWidgetCompoundSeparator(QDockWidget,ui_dialog): 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((scrollHVal+currentVal)/2)
\ No newline at end of file diff --git a/DockWidgets/DockWidgetCompressorExpander.py b/DockWidgets/DockWidgetCompressorExpander.py index 841b850..5309bba 100644 --- a/DockWidgets/DockWidgetCompressorExpander.py +++ b/DockWidgets/DockWidgetCompressorExpander.py @@ -142,5 +142,8 @@ class DockWidgetCompressorExpander(QDockWidget,ui_dialog): except Exception as e: print(e) - -
\ No newline at end of file + + 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 diff --git a/DockWidgets/DockWidgetDistillationColumn.py b/DockWidgets/DockWidgetDistillationColumn.py index 34b8590..716cb1a 100644 --- a/DockWidgets/DockWidgetDistillationColumn.py +++ b/DockWidgets/DockWidgetDistillationColumn.py @@ -357,3 +357,8 @@ class DockWidgetDistillationColumn(QDockWidget, ui_dialog): t.resizeColumnsToContents() 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((scrollHVal+currentVal)/2)
\ No newline at end of file diff --git a/DockWidgets/DockWidgetFlash.py b/DockWidgets/DockWidgetFlash.py index ff8efb5..c288259 100644 --- a/DockWidgets/DockWidgetFlash.py +++ b/DockWidgets/DockWidgetFlash.py @@ -68,4 +68,9 @@ class DockWidgetFlash(QDockWidget,ui_dialog): self.hide() except Exception as e: - print(e)
\ No newline at end of file + 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((scrollHVal+currentVal)/2)
\ No newline at end of file diff --git a/DockWidgets/DockWidgetMaterialStream.py b/DockWidgets/DockWidgetMaterialStream.py index 54d57b9..09cddf4 100644 --- a/DockWidgets/DockWidgetMaterialStream.py +++ b/DockWidgets/DockWidgetMaterialStream.py @@ -345,4 +345,8 @@ class DockWidgetMaterialStream(QDockWidget,ui_dialog): except Exception as e: - print(e)
\ No newline at end of file + 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((scrollHVal+currentVal)/2)
\ No newline at end of file diff --git a/DockWidgets/DockWidgetMixer.py b/DockWidgets/DockWidgetMixer.py index 6ec6795..748ef4f 100644 --- a/DockWidgets/DockWidgetMixer.py +++ b/DockWidgets/DockWidgetMixer.py @@ -49,4 +49,8 @@ class DockWidgetMixer(QDockWidget,ui_dialog): self.hide() except Exception as e: - print(e)
\ No newline at end of file + 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((scrollHVal+currentVal)/2)
\ No newline at end of file diff --git a/DockWidgets/DockWidgetShortcutColumn.py b/DockWidgets/DockWidgetShortcutColumn.py index 3d0c287..efb044a 100644 --- a/DockWidgets/DockWidgetShortcutColumn.py +++ b/DockWidgets/DockWidgetShortcutColumn.py @@ -131,4 +131,8 @@ class DockWidgetShortcutColumn(QDockWidget,ui_dialog): self.tableWidget.setItem(rowPosition , 2, QTableWidgetItem(obj.variables[val]['unit'])) self.tableWidget.resizeColumnsToContents() except Exception as e: - print(e)
\ No newline at end of file + 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((scrollHVal+currentVal)/2)
\ No newline at end of file diff --git a/DockWidgets/DockWidgetSplitter.py b/DockWidgets/DockWidgetSplitter.py index 3b8383c..05dfb0b 100644 --- a/DockWidgets/DockWidgetSplitter.py +++ b/DockWidgets/DockWidgetSplitter.py @@ -68,3 +68,8 @@ class DockWidgetSplitter(QDockWidget,ui_dialog): 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((scrollHVal+currentVal)/2)
\ No newline at end of file diff --git a/DockWidgets/__pycache__/DockWidget.cpython-37.pyc b/DockWidgets/__pycache__/DockWidget.cpython-37.pyc Binary files differindex ca3b088..cca7be4 100644 --- a/DockWidgets/__pycache__/DockWidget.cpython-37.pyc +++ b/DockWidgets/__pycache__/DockWidget.cpython-37.pyc diff --git a/DockWidgets/__pycache__/DockWidgetCompoundSeparator.cpython-37.pyc b/DockWidgets/__pycache__/DockWidgetCompoundSeparator.cpython-37.pyc Binary files differindex 1c1f6f0..7bf913d 100644 --- a/DockWidgets/__pycache__/DockWidgetCompoundSeparator.cpython-37.pyc +++ b/DockWidgets/__pycache__/DockWidgetCompoundSeparator.cpython-37.pyc diff --git a/DockWidgets/__pycache__/DockWidgetDistillationColumn.cpython-37.pyc b/DockWidgets/__pycache__/DockWidgetDistillationColumn.cpython-37.pyc Binary files differindex 8235011..34174b8 100644 --- a/DockWidgets/__pycache__/DockWidgetDistillationColumn.cpython-37.pyc +++ b/DockWidgets/__pycache__/DockWidgetDistillationColumn.cpython-37.pyc diff --git a/DockWidgets/__pycache__/DockWidgetFlash.cpython-37.pyc b/DockWidgets/__pycache__/DockWidgetFlash.cpython-37.pyc Binary files differindex c3d3567..9dfa718 100644 --- a/DockWidgets/__pycache__/DockWidgetFlash.cpython-37.pyc +++ b/DockWidgets/__pycache__/DockWidgetFlash.cpython-37.pyc diff --git a/DockWidgets/__pycache__/DockWidgetMaterialStream.cpython-37.pyc b/DockWidgets/__pycache__/DockWidgetMaterialStream.cpython-37.pyc Binary files differindex b9e781b..d693fd0 100644 --- a/DockWidgets/__pycache__/DockWidgetMaterialStream.cpython-37.pyc +++ b/DockWidgets/__pycache__/DockWidgetMaterialStream.cpython-37.pyc diff --git a/DockWidgets/__pycache__/DockWidgetMixer.cpython-37.pyc b/DockWidgets/__pycache__/DockWidgetMixer.cpython-37.pyc Binary files differindex 150b189..454fa28 100644 --- a/DockWidgets/__pycache__/DockWidgetMixer.cpython-37.pyc +++ b/DockWidgets/__pycache__/DockWidgetMixer.cpython-37.pyc diff --git a/DockWidgets/__pycache__/DockWidgetShortcutColumn.cpython-37.pyc b/DockWidgets/__pycache__/DockWidgetShortcutColumn.cpython-37.pyc Binary files differindex 42e53d9..ec04e53 100644 --- a/DockWidgets/__pycache__/DockWidgetShortcutColumn.cpython-37.pyc +++ b/DockWidgets/__pycache__/DockWidgetShortcutColumn.cpython-37.pyc diff --git a/DockWidgets/__pycache__/DockWidgetSplitter.cpython-37.pyc b/DockWidgets/__pycache__/DockWidgetSplitter.cpython-37.pyc Binary files differindex d82db97..c888614 100644 --- a/DockWidgets/__pycache__/DockWidgetSplitter.cpython-37.pyc +++ b/DockWidgets/__pycache__/DockWidgetSplitter.cpython-37.pyc diff --git a/Graphics.py b/Graphics.py index 8fbbbf0..7d456fe 100644 --- a/Graphics.py +++ b/Graphics.py @@ -30,6 +30,7 @@ class Graphics(QDialog, QtWidgets.QGraphicsItem): self.graphicsView = graphicsView self.pos = None self.unit_operations = unit_operations + self.graphicsView.horizontalScrollBarVal = self.graphicsView.horizontalScrollBar().value() def get_scene(self): return self.scene @@ -286,7 +287,7 @@ class NodeSocket(QtWidgets.QGraphicsItem): painter.setBrush(self.brush) painter.setPen(self.pen) painter.drawEllipse(self.rect) - + def mousePressEvent(self, event): cursor = QCursor( Qt.PointingHandCursor ) QApplication.instance().setOverrideCursor(cursor) @@ -385,8 +386,8 @@ class NodeSocket(QtWidgets.QGraphicsItem): return center def hoverEnterEvent(self, event): - cursor = QCursor( Qt.CrossCursor ) - QApplication.instance().setOverrideCursor(cursor) + cursor = QCursor( Qt.PointingHandCursor) + QApplication.instance().setOverrideCursor(cursor) def hoverLeaveEvent(self, event): cursor = QCursor( Qt.ArrowCursor ) @@ -558,19 +559,23 @@ class NodeItem(QtWidgets.QGraphicsItem): def mouseMoveEvent(self, event): super(NodeItem, self).mouseMoveEvent(event) - for op in self.output: - for line in op.out_lines: - line.pointA = line.source.get_center() - line.pointB = line.target.get_center() - for ip in self.input: - for line in ip.in_lines: - line.pointA = line.source.get_center() - line.pointB = line.target.get_center() + items = self.graphicsView.items() + for i in items: + if(type(i) == NodeItem): + for op in i.output: + for line in op.out_lines: + line.pointA = line.source.get_center() + line.pointB = line.target.get_center() + for ip in i.input: + for line in ip.in_lines: + line.pointA = line.source.get_center() + line.pointB = line.target.get_center() self.pos = event.scenePos() self.obj.set_pos(self.pos) def mouseDoubleClickEvent(self, event): + self.graphicsView.horizontalScrollBarVal = self.graphicsView.horizontalScrollBar().value() self.graphicsView.setInteractive(False) if len(stack): stack[-1].hide() @@ -592,8 +597,8 @@ class NodeItem(QtWidgets.QGraphicsItem): self.dock_widget.update_compounds() except AttributeError: pass - - + + def findMainWindow(self): ''' Global function to find the (open) QMainWindow in application Binary files differ |