diff --git a/client-barcode/freitagskasse.py b/client-barcode/freitagskasse.py index b0554fe..701da0f 100644 --- a/client-barcode/freitagskasse.py +++ b/client-barcode/freitagskasse.py @@ -162,7 +162,10 @@ class Status: if isinstance(command, BuyCommand): print_display('\x0b%-15s %4.2f' % (command.commodity_label()[:15],abs(command.difference()))); - print_display('\x0b\nSUMME: %2i %10.2f' % (i-1,initial_balance - self.balance)); + print_display('\x0b\nSUMME: {%02i} %8.2f' % ((i-1),initial_balance - self.balance)); + else: + print_display('\x0b%-15s %4.2f' % (command.label()[:15],abs(command.difference()))); + print_display('\x0b\nSUMME: {%02i} %8.2f' % ((i-1),initial_balance - self.balance)); if len(self.transfers) > 1: show_total(self.balance - initial_balance, plus='+') @@ -293,9 +296,11 @@ class Status: error_page(_PRODUCT_FIRST) return if prev.includes_deposit(): + print_display('\x0cFEHLER: schon Pfand %20s' % prev.item_name()[:20]) error_page('FEHLER: Pfand für Produkt "%s" bereits aktiviert' % prev.item_name()) return if prev.deposit_value() <= 0: + print_display('\x0cFEHLER: Pfandfrei! %20s' % prev.item_name()[:20]) error_page('FEHLER: Produkt "%s" hat kein Pfand' % prev.item_name()) return before = prev.difference() @@ -351,7 +356,7 @@ def handle(line, status): item = status.find(line) except urllib2.HTTPError as e: if e.code == 404: # URL not found == item not found with REST - print_display('\x0cERROR:\nCode ist unbekannt!') + print_display('\x0cERROR: %13sCode ist unbekannt' % ( line[:13])) error_page('FEHLER: Aktion oder Ware "%s" nicht bekannt' % line) else: print_display('\x0cERROR: Server Error%20s' % str(e)[:20]) @@ -363,13 +368,13 @@ def handle(line, status): status.login(line) except urllib2.HTTPError as e: if e.code == 404: # URL not found == user unknown - print_display('\e\x0cFEHLER: Nutzer ist unbekannt: "%7s"' % line[:7]) + print_display('\x0cFEHLER: Nutzer ist unbekannt: "%7s"' % line[:7]) error_page('FEHLER: Benutzer "%s" nicht bekannt' % line, hint_message='Ist in der WebApp unter "Einstellungen" ' \ 'für Ihren Account Plugin "BarcodePlugin" ' \ 'als erlaubt markiert?') else: - print_display('\e\x0cFEHLER: Server Error%20s' % str(e)[:20]) + print_display('\x0cFEHLER: Server Error%20s' % str(e)[:20]) error_page('FEHLER bei Kommunikation mit Server "%s"' % str(e)) except urllib2.URLError as e: error_page('FEHLER bei Kommunikation mit Server "%s"' % str(e)) @@ -389,6 +394,7 @@ def main(): if not l: break line = l.rstrip() + print_display('\x0cBarcode:\n%20s' % line[:20]) if line: handle(line, status)