Merge pull request #5028 from luzpaz/Crowdin-MeshPart

Crowdin: Fix and expose Mesh WB translations
This commit is contained in:
Yorik van Havre
2021-11-18 12:27:42 +01:00
committed by GitHub
2 changed files with 14 additions and 5 deletions

View File

@@ -45,6 +45,7 @@ using namespace MeshGui;
qApp->translate("Workbench", "Analyze");
qApp->translate("Workbench", "Boolean");
qApp->translate("Workbench", "&Meshes");
qApp->translate("Workbench", "Cutting");
qApp->translate("Workbench", "Mesh tools");
#endif

View File

@@ -26,6 +26,8 @@ import FreeCADGui as Gui
import Part
import MeshPartGui
from PySide.QtCore import QT_TRANSLATE_NOOP # for translations
class BaseCommand(object):
def __init__(self):
pass
@@ -41,7 +43,9 @@ class CreateFlatMesh(BaseCommand):
"""create flat wires from a meshed face"""
def GetResources(self):
return {'Pixmap': 'MeshPart_CreateFlatMesh.svg', 'MenuText': 'Unwrap Mesh', 'ToolTip': 'find a flat representation of a mesh'}
return {'Pixmap': 'MeshPart_CreateFlatMesh.svg',
'MenuText': QT_TRANSLATE_NOOP("MeshPart_FlatteningCommand", "Unwrap Mesh"),
'ToolTip': QT_TRANSLATE_NOOP("MeshPart_FlatteningCommand", "Find a flat representation of a mesh.")}
def Activated(self):
import numpy as np
@@ -69,10 +73,12 @@ class CreateFlatMesh(BaseCommand):
class CreateFlatFace(BaseCommand):
"""create a flat face from a single face
only full faces are supported right now"""
def GetResources(self):
return {'Pixmap': 'MeshPart_CreateFlatFace.svg', 'MenuText': 'Unwrap Face', 'ToolTip': 'find a flat representation of a mesh'}
return {'Pixmap': 'MeshPart_CreateFlatFace.svg',
'MenuText': QT_TRANSLATE_NOOP("MeshPart_FlatteningCommand", "Unwrap Face"),
'ToolTip': QT_TRANSLATE_NOOP("MeshPart_FlatteningCommand", "Find a flat representation of a mesh.")}
def Activated(self):
import numpy as np
import flatmesh
@@ -96,12 +102,14 @@ class CreateFlatFace(BaseCommand):
bs.setPole(u + 1, v + 1, App.Vector(poles[i]))
i += 1
Part.show(bs.toShape())
def IsActive(self):
assert(super(CreateFlatFace, self).IsActive())
assert(isinstance(Gui.Selection.getSelectionEx()[0].SubObjects[0], Part.Face))
return True
# Test if pybind11 dependency is available
try:
import flatmesh
Gui.addCommand('MeshPart_CreateFlatMesh', CreateFlatMesh())