summaryrefslogtreecommitdiff
path: root/docs/reference/pygtk-gtkprogressbar.xml
blob: ad140ca8bf25845a8b4afe52e940949f0f84f731 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
<?xml version="1.0" standalone="no"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
    "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">

<refentry id="class-gtkprogressbar">
  <refnamediv>
    <refname>gtk.ProgressBar</refname>
    <refpurpose>a widget which indicates progress visually.</refpurpose>
  </refnamediv>

  <refsect1>
    <title>Synopsis</title>

    <classsynopsis language="python">
      <ooclass><classname>gtk.ProgressBar</classname></ooclass>
      <ooclass><classname><link
linkend="class-gtkprogress">gtk.Progress</link></classname></ooclass>
      <constructorsynopsis language="python">
	<methodname><link
linkend="constructor-gtkprogressbar">gtk.ProgressBar</link></methodname>
	<methodparam></methodparam>
      </constructorsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-gtkprogressbar--pulse">pulse</link></methodname>
	<methodparam></methodparam>  </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-gtkprogressbar--set-text">set_text</link></methodname>
	<methodparam><parameter
		       role="keyword">text</parameter></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-gtkprogressbar--set-fraction">set_fraction</link></methodname>
	<methodparam><parameter
		       role="keyword">fraction</parameter></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-gtkprogressbar--set-pulse-step">set_pulse_step</link></methodname>
	<methodparam><parameter
		       role="keyword">fraction</parameter></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-gtkprogressbar--set-orientation">set_orientation</link></methodname>
	<methodparam><parameter
		       role="keyword">orientation</parameter></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-gtkprogressbar--get-text">get_text</link></methodname>
	<methodparam></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-gtkprogressbar--get-fraction">get_fraction</link></methodname>
	<methodparam></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-gtkprogressbar--get-pulse-step">get_pulse_step</link></methodname>
	<methodparam></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-gtkprogressbar--get-orientation">get_orientation</link></methodname>
	<methodparam></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-gtkprogressbar--set-ellipsize">set_ellipsize</link></methodname>
	<methodparam><parameter
		       role="keyword">mode</parameter></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-gtkprogressbar--get-ellipsize">get_ellipsize</link></methodname>
	<methodparam></methodparam>
      </methodsynopsis>
    </classsynopsis>

  </refsect1>

  <refsect1>
    <title>Ancestry</title>

<synopsis>+-- <link linkend="class-gobject">gobject.GObject</link>
  +-- <link linkend="class-gtkobject">gtk.Object</link>
    +-- <link linkend="class-gtkwidget">gtk.Widget</link>
      +-- <link linkend="class-gtkprogress">gtk.Progress</link>
        +-- <link linkend="class-gtkprogressbar">gtk.ProgressBar</link>
</synopsis>

  </refsect1>
  
  <refsect1>
		<title>Implemented Interfaces</title>
		<para>
			<link linkend="class-gtkprogressbar"><classname>gtk.ProgressBar</classname></link>
			implements 
			<link linkend="class-gtkbuildable"><classname>gtk.Buildable</classname></link>
		</para>
	</refsect1>


  <refsect1 id="properties-gtkprogressbar">
    <title>gtk.ProgressBar Properties</title>

    <para><link linkend="properties-gtkobject">gtk.Object Properties</link></para>
    <para><link linkend="properties-gtkwidget">gtk.Widget Properties</link></para>
    <para><link linkend="properties-gtkprogress">gtk.Progress Properties</link></para>

    <blockquote role="properties">
      <informaltable pgwide="1" frame="none">
	<tgroup cols="3">
	  <colspec column="1" colwidth="1in"/>
	  <colspec column="2" colwidth="1in"/>
	  <colspec column="3" colwidth="4in"/>
	  <tbody>

        <row valign="top">
          <entry>"discrete-blocks"</entry>
          <entry>Read-Write</entry>
          <entry>The number of discrete blocks in a progress bar (when shown
          in the discrete style)</entry>
        </row>

        <row valign="top">
          <entry>"ellipsize"</entry>
          <entry>Read-Write</entry>
          <entry>The preferred place to ellipsize the string, if the
          progressbar does not have enough room to display the entire
          string, specified as one of the <xref
          linkend="pango-ellipsize-mode-constants"
          endterm="pango-ellipsize-mode-constants-title"></xref>.  Note that
          setting this property to a value other than
          <literal>pango.ELLIPSIZE_NONE</literal> has the side-effect that
          the progressbar requests only enough space to display the ellipsis
          "...". Another means to set a progressbar's width is the <link
          linkend="method-gtkwidget--set-size-request"><methodname>gtk.Widget.set_size_request()</methodname></link>.
          This property is available in GTK+ 2.6 and above.</entry>
        </row>

	    <row valign="top">
	      <entry>"fraction"</entry>
	      <entry>Read-Write</entry>
	      <entry>The fraction of total work that has been completed</entry>
	    </row>

	    <row valign="top">
	      <entry>"orientation"</entry>
	      <entry>Read-Write</entry>
	      <entry>The orientation and growth direction of the progress
bar - one of the <xref
linkend="gtk-progressbar-orientation-constants"
endterm="gtk-progressbar-orientation-constants-title"></xref>:
<literal>gtk.PROGRESS_LEFT_TO_RIGHT</literal>,
<literal>gtk.PROGRESS_RIGHT_TO_LEFT</literal>,
<literal>gtk.PROGRESS_BOTTOM_TO_TOP</literal>,
<literal>gtk.PROGRESS_TOP_TO_BOTTOM</literal></entry>
	    </row>

	    <row valign="top">
	      <entry>"pulse-step"</entry>
	      <entry>Read-Write</entry>
	      <entry>The fraction of total progress to move the bouncing
block when pulsed</entry>
	    </row>

	    <row valign="top">
	      <entry>"text"</entry>
	      <entry>Read-Write</entry>
	      <entry>The text to be displayed in the progress bar</entry>
	    </row>

	  </tbody>
	</tgroup>
      </informaltable>
    </blockquote>

  </refsect1>

  <refsect1 id="style-properties-gtkprogressbar">
    <title>gtk.ProgressBar Style Properties</title>

    <para><link linkend="style-properties-gtkwidget">gtk.Widget Style Properties</link></para>
    
    <blockquote role="properties">
      <informaltable pgwide="1" frame="none">
	<tgroup cols="3">
	  <colspec column="1" colwidth="1in"/>
	  <colspec column="2" colwidth="1in"/>
	  <colspec column="3" colwidth="4in"/>
	  <tbody>

	    <row valign="top">
	      <entry>"min-horizontal-bar-height"</entry>
	      <entry>Read</entry>
	      <entry>
		Minimum horizontal height of the progress bar.
		Allowed values: >= 1. Default value: 20.
		Available in GTK+ 2.14 and above.
	      </entry>
	    </row>

	    <row valign="top">
	      <entry>"min-horizontal-bar-width"</entry>
	      <entry>Read</entry>
	      <entry>
		The minimum horizontal width of the progress bar.
		Allowed values: >= 1. Default value: 150.
		Available in GTK+ 2.14 and above.
	      </entry>
	    </row>

	    <row valign="top">
	      <entry>"min-vertical-bar-height"</entry>
	      <entry>Read</entry>
	      <entry>
		The minimum vertical height of the progress bar.
		Allowed values: >= 1. Default value: 80.
		Available in GTK+ 2.14 and above.
	      </entry>
	    </row>

	    <row valign="top">
	      <entry>"min-vertical-bar-width"</entry>
	      <entry>Read</entry>
	      <entry>
		The minimum vertical width of the progress bar.
		Allowed values: >= 1. Default value: 22.
		Available in GTK+ 2.14 and above.
	      </entry>
	    </row>

	    <row valign="top">
	      <entry>"xspacing"</entry>
	      <entry>Read</entry>
	      <entry>
		Extra spacing applied to the width of a progress bar.
		Allowed values: >= 0. Default value: 7.
	      </entry>
	    </row>

	    <row valign="top">
	      <entry>"yspacing"</entry>
	      <entry>Read</entry>
	      <entry>
		Extra spacing applied to the width of a progress bar.
		Allowed values: >= 0. Default value: 7.
	      </entry>
	    </row>

	  </tbody>
	</tgroup>
      </informaltable>
    </blockquote>
  </refsect1>

  <refsect1 id="signal-prototypes-gtkprogressbar">
    <title>gtk.ProgressBar Signal Prototypes</title>

    <para><link linkend="signal-prototypes-gobject">gobject.GObject Signal Prototypes</link></para>
    <para><link linkend="signal-prototypes-gtkobject">gtk.Object Signal Prototypes</link></para>
    <para><link linkend="signal-prototypes-gtkwidget">gtk.Widget Signal Prototypes</link></para>
  </refsect1>

  <refsect1>
    <title>Description</title>

    <para>The <link
linkend="class-gtkprogressbar"><classname>gtk.ProgressBar</classname></link>
is typically used to display the progress of a long running operation. It
provides a visual clue that processing is underway. The <link
linkend="class-gtkprogressbar"><classname>gtk.ProgressBar</classname></link>
can be used in two different modes: percentage mode and activity
mode.</para>

    <para>When an application can determine how much work needs to take
place (e.g. read a fixed number of bytes from a file) and can monitor its
progress, it can use the <link
linkend="class-gtkprogressbar"><classname>gtk.ProgressBar</classname></link>
in percentage mode and the user sees a growing bar indicating the percentage
of the work that has been completed. In this mode, the application is
required to call the <link
linkend="method-gtkprogressbar--set-fraction"><methodname>set_fraction</methodname>()</link> 
method periodically to update the progress bar.</para>

    <para>When an application has no accurate way of knowing the amount of
work to do, it can use the <link
linkend="class-gtkprogressbar"><classname>gtk.ProgressBar</classname></link>
in activity mode, which shows activity by a block moving back and forth
within the progress area. In this mode, the application is required to call
the <link
linkend="method-gtkprogressbar--pulse"><methodname>pulse</methodname>()</link> 
method periodically to update the progress bar.</para>

    <para>There is quite a bit of flexibility provided to control the
appearance of the <link
linkend="class-gtkprogressbar"><classname>gtk.ProgressBar</classname></link>. 
Methods are provided to control the orientation of the bar, optional text
can be displayed along with the bar, and the step size used in activity mode
can be set.</para>

  </refsect1>

  <refsect1 id="constructor-gtkprogressbar">
    <title>Constructor</title>

<programlisting><constructorsynopsis language="python">
    <methodname>gtk.ProgressBar</methodname>
    <methodparam></methodparam>
  </constructorsynopsis></programlisting>
  <variablelist>
    <varlistentry>
      <term><emphasis>Returns</emphasis>&nbsp;:</term>
      <listitem><simpara>a new <link
linkend="class-gtkprogressbar"><classname>gtk.ProgressBar</classname></link>
widget</simpara></listitem>
    </varlistentry>
  </variablelist>

    <para>Creates a new <link
linkend="class-gtkprogressbar"><classname>gtk.Progressbar</classname></link>
widget.</para>

  </refsect1>

  <refsect1>
    <title>Methods</title>

    <refsect2 id="method-gtkprogressbar--pulse">
      <title>gtk.ProgressBar.pulse</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>pulse</methodname>
	  <methodparam></methodparam>  </methodsynopsis></programlisting>

      <para>The <methodname>pulse</methodname>() method nudges the
progressbar to indicate that some progress has been made, but you don't know
how much. This method also changes progress bar mode to "activity mode,"
where a block bounces back and forth. Each call to the <link
linkend="method-gtkprogressbar--pulse"><methodname>pulse</methodname>()</link> 
method causes the block to move by a little bit (the amount of movement per
pulse is determined by the <link
linkend="method-gtkprogressbar--set-pulse-step"><methodname>set_pulse_step</methodname>()</link> 
method).</para>

    </refsect2>

    <refsect2 id="method-gtkprogressbar--set-text">
      <title>gtk.ProgressBar.set_text</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>set_text</methodname>
	  <methodparam><parameter
			 role="keyword">text</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">text</parameter>&nbsp;:</term>
	  <listitem><simpara>a UTF-8 string</simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <methodname>set_text</methodname>() method superimposes the
text specified by <parameter>text</parameter> on the progress bar.</para>

    </refsect2>

    <refsect2 id="method-gtkprogressbar--set-fraction">
      <title>gtk.ProgressBar.set_fraction</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>set_fraction</methodname>
	  <methodparam><parameter
			 role="keyword">fraction</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">fraction</parameter>&nbsp;:</term>
	  <listitem><simpara>the fraction of the task that's been
completed</simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <methodname>set_fraction</methodname>() method causes the
progress bar to "fill in" the portion of the bar specified by
<parameter>fraction</parameter>. The value of
<parameter>fraction</parameter> should be between 0.0 and 1.0.</para>

    </refsect2>

    <refsect2 id="method-gtkprogressbar--set-pulse-step">
      <title>gtk.ProgressBar.set_pulse_step</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>set_pulse_step</methodname>
	  <methodparam><parameter
			 role="keyword">fraction</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">fraction</parameter>&nbsp;:</term>
	  <listitem><simpara>a value between 0.0 and
1.0</simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <methodname>set_pulse_step</methodname>() method sets the
portion (specified by <parameter>fraction</parameter>) of the total progress
bar length to move the bouncing block for each call to the <link
linkend="method-gtkprogressbar--pulse"><methodname>pulse</methodname>()</link> 
method.</para>

    </refsect2>

    <refsect2 id="method-gtkprogressbar--set-orientation">
      <title>gtk.ProgressBar.set_orientation</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>set_orientation</methodname>
	  <methodparam><parameter
			 role="keyword">orientation</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter
role="keyword">orientation</parameter>&nbsp;:</term>
	  <listitem><simpara>the orientation of the progress
bar</simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <methodname>set_orientation</methodname>() method switches
the progress bar to a different orientation as specified by the value of
<parameter>orientation</parameter>. The value of
<parameter>orientation</parameter> must be one of the <xref
linkend="gtk-progressbar-orientation-constants"
endterm="gtk-progressbar-orientation-constants-title"></xref>.</para>

    </refsect2>

    <refsect2 id="method-gtkprogressbar--get-text">
      <title>gtk.ProgressBar.get_text</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>get_text</methodname>
	  <methodparam></methodparam>  </methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara>the text, or
<literal>None</literal></simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <methodname>get_text</methodname>() method returns the text
superimposed on the progress bar. If there is no superimposed text this
method returns <literal>None</literal>.</para>

    </refsect2>

    <refsect2 id="method-gtkprogressbar--get-fraction">
      <title>gtk.ProgressBar.get_fraction</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>get_fraction</methodname>
	  <methodparam></methodparam>  </methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara>a fraction from 0.0 to 1.0</simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <methodname>get_fraction</methodname>() method returns the
current fraction of the task that's been set by the <link
linkend="method-gtkprogressbar--set-fraction"><methodname>set_fraction</methodname>()</link> 
method .</para>

    </refsect2>

    <refsect2 id="method-gtkprogressbar--get-pulse-step">
      <title>gtk.ProgressBar.get_pulse_step</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>get_pulse_step</methodname>
	  <methodparam></methodparam>  </methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara>a fraction from 0.0 to 1.0</simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <methodname>get_pulse_step</methodname>() method returns the
pulse step set with the <link
linkend="method-gtkprogressbar--set-pulse-step"><methodname>set_pulse_step</methodname>()</link>.</para>

    </refsect2>

    <refsect2 id="method-gtkprogressbar--get-orientation">
      <title>gtk.ProgressBar.get_orientation</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>get_orientation</methodname>
	  <methodparam></methodparam>  </methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara>the orientation of the progress
bar</simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <methodname>get_orientation</methodname>() method returns
the current progress bar orientation. See the <link
linkend="method-gtkprogressbar--set-orientation"><methodname>set_orientation</methodname>()</link>
method for information about the orientation values.</para>

    </refsect2>

    <refsect2 id="method-gtkprogressbar--set-ellipsize">
      <title>gtk.ProgressBar.set_ellipsize</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>set_ellipsize</methodname>
	  <methodparam><parameter
			 role="keyword">mode</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter
role="keyword">mode</parameter>&nbsp;:</term>
	  <listitem><simpara>one of the <xref
linkend="pango-ellipsize-mode-constants"
endterm="pango-ellipsize-mode-constants-title"></xref></simpara></listitem>
	</varlistentry>
      </variablelist>

    <note>
      <para>This method is available in PyGTK 2.6 and above.</para>
    </note>

      <para>The <methodname>set_ellipsize</methodname>() method sets the
mode used to ellipsize (add an ellipsis "...") the text if there is not
enough space to render the entire string to the value specified by
<parameter>mode</parameter>. <parameter>mode</parameter> must be one of the
<xref linkend="pango-ellipsize-mode-constants"
endterm="pango-ellipsize-mode-constants-title"></xref></para>

    </refsect2>

    <refsect2 id="method-gtkprogressbar--get-ellipsize">
      <title>gtk.ProgressBar.get_ellipsize</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>get_ellipsize</methodname>
	  <methodparam></methodparam>
        </methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara>the mode used to ellipsize
text</simpara></listitem>
	</varlistentry>
      </variablelist>

    <note>
      <para>This method is available in PyGTK 2.6 and above.</para>
    </note>

      <para>The <methodname>get_ellipsize</methodname>() method returns the
mode used to ellipsize text when there is not enough space. See the <link
linkend="method-gtkprogressbar--set-ellipsize"><methodname>set_ellipsize</methodname>()</link>
method for information.</para>

    </refsect2>

  </refsect1>

</refentry>