Fix non-GUI usage in BOPTools
Only define the translation related functions if the GUI is up
This commit is contained in:
parent
bf5dcbd062
commit
b6cf0e2500
|
@ -37,18 +37,18 @@ if FreeCAD.GuiUp:
|
|||
#-------------------------- translation-related code ----------------------------------------
|
||||
#(see forum thread "A new Part tool is being born... JoinFeatures!"
|
||||
#http://forum.freecadweb.org/viewtopic.php?f=22&t=11112&start=30#p90239 )
|
||||
try:
|
||||
_fromUtf8 = QtCore.QString.fromUtf8
|
||||
except Exception:
|
||||
def _fromUtf8(s):
|
||||
return s
|
||||
try:
|
||||
_encoding = QtGui.QApplication.UnicodeUTF8
|
||||
def _translate(context, text, disambig):
|
||||
return QtGui.QApplication.translate(context, text, disambig, _encoding)
|
||||
except AttributeError:
|
||||
def _translate(context, text, disambig):
|
||||
return QtGui.QApplication.translate(context, text, disambig)
|
||||
try:
|
||||
_fromUtf8 = QtCore.QString.fromUtf8
|
||||
except Exception:
|
||||
def _fromUtf8(s):
|
||||
return s
|
||||
try:
|
||||
_encoding = QtGui.QApplication.UnicodeUTF8
|
||||
def _translate(context, text, disambig):
|
||||
return QtGui.QApplication.translate(context, text, disambig, _encoding)
|
||||
except AttributeError:
|
||||
def _translate(context, text, disambig):
|
||||
return QtGui.QApplication.translate(context, text, disambig)
|
||||
#--------------------------/translation-related code ----------------------------------------
|
||||
|
||||
def getIconPath(icon_dot_svg):
|
||||
|
|
Loading…
Reference in New Issue
Block a user