App: [skip ci] improve whitespace

This commit is contained in:
wmayer
2022-08-08 10:11:22 +02:00
parent 7f699c3dad
commit ec72d96038
3 changed files with 22 additions and 22 deletions

View File

@@ -214,7 +214,7 @@ init_freecad_base_module(void)
}
// Set in inside Application
static PyMethodDef* __AppMethods = nullptr;
static PyMethodDef* ApplicationMethods = nullptr;
PyMODINIT_FUNC
init_freecad_module(void)
@@ -222,7 +222,7 @@ init_freecad_module(void)
static struct PyModuleDef FreeCADModuleDef = {
PyModuleDef_HEAD_INIT,
"FreeCAD", FreeCAD_doc, -1,
__AppMethods,
ApplicationMethods,
nullptr, nullptr, nullptr, nullptr
};
return PyModule_Create(&FreeCADModuleDef);
@@ -248,7 +248,7 @@ void Application::setupPythonTypes()
Base::PyGILStateLocker lock;
PyObject* modules = PyImport_GetModuleDict();
__AppMethods = Application::Methods;
ApplicationMethods = Application::Methods;
PyObject* pAppModule = PyImport_ImportModule ("FreeCAD");
if (!pAppModule) {
PyErr_Clear();

View File

@@ -45,7 +45,7 @@ using namespace App;
//**************************************************************************
// Python stuff
// Application Methods // Methods structure
// Application methods structure
PyMethodDef Application::Methods[] = {
{"ParamGet", (PyCFunction) Application::sGetParam, METH_VARARGS,
"Get parameters by path"},
@@ -125,7 +125,7 @@ PyMethodDef Application::Methods[] = {
{"activeDocument", (PyCFunction) Application::sActiveDocument, METH_VARARGS,
"activeDocument() -> object or None\n\n"
"Return the active document or None if there is no one."},
{"setActiveDocument",(PyCFunction) Application::sSetActiveDocument, METH_VARARGS,
{"setActiveDocument", (PyCFunction) Application::sSetActiveDocument, METH_VARARGS,
"setActiveDocement(string) -> None\n\n"
"Set the active document by its name."},
{"getDocument", (PyCFunction) Application::sGetDocument, METH_VARARGS,
@@ -179,13 +179,15 @@ PyMethodDef Application::Methods[] = {
"There is an active sequencer during document restore and recomputation. User may\n"
"abort the operation by pressing the ESC key. Once detected, this function will\n"
"trigger a Base.FreeCADAbort exception."},
{nullptr, nullptr, 0, nullptr} /* Sentinel */
{nullptr, nullptr, 0, nullptr} /* Sentinel */
};
PyObject* Application::sLoadFile(PyObject * /*self*/, PyObject *args)
{
char *path, *doc="",*mod="";
char *path;
char *doc="";
char *mod="";
if (!PyArg_ParseTuple(args, "s|ss", &path, &doc, &mod))
return nullptr;
try {
@@ -238,7 +240,7 @@ PyObject* Application::sOpenDocument(PyObject * /*self*/, PyObject *args, PyObje
{
char* Name;
PyObject *hidden = Py_False;
static char *kwlist[] = {"name","hidden",nullptr};
static char *kwlist[] = {"name", "hidden", nullptr};
if (!PyArg_ParseTupleAndKeywords(args, kwd, "et|O!", kwlist,
"utf-8", &Name, &PyBool_Type, &hidden))
return nullptr;
@@ -265,7 +267,7 @@ PyObject* Application::sNewDocument(PyObject * /*self*/, PyObject *args, PyObjec
char *usrName = nullptr;
PyObject *hidden = Py_False;
PyObject *temp = Py_False;
static char *kwlist[] = {"name","label","hidden","temp",nullptr};
static char *kwlist[] = {"name", "label", "hidden", "temp", nullptr};
if (!PyArg_ParseTupleAndKeywords(args, kwd, "|etetO!O!", kwlist,
"utf-8", &docName, "utf-8", &usrName, &PyBool_Type, &hidden, &PyBool_Type, &temp))
return nullptr;
@@ -419,7 +421,7 @@ PyObject* Application::sGetConfig(PyObject * /*self*/, PyObject *args)
std::map<std::string, std::string>::const_iterator it = Map.find(pstr);
if (it != Map.end()) {
return Py_BuildValue("s",it->second.c_str());
return Py_BuildValue("s", it->second.c_str());
}
else {
// do not set an error because this may break existing python code
@@ -433,8 +435,7 @@ PyObject* Application::sDumpConfig(PyObject * /*self*/, PyObject *args)
return nullptr;
PyObject *dict = PyDict_New();
for (std::map<std::string,std::string>::iterator It= GetApplication()._mConfig.begin();
It!=GetApplication()._mConfig.end();++It) {
for (auto It= GetApplication()._mConfig.begin(); It != GetApplication()._mConfig.end(); ++It) {
PyDict_SetItemString(dict,It->first.c_str(), PyUnicode_FromString(It->second.c_str()));
}
return dict;
@@ -442,9 +443,9 @@ PyObject* Application::sDumpConfig(PyObject * /*self*/, PyObject *args)
PyObject* Application::sSetConfig(PyObject * /*self*/, PyObject *args)
{
char *pstr,*pstr2;
char *pstr, *pstr2;
if (!PyArg_ParseTuple(args, "ss", &pstr,&pstr2))
if (!PyArg_ParseTuple(args, "ss", &pstr, &pstr2))
return nullptr;
GetApplication()._mConfig[pstr] = pstr2;

View File

@@ -328,7 +328,7 @@ App::DocumentObjectExecReturn *LinkBaseExtension::extensionExecute() {
PropertyPythonObject *proxy = nullptr;
if(getLinkExecuteProperty()
&& !boost::iequals(getLinkExecuteValue(), "none")
&& (!_LinkOwner.getValue()
&& (!_LinkOwner.getValue()
|| !container->getDocument()->getObjectByID(_LinkOwner.getValue())))
{
// Check if this is an element link. Do not invoke appLinkExecute()
@@ -502,7 +502,7 @@ void LinkBaseExtension::syncCopyOnChange()
auto parent = getContainer();
auto linked = linkProp->getValue();
std::vector<App::DocumentObjectT> oldObjs;
std::vector<App::DocumentObject*> objs;
@@ -540,7 +540,7 @@ void LinkBaseExtension::syncCopyOnChange()
// Obtain the original linked object and its dependency in depending order.
// The last being the original linked object.
auto srcObjs = getOnChangeCopyObjects();
// Refresh signal connection to monitor changes
// Refresh signal connection to monitor changes
monitorOnChangeCopyObjects(srcObjs);
// Copy the objects. Document::export/importObjects() (called by
@@ -656,7 +656,7 @@ void LinkBaseExtension::syncCopyOnChange()
// Finally, remove all old copies. oldObjs stores type of DocumentObjectT
// which stores the object name. Before removing, we need to make sure the
// object exists, and it is not some new object with the same name, by
// checking objs which stores DocumentObject pointer.
// checking objs which stores DocumentObject pointer.
for (const auto &objT : oldObjs) {
auto obj = objT.getObject();
if (obj && std::binary_search(objs.begin(), objs.end(), obj))
@@ -811,8 +811,7 @@ bool LinkBaseExtension::setupCopyOnChange(DocumentObject *parent, DocumentObject
return res;
}
void LinkBaseExtension::checkCopyOnChange(
App::DocumentObject *parent, const App::Property &prop)
void LinkBaseExtension::checkCopyOnChange(App::DocumentObject *parent, const App::Property &prop)
{
if(!parent || !parent->getDocument()
|| parent->getDocument()->isPerformingTransaction())
@@ -1829,8 +1828,8 @@ void LinkBaseExtension::update(App::DocumentObject *parent, const Property *prop
if (src != &obj || getLinkCopyOnChangeValue()==CopyOnChangeDisabled)
return;
if (App::Document::isAnyRestoring()
|| obj.testStatus(ObjectStatus::NoTouch)
|| (prop.getType() & Prop_Output)
|| obj.testStatus(ObjectStatus::NoTouch)
|| (prop.getType() & Prop_Output)
|| prop.testStatus(Property::Output))
return;
if (auto propTouch = getLinkCopyOnChangeTouchedProperty())