diff options
author | rrsr28 | 2023-06-13 19:56:03 +0530 |
---|---|---|
committer | rrsr28 | 2023-06-13 19:56:03 +0530 |
commit | df110d2a19d995db7db0888e4a853a48cdced6ea (patch) | |
tree | 4bd54c8eb3c1eb80150350877366a44904c155a2 /src/main/python/main.py | |
parent | 8faea682e5ec94caf0a62ea275fb1509c8582296 (diff) | |
download | Chemical-PFD-df110d2a19d995db7db0888e4a853a48cdced6ea.tar.gz Chemical-PFD-df110d2a19d995db7db0888e4a853a48cdced6ea.tar.bz2 Chemical-PFD-df110d2a19d995db7db0888e4a853a48cdced6ea.zip |
Implemented saveImage feature
Diffstat (limited to 'src/main/python/main.py')
-rw-r--r-- | src/main/python/main.py | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/main/python/main.py b/src/main/python/main.py index 5af252d..23ec01f 100644 --- a/src/main/python/main.py +++ b/src/main/python/main.py @@ -139,8 +139,18 @@ class appWindow(QMainWindow): return True def saveImage(self): - #place holder for future implementaion - pass + #save the scene as png or jpg + if self.mdi.currentSubWindow(): + currentDiagram = self.mdi.currentSubWindow().tabber.currentWidget().painter + if currentDiagram: + name = QFileDialog.getSaveFileName(self, 'Save File', 'New Image', 'PNG (*.png);;JPEG (*.jpg)') + if name[0]: + image = QImage(currentDiagram.sceneRect().size().toSize(), QImage.Format_ARGB32) + image.fill(Qt.transparent) + painter = QPainter(image) + currentDiagram.render(painter) + image.save(name[0]) + painter.end() def generateReport(self): #place holder for future implementaion |