11 from PyQt6.QtGui import QPalette, QPainter, QFont, QColor, QAction, QPageLayout |
11 from PyQt6.QtGui import QPalette, QPainter, QFont, QColor, QAction, QPageLayout |
12 from PyQt6.QtWidgets import QSizePolicy, QScrollArea, QMenu, QToolBar |
12 from PyQt6.QtWidgets import QSizePolicy, QScrollArea, QMenu, QToolBar |
13 from PyQt6.QtPrintSupport import QPrinter, QPrintDialog |
13 from PyQt6.QtPrintSupport import QPrinter, QPrintDialog |
14 from PyQt6.QtSvgWidgets import QSvgWidget |
14 from PyQt6.QtSvgWidgets import QSvgWidget |
15 |
15 |
16 from EricWidgets.EricMainWindow import EricMainWindow |
16 from eric7.EricWidgets.EricMainWindow import EricMainWindow |
17 from EricWidgets.EricZoomWidget import EricZoomWidget |
17 from eric7.EricWidgets.EricZoomWidget import EricZoomWidget |
18 |
18 |
19 import UI.Config |
19 from eric7.EricGui import EricPixmapCache |
20 |
20 from eric7.UI import Config |
21 import Preferences |
21 |
|
22 from eric7 import Preferences |
22 |
23 |
23 |
24 |
24 class SvgDiagram(EricMainWindow): |
25 class SvgDiagram(EricMainWindow): |
25 """ |
26 """ |
26 Class implementing a dialog showing a SVG graphic. |
27 Class implementing a dialog showing a SVG graphic. |
89 self.svgView.setWidget(self.svgWidget) |
90 self.svgView.setWidget(self.svgWidget) |
90 |
91 |
91 self.setCentralWidget(self.svgView) |
92 self.setCentralWidget(self.svgView) |
92 |
93 |
93 self.__zoomWidget = EricZoomWidget( |
94 self.__zoomWidget = EricZoomWidget( |
94 UI.PixmapCache.getPixmap("zoomOut"), |
95 EricPixmapCache.getPixmap("zoomOut"), |
95 UI.PixmapCache.getPixmap("zoomIn"), |
96 EricPixmapCache.getPixmap("zoomIn"), |
96 UI.PixmapCache.getPixmap("zoomReset"), |
97 EricPixmapCache.getPixmap("zoomReset"), |
97 self, |
98 self, |
98 ) |
99 ) |
99 self.statusBar().addPermanentWidget(self.__zoomWidget) |
100 self.statusBar().addPermanentWidget(self.__zoomWidget) |
100 self.__zoomWidget.setMapping(SvgDiagram.ZoomLevels, SvgDiagram.ZoomLevelDefault) |
101 self.__zoomWidget.setMapping(SvgDiagram.ZoomLevels, SvgDiagram.ZoomLevelDefault) |
101 self.__zoomWidget.valueChanged.connect(self.__doZoom) |
102 self.__zoomWidget.valueChanged.connect(self.__doZoom) |
116 |
117 |
117 def __initActions(self): |
118 def __initActions(self): |
118 """ |
119 """ |
119 Private method to initialize the view actions. |
120 Private method to initialize the view actions. |
120 """ |
121 """ |
121 self.closeAct = QAction(UI.PixmapCache.getIcon("close"), self.tr("Close"), self) |
122 self.closeAct = QAction( |
|
123 EricPixmapCache.getIcon("close"), self.tr("Close"), self |
|
124 ) |
122 self.closeAct.triggered.connect(self.close) |
125 self.closeAct.triggered.connect(self.close) |
123 |
126 |
124 self.printAct = QAction(UI.PixmapCache.getIcon("print"), self.tr("Print"), self) |
127 self.printAct = QAction( |
|
128 EricPixmapCache.getIcon("print"), self.tr("Print"), self |
|
129 ) |
125 self.printAct.triggered.connect(self.__printDiagram) |
130 self.printAct.triggered.connect(self.__printDiagram) |
126 |
131 |
127 self.printPreviewAct = QAction( |
132 self.printPreviewAct = QAction( |
128 UI.PixmapCache.getIcon("printPreview"), self.tr("Print Preview"), self |
133 EricPixmapCache.getIcon("printPreview"), self.tr("Print Preview"), self |
129 ) |
134 ) |
130 self.printPreviewAct.triggered.connect(self.__printPreviewDiagram) |
135 self.printPreviewAct.triggered.connect(self.__printPreviewDiagram) |
131 |
136 |
132 def __initContextMenu(self): |
137 def __initContextMenu(self): |
133 """ |
138 """ |
154 def __initToolBars(self): |
159 def __initToolBars(self): |
155 """ |
160 """ |
156 Private method to populate the toolbars with our actions. |
161 Private method to populate the toolbars with our actions. |
157 """ |
162 """ |
158 self.windowToolBar = QToolBar(self.tr("Window"), self) |
163 self.windowToolBar = QToolBar(self.tr("Window"), self) |
159 self.windowToolBar.setIconSize(UI.Config.ToolBarIconSize) |
164 self.windowToolBar.setIconSize(Config.ToolBarIconSize) |
160 self.windowToolBar.addAction(self.closeAct) |
165 self.windowToolBar.addAction(self.closeAct) |
161 |
166 |
162 self.graphicsToolBar = QToolBar(self.tr("Graphics"), self) |
167 self.graphicsToolBar = QToolBar(self.tr("Graphics"), self) |
163 self.graphicsToolBar.setIconSize(UI.Config.ToolBarIconSize) |
168 self.graphicsToolBar.setIconSize(Config.ToolBarIconSize) |
164 self.graphicsToolBar.addAction(self.printPreviewAct) |
169 self.graphicsToolBar.addAction(self.printPreviewAct) |
165 self.graphicsToolBar.addAction(self.printAct) |
170 self.graphicsToolBar.addAction(self.printAct) |
166 |
171 |
167 self.addToolBar(Qt.ToolBarArea.TopToolBarArea, self.windowToolBar) |
172 self.addToolBar(Qt.ToolBarArea.TopToolBarArea, self.windowToolBar) |
168 self.addToolBar(Qt.ToolBarArea.TopToolBarArea, self.graphicsToolBar) |
173 self.addToolBar(Qt.ToolBarArea.TopToolBarArea, self.graphicsToolBar) |