Merge pull request #8 from jmdejong/colourfix

don't try to use colours if unsupported; fix #7
pull/11/head
Jake Funke 2018-05-23 12:20:40 -07:00 committed by GitHub
commit cd25d0a69d
1 changed files with 7 additions and 3 deletions

View File

@ -18,7 +18,8 @@ class CursedMenu(object):
self.screen = curses.initscr()
curses.noecho()
curses.raw()
curses.start_color()
if curses.has_colors():
curses.start_color()
try:
curses.curs_set(0)
except curses.error:
@ -35,8 +36,11 @@ class CursedMenu(object):
self.infotoggle = 0
self.maxy, self.maxx = self.screen.getmaxyx()
# Highlighted and Normal line definitions
self.define_colors()
self.highlighted = curses.color_pair(1)
if curses.has_colors():
self.define_colors()
self.highlighted = curses.color_pair(1)
else:
self.highlighted = curses.A_REVERSE
self.normal = curses.A_NORMAL
# Threaded screen update for live changes
screen_thread = threading.Thread(target=self.update_plant_live, args=())