eric7/Graphics/UMLGraphicsView.py

branch
eric7
changeset 8356
68ec9c3d4de5
parent 8348
f4775ae8f441
child 8358
144a6b854f70
equal deleted inserted replaced
8355:8a7677a63c8d 8356:68ec9c3d4de5
14 from PyQt6.QtWidgets import QGraphicsView, QToolBar, QDialog 14 from PyQt6.QtWidgets import QGraphicsView, QToolBar, QDialog
15 from PyQt6.QtPrintSupport import QPrinter, QPrintDialog 15 from PyQt6.QtPrintSupport import QPrinter, QPrintDialog
16 16
17 from EricGraphics.EricGraphicsView import EricGraphicsView 17 from EricGraphics.EricGraphicsView import EricGraphicsView
18 18
19 from E5Gui import E5MessageBox, E5FileDialog 19 from E5Gui import EricMessageBox, EricFileDialog
20 from E5Gui.E5ZoomWidget import E5ZoomWidget 20 from E5Gui.EricZoomWidget import EricZoomWidget
21 21
22 from .UMLItem import UMLItem 22 from .UMLItem import UMLItem
23 23
24 import UI.Config 24 import UI.Config
25 import UI.PixmapCache 25 import UI.PixmapCache
54 self.__itemId = -1 54 self.__itemId = -1
55 55
56 self.border = 10 56 self.border = 10
57 self.deltaSize = 100.0 57 self.deltaSize = 100.0
58 58
59 self.__zoomWidget = E5ZoomWidget( 59 self.__zoomWidget = EricZoomWidget(
60 UI.PixmapCache.getPixmap("zoomOut"), 60 UI.PixmapCache.getPixmap("zoomOut"),
61 UI.PixmapCache.getPixmap("zoomIn"), 61 UI.PixmapCache.getPixmap("zoomIn"),
62 UI.PixmapCache.getPixmap("zoomReset"), self) 62 UI.PixmapCache.getPixmap("zoomReset"), self)
63 parent.statusBar().addPermanentWidget(self.__zoomWidget) 63 parent.statusBar().addPermanentWidget(self.__zoomWidget)
64 self.__zoomWidget.setMapping( 64 self.__zoomWidget.setMapping(
356 356
357 def saveImage(self): 357 def saveImage(self):
358 """ 358 """
359 Public method to handle the save context menu entry. 359 Public method to handle the save context menu entry.
360 """ 360 """
361 fname, selectedFilter = E5FileDialog.getSaveFileNameAndFilter( 361 fname, selectedFilter = EricFileDialog.getSaveFileNameAndFilter(
362 self, 362 self,
363 self.tr("Save Diagram"), 363 self.tr("Save Diagram"),
364 "", 364 "",
365 self.tr("Portable Network Graphics (*.png);;" 365 self.tr("Portable Network Graphics (*.png);;"
366 "Scalable Vector Graphics (*.svg)"), 366 "Scalable Vector Graphics (*.svg)"),
367 "", 367 "",
368 E5FileDialog.DontConfirmOverwrite) 368 EricFileDialog.DontConfirmOverwrite)
369 if fname: 369 if fname:
370 ext = QFileInfo(fname).suffix() 370 ext = QFileInfo(fname).suffix()
371 if not ext: 371 if not ext:
372 ex = selectedFilter.split("(*")[1].split(")")[0] 372 ex = selectedFilter.split("(*")[1].split(")")[0]
373 if ex: 373 if ex:
374 fname += ex 374 fname += ex
375 if QFileInfo(fname).exists(): 375 if QFileInfo(fname).exists():
376 res = E5MessageBox.yesNo( 376 res = EricMessageBox.yesNo(
377 self, 377 self,
378 self.tr("Save Diagram"), 378 self.tr("Save Diagram"),
379 self.tr("<p>The file <b>{0}</b> already exists." 379 self.tr("<p>The file <b>{0}</b> already exists."
380 " Overwrite it?</p>").format(fname), 380 " Overwrite it?</p>").format(fname),
381 icon=E5MessageBox.Warning) 381 icon=EricMessageBox.Warning)
382 if not res: 382 if not res:
383 return 383 return
384 384
385 success = super().saveImage( 385 success = super().saveImage(
386 fname, QFileInfo(fname).suffix().upper()) 386 fname, QFileInfo(fname).suffix().upper())
387 if not success: 387 if not success:
388 E5MessageBox.critical( 388 EricMessageBox.critical(
389 self, 389 self,
390 self.tr("Save Diagram"), 390 self.tr("Save Diagram"),
391 self.tr( 391 self.tr(
392 """<p>The file <b>{0}</b> could not be saved.</p>""") 392 """<p>The file <b>{0}</b> could not be saved.</p>""")
393 .format(fname)) 393 .format(fname))

eric ide

mercurial