FEM: Usability and UI improvements for data extraction

Update icons for post data extraction
Improve translatability of post data extraction
Fix post data extraction commit handling
This commit is contained in:
Stefan Tröger
2025-04-21 19:29:22 +02:00
parent 005d0aa854
commit 3c22e30cd2
20 changed files with 260 additions and 178 deletions

View File

@@ -87,7 +87,6 @@
<file>icons/FEM_PostBranchFilter.svg</file>
<file>icons/FEM_PostPipelineFromResult.svg</file>
<file>icons/FEM_PostLineplot.svg</file>
<file>icons/FEM_PostPlotline.svg</file>
<file>icons/FEM_PostHistogram.svg</file>
<file>icons/FEM_PostSpreadsheet.svg</file>
<file>icons/FEM_PostField.svg</file>

View File

@@ -8,7 +8,7 @@
version="1.1"
id="svg1"
sodipodi:docname="FEM_PostField.svg"
inkscape:version="1.4 (e7c3feb100, 2024-10-09)"
inkscape:version="1.4.1 (93de688d07, 2025-03-30)"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
@@ -25,36 +25,78 @@
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#505050"
inkscape:zoom="34.537747"
inkscape:cx="8.8743484"
inkscape:cy="9.6850556"
inkscape:cx="8.8598715"
inkscape:cy="9.6561018"
inkscape:window-width="3132"
inkscape:window-height="1772"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="svg1" />
<circle
style="fill:#800080;stroke:none;stroke-width:14.2999;stroke-linejoin:round"
id="path2"
cx="4.0849209"
cy="4.0125365"
r="3.9000001" />
<circle
style="fill:#800080;stroke:none;stroke-width:14.2999;stroke-linejoin:round"
<rect
style="fill:#e5007e;stroke:#260013;stroke-width:0.463544;stroke-linecap:square;stroke-linejoin:round;stroke-dasharray:none"
id="rect5"
width="10.440784"
height="2.0364563"
x="2.1338818"
y="-5.0367694"
rx="1.9162874"
ry="2.0364563"
transform="rotate(90)" />
<rect
style="fill:#e5007e;stroke:#260013;stroke-width:0.463544;stroke-linecap:square;stroke-linejoin:round;stroke-dasharray:none"
id="rect6"
width="10.440784"
height="2.0364563"
x="2.2207432"
y="-13.056973"
rx="1.9162874"
ry="2.0364563"
transform="rotate(90)" />
<rect
style="fill:#e5007e;stroke:#260013;stroke-width:0.463544;stroke-linecap:square;stroke-linejoin:round;stroke-dasharray:none"
id="rect4"
width="10.440784"
height="2.0364563"
x="2.7107689"
y="11.254348"
rx="1.9162874"
ry="2.0364563" />
<rect
style="fill:#e5007e;stroke:#260013;stroke-width:0.463537;stroke-linecap:square;stroke-linejoin:round;stroke-dasharray:none"
id="rect3"
width="10.440463"
height="2.0364628"
x="2.5080891"
y="2.7419074"
rx="1.9162284"
ry="2.0364628" />
<ellipse
style="fill:#e5007e;stroke:#260013;stroke-width:0.4;stroke-linecap:square;stroke-linejoin:round;stroke-dasharray:none"
id="path1"
cx="4.0924597"
cy="3.7761521"
rx="2.7138755"
ry="2.7138758" />
<ellipse
style="fill:#e5007e;stroke:#260013;stroke-width:0.4;stroke-linecap:square;stroke-linejoin:round;stroke-dasharray:none"
id="circle1"
cx="12.092448"
cy="3.7761521"
rx="2.7138755"
ry="2.7138758" />
<ellipse
style="fill:#e5007e;stroke:#260013;stroke-width:0.4;stroke-linecap:square;stroke-linejoin:round;stroke-dasharray:none"
id="circle2"
cx="11.960362"
cy="4.0414896"
r="3.9000001" />
<circle
style="fill:#800080;stroke:none;stroke-width:14.2999;stroke-linejoin:round"
id="circle4"
cx="4.0270133"
cy="12.003795"
r="3.9000001" />
<circle
style="fill:#800080;stroke:none;stroke-width:14.2999;stroke-linejoin:round"
id="circle5"
cx="11.902454"
cy="12.061702"
r="3.9000001" />
cx="4.0927677"
cy="12.27616"
rx="2.7138755"
ry="2.7138758" />
<ellipse
style="fill:#e5007e;stroke:#260013;stroke-width:0.4;stroke-linecap:square;stroke-linejoin:round;stroke-dasharray:none"
id="circle3"
cx="12.092757"
cy="12.27616"
rx="2.7138755"
ry="2.7138758" />
</svg>

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

@@ -8,7 +8,7 @@
version="1.1"
id="svg1"
sodipodi:docname="FEM_PostHistogram.svg"
inkscape:version="1.4 (e7c3feb100, 2024-10-09)"
inkscape:version="1.4.1 (93de688d07, 2025-03-30)"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
@@ -24,17 +24,46 @@
inkscape:pageopacity="0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#505050"
inkscape:zoom="97.6875"
inkscape:cx="8"
inkscape:cy="8"
inkscape:zoom="48.84375"
inkscape:cx="9.4996801"
inkscape:cy="6.1932182"
inkscape:window-width="3132"
inkscape:window-height="1772"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="svg1" />
<path
d="M4 11H2v3h2zm5-4H7v7h2zm5-5v12h-2V2zm-2-1a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1zM6 7a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v7a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1zm-5 4a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v3a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1z"
id="path1"
style="fill:#800080;fill-opacity:1" />
<rect
style="fill:#e5007e;stroke:#260013;stroke-width:0.461535;stroke-linecap:square;stroke-linejoin:round;stroke-dasharray:none"
id="rect2"
width="3.5384648"
height="4.3404469"
x="0.67558533"
y="9.1421566"
ry="0.68956506" />
<rect
style="fill:#e5007e;stroke:#260013;stroke-width:0.459332;stroke-linecap:square;stroke-linejoin:round;stroke-dasharray:none"
id="rect3"
width="3.540668"
height="8.5446272"
x="6.2196369"
y="4.9390783"
ry="0.62339282" />
<rect
style="fill:#e5007e;stroke:#260013;stroke-width:0.459208;stroke-linecap:square;stroke-linejoin:round;stroke-dasharray:none"
id="rect4"
width="3.5407922"
height="12.789965"
x="11.764729"
y="0.69380343"
ry="0.64040416" />
<rect
style="fill:#e5007e;stroke:#260013;stroke-width:0.4;stroke-linecap:square;stroke-linejoin:round;fill-opacity:1"
id="rect5"
width="14.966091"
height="1.412668"
x="0.53230965"
y="14.167626"
rx="0.12284084"
ry="0" />
</svg>

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@@ -8,7 +8,7 @@
version="1.1"
id="svg1"
sodipodi:docname="FEM_PostIndex.svg"
inkscape:version="1.4 (e7c3feb100, 2024-10-09)"
inkscape:version="1.4.1 (93de688d07, 2025-03-30)"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
@@ -25,18 +25,18 @@
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#505050"
inkscape:zoom="34.537747"
inkscape:cx="8.8453946"
inkscape:cx="7.7885798"
inkscape:cy="9.6561018"
inkscape:window-width="3132"
inkscape:window-height="1772"
inkscape:window-width="1960"
inkscape:window-height="1308"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:window-maximized="0"
inkscape:current-layer="svg1" />
<circle
style="fill:#800080;stroke:none;stroke-width:14.2999;stroke-linejoin:round"
id="path2"
cx="8.0515957"
cy="7.9792109"
r="3.9000001" />
style="fill:#e5007e;stroke:#260013;stroke-width:0.4;stroke-linecap:square;stroke-linejoin:round;stroke-dasharray:none"
id="path1"
cx="7.9564848"
cy="7.9564848"
r="4.2860532" />
</svg>

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@@ -8,7 +8,7 @@
version="1.1"
id="svg1"
sodipodi:docname="FEM_PostLineplot.svg"
inkscape:version="1.4 (e7c3feb100, 2024-10-09)"
inkscape:version="1.4.1 (93de688d07, 2025-03-30)"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
@@ -24,9 +24,9 @@
inkscape:pageopacity="0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#505050"
inkscape:zoom="97.6875"
inkscape:cx="8"
inkscape:cy="8"
inkscape:zoom="45.254834"
inkscape:cx="1.6793786"
inkscape:cy="9.534893"
inkscape:window-width="3132"
inkscape:window-height="1772"
inkscape:window-x="0"
@@ -34,8 +34,13 @@
inkscape:window-maximized="1"
inkscape:current-layer="svg1" />
<path
fill-rule="evenodd"
d="M0 0h1v15h15v1H0zm14.817 3.113a.5.5 0 0 1 .07.704l-4.5 5.5a.5.5 0 0 1-.74.037L7.06 6.767l-3.656 5.027a.5.5 0 0 1-.808-.588l4-5.5a.5.5 0 0 1 .758-.06l2.609 2.61 4.15-5.073a.5.5 0 0 1 .704-.07"
id="path1"
style="fill:#800080;fill-opacity:1" />
id="rect1"
style="fill:#e5007e;fill-opacity:1;stroke:#260013;stroke-width:0.4;stroke-linecap:square;stroke-linejoin:round;stroke-dasharray:none;stroke-opacity:1"
d="M 0.5234375,0.5390625 V 14.324219 15.548828 H 2.0332031 15.248047 V 14.324219 H 2.0332031 V 0.5390625 Z"
sodipodi:nodetypes="ccccccccc" />
<path
style="fill:#e5007e;fill-opacity:1;stroke:#260013;stroke-width:0.4;stroke-linecap:square;stroke-linejoin:round;stroke-dasharray:none;stroke-opacity:1"
d="M 2.6295533,11.313708 6.8942911,5.4137863 9.8994949,7.6234949 13.788583,1.8119611 15.490059,2.9831067 10.496116,10.54031 7.2920386,8.1980192 4.0879611,12.484854 Z"
id="path8"
sodipodi:nodetypes="ccccccccc" />
</svg>

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@@ -1,41 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
width="16"
height="16"
fill="currentColor"
class="bi bi-graph-up"
viewBox="0 0 16 16"
version="1.1"
id="svg1"
sodipodi:docname="Fem_PostPlotline.svg"
inkscape:version="1.4 (e7c3feb100, 2024-10-09)"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<defs
id="defs1" />
<sodipodi:namedview
id="namedview1"
pagecolor="#505050"
bordercolor="#eeeeee"
borderopacity="1"
inkscape:showpageshadow="0"
inkscape:pageopacity="0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#505050"
inkscape:zoom="69.075494"
inkscape:cx="11.458478"
inkscape:cy="9.6343864"
inkscape:window-width="3132"
inkscape:window-height="1772"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="svg1" />
<path
fill-rule="evenodd"
d="m 14.817,3.113 c 0.21387,0.1750014 0.245222,0.4903105 0.07,0.704 l -4.5,5.5 C 10.199729,9.5455781 9.8561383,9.5627576 9.647,9.354 L 7.06,6.767 3.404,11.794 C 3.006988,12.298831 2.2377371,11.73903 2.596,11.206 l 4,-5.5 C 6.7765369,5.4573046 7.1365852,5.4288047 7.354,5.646 l 2.609,2.61 4.15,-5.073 c 0.175001,-0.2138702 0.49031,-0.245222 0.704,-0.07"
id="path1"
sodipodi:nodetypes="cccccccccccc" />
</svg>

Before

Width:  |  Height:  |  Size: 1.5 KiB

View File

@@ -8,7 +8,7 @@
version="1.1"
id="svg1"
sodipodi:docname="FEM_PostSpreadsheet.svg"
inkscape:version="1.4 (e7c3feb100, 2024-10-09)"
inkscape:version="1.4.1 (93de688d07, 2025-03-30)"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
@@ -24,17 +24,41 @@
inkscape:pageopacity="0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#505050"
inkscape:zoom="97.6875"
inkscape:cx="8"
inkscape:cy="8"
inkscape:zoom="48.84375"
inkscape:cx="2.9277031"
inkscape:cy="8.4248241"
inkscape:window-width="3132"
inkscape:window-height="1772"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="svg1" />
<rect
style="fill:#e5007e;stroke:#260013;stroke-width:0.4;stroke-linecap:square;stroke-linejoin:round;stroke-dasharray:none"
id="rect2"
width="14.571755"
height="14.865558"
x="0.72790933"
y="0.64063662"
ry="2.3616853" />
<path
d="M0 2a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2zm15 2h-4v3h4zm0 4h-4v3h4zm0 4h-4v3h3a1 1 0 0 0 1-1zm-5 3v-3H6v3zm-5 0v-3H1v2a1 1 0 0 0 1 1zm-4-4h4V8H1zm0-4h4V4H1zm5-3v3h4V4zm4 4H6v3h4z"
id="path1"
style="fill:#800080;fill-opacity:1" />
style="fill:#e5007e;stroke:#260013;stroke-width:0.694259;stroke-linecap:square;stroke-linejoin:round;stroke-dasharray:none"
d="M 1.013422,5.2704734 H 15.11965"
id="path2" />
<path
style="fill:#e5007e;stroke:#260013;stroke-width:0.694244;stroke-linecap:square;stroke-linejoin:round;stroke-dasharray:none"
d="M 0.96706864,8.6996694 H 15.033695"
id="path2-8" />
<path
style="fill:#e5007e;stroke:#260013;stroke-width:0.688579;stroke-linecap:square;stroke-linejoin:round;stroke-dasharray:none"
d="M 5.572664,15.121805 V 5.3933605"
id="path2-8-3" />
<path
style="fill:#e5007e;stroke:#260013;stroke-width:0.690432;stroke-linecap:square;stroke-linejoin:round;stroke-dasharray:none"
d="M 1.0023108,12.128865 H 14.992054"
id="path2-8-6" />
<path
style="fill:#e5007e;stroke:#260013;stroke-width:0.688011;stroke-linecap:square;stroke-linejoin:round;stroke-dasharray:none"
d="M 10.451292,15.119885 V 5.313384"
id="path3" />
</svg>

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

@@ -39,6 +39,8 @@ import FreeCADGui
from . import post_visualization as pv
translate = FreeCAD.Qt.translate
# a model showing available visualizations and possible extractions
# #################################################################
@@ -50,14 +52,14 @@ def build_new_visualization_tree_model():
visualizations = pv.get_registered_visualizations()
for vis_name in visualizations:
vis_icon = FreeCADGui.getIcon(visualizations[vis_name].icon)
vis_item = QtGui.QStandardItem(vis_icon, f"New {vis_name}")
vis_item = QtGui.QStandardItem(vis_icon, translate("FEM", "New {}").format(vis_name))
vis_item.setFlags(QtGui.Qt.ItemIsEnabled)
vis_item.setData(visualizations[vis_name])
for ext in visualizations[vis_name].extractions:
icon = FreeCADGui.getIcon(ext.icon)
name = ext.name.removeprefix(vis_name)
ext_item = QtGui.QStandardItem(icon, f"with {name}")
ext_item = QtGui.QStandardItem(icon, translate("FEM", "with {}").format(name))
ext_item.setData(ext)
vis_item.appendRow(ext_item)
model.appendRow(vis_item)
@@ -89,7 +91,7 @@ def build_add_to_visualization_tree_model():
for ext in visualizations[vis_type].extractions:
icon = FreeCADGui.getIcon(ext.icon)
name = ext.name.removeprefix(vis_type)
ext_item = QtGui.QStandardItem(icon, f"Add {name}")
ext_item = QtGui.QStandardItem(icon, translate("FEM", "Add {}").format(name))
ext_item.setData(ext)
vis_item.appendRow(ext_item)
@@ -101,7 +103,7 @@ def build_add_to_visualization_tree_model():
def build_post_object_item(post_object, extractions, vis_type):
# definitely build a item and add the extractions
post_item = QtGui.QStandardItem(post_object.ViewObject.Icon, f"From {post_object.Label}")
post_item = QtGui.QStandardItem(post_object.ViewObject.Icon, translate("FEM", "From {}").format(post_object.Label))
post_item.setFlags(QtGui.Qt.ItemIsEnabled)
post_item.setData(post_object)
@@ -109,7 +111,7 @@ def build_post_object_item(post_object, extractions, vis_type):
for ext in extractions:
icon = FreeCADGui.getIcon(ext.icon)
name = ext.name.removeprefix(vis_type)
ext_item = QtGui.QStandardItem(icon, f"add {name}")
ext_item = QtGui.QStandardItem(icon, translate("FEM", "add {}").format(name))
ext_item.setData(ext)
post_item.appendRow(ext_item)
@@ -268,7 +270,7 @@ class _SummaryWidget(QtGui.QWidget):
self.viewButton.hide()
self.warning = QtGui.QLabel(self)
self.warning.full_text = f"{extractor.Label}: Data source not available"
self.warning.full_text = translate("FEM", "{}: Data source not available").format(extractor.Label)
self.rmButton = QtGui.QToolButton(self)
self.rmButton.setIcon(QtGui.QIcon.fromTheme("delete"))
@@ -462,9 +464,9 @@ class ExtractLinkView(QtGui.QWidget):
self._scroll_view.setWidgetResizable(True)
hbox = QtGui.QHBoxLayout()
label = QtGui.QLabel("Data used in:")
label = QtGui.QLabel(translate("FEM", "Data used in:"))
if not self._is_source:
label.setText("Data used from:")
label.setText(translate("FEM", "Data used from:"))
label.setAlignment(QtGui.Qt.AlignBottom)
hbox.addWidget(label)
@@ -473,19 +475,19 @@ class ExtractLinkView(QtGui.QWidget):
if self._is_source:
self._add = _TreeChoiceButton(build_add_to_visualization_tree_model())
self._add.setText("Add data to")
self._add.setText(translate("FEM", "Add data to"))
self._add.selection.connect(self.addExtractionToVisualization)
hbox.addWidget(self._add)
self._create = _TreeChoiceButton(build_new_visualization_tree_model())
self._create.setText("New")
self._create.setText(translate("FEM", "New"))
self._create.selection.connect(self.newVisualization)
hbox.addWidget(self._create)
else:
vis_type = vis.get_visualization_type(self._object)
self._add = _TreeChoiceButton(build_add_from_data_tree_model(vis_type))
self._add.setText("Add data from")
self._add.setText(translate("FEM", "Add data from"))
self._add.selection.connect(self.addExtractionToPostObject)
hbox.addWidget(self._add)

View File

@@ -95,7 +95,8 @@ class _VisualizationGroupCommand:
return 0
def GetResources(self):
return { 'MenuText': 'Data Visualizations', 'ToolTip': 'Different visualizations to show post processing data in'}
return { 'MenuText': QtCore.QT_TRANSLATE_NOOP("FEM", 'Data Visualizations'),
'ToolTip': QtCore.QT_TRANSLATE_NOOP("FEM", 'Different visualizations to show post processing data in')}
def IsActive(self):
if not FreeCAD.ActiveDocument:
@@ -117,7 +118,7 @@ class _VisualizationCommand:
return {
"Pixmap": vis.icon,
"MenuText": QtCore.QT_TRANSLATE_NOOP(cmd, f"{self._visualization_type}"),
"MenuText": QtCore.QT_TRANSLATE_NOOP(cmd, "Create {}".format(self._visualization_type)),
"Accel": "",
"ToolTip": QtCore.QT_TRANSLATE_NOOP(cmd, tooltip),
"CmdType": "AlterDoc"

View File

@@ -37,6 +37,8 @@ import FreeCADGui
from vtkmodules.vtkIOCore import vtkDelimitedTextWriter
translate = FreeCAD.Qt.translate
class VtkTableModel(QtCore.QAbstractTableModel):
# Simple table model. Only supports single component columns
# One can supply a header_names dict to replace the table column names
@@ -160,14 +162,14 @@ class VtkTableView(QtGui.QWidget):
csv_action = QtGui.QAction(self)
csv_action.triggered.connect(self.exportCsv)
csv_action.setIcon(FreeCADGui.getIcon("Std_Export"))
csv_action.setToolTip("Export to CSV")
csv_action.setToolTip(translate("FEM", "Export to CSV"))
self.toolbar.addAction(csv_action)
copy_action = QtGui.QAction(self)
copy_action.triggered.connect(self.copyToClipboard)
copy_action.setIcon(FreeCADGui.getIcon("edit-copy"))
shortcut = QtGui.QKeySequence(QtGui.QKeySequence.Copy)
copy_action.setToolTip(f"Copy to clipboard ({shortcut.toString()})")
copy_action.setToolTip(translate("FEM", "Copy selection to clipboard ({})".format(shortcut.toString())))
copy_action.setShortcut(shortcut)
self.toolbar.addAction(copy_action)
@@ -195,9 +197,9 @@ class VtkTableView(QtGui.QWidget):
@QtCore.Slot(bool)
def exportCsv(self, state):
file_path, filter = QtGui.QFileDialog.getSaveFileName(None, "Save as csv file", "", "CSV (*.csv)")
file_path, filter = QtGui.QFileDialog.getSaveFileName(None, translate("FEM", "Save as csv file"), "", "CSV (*.csv)")
if not file_path:
FreeCAD.Console.PrintMessage("CSV file export aborted: no filename selected")
FreeCAD.Console.PrintMessage(translate("FEM", "CSV file export aborted: no filename selected"))
return
writer = vtkDelimitedTextWriter()

View File

@@ -33,6 +33,8 @@ from vtkmodules.vtkCommonCore import vtkIntArray
from vtkmodules.vtkCommonCore import vtkDoubleArray
from vtkmodules.vtkCommonDataModel import vtkTable
from PySide.QtCore import QT_TRANSLATE_NOOP
from . import base_fempythonobject
_PropHelper = base_fempythonobject._PropHelper
@@ -78,14 +80,14 @@ class Extractor(base_fempythonobject.BaseFemPythonObject):
type="Fem::PropertyPostDataObject",
name="Table",
group="Base",
doc="The data table that stores the extracted data",
doc=QT_TRANSLATE_NOOP("FEM", "The data table that stores the extracted data"),
value=vtkTable(),
),
_PropHelper(
type="App::PropertyLink",
name="Source",
group="Base",
doc="The data source from which the data is extracted",
doc=QT_TRANSLATE_NOOP("FEM", "The data source from which the data is extracted"),
value=None,
),
]
@@ -140,14 +142,14 @@ class Extractor1D(Extractor):
type="App::PropertyEnumeration",
name="XField",
group="X Data",
doc="The field to use as X data",
doc=QT_TRANSLATE_NOOP("FEM", "The field to use as X data"),
value=[],
),
_PropHelper(
type="App::PropertyEnumeration",
name="XComponent",
group="X Data",
doc="Which part of the X field vector to use for the X axis",
doc=QT_TRANSLATE_NOOP("FEM", "Which part of the X field vector to use for the X axis"),
value=[],
),
]
@@ -278,14 +280,14 @@ class Extractor2D(Extractor1D):
type="App::PropertyEnumeration",
name="YField",
group="Y Data",
doc="The field to use as Y data",
doc=QT_TRANSLATE_NOOP("FEM", "The field to use as Y data"),
value=[],
),
_PropHelper(
type="App::PropertyEnumeration",
name="YComponent",
group="Y Data",
doc="Which part of the Y field vector to use for the Y axis",
doc=QT_TRANSLATE_NOOP("FEM", "Which part of the Y field vector to use for the Y axis"),
value=[],
),
]

View File

@@ -39,6 +39,9 @@ from vtkmodules.vtkCommonCore import vtkDoubleArray
from vtkmodules.vtkCommonDataModel import vtkTable
from vtkmodules.vtkCommonExecutionModel import vtkStreamingDemandDrivenPipeline
from PySide.QtCore import QT_TRANSLATE_NOOP
class PostFieldData1D(base_fempostextractors.Extractor1D):
"""
A post processing extraction of one dimensional field data
@@ -54,7 +57,7 @@ class PostFieldData1D(base_fempostextractors.Extractor1D):
type="App::PropertyBool",
name="ExtractFrames",
group="Multiframe",
doc="Specify if the field shall be extracted for every available frame",
doc=QT_TRANSLATE_NOOP("FEM", "Specify if the field shall be extracted for every available frame"),
value=False,
),
]
@@ -126,7 +129,7 @@ class PostIndexOverFrames1D(base_fempostextractors.Extractor1D):
type="App::PropertyInteger",
name="Index",
group="X Data",
doc="Specify for which index the data should be extracted",
doc=QT_TRANSLATE_NOOP("FEM", "Specify for which index the data should be extracted"),
value=0,
),
]

View File

@@ -39,6 +39,9 @@ from vtkmodules.vtkCommonCore import vtkDoubleArray
from vtkmodules.vtkCommonDataModel import vtkTable
from vtkmodules.vtkCommonExecutionModel import vtkStreamingDemandDrivenPipeline
from PySide.QtCore import QT_TRANSLATE_NOOP
class PostFieldData2D(base_fempostextractors.Extractor2D):
"""
A post processing extraction of two dimensional field data
@@ -54,7 +57,7 @@ class PostFieldData2D(base_fempostextractors.Extractor2D):
type="App::PropertyBool",
name="ExtractFrames",
group="Multiframe",
doc="Specify if the field shall be extracted for every available frame",
doc=QT_TRANSLATE_NOOP("FEM", "Specify if the field shall be extracted for every available frame"),
value=False,
),
]
@@ -142,7 +145,7 @@ class PostIndexOverFrames2D(base_fempostextractors.Extractor2D):
type="App::PropertyInteger",
name="Index",
group="Data",
doc="Specify for which point index the data should be extracted",
doc=QT_TRANSLATE_NOOP("FEM", "Specify for which point index the data should be extracted"),
value=0,
),
]

View File

@@ -37,6 +37,8 @@ import FreeCADGui
from femguiutils import selection_widgets
from . import base_femtaskpanel
translate = FreeCAD.Qt.translate
class _BasePostTaskPanel(base_femtaskpanel._BaseTaskPanel):
"""
@@ -60,6 +62,12 @@ class _BasePostTaskPanel(base_femtaskpanel._BaseTaskPanel):
if button == QtGui.QDialogButtonBox.Apply:
self.obj.Document.recompute()
def open(self):
# open a new transaction if non is open
if not FreeCAD.getActiveTransaction():
FreeCAD.ActiveDocument.openTransaction(translate("FEM", "Edit {}").format(self.obj.Label))
# Helper functions
# ################

View File

@@ -38,6 +38,8 @@ from . import base_fempostpanel
from femguiutils import extract_link_view as elv
from femguiutils import vtk_table_view
translate = FreeCAD.Qt.translate
class _TaskPanel(base_fempostpanel._BasePostTaskPanel):
"""
The TaskPanel for editing properties of glyph filter
@@ -50,10 +52,10 @@ class _TaskPanel(base_fempostpanel._BasePostTaskPanel):
self.data_widget = QtGui.QWidget()
hbox = QtGui.QHBoxLayout()
self.data_widget.show_plot = QtGui.QPushButton()
self.data_widget.show_plot.setText("Show plot")
self.data_widget.show_plot.setText(translate("FEM", "Show plot"))
hbox.addWidget(self.data_widget.show_plot)
self.data_widget.show_table = QtGui.QPushButton()
self.data_widget.show_table.setText("Show data")
self.data_widget.show_table.setText(translate("FEM", "Show data"))
hbox.addWidget(self.data_widget.show_table)
vbox = QtGui.QVBoxLayout()
vbox.addItem(hbox)
@@ -63,7 +65,7 @@ class _TaskPanel(base_fempostpanel._BasePostTaskPanel):
vbox.addWidget(extracts)
self.data_widget.setLayout(vbox)
self.data_widget.setWindowTitle("Histogram data")
self.data_widget.setWindowTitle(translate("FEM", "Histogram data"))
self.data_widget.setWindowIcon(FreeCADGui.getIcon(":/icons/FEM_PostHistogram.svg"))
@@ -71,7 +73,7 @@ class _TaskPanel(base_fempostpanel._BasePostTaskPanel):
self.view_widget = FreeCADGui.PySideUic.loadUi(
FreeCAD.getHomePath() + "Mod/Fem/Resources/ui/TaskPostHistogram.ui"
)
self.view_widget.setWindowTitle("Histogram view settings")
self.view_widget.setWindowTitle(translate("FEM", "Histogram view settings"))
self.view_widget.setWindowIcon(FreeCADGui.getIcon(":/icons/FEM_PostHistogram.svg"))
self.__init_widgets()

View File

@@ -38,6 +38,8 @@ from . import base_fempostpanel
from femguiutils import extract_link_view as elv
from femguiutils import vtk_table_view
translate = FreeCAD.Qt.translate
class _TaskPanel(base_fempostpanel._BasePostTaskPanel):
"""
The TaskPanel for editing properties of glyph filter
@@ -50,10 +52,10 @@ class _TaskPanel(base_fempostpanel._BasePostTaskPanel):
self.data_widget = QtGui.QWidget()
hbox = QtGui.QHBoxLayout()
self.data_widget.show_plot = QtGui.QPushButton()
self.data_widget.show_plot.setText("Show plot")
self.data_widget.show_plot.setText(translate("FEM", "Show plot"))
hbox.addWidget(self.data_widget.show_plot)
self.data_widget.show_table = QtGui.QPushButton()
self.data_widget.show_table.setText("Show data")
self.data_widget.show_table.setText(translate("FEM", "Show data"))
hbox.addWidget(self.data_widget.show_table)
vbox = QtGui.QVBoxLayout()
vbox.addItem(hbox)
@@ -63,7 +65,7 @@ class _TaskPanel(base_fempostpanel._BasePostTaskPanel):
vbox.addWidget(extracts)
self.data_widget.setLayout(vbox)
self.data_widget.setWindowTitle("Lineplot data")
self.data_widget.setWindowTitle(translate("FEM", "Lineplot data"))
self.data_widget.setWindowIcon(FreeCADGui.getIcon(":/icons/FEM_PostLineplot.svg"))
@@ -71,7 +73,7 @@ class _TaskPanel(base_fempostpanel._BasePostTaskPanel):
self.view_widget = FreeCADGui.PySideUic.loadUi(
FreeCAD.getHomePath() + "Mod/Fem/Resources/ui/TaskPostLineplot.ui"
)
self.view_widget.setWindowTitle("Lineplot view settings")
self.view_widget.setWindowTitle(translate("FEM", "Lineplot view settings"))
self.view_widget.setWindowIcon(FreeCADGui.getIcon(":/icons/FEM_PostLineplot.svg"))
self.__init_widgets()

View File

@@ -38,6 +38,8 @@ from . import base_fempostpanel
from femguiutils import extract_link_view as elv
from femguiutils import vtk_table_view
translate = FreeCAD.Qt.translate
class _TaskPanel(base_fempostpanel._BasePostTaskPanel):
"""
The TaskPanel for editing properties of glyph filter
@@ -49,7 +51,7 @@ class _TaskPanel(base_fempostpanel._BasePostTaskPanel):
# data widget
self.data_widget = QtGui.QWidget()
self.data_widget.show_table = QtGui.QPushButton()
self.data_widget.show_table.setText("Show table")
self.data_widget.show_table.setText(translate("FEM", "Show table"))
vbox = QtGui.QVBoxLayout()
vbox.addWidget(self.data_widget.show_table)
@@ -59,17 +61,9 @@ class _TaskPanel(base_fempostpanel._BasePostTaskPanel):
vbox.addWidget(extracts)
self.data_widget.setLayout(vbox)
self.data_widget.setWindowTitle("Table data")
self.data_widget.setWindowTitle(translate("FEM", "Table data"))
self.data_widget.setWindowIcon(FreeCADGui.getIcon(":/icons/FEM_PostSpreadsheet.svg"))
# histogram parameter widget
#self.view_widget = FreeCADGui.PySideUic.loadUi(
# FreeCAD.getHomePath() + "Mod/Fem/Resources/ui/TaskPostTable.ui"
#)
#self.view_widget.setWindowTitle("Table view settings")
#self.view_widget.setWindowIcon(FreeCADGui.getIcon(":/icons/FEM_PostTable.svg"))
self.__init_widgets()
# form made from param and selection widget

View File

@@ -35,6 +35,7 @@ import FreeCADGui
import Plot
import FemGui
from PySide import QtGui, QtCore
from PySide.QtCore import QT_TRANSLATE_NOOP
import io
import numpy as np
@@ -48,6 +49,7 @@ from femtaskpanels import task_post_histogram
_GuiPropHelper = view_base_fempostvisualization._GuiPropHelper
class EditViewWidget(QtGui.QWidget):
def __init__(self, obj, post_dialog):
@@ -260,49 +262,49 @@ class VPPostHistogramFieldData(view_base_fempostextractors.VPPostExtractor):
type="App::PropertyString",
name="Legend",
group="HistogramPlot",
doc="The name used in the plots legend",
doc=QT_TRANSLATE_NOOP("FEM", "The name used in the plots legend"),
value="",
),
_GuiPropHelper(
type="App::PropertyColor",
name="BarColor",
group="HistogramBar",
doc="The color the data bin area is drawn with",
doc=QT_TRANSLATE_NOOP("FEM", "The color the data bin area is drawn with"),
value=(0, 85, 255, 255),
),
_GuiPropHelper(
type="App::PropertyEnumeration",
name="Hatch",
group="HistogramBar",
doc="The hatch pattern drawn in the bar",
doc=QT_TRANSLATE_NOOP("FEM", "The hatch pattern drawn in the bar"),
value=['None', '/', '\\', '|', '-', '+', 'x', 'o', 'O', '.', '*'],
),
_GuiPropHelper(
type="App::PropertyIntegerConstraint",
name="HatchDensity",
group="HistogramBar",
doc="The line width of the hatch",
doc=QT_TRANSLATE_NOOP("FEM", "The line width of the hatch)"),
value=(1, 1, 99, 1),
),
_GuiPropHelper(
type="App::PropertyColor",
name="LineColor",
group="HistogramLine",
doc="The color the data bin area is drawn with",
doc=QT_TRANSLATE_NOOP("FEM", "The color the data bin area is drawn with"),
value=(0, 0, 0, 1), # black
),
_GuiPropHelper(
type="App::PropertyFloatConstraint",
name="LineWidth",
group="HistogramLine",
doc="The width of the bar, between 0 and 1 (1 being without gaps)",
doc=QT_TRANSLATE_NOOP("FEM", "The width of the bar, between 0 and 1 (1 being without gaps)"),
value=(1, 0, 99, 0.1),
),
_GuiPropHelper(
type="App::PropertyEnumeration",
name="LineStyle",
group="HistogramLine",
doc="The style the line is drawn in",
doc=QT_TRANSLATE_NOOP("FEM", "The style the line is drawn in"),
value=['None', '-', '--', '-.', ':'],
),
]
@@ -390,70 +392,70 @@ class VPPostHistogram(view_base_fempostvisualization.VPPostVisualization):
type="App::PropertyBool",
name="Cumulative",
group="Histogram",
doc="If be the bars shoud show the cumulative sum left to rigth",
doc=QT_TRANSLATE_NOOP("FEM", "If be the bars shoud show the cumulative sum left to rigth"),
value=False,
),
_GuiPropHelper(
type="App::PropertyEnumeration",
name="Type",
group="Histogram",
doc="The type of histogram plotted",
doc=QT_TRANSLATE_NOOP("FEM", "The type of histogram plotted"),
value=["bar","barstacked", "step", "stepfilled"],
),
_GuiPropHelper(
type="App::PropertyFloatConstraint",
name="BarWidth",
group="Histogram",
doc="The width of the bar, between 0 and 1 (1 being without gaps)",
doc=QT_TRANSLATE_NOOP("FEM", "The width of the bar, between 0 and 1 (1 being without gaps)"),
value=(0.9, 0, 1, 0.05),
),
_GuiPropHelper(
type="App::PropertyFloatConstraint",
name="HatchLineWidth",
group="Histogram",
doc="The line width of all drawn hatch patterns",
doc=QT_TRANSLATE_NOOP("FEM", "The line width of all drawn hatch patterns"),
value=(1, 0, 99, 0.1),
),
_GuiPropHelper(
type="App::PropertyInteger",
name="Bins",
group="Histogram",
doc="The number of bins the data is split into",
doc=QT_TRANSLATE_NOOP("FEM", "The number of bins the data is split into"),
value=10,
),
_GuiPropHelper(
type="App::PropertyString",
name="Title",
group="Plot",
doc="The histogram plot title",
doc=QT_TRANSLATE_NOOP("FEM", "The histogram plot title"),
value="",
),
_GuiPropHelper(
type="App::PropertyString",
name="XLabel",
group="Plot",
doc="The label shown for the histogram X axis",
doc=QT_TRANSLATE_NOOP("FEM", "The label shown for the histogram X axis"),
value="",
),
_GuiPropHelper(
type="App::PropertyString",
name="YLabel",
group="Plot",
doc="The label shown for the histogram Y axis",
doc=QT_TRANSLATE_NOOP("FEM", "The label shown for the histogram Y axis"),
value="",
),
_GuiPropHelper(
type="App::PropertyBool",
name="Legend",
group="Plot",
doc="Determines if the legend is plotted",
doc=QT_TRANSLATE_NOOP("FEM", "Determines if the legend is plotted"),
value=True,
),
_GuiPropHelper(
type="App::PropertyEnumeration",
name="LegendLocation",
group="Plot",
doc="Determines if the legend is plotted",
doc=QT_TRANSLATE_NOOP("FEM", "Determines if the legend is plotted"),
value=['best','upper right','upper left','lower left','lower right','right',
'center left','center right','lower center','upper center','center'],
),

View File

@@ -35,6 +35,8 @@ import FreeCADGui
import Plot
import FemGui
from PySide import QtGui, QtCore
from PySide.QtCore import QT_TRANSLATE_NOOP
import io
import numpy as np
@@ -265,43 +267,43 @@ class VPPostLineplotFieldData(view_base_fempostextractors.VPPostExtractor):
type="App::PropertyString",
name="Legend",
group="Lineplot",
doc="The name used in the plots legend",
doc=QT_TRANSLATE_NOOP("FEM", "The name used in the plots legend"),
value="",
),
_GuiPropHelper(
type="App::PropertyColor",
name="Color",
group="Lineplot",
doc="The color the line and the markers are drawn with",
doc=QT_TRANSLATE_NOOP("FEM", "The color the line and the markers are drawn with"),
value=(0, 85, 255, 255),
),
_GuiPropHelper(
type="App::PropertyEnumeration",
name="LineStyle",
group="Lineplot",
doc="The style the line is drawn in",
doc=QT_TRANSLATE_NOOP("FEM", "The style the line is drawn in"),
value=['-', '--', '-.', ':', 'None'],
),
_GuiPropHelper(
type="App::PropertyFloatConstraint",
name="LineWidth",
group="Lineplot",
doc="The width the line is drawn with",
doc=QT_TRANSLATE_NOOP("FEM", "The width the line is drawn with"),
value=(1, 0.1, 99, 0.1),
),
_GuiPropHelper(
type="App::PropertyEnumeration",
name="MarkerStyle",
group="Lineplot",
doc="The style the data markers are drawn with",
doc=QT_TRANSLATE_NOOP("FEM", "The style the data markers are drawn with"),
value=['None', '*', '+', 's', '.', 'o', 'x'],
),
_GuiPropHelper(
type="App::PropertyFloatConstraint",
name="MarkerSize",
group="Lineplot",
doc="The size the data markers are drawn in",
value=(10, 0.1, 99, 0.1),
doc=QT_TRANSLATE_NOOP("FEM", "The size the data markers are drawn in"),
value=(5, 0.1, 99, 0.1),
),
]
return super()._get_properties() + prop
@@ -389,49 +391,49 @@ class VPPostLineplot(view_base_fempostvisualization.VPPostVisualization):
type="App::PropertyBool",
name="Grid",
group="Lineplot",
doc="If be the bars shoud show the cumulative sum left to rigth",
doc=QT_TRANSLATE_NOOP("FEM", "If be the bars shoud show the cumulative sum left to rigth"),
value=True,
),
_GuiPropHelper(
type="App::PropertyEnumeration",
name="Scale",
group="Lineplot",
doc="The scale the axis are drawn in",
doc=QT_TRANSLATE_NOOP("FEM", "The scale the axis are drawn in"),
value=["linear","semi-log x", "semi-log y", "log"],
),
_GuiPropHelper(
type="App::PropertyString",
name="Title",
group="Plot",
doc="The histogram plot title",
doc=QT_TRANSLATE_NOOP("FEM", "The histogram plot title"),
value="",
),
_GuiPropHelper(
type="App::PropertyString",
name="XLabel",
group="Plot",
doc="The label shown for the histogram X axis",
doc=QT_TRANSLATE_NOOP("FEM", "The label shown for the histogram X axis"),
value="",
),
_GuiPropHelper(
type="App::PropertyString",
name="YLabel",
group="Plot",
doc="The label shown for the histogram Y axis",
doc=QT_TRANSLATE_NOOP("FEM", "The label shown for the histogram Y axis"),
value="",
),
_GuiPropHelper(
type="App::PropertyBool",
name="Legend",
group="Plot",
doc="Determines if the legend is plotted",
doc=QT_TRANSLATE_NOOP("FEM", "Determines if the legend is plotted"),
value=True,
),
_GuiPropHelper(
type="App::PropertyEnumeration",
name="LegendLocation",
group="Plot",
doc="Determines if the legend is plotted",
doc=QT_TRANSLATE_NOOP("FEM", "Determines if the legend is plotted"),
value=['best','upper right','upper left','lower left','lower right','right',
'center left','center right','lower center','upper center','center'],
),

View File

@@ -35,6 +35,7 @@ import FreeCADGui
import Plot
import FemGui
from PySide import QtGui, QtCore
from PySide.QtCore import QT_TRANSLATE_NOOP
import io
import numpy as np
@@ -186,7 +187,7 @@ class VPPostTableFieldData(view_base_fempostextractors.VPPostExtractor):
type="App::PropertyString",
name="Name",
group="Table",
doc="The name used in the table header. Default name is used if empty",
doc=QT_TRANSLATE_NOOP("FEM", "The name used in the table header. Default name is used if empty"),
value="",
),
]