Helix Core is now P4. Product user interfaces will be updated soon. Learn more >>

P4 API for Python Documentation | 2025.2

# 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.

## Progress Units

Progress Unit Type | Value
--- | ---
Unspecified | `0`
Percentage Complete | `1`
Number of files | `2`
KB (1024 bytes) | `3`
MB (1024*1024 bytes) | `4`
Number of deltas | `5`

## Progress Types

The following `ProgressTypes` can be reported:

Type | Value | Meaning
--- | --- | ---
`SendFile` | `1` | Files sent to the server. This represents the source path, that is, the local path to the file being sent.
`ReceiveFile` | `2` | Files received from server. This represents the destination path, that is, the local path to the file being received.
`FilesTransferring` | `3` | Files transmitted.
`Computation` | `4` | Computation performed server-side.

For more information on progress indicators from the server see the ClientProgress documentation.

Your search for returned results