Core: do not override sys.stdin when using FreeCAD as Python module

This commit is contained in:
wmayer
2023-05-01 17:04:40 +02:00
committed by wwmayer
parent 7f1e979aad
commit d7174ae2b8
4 changed files with 25 additions and 6 deletions

View File

@@ -287,19 +287,23 @@ QWidget* setupMainWindow()
}
Base::PyGILStateLocker lock;
PyObject* input = PySys_GetObject("stdin");
// It's sufficient to create the config key
App::Application::Config()["DontOverrideStdIn"] = "";
Gui::MainWindow *mw = new Gui::MainWindow();
hasMainWindow = true;
QIcon icon = qApp->windowIcon();
if (icon.isNull())
if (icon.isNull()) {
qApp->setWindowIcon(Gui::BitmapFactory().pixmap(App::Application::Config()["AppIcon"].c_str()));
}
mw->setWindowIcon(qApp->windowIcon());
QString appName = qApp->applicationName();
if (!appName.isEmpty())
if (!appName.isEmpty()) {
mw->setWindowTitle(appName);
else
}
else {
mw->setWindowTitle(QString::fromLatin1(App::Application::Config()["ExeName"].c_str()));
}
if (!SoDB::isInitialized()) {
// init the Inventor subsystem
@@ -350,7 +354,6 @@ QWidget* setupMainWindow()
Gui::Application::Instance->activateWorkbench(start.c_str());
mw->loadWindowSettings();
PySys_SetObject("stdin", input);
}
else {
Gui::getMainWindow()->show();