gnah.. i don't know yet if I hate or like that language

This commit is contained in:
Florian Streibelt 2011-10-19 00:22:14 +02:00
parent dd49d650fb
commit 4af7594490
2 changed files with 7 additions and 8 deletions

View File

@ -21,7 +21,6 @@ class Display(threading.Thread):
def __del__(self): def __del__(self):
if (not self.screensaver == None): if (not self.screensaver == None):
self.screensaver.terminate()
self.screensaver = None self.screensaver = None
if (not self.serialport == None): if (not self.serialport == None):
@ -79,17 +78,15 @@ class Display(threading.Thread):
#print "Starting Display thread" #print "Starting Display thread"
self.screensaver.start() self.screensaver.start()
while(self.runme): while(self.runme):
#print("display thread loop\n") print("display thread loop\n")
self.mutex_get() self.mutex_get()
#print("display got mutex and handles scroll\n") #print("display got mutex and handles scroll\n")
self.offset_line1 = self.display_handle_scroll(1,self.scroll_line1,self.offset_line1) self.offset_line1 = self.display_handle_scroll(1,self.scroll_line1,self.offset_line1)
self.offset_line2 = self.display_handle_scroll(2,self.scroll_line2,self.offset_line2) self.offset_line2 = self.display_handle_scroll(2,self.scroll_line2,self.offset_line2)
self.mutex_release() self.mutex_release()
time.sleep(.5) time.sleep(.5)
#print "Exiting Display thread" print "Exiting Display thread"
def terminate(self):
self.runme = False
@ -223,6 +220,7 @@ class Display(threading.Thread):
self.portlock.release() self.portlock.release()
def terminate(self): def terminate(self):
self.runme=False
if (not self.screensaver == None): if (not self.screensaver == None):
self.screensaver.terminate() self.screensaver.terminate()
self.screensaver = None self.screensaver = None

View File

@ -239,7 +239,7 @@ class Status:
try: try:
command.run(self.login_name) command.run(self.login_name)
except urllib2.HTTPError as e: except urllib2.HTTPError as e:
myDisplay.write('\x0cFEHLER: Server Error%20s' % str(e)[:20]) myDisplay.display_screen("Server error",'Server Error: %s' % str(e))
error_page('FEHLER bei Kommunikation mit Server "%s"' % str(e)) error_page('FEHLER bei Kommunikation mit Server "%s"' % str(e))
break break
else: else:
@ -371,6 +371,7 @@ def handle(line, status):
if line == 'exit': if line == 'exit':
clear() clear()
myDisplay.write("\x0c") myDisplay.write("\x0c")
myDisplay.terminate()
sys.exit(0) sys.exit(0)
if status.logged_in(): if status.logged_in():
@ -448,7 +449,7 @@ if __name__ == '__main__':
try: try:
main() main()
except KeyboardInterrupt: except KeyboardInterrupt:
pass
myDisplay.write("\x1b\x40Goodbye!")
myDisplay.terminate() myDisplay.terminate()
myDisplay.write("\x1b\x40Goodbye!")
pass