diff --git a/Modules/Wrappers/SWIG/src/otbApplication.i b/Modules/Wrappers/SWIG/src/otbApplication.i index 3cf79c5d8991ba6e59eeb21ea75b39f6775b60f5..e8837af9e9090931ce5b760b28f6b097a3fd9565 100644 --- a/Modules/Wrappers/SWIG/src/otbApplication.i +++ b/Modules/Wrappers/SWIG/src/otbApplication.i @@ -271,8 +271,10 @@ public: logger = self.GetLogger() logger.AddLogOutput(_libraryLogOutput.GetPointer()) + self.progressReportManager = ProgressReporterManager_New() + self.progressReportManager.SetLogOutputCallback(_libraryLogCallback) self.AddObserver(AddProcessToWatchEvent(), - _libraryProgressReportManager.GetAddProcessCommand() + self.progressReportManager.GetAddProcessCommand() ) } } @@ -743,6 +745,8 @@ class ApplicationProxy(object): key_list = [k.upper() for k in self.GetParametersKeys(True)] if name in key_list: self.SetParameterValue(name.lower(), value) + if (name == "progressReportManager"): + super().__setattr__(name, value) else: raise AttributeError("You cannot add attributes to %s" % self) diff --git a/Modules/Wrappers/SWIG/src/otbPythonLogOutput.i b/Modules/Wrappers/SWIG/src/otbPythonLogOutput.i index 748c8bfef4820b6bd9a04c6d19d8c57f61ca7a84..044942d56dfef11fef66bcc2d40fb5595097948d 100644 --- a/Modules/Wrappers/SWIG/src/otbPythonLogOutput.i +++ b/Modules/Wrappers/SWIG/src/otbPythonLogOutput.i @@ -91,9 +91,7 @@ class ProgressReporterManager: public itkObject { public: /** Default constructor */ - static ProgressReporterManager_Pointer New(); - virtual void Delete(); void DeleteWatcherList(); void SetLogOutputCallback(otb::SwigPrintCallback* callback); itkCommand* GetAddProcessCommand(); @@ -109,14 +107,10 @@ DECLARE_REF_COUNT_CLASS( ProgressReporterManager ) %pythoncode { _libraryLogOutput = PythonLogOutput_New() _libraryLogCallback = PythonPrintCallback() - _libraryProgressReportManager = ProgressReporterManager_New() - + Logger.Instance().ResetOutputs() _libraryLogOutput.SetCallback(_libraryLogCallback) Logger.Instance().AddLogOutput(_libraryLogOutput.GetPointer()) - - _libraryProgressReportManager.SetLogOutputCallback(_libraryLogCallback) - } #endif