diff --git a/src/App/Application.cpp b/src/App/Application.cpp
index 68f1040362..8e89022a06 100644
--- a/src/App/Application.cpp
+++ b/src/App/Application.cpp
@@ -71,8 +71,8 @@
#include
#include
#include
+#include
#include
-#include
#include
#include
#include
diff --git a/src/Base/CMakeLists.txt b/src/Base/CMakeLists.txt
index 7d71991f4a..78cf4ef167 100644
--- a/src/Base/CMakeLists.txt
+++ b/src/Base/CMakeLists.txt
@@ -247,6 +247,7 @@ SET(FreeCADBase_CPP_SRCS
Placement.cpp
PlacementPyImp.cpp
PrecisionPyImp.cpp
+ ProgressIndicatorPy.cpp
PyExport.cpp
PyObjectBase.cpp
QtTools.cpp
@@ -313,6 +314,7 @@ SET(FreeCADBase_HPP_SRCS
Persistence.h
Placement.h
Precision.h
+ ProgressIndicatorPy.h
PyExport.h
PyObjectBase.h
QtTools.h
diff --git a/src/Base/ProgressIndicatorPy.cpp b/src/Base/ProgressIndicatorPy.cpp
new file mode 100644
index 0000000000..fb88d7d709
--- /dev/null
+++ b/src/Base/ProgressIndicatorPy.cpp
@@ -0,0 +1,95 @@
+/***************************************************************************
+ * Copyright (c) 2004 Werner Mayer *
+ * *
+ * This file is part of the FreeCAD CAx development system. *
+ * *
+ * This library is free software; you can redistribute it and/or *
+ * modify it under the terms of the GNU Library General Public *
+ * License as published by the Free Software Foundation; either *
+ * version 2 of the License, or (at your option) any later version. *
+ * *
+ * This library is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU Library General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Library General Public *
+ * License along with this library; see the file COPYING.LIB. If not, *
+ * write to the Free Software Foundation, Inc., 59 Temple Place, *
+ * Suite 330, Boston, MA 02111-1307, USA *
+ * *
+ ***************************************************************************/
+
+
+#include "PreCompiled.h"
+
+#include "ProgressIndicatorPy.h"
+
+
+using namespace Base;
+
+void ProgressIndicatorPy::init_type()
+{
+ behaviors().name("ProgressIndicator");
+ behaviors().doc("Progress indicator");
+ // you must have overwritten the virtual functions
+ behaviors().supportRepr();
+ behaviors().supportGetattr();
+ behaviors().supportSetattr();
+ behaviors().set_tp_new(PyMake);
+
+ add_varargs_method("start",&ProgressIndicatorPy::start,"start(string,int)");
+ add_varargs_method("next",&ProgressIndicatorPy::next,"next()");
+ add_varargs_method("stop",&ProgressIndicatorPy::stop,"stop()");
+}
+
+PyObject *ProgressIndicatorPy::PyMake(struct _typeobject *, PyObject *, PyObject *)
+{
+ return new ProgressIndicatorPy();
+}
+
+ProgressIndicatorPy::ProgressIndicatorPy() = default;
+
+ProgressIndicatorPy::~ProgressIndicatorPy() = default;
+
+Py::Object ProgressIndicatorPy::repr()
+{
+ std::string s = "Base.ProgressIndicator";
+ return Py::String(s);
+}
+
+Py::Object ProgressIndicatorPy::start(const Py::Tuple& args)
+{
+ char* text;
+ unsigned int steps;
+ if (!PyArg_ParseTuple(args.ptr(), "sI",&text,&steps))
+ throw Py::Exception();
+ if (!_seq.get())
+ _seq.reset(new SequencerLauncher(text,steps));
+ return Py::None();
+}
+
+Py::Object ProgressIndicatorPy::next(const Py::Tuple& args)
+{
+ int b=0;
+ if (!PyArg_ParseTuple(args.ptr(), "|i",&b))
+ throw Py::Exception();
+ if (_seq.get()) {
+ try {
+ _seq->next(b ? true : false);
+ }
+ catch (const Base::AbortException&) {
+ _seq.reset();
+ throw Py::RuntimeError("abort progress indicator");
+ }
+ }
+ return Py::None();
+}
+
+Py::Object ProgressIndicatorPy::stop(const Py::Tuple& args)
+{
+ if (!PyArg_ParseTuple(args.ptr(), ""))
+ throw Py::Exception();
+ _seq.reset();
+ return Py::None();
+}
diff --git a/src/Base/ProgressIndicatorPy.h b/src/Base/ProgressIndicatorPy.h
new file mode 100644
index 0000000000..556fc97bdc
--- /dev/null
+++ b/src/Base/ProgressIndicatorPy.h
@@ -0,0 +1,57 @@
+/***************************************************************************
+ * Copyright (c) 2022 Werner Mayer *
+ * *
+ * This file is part of the FreeCAD CAx development system. *
+ * *
+ * This library is free software; you can redistribute it and/or *
+ * modify it under the terms of the GNU Library General Public *
+ * License as published by the Free Software Foundation; either *
+ * version 2 of the License, or (at your option) any later version. *
+ * *
+ * This library is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU Library General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Library General Public *
+ * License along with this library; see the file COPYING.LIB. If not, *
+ * write to the Free Software Foundation, Inc., 59 Temple Place, *
+ * Suite 330, Boston, MA 02111-1307, USA *
+ * *
+ ***************************************************************************/
+
+
+#ifndef BASE_PROGRESSINDICATORPY_H
+#define BASE_PROGRESSINDICATORPY_H
+
+#include
+#include
+#include
+
+namespace Base
+{
+
+class BaseExport ProgressIndicatorPy : public Py::PythonExtension
+{
+public:
+ static void init_type(); // announce properties and methods
+
+ ProgressIndicatorPy();
+ ~ProgressIndicatorPy() override;
+
+ Py::Object repr() override;
+
+ Py::Object start(const Py::Tuple&);
+ Py::Object next(const Py::Tuple&);
+ Py::Object stop(const Py::Tuple&);
+
+private:
+ static PyObject *PyMake(struct _typeobject *, PyObject *, PyObject *);
+
+private:
+ std::unique_ptr _seq;
+};
+
+} // namespace Base
+
+#endif // BASE_PROGRESSINDICATORPY_H
diff --git a/src/Base/Sequencer.cpp b/src/Base/Sequencer.cpp
index 9c0bace609..75459c7737 100644
--- a/src/Base/Sequencer.cpp
+++ b/src/Base/Sequencer.cpp
@@ -287,71 +287,3 @@ bool SequencerLauncher::wasCanceled() const
{
return SequencerBase::Instance().wasCanceled();
}
-
-// ---------------------------------------------------------
-
-void ProgressIndicatorPy::init_type()
-{
- behaviors().name("ProgressIndicator");
- behaviors().doc("Progress indicator");
- // you must have overwritten the virtual functions
- behaviors().supportRepr();
- behaviors().supportGetattr();
- behaviors().supportSetattr();
- behaviors().set_tp_new(PyMake);
-
- add_varargs_method("start",&ProgressIndicatorPy::start,"start(string,int)");
- add_varargs_method("next",&ProgressIndicatorPy::next,"next()");
- add_varargs_method("stop",&ProgressIndicatorPy::stop,"stop()");
-}
-
-PyObject *ProgressIndicatorPy::PyMake(struct _typeobject *, PyObject *, PyObject *)
-{
- return new ProgressIndicatorPy();
-}
-
-ProgressIndicatorPy::ProgressIndicatorPy() = default;
-
-ProgressIndicatorPy::~ProgressIndicatorPy() = default;
-
-Py::Object ProgressIndicatorPy::repr()
-{
- std::string s = "Base.ProgressIndicator";
- return Py::String(s);
-}
-
-Py::Object ProgressIndicatorPy::start(const Py::Tuple& args)
-{
- char* text;
- unsigned int steps;
- if (!PyArg_ParseTuple(args.ptr(), "sI",&text,&steps))
- throw Py::Exception();
- if (!_seq.get())
- _seq.reset(new SequencerLauncher(text,steps));
- return Py::None();
-}
-
-Py::Object ProgressIndicatorPy::next(const Py::Tuple& args)
-{
- int b=0;
- if (!PyArg_ParseTuple(args.ptr(), "|i",&b))
- throw Py::Exception();
- if (_seq.get()) {
- try {
- _seq->next(b ? true : false);
- }
- catch (const Base::AbortException&) {
- _seq.reset();
- throw Py::RuntimeError("abort progress indicator");
- }
- }
- return Py::None();
-}
-
-Py::Object ProgressIndicatorPy::stop(const Py::Tuple& args)
-{
- if (!PyArg_ParseTuple(args.ptr(), ""))
- throw Py::Exception();
- _seq.reset();
- return Py::None();
-}
diff --git a/src/Base/Sequencer.h b/src/Base/Sequencer.h
index ae255e342d..fcb9f93376 100644
--- a/src/Base/Sequencer.h
+++ b/src/Base/Sequencer.h
@@ -24,9 +24,6 @@
#ifndef BASE_SEQUENCER_H
#define BASE_SEQUENCER_H
-#include
-#include
-
#include "Exception.h"
@@ -384,27 +381,6 @@ inline SequencerBase& Sequencer ()
return SequencerBase::Instance();
}
-class BaseExport ProgressIndicatorPy : public Py::PythonExtension
-{
-public:
- static void init_type(); // announce properties and methods
-
- ProgressIndicatorPy();
- ~ProgressIndicatorPy() override;
-
- Py::Object repr() override;
-
- Py::Object start(const Py::Tuple&);
- Py::Object next(const Py::Tuple&);
- Py::Object stop(const Py::Tuple&);
-
-private:
- static PyObject *PyMake(struct _typeobject *, PyObject *, PyObject *);
-
-private:
- std::unique_ptr _seq;
-};
-
} // namespace Base
#endif // BASE_SEQUENCER_H