mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Initial PoC of a CherryPy app integrate with the runtime.
Upon startup, the runtime will attempt to locate pgAdmin4.py in a number of different relative locations. Once found, it will execute it in a new thread. The main window is then created and the brower's initial page is set to the root of the CherryPy server. At present, that's http://127.0.0.1:8080.
This commit is contained in:
@@ -9,9 +9,12 @@
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "pgAdmin4.h"
|
||||
|
||||
// Must be before QT
|
||||
#include <Python.h>
|
||||
|
||||
// QT headers
|
||||
#include <QtGlobal>
|
||||
|
||||
#if QT_VERSION >= 0x050000
|
||||
@@ -20,16 +23,30 @@
|
||||
#include <QApplication>
|
||||
#endif
|
||||
|
||||
// App headers
|
||||
#include "BrowserWindow.h"
|
||||
#include "Server.h"
|
||||
|
||||
int main(int argc, char * argv[])
|
||||
{
|
||||
// Create the QT application
|
||||
QApplication app(argc, argv);
|
||||
|
||||
// Initialise Python
|
||||
Py_SetProgramName(argv[0]);
|
||||
Py_Initialize();
|
||||
// Fire up the webserver
|
||||
// TODO: Find an unused port number to use
|
||||
Server *server = new Server();
|
||||
|
||||
if (!server->Init())
|
||||
{
|
||||
qDebug() << server->getError();
|
||||
|
||||
QString error("An error occurred initialising the application server:\n\n" + server->getError());
|
||||
QMessageBox::critical(NULL, QString("Fatal Error"), error);
|
||||
|
||||
exit(1);
|
||||
}
|
||||
|
||||
server->start();
|
||||
|
||||
// Create & show the main window
|
||||
BrowserWindow browserWindow;
|
||||
@@ -37,9 +54,6 @@ int main(int argc, char * argv[])
|
||||
|
||||
// Go!
|
||||
return app.exec();
|
||||
|
||||
// Shutdown Python
|
||||
Py_Finalize();
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user