Add print menu
This commit is contained in:
parent
1917944966
commit
6d205fcf18
|
@ -1,3 +1,5 @@
|
||||||
|
import os
|
||||||
|
|
||||||
import barcode
|
import barcode
|
||||||
from brother_ql import BrotherQLRaster
|
from brother_ql import BrotherQLRaster
|
||||||
from brother_ql import create_label
|
from brother_ql import create_label
|
||||||
|
@ -12,8 +14,9 @@ def print_bar_code(barcode_value, barcode_text, barcode_type="ean13", rotate=Fal
|
||||||
wr = BrotherLabelWriter(typ=label_type, rot=rotate, text=barcode_text, max_height=1000)
|
wr = BrotherLabelWriter(typ=label_type, rot=rotate, text=barcode_text, max_height=1000)
|
||||||
|
|
||||||
test = bar_coder(barcode_value, writer=wr)
|
test = bar_coder(barcode_value, writer=wr)
|
||||||
fn = test.save(barcode_value)
|
base_path = os.path.dirname(os.path.realpath(__file__))
|
||||||
#print_image(fn, printer_type, label_type)
|
fn = test.save(os.path.join(base_path, "bar_codes", barcode_value))
|
||||||
|
print_image(fn, printer_type, label_type)
|
||||||
|
|
||||||
|
|
||||||
def print_image(fn, printer_type="QL-700", label_type="62"):
|
def print_image(fn, printer_type="QL-700", label_type="62"):
|
||||||
|
|
|
@ -14,6 +14,7 @@ from text_interface.helpermenus import Menu
|
||||||
from text_interface.mainmenu import MainMenu
|
from text_interface.mainmenu import MainMenu
|
||||||
from text_interface.miscmenus import ProductSearchMenu, TransferMenu, AdjustCreditMenu, UserListMenu, ShowUserMenu, \
|
from text_interface.miscmenus import ProductSearchMenu, TransferMenu, AdjustCreditMenu, UserListMenu, ShowUserMenu, \
|
||||||
ProductListMenu
|
ProductListMenu
|
||||||
|
from text_interface.printermenu import PrintLabelMenu
|
||||||
from text_interface.stats import *
|
from text_interface.stats import *
|
||||||
|
|
||||||
random.seed()
|
random.seed()
|
||||||
|
@ -47,7 +48,8 @@ if __name__ == '__main__':
|
||||||
ProductRevenueMenu(),
|
ProductRevenueMenu(),
|
||||||
BalanceMenu(),
|
BalanceMenu(),
|
||||||
LoggedStatisticsMenu()]),
|
LoggedStatisticsMenu()]),
|
||||||
FAQMenu()
|
FAQMenu(),
|
||||||
|
PrintLabelMenu()
|
||||||
],
|
],
|
||||||
exit_msg='happy happy joy joy',
|
exit_msg='happy happy joy joy',
|
||||||
exit_confirm_msg='Really quit Dibbler?')
|
exit_confirm_msg='Really quit Dibbler?')
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
from printer_helpers import print_bar_code
|
||||||
|
from text_interface.helpermenus import Menu
|
||||||
|
import conf
|
||||||
|
|
||||||
|
|
||||||
|
class PrintLabelMenu(Menu):
|
||||||
|
def __init__(self):
|
||||||
|
Menu.__init__(self, 'Edit user', uses_db=True)
|
||||||
|
self.help_text = '''
|
||||||
|
Prints out a product bar code on the printer
|
||||||
|
|
||||||
|
Put it up somewhere in the vicinity.
|
||||||
|
'''
|
||||||
|
|
||||||
|
def _execute(self):
|
||||||
|
self.print_header()
|
||||||
|
product = self.input_product('Prodct> ')
|
||||||
|
|
||||||
|
print_bar_code(product.bar_code, product.name, barcode_type="ean13", rotate=False, printer_type="QL-700",
|
||||||
|
label_type=conf.label_type)
|
Loading…
Reference in New Issue