Expose getUserMacroDir to python and use in preferences.
This commit is contained in:
@@ -306,6 +306,7 @@ private:
|
||||
static PyObject* sGetExportType (PyObject *self,PyObject *args,PyObject *kwd);
|
||||
static PyObject* sGetResourceDir (PyObject *self,PyObject *args,PyObject *kwd);
|
||||
static PyObject* sGetUserAppDataDir (PyObject *self,PyObject *args,PyObject *kwd);
|
||||
static PyObject* sGetUserMacroDir (PyObject *self,PyObject *args,PyObject *kwd);
|
||||
static PyObject* sGetHomePath (PyObject *self,PyObject *args,PyObject *kwd);
|
||||
|
||||
static PyObject* sLoadFile (PyObject *self,PyObject *args,PyObject *kwd);
|
||||
|
||||
@@ -85,6 +85,8 @@ PyMethodDef Application::Methods[] = {
|
||||
"Get the root directory of all resources"},
|
||||
{"getUserAppDataDir", (PyCFunction) Application::sGetUserAppDataDir ,1,
|
||||
"Get the root directory of user settings"},
|
||||
{"getUserMacroDir", (PyCFunction) Application::sGetUserMacroDir ,1,
|
||||
"Get the directory of the user's macro directory"},
|
||||
{"getHomePath", (PyCFunction) Application::sGetHomePath ,1,
|
||||
"Get the home path, i.e. the parent directory of the executable"},
|
||||
|
||||
@@ -582,6 +584,15 @@ PyObject* Application::sGetUserAppDataDir(PyObject * /*self*/, PyObject *args,Py
|
||||
return Py::new_reference_to(user_data_dir);
|
||||
}
|
||||
|
||||
PyObject* Application::sGetUserMacroDir(PyObject * /*self*/, PyObject *args,PyObject * /*kwd*/)
|
||||
{
|
||||
if (!PyArg_ParseTuple(args, "")) // convert args: Python->C
|
||||
return NULL; // NULL triggers exception
|
||||
|
||||
Py::String user_macro_dir(Application::getUserMacroDir(),"utf-8");
|
||||
return Py::new_reference_to(user_macro_dir);
|
||||
}
|
||||
|
||||
PyObject* Application::sGetHomePath(PyObject * /*self*/, PyObject *args,PyObject * /*kwd*/)
|
||||
{
|
||||
if (!PyArg_ParseTuple(args, "")) // convert args: Python->C
|
||||
|
||||
@@ -112,7 +112,7 @@ class PathPreferences:
|
||||
@classmethod
|
||||
def macroFilePath(cls):
|
||||
grp = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Macro")
|
||||
return grp.GetString("MacroPath", FreeCAD.getUserAppDataDir())
|
||||
return grp.GetString("MacroPath", FreeCAD.getUserMacroDir())
|
||||
|
||||
@classmethod
|
||||
def searchPaths(cls):
|
||||
|
||||
Reference in New Issue
Block a user