ui/Curses.py avoid multiple statements in one line

This commit is contained in:
Rodolfo García Peñas (kix) 2020-08-30 15:59:21 +02:00
parent 5ebbba2995
commit 6bf45233bb

View File

@ -270,7 +270,8 @@ class InputHandler(ExitNotifyThread):
while self.enabled.is_set(): while self.enabled.is_set():
with self.inputlock: with self.inputlock:
char = self.ui.stdscr.getch() char = self.ui.stdscr.getch()
if char != -1: yield char if char != -1:
yield char
def run(self): def run(self):
while True: while True:
@ -327,7 +328,9 @@ class CursesLogHandler(logging.StreamHandler):
self.ui.lock() self.ui.lock()
try: try:
y, x = self.ui.logwin.getyx() y, x = self.ui.logwin.getyx()
if y or x: self.ui.logwin.addch(10) # no \n before 1st item if y or x:
self.ui.logwin.addch(10) # no \n before 1st item
self.ui.logwin.addstr(log_str, color) self.ui.logwin.addstr(log_str, color)
self.ui.logwin.noutrefresh() self.ui.logwin.noutrefresh()
self.ui.stdscr.refresh() self.ui.stdscr.refresh()
@ -653,7 +656,9 @@ class Blinkenlights(UIBase, CursesUtil):
with self.aflock: with self.aflock:
# 1) Return existing or 2) create a new CursesAccountFrame. # 1) Return existing or 2) create a new CursesAccountFrame.
if acc_name in self.accframes: return self.accframes[acc_name] if acc_name in self.accframes:
return self.accframes[acc_name]
self.accframes[acc_name] = CursesAccountFrame(self, acc_name) self.accframes[acc_name] = CursesAccountFrame(self, acc_name)
# update the window layout # update the window layout
self.setupwindows(resize=True) self.setupwindows(resize=True)