Fem: Add preference entry to set Gmsh log verbosity - fixes #17673
This commit is contained in:
committed by
Chris Hennes
parent
a9554c2fe0
commit
be8dfbfc7e
@@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>105</height>
|
||||
<width>420</width>
|
||||
<height>193</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -55,6 +55,12 @@
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
@@ -111,6 +117,45 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="gb_options">
|
||||
<property name="title">
|
||||
<string>Options</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="hbl_otions">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gl_options">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lbl_log_level">
|
||||
<property name="text">
|
||||
<string>Log verbosity</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="Gui::PrefComboBox" name="cb_log_verbosity">
|
||||
<property name="toolTip">
|
||||
<string>Level of verbosity printed on the task panel</string>
|
||||
</property>
|
||||
<property name="sizeAdjustPolicy">
|
||||
<enum>QComboBox::AdjustToContents</enum>
|
||||
</property>
|
||||
<property name="prefEntry" stdset="0">
|
||||
<cstring>LogVerbosity</cstring>
|
||||
</property>
|
||||
<property name="prefPath" stdset="0">
|
||||
<cstring>Mod/Fem/Gmsh</cstring>
|
||||
</property>
|
||||
<property name="prefType" stdset="0">
|
||||
<cstring></cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
@@ -143,6 +188,11 @@
|
||||
<extends>QCheckBox</extends>
|
||||
<header>Gui/PrefWidgets.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>Gui::PrefComboBox</class>
|
||||
<extends>QComboBox</extends>
|
||||
<header>Gui/PrefWidgets.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="Resources/Fem.qrc"/>
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include <QMessageBox>
|
||||
#endif
|
||||
|
||||
#include <App/Application.h>
|
||||
#include "DlgSettingsFemGmshImp.h"
|
||||
#include "ui_DlgSettingsFemGmsh.h"
|
||||
|
||||
@@ -51,12 +52,16 @@ void DlgSettingsFemGmshImp::saveSettings()
|
||||
{
|
||||
ui->cb_gmsh_binary_std->onSave();
|
||||
ui->fc_gmsh_binary_path->onSave();
|
||||
ui->cb_log_verbosity->onSave();
|
||||
}
|
||||
|
||||
void DlgSettingsFemGmshImp::loadSettings()
|
||||
{
|
||||
ui->cb_gmsh_binary_std->onRestore();
|
||||
ui->fc_gmsh_binary_path->onRestore();
|
||||
|
||||
populateLogVerbosity();
|
||||
ui->cb_log_verbosity->onRestore();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -83,4 +88,26 @@ void DlgSettingsFemGmshImp::onfileNameChanged(QString FileName)
|
||||
}
|
||||
}
|
||||
|
||||
void DlgSettingsFemGmshImp::populateLogVerbosity()
|
||||
{
|
||||
std::list<std::pair<std::string, int>> mapValues = {{"Silent", 0},
|
||||
{"Errors", 1},
|
||||
{"Warnings", 2},
|
||||
{"Direct", 3},
|
||||
{"Information", 4},
|
||||
{"Status", 5},
|
||||
{"Debug", 99}};
|
||||
|
||||
for (const auto& val : mapValues) {
|
||||
ui->cb_log_verbosity->addItem(QString::fromStdString(val.first),
|
||||
QString::number(val.second));
|
||||
}
|
||||
|
||||
auto hGrp = App::GetApplication().GetParameterGroupByPath(
|
||||
"User parameter:BaseApp/Preferences/Mod/Fem/Gmsh");
|
||||
std::string current = hGrp->GetASCII("LogVerbosity", "3");
|
||||
int index = ui->cb_log_verbosity->findData(QString::fromStdString(current));
|
||||
ui->cb_log_verbosity->setCurrentIndex(index);
|
||||
}
|
||||
|
||||
#include "moc_DlgSettingsFemGmshImp.cpp"
|
||||
|
||||
@@ -47,6 +47,7 @@ protected:
|
||||
void saveSettings() override;
|
||||
void loadSettings() override;
|
||||
void changeEvent(QEvent* e) override;
|
||||
void populateLogVerbosity();
|
||||
|
||||
private:
|
||||
std::unique_ptr<Ui_DlgSettingsFemGmshImp> ui;
|
||||
|
||||
@@ -219,7 +219,10 @@ class GmshTools:
|
||||
self.write_gmsh_input_files()
|
||||
|
||||
def compute(self):
|
||||
command_list = ["-v", "4", "-", self.temp_file_geo]
|
||||
log_level = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Fem/Gmsh").GetString(
|
||||
"LogVerbosity", "3"
|
||||
)
|
||||
command_list = ["-v", log_level, "-", self.temp_file_geo]
|
||||
self.process.start(self.gmsh_bin, command_list)
|
||||
return self.process
|
||||
|
||||
|
||||
Reference in New Issue
Block a user