Progress Indication Suggestions Wanted

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
User avatar
wandererfan
Veteran
Posts: 6268
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Progress Indication Suggestions Wanted

Post by wandererfan »

Looking for suggestions on how to let user know that FreeCAD is still alive during long OCC hidden line removal processing.

The long processing takes place in HLRBRep_Algo::Hide(), so there aren't any convenient steps to use Base::ProgressBar.

AFAICT HLRBrep_Algo does not implement OCC's Message_ProgressIndicator, so no help there. Maybe a change request to OCC?

The only thing I've come up with so far is a QTimer that pops up every n seconds to update a progress bar, but that feels like a hack.

Any thoughts?
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Progress Indication Suggestions Wanted

Post by Kunda1 »

ooh... i know there are some open bugs requesting this. Lemme see if I can find them and point them to this discussion :D
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
User avatar
chennes
Veteran
Posts: 3881
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: Progress Indication Suggestions Wanted

Post by chennes »

What about adding some methods to the Base::ProgressBar that implement an "unknown progress state" for the bar? Qt doesn't provide this sort of widget, so we'd have to do the drawing ourselves, but I've seen various progress bars that just bounce a box back and forth in the progress region when the actual progress isn't known.
Chris Hennes
Pioneer Library System
GitHub profile, LinkedIn profile, chrishennes.com
wmayer
Founder
Posts: 20243
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Progress Indication Suggestions Wanted

Post by wmayer »

The only thing I've come up with so far is a QTimer that pops up every n seconds to update a progress bar, but that feels like a hack
In case HLRBrep_Algo is executed in the main thread then the QTimer will be useless because the event loop won't be processed as long as the OCC algorithm is running. So, in order to make this work you should execute HLRBrep_Algo in a worker thread.

Instead of a progress bar you can use the widget StatusWidget that is prominently put into the center of the screen and there some text can be added. This might be an option if the operation only takes several seconds.

If it takes considerably longer then a "dynamic" widget is needed. It would be good if we implemented our own radial progress indicator that could be easily used inside the StatusWidget. But then of course the OCC algorithm has to be executed in a thread.
Qt doesn't provide this sort of widget
https://doc.qt.io/qt-5/qprogressbar.html#setRange
Post Reply