Merge branch 'master' of someserver.de:k4ever

This commit is contained in:
TKroenert 2011-10-22 22:58:36 +02:00
commit 1e26d28122
2 changed files with 23 additions and 11 deletions

View File

@ -29,7 +29,7 @@ class Display(threading.Thread):
def open_port(self):
try:
self.serialport = serial.Serial(self.portname,9600,timeout=2,rtscts=True, dsrdtr=True)
self.serialport = serial.Serial(self.portname,9600,timeout=2,rtscts=False, dsrdtr=False)
#print ("Initializing display on port:\n %s\n" % self.serialport )
self.mutex_get()
self.cmd_reset()
@ -172,10 +172,12 @@ class Display(threading.Thread):
def cmd_curmode(self,val=2):
self.cmd("\x1f%c" % chr(val))
def cmd_home(self):
self.cmd("\x0b")
def cmd_clear(self):
self.cmd("\x0c")
def cmd_time(self):
# activate timer display in lower right corner.
# actual time has to be set via display_set_timer.
@ -274,6 +276,7 @@ class Screensaver (threading.Thread):
self.display.mutex_get()
self.display.cmd_time_set()
self.display.scroll_line1 = self.display.getIdlemessage()
self.display.scroll_line2 = None
self.display.mutex_release()
return

View File

@ -178,7 +178,8 @@ class Status:
if self.logged_in():
print('Eingeloggt als: %s%s%s' % (COLOR_SOME, self.login_name, COLOR_RESET))
print()
myDisplay.write('\x0cHallo %-14s' % (self.login_name[:13]+"!") )
myDisplay.cmd_clear()
myDisplay.write('Hallo %-14s' % (self.login_name[:13]+"!") )
if self.transfers:
initial_command, initial_balance = self.transfers[0]
@ -210,11 +211,15 @@ class Status:
mylabel="Pfand "+command.commodity_label()[:9]
if (mycmd==3):
mylabel=("%-13s" % (command.commodity_label()[:13]))+"+P"
myDisplay.write('\x0b%-15s %4.2f' % (asciify(mylabel)[:15],abs(command.difference())));
myDisplay.write('\x0b\nSUMME: {%02i} %8.2f' % ((i-1),initial_balance - self.balance));
myDisplay.cmd_home()
myDisplay.write('%-15s %4.2f' % (asciify(mylabel)[:15],abs(command.difference())));
myDisplay.cmd_home()
myDisplay.write('\nSUMME: {%02i} %8.2f' % ((i-1),initial_balance - self.balance));
else:
myDisplay.write('\x0b%-15s %4.2f' % (command.label()[:15],abs(command.difference())));
myDisplay.write('\x0b\nSUMME: {%02i} %8.2f' % ((i-1),initial_balance - self.balance));
myDisplay.cmd_home()
myDisplay.write('%-15s %4.2f' % (command.label()[:15],abs(command.difference())));
myDisplay.cmd_home()
myDisplay.write('\nSUMME: {%02i} %8.2f' % ((i-1),initial_balance - self.balance));
if len(self.transfers) > 1:
show_total(self.balance - initial_balance, plus='+')
@ -223,7 +228,8 @@ class Status:
if self.balance < 0:
warn_balance()
myDisplay.write('\x0b\nKonto: %5.2f!' % (self.balance) )
myDisplay.cmd_home()
myDisplay.write('\nKonto: %5.2f!' % (self.balance) )
print()
print(COLOR_MUCH + 'Committen nicht vergessen.' + COLOR_RESET)
@ -364,11 +370,13 @@ class Status:
error_page(_PRODUCT_FIRST)
return
if prev.includes_deposit():
myDisplay.write('\x0cFEHLER: schon Pfand %20s' % prev.item_name()[:20])
myDisplay.cmd_clear()
myDisplay.write('FEHLER: schon Pfand %20s' % prev.item_name()[:20])
error_page('FEHLER: Pfand für Produkt "%s" bereits aktiviert' % prev.item_name())
return
if prev.deposit_value() <= 0:
myDisplay.write('\x0cFEHLER: Pfandfrei! %20s' % prev.item_name()[:20])
myDisplay.cmd_clear()
myDisplay.write('FEHLER: Pfandfrei! %20s' % prev.item_name()[:20])
error_page('FEHLER: Produkt "%s" hat kein Pfand' % prev.item_name())
return
before = prev.difference()
@ -492,7 +500,8 @@ def main():
print_prompt()
line = read_line(sys.stdin, timeout=3*60.0, timeout_func=status.logout)
if line:
myDisplay.write('\x0cRFID/Barcode:\n%20s' % line[:20])
myDisplay.cmd_clear()
myDisplay.write('RFID/Barcode:\n%20s' % line[:20])
handle(line, status)