Graphics/SvgDiagram.py

changeset 3190
a9a94491c4fd
parent 3160
209a07d7e401
child 3345
071afe8be2a1
equal deleted inserted replaced
3189:9a21c547de5f 3190:a9a94491c4fd
44 super().__init__(parent) 44 super().__init__(parent)
45 if name: 45 if name:
46 self.setObjectName(name) 46 self.setObjectName(name)
47 else: 47 else:
48 self.setObjectName("SvgDiagram") 48 self.setObjectName("SvgDiagram")
49 self.setWindowTitle(self.trUtf8("SVG-Viewer")) 49 self.setWindowTitle(self.tr("SVG-Viewer"))
50 50
51 self.svgWidget = QSvgWidget() 51 self.svgWidget = QSvgWidget()
52 self.svgWidget.setObjectName("svgWidget") 52 self.svgWidget.setObjectName("svgWidget")
53 self.svgWidget.setBackgroundRole(QPalette.Base) 53 self.svgWidget.setBackgroundRole(QPalette.Base)
54 self.svgWidget.setSizePolicy(QSizePolicy.Ignored, QSizePolicy.Ignored) 54 self.svgWidget.setSizePolicy(QSizePolicy.Ignored, QSizePolicy.Ignored)
87 """ 87 """
88 Private method to initialize the view actions. 88 Private method to initialize the view actions.
89 """ 89 """
90 self.closeAct = \ 90 self.closeAct = \
91 QAction(UI.PixmapCache.getIcon("close.png"), 91 QAction(UI.PixmapCache.getIcon("close.png"),
92 self.trUtf8("Close"), self) 92 self.tr("Close"), self)
93 self.closeAct.triggered[()].connect(self.close) 93 self.closeAct.triggered[()].connect(self.close)
94 94
95 self.printAct = \ 95 self.printAct = \
96 QAction(UI.PixmapCache.getIcon("print.png"), 96 QAction(UI.PixmapCache.getIcon("print.png"),
97 self.trUtf8("Print"), self) 97 self.tr("Print"), self)
98 self.printAct.triggered[()].connect(self.__printDiagram) 98 self.printAct.triggered[()].connect(self.__printDiagram)
99 99
100 self.printPreviewAct = \ 100 self.printPreviewAct = \
101 QAction(UI.PixmapCache.getIcon("printPreview.png"), 101 QAction(UI.PixmapCache.getIcon("printPreview.png"),
102 self.trUtf8("Print Preview"), self) 102 self.tr("Print Preview"), self)
103 self.printPreviewAct.triggered[()].connect(self.__printPreviewDiagram) 103 self.printPreviewAct.triggered[()].connect(self.__printPreviewDiagram)
104 104
105 def __initContextMenu(self): 105 def __initContextMenu(self):
106 """ 106 """
107 Private method to initialize the context menu. 107 Private method to initialize the context menu.
125 125
126 def __initToolBars(self): 126 def __initToolBars(self):
127 """ 127 """
128 Private method to populate the toolbars with our actions. 128 Private method to populate the toolbars with our actions.
129 """ 129 """
130 self.windowToolBar = QToolBar(self.trUtf8("Window"), self) 130 self.windowToolBar = QToolBar(self.tr("Window"), self)
131 self.windowToolBar.setIconSize(UI.Config.ToolBarIconSize) 131 self.windowToolBar.setIconSize(UI.Config.ToolBarIconSize)
132 self.windowToolBar.addAction(self.closeAct) 132 self.windowToolBar.addAction(self.closeAct)
133 133
134 self.graphicsToolBar = QToolBar(self.trUtf8("Graphics"), self) 134 self.graphicsToolBar = QToolBar(self.tr("Graphics"), self)
135 self.graphicsToolBar.setIconSize(UI.Config.ToolBarIconSize) 135 self.graphicsToolBar.setIconSize(UI.Config.ToolBarIconSize)
136 self.graphicsToolBar.addAction(self.printPreviewAct) 136 self.graphicsToolBar.addAction(self.printPreviewAct)
137 self.graphicsToolBar.addAction(self.printAct) 137 self.graphicsToolBar.addAction(self.printAct)
138 138
139 self.addToolBar(Qt.TopToolBarArea, self.windowToolBar) 139 self.addToolBar(Qt.TopToolBarArea, self.windowToolBar)
347 height = printer.height() - fontHeight - 4 - marginY - \ 347 height = printer.height() - fontHeight - 4 - marginY - \
348 Preferences.getPrinter("BottomMargin") * \ 348 Preferences.getPrinter("BottomMargin") * \
349 int(printer.resolution() / 2.54) 349 int(printer.resolution() / 2.54)
350 350
351 # write a foot note 351 # write a foot note
352 s = self.trUtf8("Diagram: {0}").format(self.getDiagramName()) 352 s = self.tr("Diagram: {0}").format(self.getDiagramName())
353 tc = QColor(50, 50, 50) 353 tc = QColor(50, 50, 50)
354 painter.setPen(tc) 354 painter.setPen(tc)
355 painter.drawRect(marginX, marginY, width, height) 355 painter.drawRect(marginX, marginY, width, height)
356 painter.drawLine(marginX, marginY + height + 2, 356 painter.drawLine(marginX, marginY + height + 2,
357 marginX + width, marginY + height + 2) 357 marginX + width, marginY + height + 2)

eric ide

mercurial