Catched keyboardInterrupt exception in mainLoop
This commit is contained in:
parent
249f6e03c2
commit
22ab73be26
@ -63,20 +63,23 @@ class Window(object):
|
|||||||
self.screen.refresh()
|
self.screen.refresh()
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
while 1:
|
try:
|
||||||
time.sleep(0.01)
|
while 1:
|
||||||
if self.status_counter != None:
|
time.sleep(0.01)
|
||||||
if self.status_counter >= 10:
|
if self.status_counter != None:
|
||||||
self.status_counter = None
|
if self.status_counter >= 10:
|
||||||
self.setStatus(" "*self.maxx)
|
self.status_counter = None
|
||||||
else:
|
self.setStatus(" "*self.maxx)
|
||||||
self.status_counter += 1
|
else:
|
||||||
c=self.screen.getch()
|
self.status_counter += 1
|
||||||
if c!=-1:
|
c=self.screen.getch()
|
||||||
for handler in self.handlers[:]:
|
if c!=-1:
|
||||||
if handler.handleKey(c):
|
for handler in self.handlers[:]:
|
||||||
self.check_changes(handler)
|
if handler.handleKey(c):
|
||||||
break
|
self.check_changes(handler)
|
||||||
|
break
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
pass
|
||||||
|
|
||||||
def check_changes(self, handler):
|
def check_changes(self, handler):
|
||||||
if hasattr(handler, "selected_action") and handler.done == 1:
|
if hasattr(handler, "selected_action") and handler.done == 1:
|
||||||
|
Loading…
Reference in New Issue
Block a user