Salome HOME
*** empty log message ***
[modules/gui.git] / src / SUITApp / SUITApp.cxx
1 #if defined WNT
2 #undef SUIT_ENABLE_PYTHON
3 //#else
4 //#include "SUITconfig.h"
5 #endif
6
7 #include <qapplication.h>
8
9 #include "SUIT_Session.h"
10 #include "SUITApp_Application.h"
11
12 #ifdef SUIT_ENABLE_PYTHON
13 #include <Python.h>
14 #endif
15
16 #include <qstringlist.h>
17
18 int main( int args, char* argv[] )
19 {
20 #ifdef SUIT_ENABLE_PYTHON
21   Py_Initialize();
22   PySys_SetArgv( args, argv );
23 #endif
24   
25   QStringList argList;
26   bool noExceptHandling = false;
27   for ( int i = 1; i < args && !noExceptHandling; i++ )
28   {
29     if ( !strcmp( argv[i], "/noexcepthandling" ) )
30       noExceptHandling = true;
31     else
32       argList.append( QString( argv[i] ) );
33   }
34
35   SUITApp_Application app( args, argv );
36
37   int result = -1;
38   if ( !argList.isEmpty() )
39   {
40     SUIT_Session* aSession = new SUIT_Session();
41           if ( aSession->startApplication( argList.first() ) )
42     {
43       if ( !noExceptHandling )
44         app.setHandler( aSession->handler() );
45
46       result = app.exec();
47     }
48     delete aSession;
49   }
50
51   return result;
52 }