X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=VendServer%2FVendServer.py;h=cf9c8bbdbb689476b1c8fe584a16049691175b2f;hb=HEAD;hp=016c6d40a9b3d02c1c617d9591fa972fc68bc024;hpb=416c876713175e18280d86a427b29d941611828e;p=uccvend-vendserver.git diff --git a/VendServer/VendServer.py b/VendServer/VendServer.py index 016c6d4..cf9c8bb 100755 --- a/VendServer/VendServer.py +++ b/VendServer/VendServer.py @@ -20,6 +20,7 @@ from SnackConfig import get_snack#, get_snacks import socket from posix import geteuid from OpenDispense import OpenDispense as Dispense +import TracebackPrinter CREDITS=""" This vending machine software brought to you by: @@ -140,8 +141,6 @@ 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), (self.center(balance), False, TEXT_SPEED),] @@ -398,7 +397,6 @@ class VendServer(): # Price check mode. (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 = '' @@ -966,6 +964,7 @@ def parse_args(): op.add_option('-v', '--verbose', dest='verbose', action='store_true', default=False, help='spit out lots of debug output') op.add_option('-q', '--quiet', dest='quiet', action='store_true', default=False, help='only report errors') op.add_option('--pid-file', dest='pid_file', metavar='FILE', default='', help='store daemon\'s pid in the given file') + op.add_option('--traceback-file', dest='traceback_file', default='', help='destination to print tracebacks when receiving SIGUSR1') options, args = op.parse_args() if len(args) != 0: @@ -994,7 +993,7 @@ def set_stuff_up(): if options.daemon: become_daemon() set_up_logging(options) if options.pid_file != '': create_pid_file(options.pid_file) - + if options.traceback_file != '': TracebackPrinter.traceback_init(options.traceback_file) return options, config_opts def clean_up_nicely(options, config_opts): @@ -1058,7 +1057,7 @@ def do_vend_server(options, config_opts): continue # run_forever(rfh, wfh, options, config_opts) - + try: vserver = VendServer() vserver.run_forever(rfh, wfh, options, config_opts)