From 2a07cd688d615b7996be7420b2e9e38696c210cd Mon Sep 17 00:00:00 2001 From: John Hodge Date: Sun, 19 Feb 2017 19:38:27 +0800 Subject: [PATCH] VendServer - Work around display bug --- VendServer/VendServer.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/VendServer/VendServer.py b/VendServer/VendServer.py index 6dfbfe1..3ac2b81 100755 --- a/VendServer/VendServer.py +++ b/VendServer/VendServer.py @@ -140,6 +140,7 @@ class VendServer(): # If the user has just logged in, show them their balance if welcome: balance = self.dispense.getBalance() + balance = balance[:-4] + '.' + balance[-4] + balance[-2:] # Work around display bug msg = [(self.center('WELCOME'), False, TEXT_SPEED), (self.center(self.dispense.getUsername()), False, TEXT_SPEED), @@ -391,7 +392,11 @@ class VendServer(): self.vstatus.last_timeout_refresh = None else: # Price check mode. - self.dispense.getItemInfo(self.vstatus.cur_selection) + (name,price) = self.dispense.getItemInfo(self.vstatus.cur_selection) + dollarprice = "$%.2f" % ( price / 100.0 ) + dollarprice = dollarprice[:-4] + '.' + dollarprice[-4] + dollarprice[-2:] # Work around display bug + self.v.display( self.vstatus.cur_selection+' - %s'%dollarprice) + self.vstatus.cur_selection = '' self.vstatus.time_to_autologout = None self.vstatus.last_timeout_refresh = None -- 2.20.1