My python application consists of various separate processing algorithms/modules combined within a single (Py)Qt GUI for ease of access.
Every processing algorithm sits within its own module and all the communication with GUI elements is implemented within a single class in the main module.
In particular, this GUI class has a progressbar (QProgressBar) object designed to represent the current processing progress of a chosen algorithm.
This object has .setValue()
method (self.dlg.progressBar.setValue(int)
).
The problem is that since self.dlg.progressBar.setValue()
is a class method I cannot use it inside my imported processing modules to report their progress state within their own code.
The only workaround I found is to add progressbar
variable to definition of each processing module, pass there self.dlg.progressBar
inside the main module and then blindly call progressbar.setValue(%some_processing_var%)
inside the processing module.
Is this the only way to use outer class methods inside imported modules or are there better ways?