source: orange/orange/doc/extend-widgets/progressbar.htm @ 9398:a6b3d9c13ee0

Revision 9398:a6b3d9c13ee0, 1.9 KB checked in by mitar, 2 years ago (diff)

Renaming documentation for widgets developers.

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