[packagekit] how make a percercent on downloading ....

Richard Hughes hughsient at gmail.com
Fri Feb 13 01:45:47 PST 2009


On Fri, 2009-02-13 at 02:29 -0600, zodman wrote:
> How can i make a bar percent for represent  the download of changeset
> some like:
> DownloadFiles [ ==========          ]  #%%

Okay, PackageKit doesn't really have the notion of percentage-tasks.
PackageKit has three concepts:

* StatusChanged (tell the UI what you are doing)
* PercentageChanged (including all the operations of the transactions)
* SubPercentageChanged (which is a small part of the transaction, e.g.
downloading)

Percentage is what we show on the UI, and also what we use for the time
estimation, so it's important you use that too.

What you should be doing is something like this:

PC 0
STATUS downloading
SPC 0
SPC 10
SPC 50
PC 25
SPC 80
SPC 100
STATUS installing
SPC 0
SPC 10
PC 50
SPC 50
SPC 80
SPC 100
STATUS cleaning up
SPC 0
SPC 50
PC 75
SPC 100
PC 100

Now, a sub task doesn't have to be "download everything", a sub-task can
be download package A, and another sub-task for download package B.
PackageKit doesn't define what a sub task it, as that would be different
for all the backends.

You should also try to do as many PercentageChanged events as possible,
as this makes the time remaining calculations more accurate, and also
makes the progress bar move smoothly from left to right without
stopping.

Richard.





More information about the PackageKit mailing list