Show report view on all warnings or errors by default, can be disabled in preferences
This commit is contained in:
@@ -458,7 +458,7 @@ class BaseExport ConsoleObserver
|
||||
{
|
||||
public:
|
||||
ConsoleObserver()
|
||||
:bErr(true),bMsg(true),bLog(true),bWrn(true) {}
|
||||
:bErr(true),bMsg(true),bLog(true),bWrn(true),bShow(true) {}
|
||||
virtual ~ConsoleObserver() {}
|
||||
/// get calls when a Warning is issued
|
||||
virtual void Warning(const char *){}
|
||||
@@ -470,7 +470,7 @@ public:
|
||||
virtual void Log (const char *){}
|
||||
|
||||
virtual const char *Name(void){return 0L;}
|
||||
bool bErr,bMsg,bLog,bWrn;
|
||||
bool bErr,bMsg,bLog,bWrn,bShow;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -86,6 +86,22 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="Gui::PrefCheckBox" name="checkShowReportViewOnWarningOrError">
|
||||
<property name="text">
|
||||
<string>Show report view on warning or error</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="prefEntry" stdset="0">
|
||||
<cstring>checkShowReportViewOnWarningOrError</cstring>
|
||||
</property>
|
||||
<property name="prefPath" stdset="0">
|
||||
<cstring>OutputWindow</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -469,6 +485,7 @@ from Python console to Report view panel</string>
|
||||
<tabstop>checkLogging</tabstop>
|
||||
<tabstop>checkWarning</tabstop>
|
||||
<tabstop>checkError</tabstop>
|
||||
<tabstop>checkShowReportViewOnWarningOrError</tabstop>
|
||||
<tabstop>colorText</tabstop>
|
||||
<tabstop>colorLogging</tabstop>
|
||||
<tabstop>colorWarning</tabstop>
|
||||
|
||||
@@ -59,6 +59,7 @@ void DlgReportViewImp::saveSettings()
|
||||
checkLogging->onSave();
|
||||
checkWarning->onSave();
|
||||
checkError->onSave();
|
||||
checkShowReportViewOnWarningOrError->onSave();
|
||||
colorText->onSave();
|
||||
colorLogging->onSave();
|
||||
colorWarning->onSave();
|
||||
@@ -72,6 +73,7 @@ void DlgReportViewImp::loadSettings()
|
||||
checkLogging->onRestore();
|
||||
checkWarning->onRestore();
|
||||
checkError->onRestore();
|
||||
checkShowReportViewOnWarningOrError->onRestore();
|
||||
colorText->onRestore();
|
||||
colorLogging->onRestore();
|
||||
colorWarning->onRestore();
|
||||
|
||||
@@ -37,6 +37,8 @@
|
||||
#include "PythonConsole.h"
|
||||
#include "PythonConsolePy.h"
|
||||
#include "BitmapFactory.h"
|
||||
#include "MainWindow.h"
|
||||
#include "Application.h"
|
||||
|
||||
using namespace Gui;
|
||||
using namespace Gui::DockWnd;
|
||||
@@ -148,6 +150,8 @@ void ReportHighlighter::highlightBlock (const QString & text)
|
||||
ud->block.append(b);
|
||||
|
||||
QVector<TextBlockData::State> block = ud->block;
|
||||
bool hasErrors = false;
|
||||
bool hasWarnings = false;
|
||||
int start = 0;
|
||||
for (QVector<TextBlockData::State>::Iterator it = block.begin(); it != block.end(); ++it) {
|
||||
switch (it->type)
|
||||
@@ -157,9 +161,11 @@ void ReportHighlighter::highlightBlock (const QString & text)
|
||||
break;
|
||||
case Warning:
|
||||
setFormat(start, it->length-start, warnCol);
|
||||
hasWarnings = true;
|
||||
break;
|
||||
case Error:
|
||||
setFormat(start, it->length-start, errCol);
|
||||
hasErrors = true;
|
||||
break;
|
||||
case LogText:
|
||||
setFormat(start, it->length-start, logCol);
|
||||
@@ -170,6 +176,22 @@ void ReportHighlighter::highlightBlock (const QString & text)
|
||||
|
||||
start = it->length;
|
||||
}
|
||||
if(hasErrors || hasWarnings){
|
||||
//activate report view unless this is disabled in preferences
|
||||
|
||||
ParameterGrp::handle group = App::GetApplication().GetUserParameter().
|
||||
GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("OutputWindow");
|
||||
bool showReportViewOnWarningOrError = group->GetBool("checkShowReportViewOnWarningOrError", true);
|
||||
if (showReportViewOnWarningOrError){
|
||||
QWidget* reportView = Gui::getMainWindow()->findChild<QWidget*>(QString::fromLatin1("Report view"));
|
||||
if (reportView){
|
||||
if (!reportView->isVisible()){
|
||||
reportView->show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void ReportHighlighter::setParagraphType(ReportHighlighter::Paragraph t)
|
||||
@@ -470,6 +492,10 @@ void ReportOutput::onToggleError()
|
||||
getWindowParameter()->SetBool( "checkError", bErr );
|
||||
}
|
||||
|
||||
void ReportOutput::onToggleShowReportViewOnWarningOrError(){
|
||||
bShow = bShow ? false : true;
|
||||
getWindowParameter()->SetBool("checkShowReportViewOnWarningOrError", bShow);
|
||||
}
|
||||
void ReportOutput::onToggleWarning()
|
||||
{
|
||||
bWrn = bWrn ? false : true;
|
||||
|
||||
@@ -171,6 +171,8 @@ public Q_SLOTS:
|
||||
void onToggleWarning();
|
||||
/** Toggles the report of log messages. */
|
||||
void onToggleLogging();
|
||||
/** Toggles whether to show report view on warnings or errors */
|
||||
void onToggleShowReportViewOnWarningOrError();
|
||||
/** Toggles the redirection of Python stdout. */
|
||||
void onToggleRedirectPythonStdout();
|
||||
/** Toggles the redirection of Python stderr. */
|
||||
|
||||
Reference in New Issue
Block a user