Skip to content

Commit

Permalink
Correcting CLI handling of main() for issue #1036
Browse files Browse the repository at this point in the history
The idiom for handling main() was incorrect to allow the CLI
to be invoked by the mycroft-cli-clent script.

==== Fixed Issues ====
  • Loading branch information
Steve Penrod committed Aug 31, 2017
1 parent 031e07b commit b99ddc6
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions mycroft/client/text/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ def draw_screen():
# Meter
if show_meter:
scr.addstr(curses.LINES - 10, curses.COLS - 14, " Mic Level ",
CLR_HEADING)
CLR_HEADING)

# History log in the middle
chat_width = curses.COLS / 2 - 2
Expand Down Expand Up @@ -653,7 +653,7 @@ def handle_cmd(cmd):
return 0 # do nothing upon return


def main(stdscr):
def gui_main(stdscr):
global scr
global ws
global line
Expand Down Expand Up @@ -829,13 +829,17 @@ def simple_cli():
# Monitor IPC file containing microphone level info
start_mic_monitor(os.path.join(get_ipc_directory(), "mic_level"))

if __name__ == "__main__":

def main():
if bSimple:
sys.stdout = sys.__stdout__
sys.stderr = sys.__stderr__
simple_cli()
else:
load_settings()
curses.wrapper(main)
curses.wrapper(gui_main)
curses.endwin()
save_settings()

if __name__ == "__main__":
main()

0 comments on commit b99ddc6

Please sign in to comment.