Gui: Attach PythonConsole to parameter group and handle changes in its OnChange() method

This avoids code duplications and makes sure the group name is used only once.
The parameters are saved to the group 'PythonConsole' instead of 'General'.
This commit is contained in:
wmayer
2022-02-21 19:26:44 +01:00
parent 973eb27d7e
commit cf49fc7c6d
4 changed files with 28 additions and 68 deletions

View File

@@ -425,15 +425,6 @@ MainWindow::MainWindow(QWidget * parent, Qt::WindowFlags f)
// Python console
if (hiddenDockWindows.find("Std_PythonView") == std::string::npos) {
PythonConsole* pcPython = new PythonConsole(this);
ParameterGrp::handle hGrp = App::GetApplication().GetUserParameter().
GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("General");
if (hGrp->GetBool("PythonWordWrap", true)) {
pcPython->setWordWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere);
} else {
pcPython->setWordWrapMode(QTextOption::NoWrap);
}
pcPython->setWindowIcon(Gui::BitmapFactory().iconFromTheme("applications-python"));
pcPython->setObjectName
(QString::fromLatin1(QT_TRANSLATE_NOOP("QDockWidget","Python console")));