示例#1
0
 def getPrintList(self):
     printer = []
     printerInfo = QPrinterInfo()
     print('availablePrinterNames', printerInfo.availablePrinterNames())
     print('defaultPrinterName', printerInfo.defaultPrinterName())
     for item in printerInfo.availablePrinters():
         printer.append(item.printerName())
     return printer
示例#2
0
 def getPrinter(p):
     printer = []
     printerInfo = QPrinterInfo()
     print('availablePrinterNames', printerInfo.availablePrinterNames())
     print('defaultPrinterName', printerInfo.defaultPrinterName())
     for item in printerInfo.availablePrinters():
         printer.append(item.printerName())
     if p in printer:
         print(p)
         return p
     else:
         print(printerInfo.defaultPrinterName())
         return printerInfo.defaultPrinterName()
示例#3
0
 def getPrinter(p):
     printer = []
     printerInfo = QPrinterInfo()
     print('availablePrinterNames', printerInfo.availablePrinterNames())
     print('defaultPrinterName', printerInfo.defaultPrinterName())
     for item in printerInfo.availablePrinters():
         printer.append(item.printerName())
         log.write(Printer.getTime() + "--availablePrinterName --" + str(item.printerName()))
     if p in printer:
         print(p)
         return p
     else:
         print(printerInfo.defaultPrinterName())
         log.write(Printer.getTime() + "--defaultPrinterName --" + str(printerInfo.defaultPrinterName()))
         return printerInfo.defaultPrinterName()
示例#4
0
 def __init__(self, p):
     printer = []
     printerInfo = QPrinterInfo()
     print('availablePrinterNames', printerInfo.availablePrinterNames())
     print('defaultPrinterName', printerInfo.defaultPrinterName())
     if p is None or p == "":
         self.p = QPrinterInfo.defaultPrinter()
         self.print_device = QPrinter(self.p)
     else:
         for item in printerInfo.availablePrinters():
             printer.append(item.printerName())
         if p in printer:
             self.p = QPrinter(p)
         else:
             self.p = QPrinterInfo.defaultPrinter()
         self.print_device = QPrinter(self.p)  # 指定打印所使用的装置