YaST2 Developers Documentation: YCP UI Reference: Widgets



YCP UI Widget Reference

Back to the widget index

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

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.

Please notice that this will work only if the UI runs on the same machine as the file to download which may not taken for granted ( but which is so for most users ).

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

Arguments

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

Special Properties

string Label the label above the progress indicator
string Filename file name with full path of the file to poll
integer ExpectedSize expected final size of the file in bytes

Sample Usage

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

Examples

Example 1: DownloadProgress1.ycp


{
    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();
}
		

Back to the widget index


YaST2 Developers Documentation: YCP UI Reference: Widgets

Generated Fri May 21 12:39:01 2004