PathProfile.py: Fix non-GUI usage

The call to QtGui.QApplication.translate is not possible and necessary
without a GUI
This commit is contained in:
Lorenz Hüdepohl 2016-06-10 23:07:47 +02:00
parent a363d6ff7c
commit 7be378954e

View File

@ -33,6 +33,14 @@ if FreeCAD.GuiUp:
import FreeCADGui
from PySide import QtCore, QtGui
from DraftTools import translate
# Qt tanslation handling
try:
_encoding = QtGui.QApplication.UnicodeUTF8
def translate(context, text, disambig=None):
return QtGui.QApplication.translate(context, text, disambig, _encoding)
except AttributeError:
def translate(context, text, disambig=None):
return QtGui.QApplication.translate(context, text, disambig)
else:
def translate(ctxt, txt):
return txt
@ -43,16 +51,6 @@ __url__ = "http://www.freecadweb.org"
"""Path Profile object and FreeCAD command"""
# Qt tanslation handling
try:
_encoding = QtGui.QApplication.UnicodeUTF8
def translate(context, text, disambig=None):
return QtGui.QApplication.translate(context, text, disambig, _encoding)
except AttributeError:
def translate(context, text, disambig=None):
return QtGui.QApplication.translate(context, text, disambig)
class ObjectProfile:
def __init__(self, obj):