14 from PyQt6.QtWidgets import ( |
14 from PyQt6.QtWidgets import ( |
15 QLabel, QSizePolicy, QScrollArea, QMenu, QToolBar |
15 QLabel, QSizePolicy, QScrollArea, QMenu, QToolBar |
16 ) |
16 ) |
17 from PyQt6.QtPrintSupport import QPrinter, QPrintDialog |
17 from PyQt6.QtPrintSupport import QPrinter, QPrintDialog |
18 |
18 |
19 from E5Gui import E5MessageBox |
19 from E5Gui import EricMessageBox |
20 from E5Gui.E5MainWindow import E5MainWindow |
20 from E5Gui.EricMainWindow import EricMainWindow |
21 from E5Gui.E5ZoomWidget import E5ZoomWidget |
21 from E5Gui.EricZoomWidget import EricZoomWidget |
22 |
22 |
23 import UI.Config |
23 import UI.Config |
24 |
24 |
25 import Preferences |
25 import Preferences |
26 |
26 |
27 |
27 |
28 class PixmapDiagram(E5MainWindow): |
28 class PixmapDiagram(EricMainWindow): |
29 """ |
29 """ |
30 Class implementing a dialog showing a pixmap. |
30 Class implementing a dialog showing a pixmap. |
31 """ |
31 """ |
32 ZoomLevels = [ |
32 ZoomLevels = [ |
33 1, 3, 5, 7, 9, |
33 1, 3, 5, 7, 9, |
68 self.pixmapView.setBackgroundRole(QPalette.ColorRole.Dark) |
68 self.pixmapView.setBackgroundRole(QPalette.ColorRole.Dark) |
69 self.pixmapView.setWidget(self.pixmapLabel) |
69 self.pixmapView.setWidget(self.pixmapLabel) |
70 |
70 |
71 self.setCentralWidget(self.pixmapView) |
71 self.setCentralWidget(self.pixmapView) |
72 |
72 |
73 self.__zoomWidget = E5ZoomWidget( |
73 self.__zoomWidget = EricZoomWidget( |
74 UI.PixmapCache.getPixmap("zoomOut"), |
74 UI.PixmapCache.getPixmap("zoomOut"), |
75 UI.PixmapCache.getPixmap("zoomIn"), |
75 UI.PixmapCache.getPixmap("zoomIn"), |
76 UI.PixmapCache.getPixmap("zoomReset"), self) |
76 UI.PixmapCache.getPixmap("zoomReset"), self) |
77 self.statusBar().addPermanentWidget(self.__zoomWidget) |
77 self.statusBar().addPermanentWidget(self.__zoomWidget) |
78 self.__zoomWidget.setMapping( |
78 self.__zoomWidget.setMapping( |
157 @return flag indicating success |
157 @return flag indicating success |
158 @rtype bool |
158 @rtype bool |
159 """ |
159 """ |
160 image = QImage(filename) |
160 image = QImage(filename) |
161 if image.isNull(): |
161 if image.isNull(): |
162 E5MessageBox.warning( |
162 EricMessageBox.warning( |
163 self, |
163 self, |
164 self.tr("Pixmap-Viewer"), |
164 self.tr("Pixmap-Viewer"), |
165 self.tr( |
165 self.tr( |
166 """<p>The file <b>{0}</b> cannot be displayed.""" |
166 """<p>The file <b>{0}</b> cannot be displayed.""" |
167 """ The format is not supported.</p>""").format(filename)) |
167 """ The format is not supported.</p>""").format(filename)) |