def __kdeKQPrintDialog(printer, parent):
     """
     Compatibility function to use the KDE4 print dialog.
     
     @param printer reference to the printer object (QPrinter)
     @param parent reference to the parent widget (QWidget)
     """
     return KdePrint.createPrintDialog(printer, parent)
예제 #2
0
def getPrinter(window, caption=None, printer=None, allowPrintToFile=True):
    """Opens a Print Dialog and waits for user interaction.
    
    If the dialog is accepted, the configured printer (a QPrinter) is
    returned, otherwise None.
    
    window is the parent window for the print dialog.
    If printer is given, it must be a QPrinter instance.
    If allowPrintToFile=False, printing to a file is not allowed.
    
    """
    if printer is None:
        printer = QPrinter()
    dlg = KdePrint.createPrintDialog(printer, window)
    if caption:
        dlg.setWindowTitle(KDialog.makeStandardCaption(caption))
    dlg.setOption(dlg.PrintToFile, allowPrintToFile)
    if dlg.exec_():
        return printer