eric7/Graphics/SvgDiagram.py

branch
eric7
changeset 8318
962bce857696
parent 8312
800c432b34c8
child 8335
9fa339ca2a91
equal deleted inserted replaced
8316:0c7a44af84bc 8318:962bce857696
5 5
6 """ 6 """
7 Module implementing a dialog showing a SVG graphic. 7 Module implementing a dialog showing a SVG graphic.
8 """ 8 """
9 9
10 from PyQt5.QtCore import Qt, QSize, QEvent 10 from PyQt6.QtCore import Qt, QSize, QEvent
11 from PyQt5.QtGui import QPalette, QPainter, QFont, QColor 11 from PyQt6.QtGui import QPalette, QPainter, QFont, QColor, QAction
12 from PyQt5.QtWidgets import QSizePolicy, QScrollArea, QAction, QMenu, QToolBar 12 from PyQt6.QtWidgets import QSizePolicy, QScrollArea, QMenu, QToolBar
13 from PyQt5.QtPrintSupport import QPrinter, QPrintDialog 13 from PyQt6.QtPrintSupport import QPrinter, QPrintDialog
14 from PyQt5.QtSvg import QSvgWidget 14 from PyQt6.QtSvg import QSvgWidget
15 15
16 from E5Gui.E5MainWindow import E5MainWindow 16 from E5Gui.E5MainWindow import E5MainWindow
17 from E5Gui.E5ZoomWidget import E5ZoomWidget 17 from E5Gui.E5ZoomWidget import E5ZoomWidget
18 18
19 import UI.Config 19 import UI.Config
309 309
310 def __printPreviewDiagram(self): 310 def __printPreviewDiagram(self):
311 """ 311 """
312 Private slot called to show a print preview of the diagram. 312 Private slot called to show a print preview of the diagram.
313 """ 313 """
314 from PyQt5.QtPrintSupport import QPrintPreviewDialog 314 from PyQt6.QtPrintSupport import QPrintPreviewDialog
315 315
316 printer = QPrinter(mode=QPrinter.PrinterMode.ScreenResolution) 316 printer = QPrinter(mode=QPrinter.PrinterMode.ScreenResolution)
317 printer.setFullPage(True) 317 printer.setFullPage(True)
318 if Preferences.getPrinter("ColorMode"): 318 if Preferences.getPrinter("ColorMode"):
319 printer.setColorMode(QPrinter.ColorMode.Color) 319 printer.setColorMode(QPrinter.ColorMode.Color)
347 """ 347 """
348 painter = QPainter() 348 painter = QPainter()
349 painter.begin(printer) 349 painter.begin(printer)
350 350
351 # calculate margin and width of printout 351 # calculate margin and width of printout
352 font = QFont("times", 10) 352 font = QFont(["times"], 10)
353 painter.setFont(font) 353 painter.setFont(font)
354 fm = painter.fontMetrics() 354 fm = painter.fontMetrics()
355 fontHeight = fm.lineSpacing() 355 fontHeight = fm.lineSpacing()
356 marginX = ( 356 marginX = (
357 printer.pageLayout().paintRectPixels(printer.resolution()).x() - 357 printer.pageLayout().paintRectPixels(printer.resolution()).x() -

eric ide

mercurial