summaryrefslogtreecommitdiff
path: root/src/main/python/main.py
diff options
context:
space:
mode:
authorpravindalve2023-06-28 23:19:45 +0530
committerGitHub2023-06-28 23:19:45 +0530
commita36163acf0ed62f0a14e11d2e1c91eacfa7e281a (patch)
treeabf1fe949781291ba4b80e4a827e9c532b628853 /src/main/python/main.py
parent6a949fca57bdb737cfbc21be98c23797977ba4e2 (diff)
parenta1e135b5c0f208b7d96bbb780441687b6a353064 (diff)
downloadChemical-PFD-a36163acf0ed62f0a14e11d2e1c91eacfa7e281a.tar.gz
Chemical-PFD-a36163acf0ed62f0a14e11d2e1c91eacfa7e281a.tar.bz2
Chemical-PFD-a36163acf0ed62f0a14e11d2e1c91eacfa7e281a.zip
Merge pull request #36 from rrsr28/pfd-changes-sanjayHEADmaster
PFD Changes
Diffstat (limited to 'src/main/python/main.py')
-rw-r--r--src/main/python/main.py20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/main/python/main.py b/src/main/python/main.py
index 5af252d..de8a12b 100644
--- a/src/main/python/main.py
+++ b/src/main/python/main.py
@@ -26,7 +26,10 @@ class appWindow(QMainWindow):
#create the menu bar
self.createMenuBar()
-
+
+ #used for file name
+ self.counterr = 0
+
self.mdi = QMdiArea(self) #create area for files to be displayed
self.mdi.setObjectName('mdi area')
@@ -139,8 +142,19 @@ 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', f'New Image {self.counterr}', '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])
+ self.counterr += 1
+ painter.end()
def generateReport(self):
#place holder for future implementaion