add prototype wrapping of the qt sequence browser
[mussa.git] / qui / mussagl.cpp
index 55afefd02bf37ca5a4fc74470def09ca02306027..d0df4c6c05dfc5e56c0e9ed73e6f8ade53c71176 100644 (file)
@@ -3,6 +3,8 @@ using namespace boost::filesystem;
 
 #ifdef USE_PYTHON
 #include "py/python.hpp"
+extern "C" void initmussa();
+//extern "C" void initmussaqui();
 #endif
 
 #include "qui/MussaWindow.hpp"
@@ -49,32 +51,41 @@ int main(int argc, char **argv)
 #endif
   //opts.doc_dir = get_doc_dir();
   QApplication app(argc, argv, opts.useGUI);
-  Q_INIT_RESOURCE(icons);
-  const QIcon mussa_icon(":/icons/mussa.png");
-  app.setWindowIcon(mussa_icon);
 
   initialize_mussa(opts, argc, argv);
   if (opts.analysis == 0) {
     return 1;
   }
-
-  ThreadManager &thread = ThreadManagerFactory();
+  
   try {
 #ifdef USE_PYTHON
     if (opts.runAsPythonInterpeter) {
+      ThreadManager &thread = ThreadManagerFactory();
       // allow the user to keep the interpreter open even after
       // closing all the windows
       app.setQuitOnLastWindowClosed(false);
-      const InterpreterThread *interp = thread.create_interpreter();
+      InterpreterThread *interp = thread.create_interpreter();
+      if (!interp) {
+        std::cerr << "Unable to initialize interpeter thread" << std::endl;
+        return 1;
+      }
+      MussaPython *py = interp->get_py_ptr();
+      if (!py) {
+        std::cerr << "Unable to initialize python interpreter" << std::endl;
+        return 1;
+      }
+      py->add_module("mussa", &initmussa);
+      //py->add_module("mussaqui", &initmussaqui);
       // quit when the interpreter exits
       QObject::connect(interp, SIGNAL(finished()),
                        &app, SLOT(quit()));
+      interp->start();
       app.exec();
     } else 
 #endif /* USE_PYTHON */
     if (opts.useGUI) { 
-      MussaWindow win(opts.analysis);
-      win.show();
+      MussaWindow *win = new MussaWindow(opts.analysis);
+      win->show();
       app.exec();
     }
     return 0;