From bdd93135823ae1ef293d4be3eb50d0ca6bdeee9e Mon Sep 17 00:00:00 2001 From: David Shah Date: Thu, 7 Jun 2018 08:56:54 +0200 Subject: Allow loading and running Python files before GUI starts Signed-off-by: David Shah --- ice40/main.cc | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) (limited to 'ice40/main.cc') diff --git a/ice40/main.cc b/ice40/main.cc index 9295bde4..3d3312c4 100644 --- a/ice40/main.cc +++ b/ice40/main.cc @@ -45,7 +45,7 @@ void svg_dump_el(const GraphicElement &el) int main(int argc, char *argv[]) { namespace po = boost::program_options; - + int rc = 0; std::string str; po::options_description options("Allowed options"); @@ -122,15 +122,7 @@ int main(int argc, char *argv[]) chipArgs.type = ChipArgs::UP5K; Design design(chipArgs); - - if (vm.count("gui")) - { - QApplication a(argc, argv); - MainWindow w; - w.show(); - - return a.exec(); - } + init_python(argv[0]); if (vm.count("test")) { @@ -216,8 +208,17 @@ int main(int argc, char *argv[]) if (vm.count("file")) { std::string filename = vm["file"].as(); - execute_python_file(argv[0],filename.c_str()); - } - - return 0; + execute_python_file(filename.c_str()); + } + + if (vm.count("gui")) + { + QApplication a(argc, argv); + MainWindow w; + w.show(); + + rc = a.exec(); + } + deinit_python(); + return rc; } -- cgit v1.2.3