Modified the macro so the WorkFeature folder can be placed somewhere else (useful for FreeCAD-addons)
This commit is contained in:
parent
f1d6aa492a
commit
d828741bbf
|
@ -6,6 +6,10 @@ try:
|
||||||
# try import
|
# try import
|
||||||
import WorkFeature.WF_2015 as WF
|
import WorkFeature.WF_2015 as WF
|
||||||
except:
|
except:
|
||||||
|
# first check if the path to WorkFeature was set in the preferences
|
||||||
|
param = FreeCAD.ParamGet('User parameter:Plugins/workfeature')
|
||||||
|
m_current_path = param.GetString('destination','')
|
||||||
|
if not m_current_path:
|
||||||
# get the path of the current python script
|
# get the path of the current python script
|
||||||
m_current_path = os.path.realpath(__file__)
|
m_current_path = os.path.realpath(__file__)
|
||||||
m_current_path = os.path.dirname(m_current_path)
|
m_current_path = os.path.dirname(m_current_path)
|
||||||
|
@ -13,6 +17,16 @@ except:
|
||||||
if not sys.path.__contains__(str(m_current_path)):
|
if not sys.path.__contains__(str(m_current_path)):
|
||||||
sys.path.append(str(m_current_path))
|
sys.path.append(str(m_current_path))
|
||||||
# retry import now
|
# retry import now
|
||||||
|
try:
|
||||||
|
import WorkFeature.WF_2015 as WF
|
||||||
|
except:
|
||||||
|
# we still cannot find WorkFeature. Ask the user
|
||||||
|
from PySide import QtGui
|
||||||
|
folderDialog = QtGui.QFileDialog.getExistingDirectory(None,QtGui.QApplication.translate("WorkFeature", "Location of your WorkFeature folder", None, QtGui.QApplication.UnicodeUTF8))
|
||||||
|
param.SetString('destination',folderDialog)
|
||||||
|
m_current_path = param.GetString('destination')
|
||||||
|
sys.path.append(str(m_current_path))
|
||||||
|
# retry import
|
||||||
import WorkFeature.WF_2015 as WF
|
import WorkFeature.WF_2015 as WF
|
||||||
|
|
||||||
WF.myDialog = WF.WorkFeatureTab()
|
WF.myDialog = WF.WorkFeatureTab()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user