|
|
@ -185,23 +185,21 @@ class Bureau(object):
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
printcfg.read("printers.cfg")
|
|
|
|
printcfg.read("printers.cfg")
|
|
|
|
self.smprint = object()
|
|
|
|
self.smprint = object()
|
|
|
|
self.smprint["vendorid"] = printcfg["smallprinter"]["vendorid"]
|
|
|
|
self.smprint["vendorid"] = int(printcfg["smallprinter"]["vendorid"], 16)
|
|
|
|
self.smprint["prodid"] = printcfg["smallprinter"]["productid"]
|
|
|
|
self.smprint["prodid"] = int(printcfg["smallprinter"]["productid"], 16)
|
|
|
|
self.smprint["in_ep"] = printcfg["smallprinter"]["inep"]
|
|
|
|
self.smprint["in_ep"] = int(printcfg["smallprinter"]["inep"], 16)
|
|
|
|
self.smprint["out_ep"] = printcfg["smallprinter"]["outep"]
|
|
|
|
self.smprint["out_ep"] = int(printcfg["smallprinter"]["outep"], 16)
|
|
|
|
self.smprint["width"] = int(printcfg["smallprinter"]["width"])
|
|
|
|
self.smprint["width"] = int(printcfg["smallprinter"]["width"])
|
|
|
|
self.smprint["textwidth"] = int(printcfg["smallprinter"]["textwidth"])
|
|
|
|
self.smprint["textwidth"] = int(printcfg["smallprinter"]["textwidth"])
|
|
|
|
|
|
|
|
|
|
|
|
self.lp["name"] = printcfg["largeprinter"]["name"]
|
|
|
|
self.lp["name"] = printcfg["largeprinter"]["name"]
|
|
|
|
self.lp["papersize"] = printcfg["largeprinter"]["papersize"]
|
|
|
|
self.lp["papersize"] = printcfg["largeprinter"]["papersize"]
|
|
|
|
self.lp["duplex"] = printcfg["largeprinter"]["duplex"]
|
|
|
|
self.lp["duplex"] = printcfg["largeprinter"].getboolean("duplex")
|
|
|
|
except KeyError:
|
|
|
|
except KeyError:
|
|
|
|
# TODO: eventually refactor this since it could overwrite a half-broken config
|
|
|
|
# TODO: eventually refactor this since it could overwrite a half-broken config
|
|
|
|
sp_dict = {"vendorid": None, "productid": None,
|
|
|
|
sp_dict = {"vendorid": "", "productid": "", "inep": "",
|
|
|
|
"inep": None, "outep": None, "width": "384",
|
|
|
|
"outep": "", "width": "384", "textwidth": "32"}
|
|
|
|
"textwidth": "32"}
|
|
|
|
lp_dict = {"name": "", "papersize": "A4", "duplex": "False"}
|
|
|
|
lp_dict = {"name": None, "papersize": "A4",
|
|
|
|
|
|
|
|
"duplex": False}
|
|
|
|
|
|
|
|
printcfg["smallprinter"] = sp_dict
|
|
|
|
printcfg["smallprinter"] = sp_dict
|
|
|
|
printcfg["largeprinter"] = lp_dict
|
|
|
|
printcfg["largeprinter"] = lp_dict
|
|
|
|
with open("printers.cfg", "w") as print_conf_file:
|
|
|
|
with open("printers.cfg", "w") as print_conf_file:
|
|
|
|