summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrrsr282023-06-13 20:06:06 +0530
committerrrsr282023-06-13 20:06:06 +0530
commitda1c2fe22daa9c7de8d0facc716405a7187873b0 (patch)
tree4adb633d32f683c5b868438570aa035e14d10a4d
parentdf110d2a19d995db7db0888e4a853a48cdced6ea (diff)
downloadChemical-PFD-da1c2fe22daa9c7de8d0facc716405a7187873b0.tar.gz
Chemical-PFD-da1c2fe22daa9c7de8d0facc716405a7187873b0.tar.bz2
Chemical-PFD-da1c2fe22daa9c7de8d0facc716405a7187873b0.zip
Improved saveImage feature
-rw-r--r--src/main/python/main.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/main/python/main.py b/src/main/python/main.py
index 23ec01f..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')
@@ -143,13 +146,14 @@ class appWindow(QMainWindow):
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)')
+ 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):