Name

DownloadProgress — Self-polling file growth progress indicator (optional widget)

Synopsis

DownloadProgress ( string label ,
  string filename ,
  integer expectedSize );
 

Parameters

string label

label above the indicator

string filename

file name with full path of the file to poll

integer expectedSize

expected final size of the file in bytes

Description

This widget automatically displays the progress of a lengthy download operation. The widget itself (i.e. the UI) polls the specified file and automatically updates the display as required even if the download is taking place in the foreground.

[Note]Note

This is a "special" widget, i.e. not all UIs necessarily support it. Check for availability with HasSpecialWidget( `DownloadProgress ) before using it.

Usage

 	if ( HasSpecialWidget( `DownloadProgress ) {...
 	`DownloadProgress( "Base system (230k)", "/tmp/aaa_base.rpm", 230*1024 );
 

Examples

          {
    if ( ! UI::HasSpecialWidget(`DownloadProgress) )
    {
	UI::OpenDialog(
		   `VBox( 
			 `Label("Error: This UI doesn't support the DownloadProgress widget!"),
			 `PushButton(`opt(`default), "&OK")
			 )
		   );
	UI::UserInput();
	UI::CloseDialog();
	
	return;
    }

    string  filename = "/suse/sh/.y2log";
    // string  filename = "/var/log/y2log";
    integer expected_size = 20 * 1024;

    UI::OpenDialog(
	       `VBox(
		     `DownloadProgress("YaST2 log file", filename, expected_size ),
		     `HSpacing(50), // force width
		     `PushButton(`opt(`default), "&Close")
		     )
	       );
    UI::UserInput();
    UI::CloseDialog();
}