|
|
|
@ -35,7 +35,7 @@ def update_commands(cls):
|
|
|
|
|
return cls
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def add_command(comstr, name=""):
|
|
|
|
|
def add_command(comstr, name="", in_menu=True):
|
|
|
|
|
""" decorator for making a method into a command """
|
|
|
|
|
def decorator(func):
|
|
|
|
|
""" the decorator itself """
|
|
|
|
@ -45,6 +45,7 @@ def add_command(comstr, name=""):
|
|
|
|
|
return func(*args, **kwargs)
|
|
|
|
|
func_wrap.command = comstr
|
|
|
|
|
func_wrap.name = name
|
|
|
|
|
func_wrap.in_menu = in_menu
|
|
|
|
|
return func_wrap
|
|
|
|
|
return decorator
|
|
|
|
|
|
|
|
|
@ -373,7 +374,8 @@ class Bureau(object):
|
|
|
|
|
cmd_detail = {"cmdname": method.name,
|
|
|
|
|
"prefix": self.prefix,
|
|
|
|
|
"cmd": method.command,
|
|
|
|
|
"desc": method.__doc__}
|
|
|
|
|
"desc": method.__doc__,
|
|
|
|
|
"in_menu": method.in_menu}
|
|
|
|
|
if self.prefix == "IR":
|
|
|
|
|
method = getattr(self, "add_cmd")
|
|
|
|
|
method(cmd_detail)
|
|
|
|
@ -411,12 +413,15 @@ class Bureau(object):
|
|
|
|
|
returns an instance of the small escpos printer
|
|
|
|
|
"""
|
|
|
|
|
if (self.smprint["inep"] is None) and (self.smprint["outep"] is None):
|
|
|
|
|
prn = printer.Usb(self.smprint["vendorid"], self.smprint["productid"])
|
|
|
|
|
prn = printer.Usb(self.smprint["vendorid"],
|
|
|
|
|
self.smprint["productid"],
|
|
|
|
|
profile=self.smprint["profile"])
|
|
|
|
|
else:
|
|
|
|
|
prn = printer.Usb(self.smprint["vendorid"],
|
|
|
|
|
self.smprint["productid"],
|
|
|
|
|
in_ep=self.smprint["inep"],
|
|
|
|
|
out_ep=self.smprint["outep"])
|
|
|
|
|
out_ep=self.smprint["outep"],
|
|
|
|
|
profile=self.smprint["profile"])
|
|
|
|
|
return prn
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|