Compare commits
1 Commits
v0.6
...
dimyme/pat
Author | SHA1 | Date | |
---|---|---|---|
|
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
|
||||
|
@ -9,7 +11,7 @@ src/bitmessagecurses/__init__.py
|
|||
# This has only been tested on Arch Linux and Linux Mint
|
||||
# Dependencies:
|
||||
# * from python2-pip
|
||||
# * python2-pythondialog
|
||||
# * python2-pythondialog
|
||||
# * dialog
|
||||
|
||||
import ConfigParser
|
||||
|
@ -144,9 +146,9 @@ def resetlookups():
|
|||
Timer(1, resetlookups, ()).start()
|
||||
|
||||
|
||||
def drawtab(stdscr): # pylint: disable=too-many-branches, too-many-statements
|
||||
"""Method for drawing different tabs"""
|
||||
if menutab in range(1, len(menu) + 1):
|
||||
def drawtab(stdscr): # pylint: disable=too-many-branches, too-many-statements
|
||||
'''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,19 +255,21 @@ 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 = []
|
||||
for host, stream in connected_hosts:
|
||||
if stream >= len(streamcount):
|
||||
streamcount.append(1)
|
||||
else:
|
||||
streamcount[stream] += 1
|
||||
for i, item in enumerate(streamcount):
|
||||
if i < 4:
|
||||
if i == 0:
|
||||
stdscr.addstr(8 + i, 6, "?")
|
||||
try:
|
||||
for host, stream in connected_hosts:
|
||||
if stream >= len(streamcount):
|
||||
streamcount.append(1)
|
||||
else:
|
||||
stdscr.addstr(8 + i, 6, str(i))
|
||||
stdscr.addstr(8 + i, 18, str(item).ljust(2))
|
||||
|
||||
streamcount[stream] += 1
|
||||
for i, item in enumerate(streamcount):
|
||||
if i < 4:
|
||||
if i == 0:
|
||||
stdscr.addstr(8 + i, 6, "?")
|
||||
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,8 +1206,12 @@ def runwrapper():
|
|||
curses.curs_set(0)
|
||||
stdscr.timeout(1000)
|
||||
|
||||
curses.wrapper(run)
|
||||
doShutdown()
|
||||
try:
|
||||
curses.wrapper(run)
|
||||
except BaseException:
|
||||
pass
|
||||
finally:
|
||||
doShutdown()
|
||||
|
||||
|
||||
def run(stdscr):
|
||||
|
@ -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