Done added coke pricechecking master
authorAndrew Gozzard <gozzarda@ucc.gu.uwa.edu.au>
Thu, 28 Feb 2013 10:40:23 +0000 (18:40 +0800)
committerAndrew Gozzard <gozzarda@ucc.gu.uwa.edu.au>
Thu, 28 Feb 2013 10:40:23 +0000 (18:40 +0800)
sql-edition/servers/VendServer.py

index 8d62489..0126063 100755 (executable)
@@ -463,7 +463,9 @@ def make_selection(v, vstatus):
 
 def price_check(v, vstatus):
        if vstatus.cur_selection[1] == '8':
 
 def price_check(v, vstatus):
        if vstatus.cur_selection[1] == '8':
-               v.display(center('SEE COKE'))
+               args = ('dispense', 'iteminfo', 'coke:' + vstatus.cur_selection[0])
+               info, unused = Popen(args, close_fds=True, stdout=PIPE).communicate()
+               dollarprice = re.match("\s*[a-z]+:\d+\s+(\d+\.\d\d)\s+([^\n]+)", info).group(1)
        else:
                # first see if it's a named slot
                try:
        else:
                # first see if it's a named slot
                try:
@@ -471,7 +473,7 @@ def price_check(v, vstatus):
                except:
                        price, shortname, name = get_snack( '--' )
                dollarprice = "$%.2f" % ( price / 100.0 )
                except:
                        price, shortname, name = get_snack( '--' )
                dollarprice = "$%.2f" % ( price / 100.0 )
-               v.display(vstatus.cur_selection+' - %s'%dollarprice)
+       v.display(vstatus.cur_selection+' - %s'%dollarprice)
 
 
 def handle_getting_pin_key(state, event, params, v, vstatus):
 
 
 def handle_getting_pin_key(state, event, params, v, vstatus):

UCC git Repository :: git.ucc.asn.au