47 super(PixmapDiagram, self).__init__(parent) |
47 super(PixmapDiagram, self).__init__(parent) |
48 if name: |
48 if name: |
49 self.setObjectName(name) |
49 self.setObjectName(name) |
50 else: |
50 else: |
51 self.setObjectName("PixmapDiagram") |
51 self.setObjectName("PixmapDiagram") |
52 self.setWindowTitle(self.trUtf8("Pixmap-Viewer")) |
52 self.setWindowTitle(self.tr("Pixmap-Viewer")) |
53 |
53 |
54 self.pixmapLabel = QLabel() |
54 self.pixmapLabel = QLabel() |
55 self.pixmapLabel.setObjectName("pixmapLabel") |
55 self.pixmapLabel.setObjectName("pixmapLabel") |
56 self.pixmapLabel.setBackgroundRole(QPalette.Base) |
56 self.pixmapLabel.setBackgroundRole(QPalette.Base) |
57 self.pixmapLabel.setSizePolicy( |
57 self.pixmapLabel.setSizePolicy( |
90 """ |
90 """ |
91 Private method to initialize the view actions. |
91 Private method to initialize the view actions. |
92 """ |
92 """ |
93 self.closeAct = \ |
93 self.closeAct = \ |
94 QAction(UI.PixmapCache.getIcon("close.png"), |
94 QAction(UI.PixmapCache.getIcon("close.png"), |
95 self.trUtf8("Close"), self) |
95 self.tr("Close"), self) |
96 self.closeAct.triggered[()].connect(self.close) |
96 self.closeAct.triggered.connect(self.close) |
97 |
97 |
98 self.printAct = \ |
98 self.printAct = \ |
99 QAction(UI.PixmapCache.getIcon("print.png"), |
99 QAction(UI.PixmapCache.getIcon("print.png"), |
100 self.trUtf8("Print"), self) |
100 self.tr("Print"), self) |
101 self.printAct.triggered[()].connect(self.__printDiagram) |
101 self.printAct.triggered.connect(self.__printDiagram) |
102 |
102 |
103 self.printPreviewAct = \ |
103 self.printPreviewAct = \ |
104 QAction(UI.PixmapCache.getIcon("printPreview.png"), |
104 QAction(UI.PixmapCache.getIcon("printPreview.png"), |
105 self.trUtf8("Print Preview"), self) |
105 self.tr("Print Preview"), self) |
106 self.printPreviewAct.triggered[()].connect(self.__printPreviewDiagram) |
106 self.printPreviewAct.triggered.connect(self.__printPreviewDiagram) |
107 |
107 |
108 def __initContextMenu(self): |
108 def __initContextMenu(self): |
109 """ |
109 """ |
110 Private method to initialize the context menu. |
110 Private method to initialize the context menu. |
111 """ |
111 """ |
128 |
128 |
129 def __initToolBars(self): |
129 def __initToolBars(self): |
130 """ |
130 """ |
131 Private method to populate the toolbars with our actions. |
131 Private method to populate the toolbars with our actions. |
132 """ |
132 """ |
133 self.windowToolBar = QToolBar(self.trUtf8("Window"), self) |
133 self.windowToolBar = QToolBar(self.tr("Window"), self) |
134 self.windowToolBar.setIconSize(UI.Config.ToolBarIconSize) |
134 self.windowToolBar.setIconSize(UI.Config.ToolBarIconSize) |
135 self.windowToolBar.addAction(self.closeAct) |
135 self.windowToolBar.addAction(self.closeAct) |
136 |
136 |
137 self.graphicsToolBar = QToolBar(self.trUtf8("Graphics"), self) |
137 self.graphicsToolBar = QToolBar(self.tr("Graphics"), self) |
138 self.graphicsToolBar.setIconSize(UI.Config.ToolBarIconSize) |
138 self.graphicsToolBar.setIconSize(UI.Config.ToolBarIconSize) |
139 self.graphicsToolBar.addAction(self.printPreviewAct) |
139 self.graphicsToolBar.addAction(self.printPreviewAct) |
140 self.graphicsToolBar.addAction(self.printAct) |
140 self.graphicsToolBar.addAction(self.printAct) |
141 |
141 |
142 self.addToolBar(Qt.TopToolBarArea, self.windowToolBar) |
142 self.addToolBar(Qt.TopToolBarArea, self.windowToolBar) |
151 """ |
151 """ |
152 image = QImage(filename) |
152 image = QImage(filename) |
153 if image.isNull(): |
153 if image.isNull(): |
154 E5MessageBox.warning( |
154 E5MessageBox.warning( |
155 self, |
155 self, |
156 self.trUtf8("Pixmap-Viewer"), |
156 self.tr("Pixmap-Viewer"), |
157 self.trUtf8( |
157 self.tr( |
158 """<p>The file <b>{0}</b> cannot be displayed.""" |
158 """<p>The file <b>{0}</b> cannot be displayed.""" |
159 """ The format is not supported.</p>""").format(filename)) |
159 """ The format is not supported.</p>""").format(filename)) |
160 return False |
160 return False |
161 |
161 |
162 self.pixmapLabel.setPixmap(QPixmap.fromImage(image)) |
162 self.pixmapLabel.setPixmap(QPixmap.fromImage(image)) |
377 height = printer.height() - fontHeight - 4 - marginY - \ |
377 height = printer.height() - fontHeight - 4 - marginY - \ |
378 Preferences.getPrinter("BottomMargin") * \ |
378 Preferences.getPrinter("BottomMargin") * \ |
379 int(printer.resolution() / 2.54) |
379 int(printer.resolution() / 2.54) |
380 |
380 |
381 # write a foot note |
381 # write a foot note |
382 s = self.trUtf8("Diagram: {0}").format(self.getDiagramName()) |
382 s = self.tr("Diagram: {0}").format(self.getDiagramName()) |
383 tc = QColor(50, 50, 50) |
383 tc = QColor(50, 50, 50) |
384 painter.setPen(tc) |
384 painter.setPen(tc) |
385 painter.drawRect(marginX, marginY, width, height) |
385 painter.drawRect(marginX, marginY, width, height) |
386 painter.drawLine(marginX, marginY + height + 2, |
386 painter.drawLine(marginX, marginY + height + 2, |
387 marginX + width, marginY + height + 2) |
387 marginX + width, marginY + height + 2) |