YaST2 Developers Documentation: Progress

Progress

modules/Progress.ycp
Progress bar
  • Petr Blahos

This module has an unstable interface.

Functions for progress bar.
 Dialog Title

 [x] Stage 1
 [x] Stage 2
  => Stage 3
  -  Stage 4
  -  Stage 5

 Progress Title
 [============================90%=======================------]

 
Example of progress bar usage (don't forget the translation marks in your code): Progress bar supposes main wizard dialog is created.
 Progress::Simple ("Some progress bar", "Progress runs here...", 3, "");
 Progress::NextStep (); // the 1st one does nothing!
 Progress::NextStep ();
 Progress::NextStep ();
 Progress::NextStep ();
Another example:
 Progress::New ("Complex progress bar", " ", 100, [
      "Stage1", "Stage2", "Stage3",
      ], [
      "Stage 1 ...", "Stage 2 ...", "Stage 3 ...", "Finished",
      ], "Help text");
 Progress::NextStage ();
 Progress::NextStageStep (20);
 Progress::Stage (0, "I am back", 2);
 Progress::Title ("Still in stage 0");
 Progress::NextStageStep (90);
 Progress::Finish ();
It is possible to add a detailed subprogress above the main progress bar:
 // create a standard progress
 Progress::New(...);

 // add a subprogress with 42 steps
 Progress::SubprogressType(`progress, 42);
 Progress::SubprogressTitle("Subprogress label");

 // set the subprogress value
 Progress::SubprogressValue(12);
 Progress::SubprogressValue(24);

 // remove the subprogress (it's only for the current task/stage)
 Progress::SubprogressType(`none, nil);

 // next stage
 Progress::NextStage();
 
See also hand made documentation. Progress.html

Imports

  • CommandLine
  • Directory
  • FileUtils
  • Mode
  • Wizard

Structures

Global Functions

Local Functions

global set (boolean state) -> boolean

Sets progress bar state: on = normal operation, off = All Progress:: calls return immediatelly.

Parameters:
state on or off
Return value:
previous state
global status () -> boolean

Returns currently selected visibility status of all UI-modifying Progress:: functions.

Return value:
whether the progress bar is used
See
Progress::set Progress::off Progress::on
global off () -> void

This function is deprecated. Use set instead.

Turns progress bar off. All Progress:: calls return immediatelly.

global on () -> void

This function is deprecated. Use set instead.

Turns progress bar on after calling Progress::off.

local Mark (symbol kind) -> any

Parameters:
kind `todo, `current or `done
Return value:
UI mark for stages
local MarkId (integer i) -> term

Parameters:
i stage number
Return value:
widget `id(...) for the marker
global New (string window_title, string progress_title, integer length, list<string> stg, list tits, string help_text) -> void

New complex progress bar with stages.

Parameters:
window_title title of the window
progress_title title of the progress bar. Pass at least " " (one space) if you want some progress bar title.
length number of steps. If 0, no progress bar is created, there are only stages and bottom title. THIS IS NOT NUMBER OF STAGES!
stg list of strings - stage names. If it is nil, then there are no stages.
tits Titles corresponding to stages. When stage changes, progress bar title changes to one of these titles. May be nil/empty.
help_text help text
global CurrentSubprogressType () -> symbol

Get current subprogress type

Return value:
Current type of the subprogress widget - can be `progress, `tick or `none
global SubprogressValue (integer value) -> void

Set value of the subprogress

Parameters:
value Current value of the subprogress, if a tick subprogress is running the value is ignored and the next tick is displayed
global SubprogressType (symbol type, integer max_value) -> void

Create (or remove) a new subprogress above the progress bar, can be use for detailed progress of the current task

Parameters:
type type of the subprogress widget, can be `progress (standard progress), `tick (tick progress) or `none (no subprogress, intended for removing the progress bar from the dialog)
max_value maximum value for `progress type, for the other types it is not relevant (use any integer value or nil)
global SubprogressTitle (string title) -> void

Set the label of the subprogress

Parameters:
title New label for the subprogress
global NewProgressIcons (string window_title, string progress_title, integer length, list<string> stg, list tits, string help_textmap, list <list <string> > icons_definition) -> void

Function adds icon-support to progress dialog. Parameters are the same as for Progress::New() function with one parameter added.

Structure icons_definition = $[

   [ // first 'visible'
     "/path/to/icon-highlighted.png"
     "/path/to/another-icon-highlighted.png",
   ]
   [ // then 'invisible'
     "/path/to/icon-gryscale.png",
     nil, // fallback icon will be used
   ],
 ]
Parameters:
window_title
progress_title
length
stg
tits
help_textmap
icons_definition
See
Function Progress::New()
global Simple (string window_title, string progress_title, integer length, string help_text) -> void

Create simple progress bar with no stages, only with progress bar.

Parameters:
window_title Title of the window.
progress_title Title of the progress bar.
length Number of steps.
help_text Help text.
local HighlightProgressIcon (integer step_id) -> void

Highlights a progress icon (changes the dimmed one into a normal one).

Parameters:
step_id
local UpdateProgressBar () -> void

Uses current_step

local SetProgressBarTitle (string s) -> void

the bar is either `ProgressBar or `Label

Parameters:
s title
global NextStep () -> void

Some people say it is the best operating system ever. But now to the function. Advances progress bar value by 1.

global NextStage () -> void

Advance stage, advance step by 1 and set progress bar caption to that defined in New.

global Step (integer st) -> void

Changes progress bar value to st.

Parameters:
st new value
global Stage (integer st, string title, integer step) -> void

Go to stage st, change progress bar title to title and set progress bar step to step.

Parameters:
st New stage.
title New title for progress bar. If nil, title specified in New is used.
step New step or -1 if step should not change.
global NextStageStep (integer st) -> void

Jumps to the next stage and sets step to st.

Parameters:
st new progress bar value
global Title (string t) -> void

Change progress bar title.

Parameters:
t new title. Use ""(empty string) if you want an empty progress bar.
global Finish () -> void

Moves progress bar to the end and marks all stages as completed.

global OpenSuperior (string title, list<string> stages) -> void

Creates a higher-level progress bar made of stages. Currently it is placed instead of help text.

Parameters:
title title of the progress...
stages list of stage descriptions
global CloseSuperior () -> void

Replaces stages of superior progress by an empty help text.

global StepSuperior () -> void

Make one step in a superior progress bar.