eric7/Graphics/UMLDialog.py

branch
eric7
changeset 9152
8a68afaf1ba2
parent 8881
54e42bc2437a
child 9153
506e35e424d5
--- a/eric7/Graphics/UMLDialog.py	Wed Jun 15 09:44:07 2022 +0200
+++ b/eric7/Graphics/UMLDialog.py	Thu Jun 16 18:28:59 2022 +0200
@@ -9,8 +9,9 @@
 
 import enum
 import json
+import pathlib
 
-from PyQt6.QtCore import pyqtSlot, Qt, QFileInfo, QCoreApplication
+from PyQt6.QtCore import pyqtSlot, Qt, QCoreApplication
 from PyQt6.QtGui import QAction
 from PyQt6.QtWidgets import QToolBar, QGraphicsScene
 
@@ -249,21 +250,22 @@
                 EricFileDialog.DontConfirmOverwrite)
             if not fname:
                 return
-            ext = QFileInfo(fname).suffix()
-            if not ext:
+            
+            fpath = pathlib.Path(fname)
+            if not fpath.suffix:
                 ex = selectedFilter.split("(*")[1].split(")")[0]
                 if ex:
-                    fname += ex
-            if QFileInfo(fname).exists():
+                    fpath = fpath.with_suffix(ex)
+            if fpath.exists():
                 res = EricMessageBox.yesNo(
                     self,
                     self.tr("Save Diagram"),
                     self.tr("<p>The file <b>{0}</b> already exists."
-                            " Overwrite it?</p>").format(fname),
+                            " Overwrite it?</p>").format(str(fpath)),
                     icon=EricMessageBox.Warning)
                 if not res:
                     return
-            filename = fname
+            filename = str(fpath)
         
         res = self.__writeJsonGraphicsFile(filename)
         

eric ide

mercurial