Création d'un compte pour un collaborateur extérieur au laboratoire depuis l'intranet ICube : https://intranet.icube.unistra.fr/fr/labs/member/profile

main.cpp 1.39 KB
Newer Older
Pierre Kraemer's avatar
Pierre Kraemer committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include <QSplashScreen>
#include "schnapps.h"
#include <QFileInfo>
#include "PythonQt/PythonQt.h"
#include "PythonQt/gui/PythonQtScriptingConsole.h"

int main(int argc, char* argv[])
{
	QApplication app(argc, argv);

	QSplashScreen* splash = new QSplashScreen(QPixmap(":splash/cgogn/splash.png"));
	splash->show();
	splash->showMessage("Welcome to SCHNApps", Qt::AlignBottom | Qt::AlignCenter);

	// init PythonQt and Python itself
	PythonQt::init();

	QStringList classNames;
	classNames.append("View");
	classNames.append("Camera");
	classNames.append("Plugin");
	classNames.append("MapHandlerGen");
	PythonQt::self()->registerQObjectClassNames(classNames);

	// get a smart pointer to the __main__ module of the Python interpreter
	PythonQtObjectPtr pythonContext = PythonQt::self()->getMainModule();

28
29
30
31
32
33
//	PythonQtScriptingConsole pythonConsole(NULL, pythonContext);
//	CGoGN::SCHNApps::SCHNApps schnapps(app.applicationDirPath(), pythonContext, pythonConsole);

	PythonQtScriptingConsole* pythonConsole = new PythonQtScriptingConsole(NULL, pythonContext);
	CGoGN::SCHNApps::SCHNApps schnapps(app.applicationDirPath(), pythonContext, *pythonConsole);

Pierre Kraemer's avatar
Pierre Kraemer committed
34
35
36
	schnapps.show();

	pythonContext.addObject("schnapps", &schnapps);
37
38
39
40
41
42
43
44

	if(argc > 1)
	{
		QString filename(argv[1]);
		QFileInfo fi(filename);
		if(fi.exists())
			pythonContext.evalFile(fi.filePath());
	}
Pierre Kraemer's avatar
Pierre Kraemer committed
45
46
47
48
49
50

	splash->finish(&schnapps);
	delete splash;

	return app.exec();
}