DownloadProgress — Self-polling file growth progress indicator (optional widget)
DownloadProgress
( | string | label , |
string | filename , | |
integer | expectedSize
) ; |
label above the indicator
file name with full path of the file to poll
expected final size of the file in bytes
the label above the progress indicator
file name with full path of the file to poll
expected final size of the file in bytes
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. |
if ( HasSpecialWidget( `DownloadProgress ) {... `DownloadProgress( "Base system ( 230k )", "/tmp/aaa_base.rpm", 230*1024 ); |
{ 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(); } |