Message_ProgressIndicator::NewScope()

Hello,

I am a new user of OpenCacade Library. I am facing an issue while using the Message_ProgressIndicator class of the library. I have overridden the Show() method in the my own child class of Message_ProgressIndicator where I get the name and position of the Message_ProgressScale using GetName() and GetPosition() respectively and use my GUI code to display the result.

I am facing problem in displaying the label text of the scope that I get from GetName() method. Everytime I call the NewScope() method (in the task whose progress I want to measure) to make a new scope, I pass a label string as well as a parameter. The problem lies in the fact that the string that I pass it never gets displayed instead the string of "Step" gets displayed all the time which is the name of the scope being set in the Reset() method that is called by default constructor of Message_Progress Indicator.

I checked the OCC library source code for NewScope and EndScope methods and found out that the call to Show() method has been commented out in NewScope method and this call is present in EndScope method which actually deletes the new scope that was created.

Can this be the source of problem? How it should be fixed? Any suggestions to display label text in an elegant way?

Please help me with this problem.

Regards,

Zia ul Azam

Benjamin Bihler's picture

Hello,

I am also interested in Message_ProgressIndicator. Is it a intensely used and thoroughly tested class? Or should I think of creating an own progress indication class that uses Message_ProgressIndicator internally only for OCCT methods?

One reason for thinking about that is the issue described by Zia. Another issue is that Message_ProgressIndicator doesn't offer a message mechanism to get more verbose messages from a long-running algorithm and to display it in an optional text widget. These messages could be stored with a severity indicator (verbose, warning, error) and then the user could open a details fold to see what the algorithm reports. Such a feature would be quite easy to add. But is Message_ProgressIndicator the right place to add it to? Does anyone use it, except ancient code?

Thank you for your answers!

Benjamin

Forum supervisor's picture

Dear by Benjamin,

Class Message_ProgressIndicator provides interface from the algorithms to actual progress indicator than must be implemented on the application side. We consider this interface as stable; it is successfully used in many projects. On the other side, it has known drawbacks; one is that its usage is not quite clear and must be better documented; another is absence of support of multithreaded algorithms. These drawbacks still have to be addressed. Regarding messages output by the algorithms, we have different interface for that: see classes Message_Messenger (tool), Message_Printer (customizable output target), and method Message::DefaultMessenger() returning instance of the tool used by default. Note that this interface is not perfect either, and some tools use alternative mechanisms, see e.g. ShapeExtend_MsgRegistrator class for one example.

Best regards
FSR

 

Forum supervisor's picture

Dear Zia ul Azam,

Probably method Show() is commented out in NewScope() by mistake.
As a work-around, Show() can be called.

Best regards

FSR