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