Class P4.Progress

Description

The P4.Progress class is a handler class that provides access to progress indicators from the server. After defining the progress class, set P4.progress to an instance of a subclass of P4.Progress, or pass the progress indicator as a named parameter for one statement only.

You must implement all five of the following methods: init(), setDescription(), update(), setTotal(), and done(), even if the implementation consists of trivially returning 0.

Instance Attributes

None.

Class Methods

class MyProgress( P4.Progress )

Constructs a new subclass of P4.Progress.

Progress.init(type)

Where type is one of the following: 1=TYPE_COMPUTATION, 2=TYPE_RECEIVEFILE, 3=TYPE_SENDFILE, 4=TYPE_TRANSFER

Progress.setDescription(description, units)

Where description is a text description and units is one of the following: 1=UNIT_PERCENT, 2=UNIT_FILES, 3=UNIT_KBYTES, 4=UNIT_MBYTES

Progress.update(position)

Set current position, if position is non-zero, the user has requested a cancellation

Progress.setTotal(total)

Set the total

Progress.done(fail)

Called when progress is complete, the "fail" parameter will be set if the operation has failed.

Instance Methods

progress.init() -> int

Initialize progress indicator.

progress.setDescription( string, int ) -> int

Description and type of units to be used for progress reporting.

progress.update() -> int

If non-zero, user has requested a cancellation of the operation.

progress.setTotal( <total> ) -> int

Total number of units expected (if known).

progress.done() -> int

If non-zero, operation has failed.