diff --git a/src/Gui/DlgGeneral.ui b/src/Gui/DlgGeneral.ui index f7b6bda16..25dbc60bf 100644 --- a/src/Gui/DlgGeneral.ui +++ b/src/Gui/DlgGeneral.ui @@ -1,111 +1,263 @@ - - - - + + Gui::Dialog::DlgGeneral - - + + 0 0 - 390 + 396 553 - + General - - + + 9 - + 6 - - - + + + General - - - 9 - - - 6 - - - - - Qt::Vertical + + + + + Language - - - 352 - 221 - - - - - - - - Start up - - - + + 11 - + 6 - - - + + + + 6 + + + 0 + + + + + Change language: + + + + + + + + + + + + + + + Main window + + + + 6 + + + 11 + + + + + 6 + + + 0 + + + + + Size of recent file list + + + + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 20 + 20 + + + + + + + + 4 + + + RecentFiles + + + RecentFiles + + + + + + + + + 6 + + + 0 + + + + + Enable tiled background + + + + + + + + + 6 + + + 0 + + + + + Style sheet: + + + + + + + + + + + + 6 + + + 0 + + + + + Window style: + + + + + + + + + + + + 6 + + + 0 + + + + + Size of toolbar icons: + + + + + + + + + + + + + + + Start up + + + + 11 + + + 6 + + + + Enable splash screen at start up - + true - + ShowSplasher - + General - - - + + + 0 - + 6 - - - + + + Switch to tab of report window: - - + + - - - + + + AutoloadTab - + General - - - + + + Auto load module after start up: @@ -115,206 +267,71 @@ - - - - Language + + + + Python console - - + + 11 - + 6 - - - - 0 + + + + Enable word wrap - - 6 + + true - - - - Change language: - - - - - - - + + PythonWordWrap + + + General + + - - - - Main window + + + + Qt::Vertical - - - 11 - - - 6 - - - - - 0 - - - 6 - - - - - Size of recent file list - - - - - - - Qt::Horizontal - - - QSizePolicy::Expanding - - - - 20 - 20 - - - - - - - - 4 - - - RecentFiles - - - RecentFiles - - - - - - - - - 0 - - - 6 - - - - - Enable tiled background - - - - - - - - - 0 - - - 6 - - - - - Style sheet: - - - - - - - - - - - - 0 - - - 6 - - - - - Window style: - - - - - - - - - - - - 0 - - - 6 - - - - - Size of toolbar icons: - - - - - - - - - - + + + 352 + 221 + + + - + Gui::PrefCheckBox QCheckBox
Gui/PrefWidgets.h
- 0 -
Gui::PrefSpinBox QSpinBox
Gui/PrefWidgets.h
- 0 -
Gui::PrefComboBox QComboBox
Gui/PrefWidgets.h
- 0 -
@@ -322,6 +339,7 @@ WindowStyle RecentFiles SplashScreen + PythonWordWrap diff --git a/src/Gui/DlgGeneralImp.cpp b/src/Gui/DlgGeneralImp.cpp index 2c5efba8e..6fcdc2643 100644 --- a/src/Gui/DlgGeneralImp.cpp +++ b/src/Gui/DlgGeneralImp.cpp @@ -35,6 +35,7 @@ #include "DockWindowManager.h" #include "MainWindow.h" #include "PrefWidgets.h" +#include "PythonConsole.h" #include "Language/Translator.h" using namespace Gui::Dialog; @@ -126,6 +127,17 @@ void DlgGeneralImp::saveSettings() AutoloadTabCombo->onSave(); RecentFiles->onSave(); SplashScreen->onSave(); + PythonWordWrap->onSave(); + + PythonConsole* pcPython = new PythonConsole(this); + bool pythonWordWrap = App::GetApplication().GetUserParameter(). + GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("General")->GetBool("PythonWordWrap", true); + + if (pythonWordWrap) { + pcPython->setWordWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere); + } else { + pcPython->setWordWrapMode(QTextOption::NoWrap); + } // set new user defined style //(void)QApplication::setStyle(WindowStyle->currentText()); @@ -199,6 +211,7 @@ void DlgGeneralImp::loadSettings() AutoloadTabCombo->onRestore(); RecentFiles->onRestore(); SplashScreen->onRestore(); + PythonWordWrap->onRestore(); // fill up styles // diff --git a/src/Gui/MainWindow.cpp b/src/Gui/MainWindow.cpp index 23074e926..7572f948c 100644 --- a/src/Gui/MainWindow.cpp +++ b/src/Gui/MainWindow.cpp @@ -371,7 +371,15 @@ MainWindow::MainWindow(QWidget * parent, Qt::WindowFlags f) // Python console PythonConsole* pcPython = new PythonConsole(this); - pcPython->setWordWrapMode(QTextOption::NoWrap); + 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"))); diff --git a/src/Gui/PythonConsole.cpp b/src/Gui/PythonConsole.cpp index b5137b85b..be720bd90 100644 --- a/src/Gui/PythonConsole.cpp +++ b/src/Gui/PythonConsole.cpp @@ -50,7 +50,6 @@ #include "FileDialog.h" #include "MainWindow.h" - #include #include #include @@ -443,6 +442,15 @@ void PythonConsole::OnChange( Base::Subject &rCaller,const char* sR Q_UNUSED(rCaller); ParameterGrp::handle hPrefGrp = getWindowParameter(); + bool pythonWordWrap = App::GetApplication().GetUserParameter(). + GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("General")->GetBool("PythonWordWrap", true); + + if (pythonWordWrap) { + this->setWordWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere); + } else { + this->setWordWrapMode(QTextOption::NoWrap); + } + if (strcmp(sReason, "FontSize") == 0 || strcmp(sReason, "Font") == 0) { int fontSize = hPrefGrp->GetInt("FontSize", 10); QString fontFamily = QString::fromLatin1(hPrefGrp->GetASCII("Font", "Courier").c_str()); @@ -1183,12 +1191,26 @@ void PythonConsole::contextMenuEvent ( QContextMenuEvent * e ) QAction* wrap = menu.addAction(tr("Word wrap")); wrap->setCheckable(true); - wrap->setChecked(this->wordWrapMode() != QTextOption::NoWrap); + + ParameterGrp::handle hGrp = App::GetApplication().GetUserParameter(). + GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("General"); + if (hGrp->GetBool("PythonWordWrap", true)) { + wrap->setChecked(true); + this->setWordWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere); + } else { + wrap->setChecked(false); + this->setWordWrapMode(QTextOption::NoWrap); + } QAction* exec = menu.exec(e->globalPos()); if (exec == wrap) { - this->setWordWrapMode(wrap->isChecked() - ? QTextOption::WrapAtWordBoundaryOrAnywhere : QTextOption::NoWrap); + if (wrap->isChecked()) { + this->setWordWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere); + hGrp->SetBool("PythonWordWrap", true); + } else { + this->setWordWrapMode(QTextOption::NoWrap); + hGrp->SetBool("PythonWordWrap", false); + } } }