From b99ddc64f2649a7dcfcf2be6aa2a6faa22f7d8db Mon Sep 17 00:00:00 2001 From: Steve Penrod Date: Wed, 30 Aug 2017 20:05:55 -0700 Subject: [PATCH] Correcting CLI handling of main() for issue #1036 The idiom for handling main() was incorrect to allow the CLI to be invoked by the mycroft-cli-clent script. ==== Fixed Issues ==== --- mycroft/client/text/main.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/mycroft/client/text/main.py b/mycroft/client/text/main.py index d41b35fc6cc4..e3fdad8332b9 100644 --- a/mycroft/client/text/main.py +++ b/mycroft/client/text/main.py @@ -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 @@ -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 @@ -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()