87 |
87 |
88 def __initActions(self): |
88 def __initActions(self): |
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 = QAction( |
93 QAction(UI.PixmapCache.getIcon("close.png"), |
93 UI.PixmapCache.getIcon("close.png"), |
94 self.tr("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 = QAction( |
98 QAction(UI.PixmapCache.getIcon("print.png"), |
98 UI.PixmapCache.getIcon("print.png"), |
99 self.tr("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 = QAction( |
103 QAction(UI.PixmapCache.getIcon("printPreview.png"), |
103 UI.PixmapCache.getIcon("printPreview.png"), |
104 self.tr("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. |
336 font = QFont("times", 10) |
336 font = QFont("times", 10) |
337 painter.setFont(font) |
337 painter.setFont(font) |
338 fm = painter.fontMetrics() |
338 fm = painter.fontMetrics() |
339 fontHeight = fm.lineSpacing() |
339 fontHeight = fm.lineSpacing() |
340 marginX = printer.pageRect().x() - printer.paperRect().x() |
340 marginX = printer.pageRect().x() - printer.paperRect().x() |
341 marginX = Preferences.getPrinter("LeftMargin") * \ |
341 marginX = ( |
|
342 Preferences.getPrinter("LeftMargin") * |
342 int(printer.resolution() / 2.54) - marginX |
343 int(printer.resolution() / 2.54) - marginX |
|
344 ) |
343 marginY = printer.pageRect().y() - printer.paperRect().y() |
345 marginY = printer.pageRect().y() - printer.paperRect().y() |
344 marginY = Preferences.getPrinter("TopMargin") * \ |
346 marginY = ( |
|
347 Preferences.getPrinter("TopMargin") * |
345 int(printer.resolution() / 2.54) - marginY |
348 int(printer.resolution() / 2.54) - marginY |
346 |
349 ) |
347 width = printer.width() - marginX - \ |
350 |
348 Preferences.getPrinter("RightMargin") * \ |
351 width = ( |
|
352 printer.width() - marginX - |
|
353 Preferences.getPrinter("RightMargin") * |
349 int(printer.resolution() / 2.54) |
354 int(printer.resolution() / 2.54) |
350 height = printer.height() - fontHeight - 4 - marginY - \ |
355 ) |
351 Preferences.getPrinter("BottomMargin") * \ |
356 height = ( |
|
357 printer.height() - fontHeight - 4 - marginY - |
|
358 Preferences.getPrinter("BottomMargin") * |
352 int(printer.resolution() / 2.54) |
359 int(printer.resolution() / 2.54) |
|
360 ) |
353 |
361 |
354 # write a foot note |
362 # write a foot note |
355 s = self.tr("Diagram: {0}").format(self.getDiagramName()) |
363 s = self.tr("Diagram: {0}").format(self.getDiagramName()) |
356 tc = QColor(50, 50, 50) |
364 tc = QColor(50, 50, 50) |
357 painter.setPen(tc) |
365 painter.setPen(tc) |