--- a/eric7/Graphics/UMLGraphicsView.py Wed Jun 15 09:44:07 2022 +0200 +++ b/eric7/Graphics/UMLGraphicsView.py Thu Jun 16 18:28:59 2022 +0200 @@ -7,8 +7,10 @@ Module implementing a subclass of EricGraphicsView for our diagrams. """ +import pathlib + from PyQt6.QtCore import ( - pyqtSignal, Qt, QSignalMapper, QFileInfo, QEvent, QRectF, QMarginsF + pyqtSignal, Qt, QSignalMapper, QEvent, QRectF, QMarginsF ) from PyQt6.QtGui import QAction, QPageLayout from PyQt6.QtWidgets import QGraphicsView, QToolBar, QDialog @@ -367,30 +369,30 @@ "", EricFileDialog.DontConfirmOverwrite) if fname: - 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 success = super().saveImage( - fname, QFileInfo(fname).suffix().upper()) + str(fpath), fpath.suffix.upper()) if not success: EricMessageBox.critical( self, self.tr("Save Diagram"), self.tr( """<p>The file <b>{0}</b> could not be saved.</p>""") - .format(fname)) + .format(str(fpath))) def __relayout(self): """