fixed some escape codes and added some output screens

master
Florian Streibelt 13 years ago
parent ad5eff49be
commit 2a1ad9f122

@ -162,7 +162,10 @@ class Status:
if isinstance(command, BuyCommand): if isinstance(command, BuyCommand):
print_display('\x0b%-15s %4.2f' % (command.commodity_label()[:15],abs(command.difference()))); 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: if len(self.transfers) > 1:
show_total(self.balance - initial_balance, plus='+') show_total(self.balance - initial_balance, plus='+')
@ -293,9 +296,11 @@ class Status:
error_page(_PRODUCT_FIRST) error_page(_PRODUCT_FIRST)
return return
if prev.includes_deposit(): 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()) error_page('FEHLER: Pfand für Produkt "%s" bereits aktiviert' % prev.item_name())
return return
if prev.deposit_value() <= 0: 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()) error_page('FEHLER: Produkt "%s" hat kein Pfand' % prev.item_name())
return return
before = prev.difference() before = prev.difference()
@ -351,7 +356,7 @@ def handle(line, status):
item = status.find(line) item = status.find(line)
except urllib2.HTTPError as e: except urllib2.HTTPError as e:
if e.code == 404: # URL not found == item not found with REST 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) error_page('FEHLER: Aktion oder Ware "%s" nicht bekannt' % line)
else: else:
print_display('\x0cERROR: Server Error%20s' % str(e)[:20]) print_display('\x0cERROR: Server Error%20s' % str(e)[:20])
@ -363,13 +368,13 @@ def handle(line, status):
status.login(line) status.login(line)
except urllib2.HTTPError as e: except urllib2.HTTPError as e:
if e.code == 404: # URL not found == user unknown 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, error_page('FEHLER: Benutzer "%s" nicht bekannt' % line,
hint_message='Ist in der WebApp unter "Einstellungen" ' \ hint_message='Ist in der WebApp unter "Einstellungen" ' \
'für Ihren Account Plugin "BarcodePlugin" ' \ 'für Ihren Account Plugin "BarcodePlugin" ' \
'als erlaubt markiert?') 'als erlaubt markiert?')
else: 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)) error_page('FEHLER bei Kommunikation mit Server "%s"' % str(e))
except urllib2.URLError as e: except urllib2.URLError as e:
error_page('FEHLER bei Kommunikation mit Server "%s"' % str(e)) error_page('FEHLER bei Kommunikation mit Server "%s"' % str(e))
@ -389,6 +394,7 @@ def main():
if not l: if not l:
break break
line = l.rstrip() line = l.rstrip()
print_display('\x0cBarcode:\n%20s' % line[:20])
if line: if line:
handle(line, status) handle(line, status)

Loading…
Cancel
Save