Draft: Fix issues with translate and _tr (#5351)
This commit is contained in:
@@ -43,7 +43,7 @@ import FreeCAD as App
|
||||
import draftutils.utils as utils
|
||||
|
||||
from draftutils.messages import _msg, _wrn, _err
|
||||
from draftutils.translate import _tr, translate
|
||||
from draftutils.translate import translate
|
||||
|
||||
if App.GuiUp:
|
||||
import FreeCADGui as Gui
|
||||
@@ -78,7 +78,7 @@ def get_3d_view():
|
||||
if v:
|
||||
return v[0]
|
||||
|
||||
_wrn(_tr("No graphical interface"))
|
||||
_wrn(translate("draft", "No graphical interface"))
|
||||
return None
|
||||
|
||||
|
||||
@@ -155,7 +155,7 @@ def autogroup(obj):
|
||||
return
|
||||
matrix = parent.getSubObject(sub, retType=4)
|
||||
if matrix.hasScale() == 1:
|
||||
err = translate("Draft",
|
||||
err = translate("draft",
|
||||
"Unable to insert new object into "
|
||||
"a scaled part")
|
||||
App.Console.PrintMessage(err)
|
||||
@@ -264,7 +264,7 @@ def dim_symbol(symbol=None, invert=False):
|
||||
elif symbol == 4:
|
||||
return dim_dash((-1.5, -1.5, 0), (1.5, 1.5, 0))
|
||||
else:
|
||||
_wrn(_tr("Symbol not implemented. Use a default symbol."))
|
||||
_wrn(translate("draft", "Symbol not implemented. Using a default symbol."))
|
||||
return coin.SoSphere()
|
||||
|
||||
|
||||
@@ -330,7 +330,7 @@ def remove_hidden(objectslist):
|
||||
if obj.ViewObject:
|
||||
if not obj.ViewObject.isVisible():
|
||||
newlist.remove(obj)
|
||||
_msg(_tr("Visibility off; removed from list: ") + obj.Label)
|
||||
_msg(translate("draft", "Visibility off; removed from list: ") + obj.Label)
|
||||
return newlist
|
||||
|
||||
|
||||
@@ -600,13 +600,13 @@ def load_texture(filename, size=None, gui=App.GuiUp):
|
||||
p = QtGui.QImage(filename)
|
||||
|
||||
if p.isNull():
|
||||
_wrn("load_texture: " + _tr("image is Null"))
|
||||
_wrn("load_texture: " + translate("draft", "image is Null"))
|
||||
|
||||
if not os.path.exists(filename):
|
||||
raise FileNotFoundError(-1,
|
||||
_tr("filename does not exist "
|
||||
"on the system or "
|
||||
"on the resource file"),
|
||||
translate("draft", "filename does not exist "
|
||||
"on the system or "
|
||||
"in the resource file"),
|
||||
filename)
|
||||
|
||||
# This is buggy so it was de-activated.
|
||||
@@ -665,7 +665,7 @@ def load_texture(filename, size=None, gui=App.GuiUp):
|
||||
return None
|
||||
except Exception as exc:
|
||||
_wrn(str(exc))
|
||||
_wrn("load_texture: " + _tr("unable to load texture"))
|
||||
_wrn("load_texture: " + translate("draft", "unable to load texture"))
|
||||
return None
|
||||
else:
|
||||
return img
|
||||
@@ -717,7 +717,7 @@ def get_bbox(obj, debug=False):
|
||||
|
||||
found, doc = utils.find_doc(App.activeDocument())
|
||||
if not found:
|
||||
_err(_tr("No active document. Aborting."))
|
||||
_err(translate("draft", "No active document. Aborting."))
|
||||
return None
|
||||
|
||||
if isinstance(obj, str):
|
||||
@@ -726,7 +726,7 @@ def get_bbox(obj, debug=False):
|
||||
found, obj = utils.find_object(obj, doc)
|
||||
if not found:
|
||||
_msg("obj: {}".format(obj_str))
|
||||
_err(_tr("Wrong input: object not in document."))
|
||||
_err(translate("draft", "Wrong input: object not in document."))
|
||||
return None
|
||||
|
||||
if debug:
|
||||
@@ -735,7 +735,7 @@ def get_bbox(obj, debug=False):
|
||||
if (not hasattr(obj, "ViewObject")
|
||||
or not obj.ViewObject
|
||||
or not hasattr(obj.ViewObject, "RootNode")):
|
||||
_err(_tr("Does not have 'ViewObject.RootNode'."))
|
||||
_err(translate("draft", "Does not have 'ViewObject.RootNode'."))
|
||||
|
||||
# For Draft Dimensions
|
||||
# node = obj.ViewObject.Proxy.node
|
||||
|
||||
Reference in New Issue
Block a user