source: orange/docs/extend-widgets/rst/progressbar.rst @ 11049:f4dd8dbc57bb

Revision 11049:f4dd8dbc57bb, 1.7 KB checked in by Miha Stajdohar <miha.stajdohar@…>, 16 months ago (diff)

From HTML to Sphinx.

RevLine 
[11049]1************
2Progress Bar
3************
4
5Widgets, where there is any chance that their operation can be
6slower than split second, should report on the progress of their
7computation. For that purpose orange widgets use progress bar
8functions, to which they report progress in terms of per-cent
9completion of the task. The progress is then either reported above the
10icon of the widget in Orange Canvas.
11
12.. image:: progressbar-canvas.png
13
14or in the title bar of the widget's window. There, Orange also
15reports on the estimated time of completion of the task:
16
17.. image:: progressbar-widget.png
18
19Class :obj:`OWWidget`, the mother class of all
20widgets, has for this purpose a set of functions, which include:
21
22<xmp class="code">
23progressBarInit()
24progressBarSet(value)
25progressBarFinished()
26</xmp>
27
28where value is any number between 0 and 100. Sometimes, like it is
29the case for our widgets, we know about the number of iterations involved in
30computation, and we would only like to advance the progress bar for
31some constant at the end of the iteration. For this, we use
32:obj:`ProgressBar` class in :obj:`OWGUI`, and the code in
33the learning curve widget described in the previous lesson that does
34it is as follows::
35
36    def getLearningCurve(self, learners):
37        pb = OWGUI.ProgressBar(self, iterations=self.steps*self.folds)
38        curve = orngTest.learningCurveN(learners, self.data,
39            folds=self.folds, proportions=self.curvePoints, callback=pb.advance)
40        pb.finish()
41        return curve
42
43:obj:`ProgressBar` class removes the need to define any
44special function to compute the percent of the task done and set the
45progress bar, and instead uses :obj:`ProgressBar`'s method
46:obj:`advance` for this purpose.
Note: See TracBrowser for help on using the repository browser.