git.ucc.asn.au
/
uccvend-vendserver.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
chmod pin automatically. remove boot up message now it doesnt take so long to boot.
[uccvend-vendserver.git]
/
sql-edition
/
servers
/
VendServer.py
diff --git
a/sql-edition/servers/VendServer.py
b/sql-edition/servers/VendServer.py
index
19d3a30
..
22958bd
100755
(executable)
--- a/
sql-edition/servers/VendServer.py
+++ b/
sql-edition/servers/VendServer.py
@@
-54,6
+54,7
@@
STATE_GET_SELECTION = 6
STATE_GRANDFATHER_CLOCK = 7
TEXT_SPEED = 0.8
STATE_GRANDFATHER_CLOCK = 7
TEXT_SPEED = 0.8
+IDLE_SPEED = 0.02
class DispenseDatabaseException(Exception): pass
class DispenseDatabaseException(Exception): pass
@@
-89,7
+90,7
@@
class DispenseDatabase:
def scroll_options(username, mk, welcome = False):
if welcome:
msg = [(center('WELCOME'), False, TEXT_SPEED),
def scroll_options(username, mk, welcome = False):
if welcome:
msg = [(center('WELCOME'), False, TEXT_SPEED),
- (center(username), False, TEXT_SPEE
d
)]
+ (center(username), False, TEXT_SPEE
D
)]
else:
msg = []
choices = ' '*10+'CHOICES: '
else:
msg = []
choices = ' '*10+'CHOICES: '
@@
-126,8
+127,8
@@
def get_pin(uid):
logging.info('getting pin for uid %d: .pin not found in home directory'%uid)
return None
if s.st_mode & 077:
logging.info('getting pin for uid %d: .pin not found in home directory'%uid)
return None
if s.st_mode & 077:
- logging.info('getting pin for uid %d: .pin has wrong permissions'%uid)
- return None
+ logging.info('getting pin for uid %d: .pin has wrong permissions
. Fixing.
'%uid)
+ os.chmod(pinfile, 0600)
try:
f = file(pinfile)
except IOError:
try:
f = file(pinfile)
except IOError:
@@
-235,6
+236,7
@@
def idle_step():
global idler
if idler.finished():
choose_idler()
global idler
if idler.finished():
choose_idler()
+ sleep(IDLE_SPEED)
idler.next()
class VendState:
idler.next()
class VendState:
@@
-708,11
+710,9
@@
def run_forever(rfh, wfh, options, cf):
if USE_DB: db = DispenseDatabase(v, cf.DBServer, cf.DBName, cf.DBUser, cf.DBPassword)
if USE_DB: db = DispenseDatabase(v, cf.DBServer, cf.DBName, cf.DBUser, cf.DBPassword)
- vstatus.mk.set_message(GREETING)
setup_idlers(v)
choose_idler()
setup_idlers(v)
choose_idler()
- vstatus.mk.set_message("Booted")
-
+ vstatus.mk.set_message(GREETING)
# This main loop was hideous and the work of the devil.
# This has now been fixed (mostly) - mtearle
# This main loop was hideous and the work of the devil.
# This has now been fixed (mostly) - mtearle
UCC
git Repository :: git.ucc.asn.au