Author: locilka
Date: Thu Apr 17 14:00:57 2008
New Revision: 46786
URL: http://svn.opensuse.org/viewcvs/yast?rev=46786&view=rev
Log:
- Added image-downloading progress (reusing existent progress bar).
- 2.16.37
Modified:
trunk/installation/VERSION
trunk/installation/package/yast2-installation.changes
trunk/installation/src/clients/inst_deploy_image.ycp
trunk/installation/src/modules/ImageInstallation.ycp
Modified: trunk/installation/VERSION
URL: http://svn.opensuse.org/viewcvs/yast/trunk/installation/VERSION?rev=46786&r1=46785&r2=46786&view=diff
==============================================================================
--- trunk/installation/VERSION (original)
+++ trunk/installation/VERSION Thu Apr 17 14:00:57 2008
@@ -1 +1 @@
-2.16.36
+2.16.37
Modified: trunk/installation/package/yast2-installation.changes
URL: http://svn.opensuse.org/viewcvs/yast/trunk/installation/package/yast2-installation.changes?rev=46786&r1=46785&r2=46786&view=diff
==============================================================================
--- trunk/installation/package/yast2-installation.changes (original)
+++ trunk/installation/package/yast2-installation.changes Thu Apr 17 14:00:57 2008
@@ -1,4 +1,10 @@
-------------------------------------------------------------------
+Thu Apr 17 14:01:46 CEST 2008 - locilka@suse.cz
+
+- Added image-downloading progress (reusing existent progress bar).
+- 2.16.37
+
+-------------------------------------------------------------------
Wed Apr 16 14:20:06 CEST 2008 - locilka@suse.cz
- Running runlevel proposal after software proposal (bnc #380141).
Modified: trunk/installation/src/clients/inst_deploy_image.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/installation/src/clients/inst_deploy_image.ycp?rev=46786&r1=46785&r2=46786&view=diff
==============================================================================
--- trunk/installation/src/clients/inst_deploy_image.ycp (original)
+++ trunk/installation/src/clients/inst_deploy_image.ycp Thu Apr 17 14:00:57 2008
@@ -4,6 +4,7 @@
import "Progress";
import "Wizard";
import "SourceManager";
+import "String";
textdomain "installation";
@@ -46,6 +47,25 @@
);
}
+integer _last_download_progress = -1;
+
+boolean MyProgressDownloadHandler (integer percent, integer bps_avg, integer bps_current) {
+ // FIXME: remove this line
+ y2milestone ("PerCent: %1, AVG: %2, Spd: %3", percent, bps_avg, bps_current);
+
+ if (_last_download_progress < percent) {
+ UI::ChangeWidget (
+ `id ("one_image"), `Label,
+ sformat (_("Downloading image at speed %1/s"), String::FormatSize (bps_current))
+ );
+ UI::ChangeWidget (`id ("one_image"), `Value, percent);
+ }
+
+ _last_download_progress = percent;
+
+ return true;
+}
+
integer _last_progress = -1;
string _last_image_id = nil;
@@ -53,9 +73,10 @@
map current_image = ImageInstallation::GetCurrentImageDetails();
integer max_progress = current_image["max_progress"]:0;
- // another file
+ // another file than the previous one
if (current_image["file"]:"" != _last_image_id) {
_last_image_id = current_image["file"]:"";
+ _last_download_progress = -1;
_last_progress = -1;
}
@@ -64,16 +85,27 @@
return;
}
+ // current progress 0 - 100
integer x_progress = (100 * current_progress / max_progress);
if (x_progress > 100) x_progress = 100;
+ // reset the label
+ if (x_progress == 0) {
+ UI::ChangeWidget (`id ("one_image"), `Label, _("Deploying image..."));
+ // one image done
+ } else if (x_progress == 100) {
+ UI::ChangeWidget (`id ("one_image"), `Label, _("Image deployed"));
+ }
+
+ // set current step
if (x_progress > _last_progress) {
- UI::ChangeWidget (`id ("deploying_image"), `Value, x_progress);
+ UI::ChangeWidget (`id ("one_image"), `Value, x_progress);
_last_progress = x_progress;
}
}
ImageInstallation::SetDeployTarImageProgress (SetOneImageProgress);
+ImageInstallation::SetDownloadTarImageProgress (MyProgressDownloadHandler);
ImageInstallation::StoreAllChanges();
@@ -83,7 +115,7 @@
_("Deploying Installation Images"),
`VBox (
`ProgressBar (
- `id ("deploying_image"),
+ `id ("one_image"),
_("Deploying image..."),
100,
0
@@ -101,6 +133,7 @@
Wizard::SetTitleIcon ("yast-inst-mode");
SourceManager::InstInitSourceMoveDownloadArea();
+
ImageInstallation::DeployImages (images, Installation::destdir, SetProgress);
y2milestone ("Target image for package selector prepared");
Modified: trunk/installation/src/modules/ImageInstallation.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/installation/src/modules/ImageInstallation.ycp?rev=46786&r1=46785&r2=46786&view=diff
==============================================================================
--- trunk/installation/src/modules/ImageInstallation.ycp (original)
+++ trunk/installation/src/modules/ImageInstallation.ycp Thu Apr 17 14:00:57 2008
@@ -164,6 +164,13 @@
y2milestone ("New tar_image_progress: %1", tar_image_progress);
}
+boolean (integer, integer, integer) download_image_progress = nil;
+
+global void SetDownloadTarImageProgress (boolean (integer, integer, integer) tip) {
+ download_image_progress = tip;
+ y2milestone ("New download_image_progress: %1", download_image_progress);
+}
+
/**
* Deploy an image of the filesystem type
* @param id string the id of the image
@@ -479,8 +486,13 @@
// unregister callbacks
PackageCallbacks::RegisterEmptyProgressCallbacks();
+ // downloads details*.xml file
FillUpImagesDetails();
+ // register own callback for downloading
+ if (download_image_progress != nil)
+ Pkg::CallbackProgressDownload (download_image_progress);
+
integer num = -1;
foreach (string img, images, {
@@ -490,6 +502,10 @@
progress (num, 100);
});
+ // unregister downloading progress
+ if (download_image_progress != nil)
+ Pkg::CallbackProgressDownload (nil);
+
// reregister callbacks
PackageCallbacks::RestorePreviousProgressCallbacks();
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org