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