From f9550712d8bae9c76eddde81e10e4f5f6d1782fa Mon Sep 17 00:00:00 2001 From: Florian Streibelt Date: Wed, 12 Oct 2011 20:45:28 +0200 Subject: [PATCH] not all screens yet on the display. scroll text would be nice... --- client-barcode/freitagskasse.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/client-barcode/freitagskasse.py b/client-barcode/freitagskasse.py index 7d61d4b..b0554fe 100644 --- a/client-barcode/freitagskasse.py +++ b/client-barcode/freitagskasse.py @@ -92,7 +92,6 @@ def delay(what, seconds): def warn_balance(): print('Kontostand im Minus, bitte Geld aufladen.') - print_display('\e\x0cKontostand im Minus,bitte Geld aufladen.') def error_page(error_message, hint_message=None): @@ -141,7 +140,7 @@ class Status: if self.logged_in(): print('Eingeloggt als: %s%s%s' % (COLOR_SOME, self.login_name, COLOR_RESET)) print() - print_display('\e\x0cBenutzer: %10s' %self.login_name[:10]) + print_display('\x0cHallo %-14s' % (self.login_name[:13]+"!") ) if self.transfers: initial_command, initial_balance = self.transfers[0] @@ -160,6 +159,11 @@ class Status: show_item(i, command.difference(), command.label(), COLOR_DEPOSIT) i += 1 show_bar() + + 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)); + if len(self.transfers) > 1: show_total(self.balance - initial_balance, plus='+') show_bar() @@ -167,6 +171,7 @@ class Status: if self.balance < 0: warn_balance() + print_display('\x0b\nKonto: %5.2f!' % (self.balance) ) print() print(COLOR_SOME + 'Committen nicht vergessen.' + COLOR_RESET) @@ -346,10 +351,10 @@ 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('\e\x0cFEHLER:\nAktion/ware unbekannt') + print_display('\x0cERROR:\nCode ist unbekannt!') error_page('FEHLER: Aktion oder Ware "%s" nicht bekannt' % line) else: - print_display('\e\x0cFEHLER: Server Error%20s' % str(e)[:20]) + print_display('\x0cERROR: Server Error%20s' % str(e)[:20]) error_page('FEHLER bei Kommunikation mit Server "%s"' % str(e)) else: status.buy(item)