Fix display init
parent
02476fcaf7
commit
c0e943a6df
|
@ -6,6 +6,7 @@ class CursedMenu(object):
|
||||||
'''A class which abstracts the horrors of building a curses-based menu system'''
|
'''A class which abstracts the horrors of building a curses-based menu system'''
|
||||||
def __init__(self, this_plant):
|
def __init__(self, this_plant):
|
||||||
'''Initialization'''
|
'''Initialization'''
|
||||||
|
self.initialized = False
|
||||||
self.screen = curses.initscr()
|
self.screen = curses.initscr()
|
||||||
curses.noecho()
|
curses.noecho()
|
||||||
curses.cbreak()
|
curses.cbreak()
|
||||||
|
@ -34,9 +35,9 @@ class CursedMenu(object):
|
||||||
self.title = title
|
self.title = title
|
||||||
self.subtitle = subtitle
|
self.subtitle = subtitle
|
||||||
self.selected = 0
|
self.selected = 0
|
||||||
|
self.initialized = True
|
||||||
self.draw_menu()
|
self.draw_menu()
|
||||||
|
|
||||||
|
|
||||||
def set_options(self, options):
|
def set_options(self, options):
|
||||||
'''Validates that the last option is "Exit"'''
|
'''Validates that the last option is "Exit"'''
|
||||||
if options[-1] is not 'Exit':
|
if options[-1] is not 'Exit':
|
||||||
|
@ -90,11 +91,12 @@ class CursedMenu(object):
|
||||||
def update_plant_live(self):
|
def update_plant_live(self):
|
||||||
# Updates plant data on menu screen, live!
|
# Updates plant data on menu screen, live!
|
||||||
# Will eventually use this to display ascii art...
|
# Will eventually use this to display ascii art...
|
||||||
while self.exit is not True:
|
if self.initialized:
|
||||||
self.plant_string = self.plant.parse_plant()
|
while self.exit is not True:
|
||||||
self.plant_ticks = str(self.plant.ticks)
|
self.plant_string = self.plant.parse_plant()
|
||||||
self.draw()
|
self.plant_ticks = str(self.plant.ticks)
|
||||||
time.sleep(1)
|
self.draw()
|
||||||
|
time.sleep(1)
|
||||||
|
|
||||||
def get_user_input(self):
|
def get_user_input(self):
|
||||||
'''Gets the user's input and acts appropriately'''
|
'''Gets the user's input and acts appropriately'''
|
||||||
|
|
Loading…
Reference in New Issue