Coupure prévue mardi 3 Août au matin pour maintenance du serveur. Nous faisons au mieux pour que celle-ci soit la plus brève possible.

main.cpp 1.19 KB
Newer Older
1
#include <QSplashScreen>
2
#include <QFileInfo>
3
4
#include "PythonQt/PythonQt.h"
#include "PythonQt/gui/PythonQtScriptingConsole.h"
5
#include "window.h"
Pierre Kraemer's avatar
Pierre Kraemer committed
6

7
8
int main(int argc, char* argv[])
{
Pierre Kraemer's avatar
Pierre Kraemer committed
9
10
	QApplication app(argc, argv);

Pierre Kraemer's avatar
Pierre Kraemer committed
11
12
13
	QSplashScreen* splash = new QSplashScreen(QPixmap(":splash/cgogn/splash.png"));
	splash->show();
	splash->showMessage("Welcome to SCHNApps", Qt::AlignBottom | Qt::AlignCenter);
Pierre Kraemer's avatar
Pierre Kraemer committed
14

Pierre Kraemer's avatar
Pierre Kraemer committed
15
16
17
	// init PythonQt and Python itself
	PythonQt::init();

18
19
20
	QStringList classNames;
	classNames.append("View");
	classNames.append("Camera");
21
22
	classNames.append("Plugin");
	classNames.append("MapHandlerGen");
23
24
	PythonQt::self()->registerQObjectClassNames(classNames);

Pierre Kraemer's avatar
Pierre Kraemer committed
25
26
	// get a smart pointer to the __main__ module of the Python interpreter
	PythonQtObjectPtr pythonContext = PythonQt::self()->getMainModule();
27
	PythonQtScriptingConsole pythonConsole(NULL, pythonContext);
Pierre Kraemer's avatar
Pierre Kraemer committed
28

29
30
	CGoGN::SCHNApps::Window schnapps(app.applicationDirPath(), pythonContext, pythonConsole);
	schnapps.show();
Pierre Kraemer's avatar
Pierre Kraemer committed
31

32
	pythonContext.addObject("schnapps", &schnapps);
33
34
35
	QFileInfo fi(app.applicationDirPath() + QString("/init.py"));
	if(fi.exists())
		pythonContext.evalFile(fi.filePath());
Pierre Kraemer's avatar
Pierre Kraemer committed
36

37
	splash->finish(&schnapps);
Pierre Kraemer's avatar
Pierre Kraemer committed
38
39
	delete splash;

Pierre Kraemer's avatar
Pierre Kraemer committed
40
41
	return app.exec();
}