clean exit of curses console
This commit is contained in:
parent
2a165380bb
commit
d9359f2d44
|
@ -1,7 +1,9 @@
|
|||
"""
|
||||
# -*- coding: UTF-8 -*-
|
||||
# kate: syntax Python ;
|
||||
'''
|
||||
src/bitmessagecurses/__init__.py
|
||||
================================
|
||||
"""
|
||||
'''
|
||||
|
||||
# Copyright (c) 2014 Luke Montalvo <lukemontalvo@gmail.com>
|
||||
# This file adds a alternative commandline interface, feel free to critique and fork
|
||||
|
@ -145,8 +147,8 @@ def resetlookups():
|
|||
|
||||
|
||||
def drawtab(stdscr): # pylint: disable=too-many-branches, too-many-statements
|
||||
"""Method for drawing different tabs"""
|
||||
if menutab in range(1, len(menu) + 1):
|
||||
'''Method for drawing different tabs'''
|
||||
if menutab in range(1, len(menu) + 1): # pylint: disable=too-many-nested-blocks
|
||||
if menutab == 1: # Inbox
|
||||
stdscr.addstr(3, 5, "To", curses.A_BOLD)
|
||||
stdscr.addstr(3, 40, "From", curses.A_BOLD)
|
||||
|
@ -253,6 +255,7 @@ def drawtab(stdscr): # pylint: disable=too-many-branches, too-many-statem
|
|||
stdscr.addstr(6, 18, "Connections", curses.A_BOLD)
|
||||
stdscr.hline(7, 6, '-', 23)
|
||||
streamcount = []
|
||||
try:
|
||||
for host, stream in connected_hosts:
|
||||
if stream >= len(streamcount):
|
||||
streamcount.append(1)
|
||||
|
@ -265,7 +268,8 @@ def drawtab(stdscr): # pylint: disable=too-many-branches, too-many-statem
|
|||
else:
|
||||
stdscr.addstr(8 + i, 6, str(i))
|
||||
stdscr.addstr(8 + i, 18, str(item).ljust(2))
|
||||
|
||||
except:
|
||||
pass
|
||||
# Uptime and processing data
|
||||
stdscr.addstr(6, 35, "Since startup on " + l10n.formatTimestamp(startuptime, False))
|
||||
stdscr.addstr(7, 40, "Processed " + str(
|
||||
|
@ -1202,7 +1206,11 @@ def runwrapper():
|
|||
curses.curs_set(0)
|
||||
stdscr.timeout(1000)
|
||||
|
||||
try:
|
||||
curses.wrapper(run)
|
||||
except BaseException:
|
||||
pass
|
||||
finally:
|
||||
doShutdown()
|
||||
|
||||
|
||||
|
@ -1259,5 +1267,5 @@ def doShutdown():
|
|||
shutdown.doCleanShutdown()
|
||||
sys.stdout = sys.__stdout__
|
||||
sys.stderr = sys.__stderr__
|
||||
|
||||
curses.endwin()
|
||||
os._exit(0) # pylint: disable=protected-access
|
||||
|
|
Loading…
Reference in New Issue
Block a user