コード例 #1
0
 def __printDiagram(self):
     """
     Private slot called to print the diagram.
     """
     printer = KdeQt.KQPrinter.KQPrinter(mode = QPrinter.ScreenResolution)
     printer.setFullPage(True)
     if Preferences.getPrinter("ColorMode"):
         printer.setColorMode(KdeQt.KQPrinter.Color)
     else:
         printer.setColorMode(KdeQt.KQPrinter.GrayScale)
     if Preferences.getPrinter("FirstPageFirst"):
         printer.setPageOrder(KdeQt.KQPrinter.FirstPageFirst)
     else:
         printer.setPageOrder(KdeQt.KQPrinter.LastPageFirst)
     printer.setPageMargins(
         Preferences.getPrinter("LeftMargin") * 10,
         Preferences.getPrinter("TopMargin") * 10,
         Preferences.getPrinter("RightMargin") * 10,
         Preferences.getPrinter("BottomMargin") * 10,
         QPrinter.Millimeter
     )
     printer.setPrinterName(Preferences.getPrinter("PrinterName"))
     
     printDialog = KQPrintDialog(printer, self)
     if printDialog.exec_():
         self.printDiagram(printer, self.diagramName)
コード例 #2
0
 def __printDiagram(self):
     """
     Private slot called to print the diagram.
     """
     printer = KdeQt.KQPrinter.KQPrinter(mode = QPrinter.ScreenResolution)
     printer.setFullPage(True)
     if Preferences.getPrinter("ColorMode"):
         printer.setColorMode(KdeQt.KQPrinter.Color)
     else:
         printer.setColorMode(KdeQt.KQPrinter.GrayScale)
     if Preferences.getPrinter("FirstPageFirst"):
         printer.setPageOrder(KdeQt.KQPrinter.FirstPageFirst)
     else:
         printer.setPageOrder(KdeQt.KQPrinter.LastPageFirst)
     printer.setPrinterName(Preferences.getPrinter("PrinterName"))
     
     printDialog = KQPrintDialog(printer, self)
     if printDialog.exec_():
         self.__print(printer)
コード例 #3
0
 def __printImage(self):
     """
     Private slot to handle the Print Image menu action.
     """
     if self.mainWidget is None:
         KQMessageBox.critical(None,
             self.trUtf8("Print Image"),
             self.trUtf8("""There is no UI file loaded."""))
         return
     
     settings = Preferences.Prefs.settings
     printer = KdeQt.KQPrinter.KQPrinter(mode = QPrinter.HighResolution)
     printer.setFullPage(True)
     
     if not KdeQt.isKDE():
         printer.setPrinterName(settings.value("UIPreviewer/printername").toString())
         printer.setPageSize(
             QPrinter.PageSize(settings.value("UIPreviewer/pagesize").toInt()[0]))
         printer.setPageOrder(
             QPrinter.PageOrder(settings.value("UIPreviewer/pageorder").toInt()[0]))
         printer.setOrientation(
             QPrinter.Orientation(settings.value("UIPreviewer/orientation").toInt()[0]))
         printer.setColorMode(
             QPrinter.ColorMode(settings.value("UIPreviewer/colormode").toInt()[0]))
     
     printDialog = KQPrintDialog(printer, self)
     if printDialog.exec_() == QDialog.Accepted:
         self.statusBar().showMessage(self.trUtf8("Printing the image..."))
         self.__print(printer)
         
         if not KdeQt.isKDE():
             settings.setValue("UIPreviewer/printername", 
                 QVariant(printer.printerName()))
             settings.setValue("UIPreviewer/pagesize", QVariant(printer.pageSize()))
             settings.setValue("UIPreviewer/pageorder", QVariant(printer.pageOrder()))
             settings.setValue("UIPreviewer/orientation", 
                 QVariant(printer.orientation()))
             settings.setValue("UIPreviewer/colormode", QVariant(printer.colorMode()))
     
     self.statusBar().showMessage(self.trUtf8("Image sent to printer..."), 2000)