53 | | display = pyosd.osd(colour="#FF0000", timeout=5, shadow=2) |
54 | | display.display("PyKota Units left : %.2f" % user.AccountBalance, type=pyosd.TYPE_STRING) |
| 56 | if user.LimitBy == "quota" : |
| 57 | printers = cmd.storage.getMatchingPrinters("*") |
| 58 | upquotas = [ cmd.storage.getUserPQuota(user, p) for p in printers ] |
| 59 | nblines = len(upquotas) |
| 60 | display = pyosd.osd(colour="#FF0000", timeout=5, shadow=2, lines=nblines) |
| 61 | for line in range(nblines) : |
| 62 | upq = upquotas[line] |
| 63 | if upq.HardLimit is None : |
| 64 | if upq.SoftLimit is None : |
| 65 | percent = 0 |
| 66 | else : |
| 67 | percent = (upq.PageCounter * 100) / upq.SoftLimit |
| 68 | else : |
| 69 | percent = (upq.PageCounter * 100) / upq.HardLimit |
| 70 | percent = min(percent, 100) |
| 71 | display.display("Pages used on %s : %s%%" % (upq.Printer.Name, percent), type=pyosd.TYPE_STRING, line=line) |
| 72 | else : |
| 73 | display = pyosd.osd(colour="#FF0000", timeout=5, shadow=2) |
| 74 | display.display("PyKota Units left : %.2f" % user.AccountBalance, type=pyosd.TYPE_STRING) |