Skip to content

Commit

Permalink
Py3: fixes #4081: Abillity to show console output when running under …
Browse files Browse the repository at this point in the history
…Python
  • Loading branch information
wwmayer committed Apr 1, 2021
1 parent b64c4da commit 377b01b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/App/Application.cpp
Expand Up @@ -1980,9 +1980,13 @@ void Application::initConfig(int argc, char ** argv)

// Init console ===========================================================
Base::PyGILStateLocker lock;
if (mConfig["LoggingConsole"] == "1") {
_pConsoleObserverStd = new ConsoleObserverStd();
Console().AttachObserver(_pConsoleObserverStd);
_pConsoleObserverStd = new ConsoleObserverStd();
Console().AttachObserver(_pConsoleObserverStd);
if (mConfig["LoggingConsole"] != "1") {
_pConsoleObserverStd->bMsg = false;
_pConsoleObserverStd->bLog = false;
_pConsoleObserverStd->bWrn = false;
_pConsoleObserverStd->bErr = false;
}
if (mConfig["Verbose"] == "Strict")
Console().UnsetConsoleMode(ConsoleSingleton::Verbose);
Expand Down
8 changes: 8 additions & 0 deletions src/Main/FreeCADGuiPy.cpp
Expand Up @@ -152,6 +152,14 @@ FreeCADGui_showMainWindow(PyObject * /*self*/, PyObject *args)
}
}

// if successful then enable Console logger
Base::ILogger *console = Base::Console().Get("Console");
if (console) {
console->bMsg = true;
console->bWrn = true;
console->bErr = true;
}

Py_INCREF(Py_None);
return Py_None;
}
Expand Down

0 comments on commit 377b01b

Please sign in to comment.