1 #include <boost/filesystem/operations.hpp>
3 #include <boost/python.hpp>
4 namespace py = boost::python;
7 using namespace boost::filesystem;
11 #include <QApplication>
13 #include "qui/MussaWindow.hpp"
14 #include "alg/parse_options.hpp"
15 #include "mussa_exceptions.hpp"
17 int main(int argc, char **argv)
21 // if we're under unix and don't have a display, see if we can still run
23 opts.useGUI = getenv("DISPLAY") != 0;
26 QApplication app(argc, argv, opts.useGUI);
27 Q_INIT_RESOURCE(icons);
29 initialize_mussa(opts, argc, argv);
31 if (opts.analysis == 0) {
37 if (opts.runAsPythonInterpeter) {
39 py::object main_module((py::handle<>(py::borrowed(PyImport_AddModule("__main__")))));
40 py::object main_namespace = main_module.attr("__dict__");
42 py::handle<> ignored((PyRun_String(
43 //"from IPython.Shell import IPShellEmbed\n"
44 //"shell = IPShellEmbed(['mussa'], '')\n",
48 " print 'the square is %d' % (r)\n"
54 py::object square = main_module.attr("square");
55 int result = py::extract<int>(square(3));
56 std::cout << "C++ has " << result << std::endl;
57 PyRun_InteractiveLoop(stdin, "mussa");
59 #endif /* USE_PYTHON */
61 MussaWindow win(opts.analysis);
66 } catch (mussa_error e) {
68 } catch (boost::filesystem::filesystem_error e) {
72 catch (py::error_already_set e) {
75 #endif /* USE_PYTHON */
76 catch (std::runtime_error e) {
79 qFatal("unrecognized exception");