209 | | self.SetColLabelValue(0, _("Page Counter")) |
210 | | self.SetColLabelValue(1, _("Soft Limit")) |
211 | | self.SetColLabelValue(2, _("Hard Limit")) |
212 | | self.SetColLabelValue(3, _("Date Limit")) |
213 | | attr = gridlib.GridCellAttr() |
214 | | attr.SetAlignment(wx.ALIGN_RIGHT, wx.ALIGN_RIGHT) |
215 | | attr.SetReadOnly(True) |
216 | | self.SetColAttr(0, attr) |
217 | | self.SetColAttr(1, attr) |
218 | | self.SetColAttr(2, attr) |
219 | | attr = gridlib.GridCellAttr() |
220 | | attr.SetAlignment(wx.ALIGN_CENTRE, wx.ALIGN_CENTRE) |
221 | | attr.SetReadOnly(True) |
222 | | self.SetColAttr(3, attr) |
223 | | i = 0 |
224 | | for printername in user.Quotas.keys() : |
225 | | quota = user.Quotas[printername] |
226 | | self.SetRowLabelValue(i, printername) |
227 | | self.SetCellValue(i, 0, str(quota.PageCounter)) |
228 | | self.SetCellValue(i, 1, str(quota.SoftLimit)) |
229 | | self.SetCellValue(i, 2, str(quota.HardLimit)) |
230 | | self.SetCellValue(i, 3, str(quota.DateLimit)) |
| 212 | if user.LimitBy == "balance" : |
| 213 | self.SetColLabelValue(0, _("Page Counter")) |
| 214 | self.SetColLabelValue(1, _("Price per Page")) |
| 215 | self.SetColLabelValue(2, _("Price per Job")) |
240 | | self.SetRowAttr(i, attr) |
241 | | i += 1 |
| 223 | self.SetColAttr(0, attr) |
| 224 | attr = gridlib.GridCellAttr() |
| 225 | attr.SetAlignment(wx.ALIGN_RIGHT, wx.ALIGN_CENTRE) |
| 226 | attr.SetReadOnly(True) |
| 227 | self.SetColAttr(1, attr) |
| 228 | self.SetColAttr(2, attr) |
| 229 | i = 0 |
| 230 | for printername in user.Printers.keys() : |
| 231 | printer = user.Printers[printername] |
| 232 | quota = user.Quotas[printername] |
| 233 | self.SetRowLabelValue(i, printername) |
| 234 | self.SetCellValue(i, 0, str(quota.PageCounter)) |
| 235 | self.SetCellValue(i, 1, str(printer.PricePerPage)) |
| 236 | self.SetCellValue(i, 2, str(printer.PricePerJob)) |
| 237 | i += 1 |
| 238 | else : |
| 239 | self.SetColLabelValue(0, _("Page Counter")) |
| 240 | self.SetColLabelValue(1, _("Soft Limit")) |
| 241 | self.SetColLabelValue(2, _("Hard Limit")) |
| 242 | self.SetColLabelValue(3, _("Date Limit")) |
| 243 | attr = gridlib.GridCellAttr() |
| 244 | attr.SetAlignment(wx.ALIGN_RIGHT, wx.ALIGN_CENTRE) |
| 245 | attr.SetReadOnly(True) |
| 246 | self.SetColAttr(0, attr) |
| 247 | attr = gridlib.GridCellAttr() |
| 248 | attr.SetAlignment(wx.ALIGN_CENTRE, wx.ALIGN_CENTRE) |
| 249 | attr.SetReadOnly(True) |
| 250 | self.SetColAttr(1, attr) |
| 251 | self.SetColAttr(2, attr) |
| 252 | self.SetColAttr(3, attr) |
| 253 | i = 0 |
| 254 | for printername in user.Quotas.keys() : |
| 255 | quota = user.Quotas[printername] |
| 256 | self.SetRowLabelValue(i, printername) |
| 257 | self.SetCellValue(i, 0, str(quota.PageCounter)) |
| 258 | self.SetCellValue(i, 1, str(quota.SoftLimit)) |
| 259 | self.SetCellValue(i, 2, str(quota.HardLimit)) |
| 260 | self.SetCellValue(i, 3, str(quota.DateLimit)) |
| 261 | colour = wx.GREEN |
| 262 | if quota.SoftLimit is not None : |
| 263 | if quota.PageCounter >= quota.SoftLimit : |
| 264 | colour = wx.RED |
| 265 | elif quota.HardLimit is not None : |
| 266 | if quota.PageCounter >= quota.HardLimit : |
| 267 | colour = wx.RED |
| 268 | self.SetCellBackgroundColour(i, 0, colour) |
| 269 | i += 1 |