Navigation C API Pages Python bindings Applications

Progressbar widget

Progressbar is a widget that shows a progress. The progress is internally stored as a floating point number that starts at 0 and ends at max.

The value can be associated with a unit currently none, percents and seconds are supported.

Progressbar can also be set to be inverse which means that the value used for unit display will be max - val instead of val.

The default unit is percents.

A progressbar widget unit=none

Progressbar widget unit=none

A progressbar widget unit=percents

Progressbar widget unit=percents

A progressbar widget unit=seconds

Progressbar widget unit=seconds

Progress bar attributes can be accessed as widget->pbar.

Progressbar widget constructor
enum gp_widget_pbar_unit {
        GP_WIDGET_PBAR_NONE,
        GP_WIDGET_PBAR_PERCENTS,
        GP_WIDGET_PBAR_SECONDS,
        GP_WIDGET_PBAR_INVERSE = 0x80,
};

gp_widget *gp_widget_pbar_new(float val, float max, enum gp_widget_pbar_unit unit);

The unit can be bitwise ored with GP_WIDGET_PBAR_INVERSE to make the progressbar unit display inverse.

Function to set progress
void gp_widget_pbar_set(gp_widget *self, float val);

This function sets a progressbar value, i.e. the progress that is shown on a screen.

Function to set max
void gp_widget_pbar_set_max(gp_widget *self, float max)

Sets a progress bar maximum.

Table 1. Progressbar JSON attributes
Attribute Type Default Description

val

float

0

Initial value

max

float

100

Maximal value

inverse

bool

false

Inverse progress

unit

string

"percents"

Value units

Table 2. Progressbar widget events
Widget event value Description