The Progress object lets you display and control a standard Directory Opus progress indicator dialog. This object can be obtained from the Command.progress property. The basic steps for using a Progress object are:
Property Name | Return Type | Description |
---|---|---|
abort |
bool |
Before calling Init, set to True if the Abort button should be available, or False to disable it. |
bytes |
bool |
Before calling Init, set to True if the dialog should show progress in bytes rather than whole files. |
delay |
bool |
Before calling Init, set to True if the dialog should delay before appearing after the Show method is called. The delay is configured by the user in Preferences. |
full |
bool |
Before calling Init, set to True to enable a "full size" progress indicator with two separate progress bars (one for files and one for bytes). |
owned |
bool |
Before calling Init, set to True if the dialog should be owned by its parent window (the parent is given later, when the dialog is created via the Init method). |
pause |
bool |
Before calling Init, set to True if the Pause button should be available. |
skip |
bool |
Before calling Init, set to True if the Skip button should be available. (This just makes it so the Skip button can be enabled. You must still call EnableSkip later to actually enable it; usually once per file.) |
Method Name | Arguments | Return Type | Description |
---|---|---|---|
AddFiles |
<int:count> |
none |
Adds the specified number of files to the operation total. The bytes argument is optional - in a "full size" progress indicator this lets you add to the total byte size of the operation. |
ClearAbortState |
none |
none |
Clears the state of the three "control" buttons (Abort / Pause / Skip) so they no longer register as being clicked when GetAbortState is called. |
EnableSkip |
<bool:enable> |
none |
Enables the progress dialog's Skip button. For EnableSkip to work, you must have set the skip property to True before the progress dialog was created by the Init method. |
FinishFile |
none |
none |
Finish the current file. If the byte size of the current file has been set the total progress will be advanced by any remaining bytes. |
GetAbortState |
<bool:autoPause> |
string |
Polls the state of the three "control" buttons. This returns a string that indicates which, if any, of the three buttons have been clicked by the user. The button states are represented by the following letters in the returned string: a - Abort If none of the states apply, an empty string is returned. |
Hide |
none |
none |
Hides the progress indicator dialog. The dialog object itself remains valid, and can be redisplayed with the Show method if desired. |
HideFileByteCounts |
<bool:show> |
none |
Hides or shows the "XX bytes / YY bytes" string in the progress dialog. You can use this to hide the string if the progress does not indicate a number of bytes (e.g. when it indicates a percentage). Pass True for the show argument to show the string and False to hide it. |
Init |
<Tab:parent> <string:title> |
none |
Initializes the dialog. This method causes the actual dialog to be created, although it will not be displayed until the Show method is called. The fundamental properties shown above must be set before this method is called - once the dialog has been created they can not be altered. |
InitFileSize |
none |
none |
Resets the byte count for the current file to zero. |
Restart |
none |
none |
Resets the total completed file and byte counts to zero. |
SetBytesProgress |
<FileSize:bytes> |
none |
Sets the total completed byte count. |
SetFileSize |
<FileSize:bytes> |
none |
Sets the size of the current file. |
SetFiles |
<int:count> |
none |
Sets the total number of files. |
SetFilesProgress |
<int:count> |
none |
Sets the total completed file count. |
SetFromTo |
<string:header> |
none |
Sets the text at the top of the dialog that indicates the source and destination of an operation. The header argument refers to the string that normally says From: - this allows you to change it in case that term is not applicable to your action. The from argument is the source path, and the to argument (if there is one) is the destination path. Note that if you specify a destination path this always has a To: header appended to it. |
SetName |
<string:name> |
none |
Sets the name of the current file. |
SetPercentProgress |
<int:percent> |
none |
Sets the current progress as a percentage (from 0 to 100). |
SetStatus |
<string:status> |
none |
Sets the text displayed in the status line at the top of the dialog. |
SetTitle |
<string:title> |
none |
Sets the title of the dialog. |
SetType |
<string:type> |
none |
Sets the type of the current item - either file or dir. |
Show |
none |
none |
Displays the progress indicator dialog. Call this once you have created the dialog using the Init method. |
SkipFile |
<bool:complete> |
none |
Skips over the current file. Set the complete argument to True to have the file counted as "complete", or False to count it as "skipped". |
StepBytes |
<FileSize:bytes> |
none |
Step the byte progress indicator the specified number of bytes. |
StepFiles |
<int:count> |
none |
Step the file progress indicator the specified number of files. |