main.cpp 1.12 KB
Newer Older
1

2
#include <QSplashScreen>
3
4
5

#include "window.h"

6
7
#include "PythonQt/PythonQt.h"
#include "PythonQt/gui/PythonQtScriptingConsole.h"
8

Pierre Kraemer's avatar
Pierre Kraemer committed
9

10
11
int main(int argc, char* argv[])
{
Pierre Kraemer's avatar
Pierre Kraemer committed
12
13
	QApplication app(argc, argv);

Pierre Kraemer's avatar
Pierre Kraemer committed
14
15
16
	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
17

Pierre Kraemer's avatar
Pierre Kraemer committed
18
19
20
	// init PythonQt and Python itself
	PythonQt::init();

21
22
23
24
25
26
27
	QStringList classNames;
	classNames.append("Plugin");
	classNames.append("View");
	classNames.append("MapHandlerGen");
	classNames.append("Camera");
	PythonQt::self()->registerQObjectClassNames(classNames);

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

32
33
	CGoGN::SCHNApps::Window schnapps(app.applicationDirPath(), pythonContext, pythonConsole);
	schnapps.show();
Pierre Kraemer's avatar
Pierre Kraemer committed
34

35
36
	pythonContext.addObject("schnapps", &schnapps);
	pythonContext.evalFile(app.applicationDirPath() + QString("/init.py"));
Pierre Kraemer's avatar
Pierre Kraemer committed
37

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

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