CheckpointModel#
- class omni.kit.widget.versioning.CheckpointModel(show_none_entry)#
Bases:
AbstractItemModel
A model for managing file checkpoints using Omni UI.
This class provides an interface for listing, filtering, and restoring checkpoints for files. It handles asynchronous operations to retrieve checkpoint data from the server and updates the checkpoint list in response to file events. It supports search filtering, single column display mode, and both single and multi selection of checkpoints. Additionally, it manages internal state and task cancellation to ensure efficient updates when the underlying file or connection status changes.
- Parameters:
show_none_entry (bool) – Indicates whether a dummy entry representing no checkpoint should be included in the list.
Methods
__init__
(show_none_entry)Initializes a new instance of CheckpointModel.
destroy
()Releases resources, resets state and cancels pending tasks.
empty
()Checks if the model has no items to display.
get_drag_mime_data
(item)Returns Multipurpose Internet Mail Extensions (MIME) data for be able to drop this item somewhere.
get_item_children
(item)Returns all the children when the widget asks it.
The number of columns.
get_url
()Gets the current URL used by the model.
Initiates an asynchronous task to list available checkpoints.
on_list_checkpoints
(file_entry, ...)Processes listed checkpoints, updates internal state and triggers callback.
reset
()Resets checkpoint lists and cancels pending tasks, if any.
restore_checkpoint
(file_path, checkpoint_path)Restores a checkpoint by copying the specified checkpoint to a file.
set_multi_select
(state)Sets the multi select state.
Sets a callback function for when checkpoints are listed.
set_search
(keywords)Updates the search keywords and triggers filtering.
set_url
(url)Updates the incoming URL and refreshes checkpoints asynchronously.
Attributes
Gets the single_column property value.
- __init__(show_none_entry)#
Initializes a new instance of CheckpointModel.
- destroy()#
Releases resources, resets state and cancels pending tasks.
- empty()#
Checks if the model has no items to display.
- get_drag_mime_data(item)#
Returns Multipurpose Internet Mail Extensions (MIME) data for be able to drop this item somewhere.
- Parameters:
item (object) – Source item for which MIME data is generated.
- Returns:
MIME data string.
- Return type:
str
- get_item_children(item)#
Returns all the children when the widget asks it.
- Parameters:
item (object) – Item for which children are returned.
- get_item_value_model_count(item)#
The number of columns.
- Parameters:
item (object) – Item for which columns count is requested.
- Returns:
Number of columns (1 for single column mode, otherwise 5).
- Return type:
int
- get_url()#
Gets the current URL used by the model.
- list_checkpoint()#
Initiates an asynchronous task to list available checkpoints.
- on_list_checkpoints(file_entry, checkpoints_entries)#
Processes listed checkpoints, updates internal state and triggers callback.
- Parameters:
file_entry (object) – File entry reference for checkpoint processing.
checkpoints_entries (list) – List of checkpoint entries.
- reset()#
Resets checkpoint lists and cancels pending tasks, if any.
- restore_checkpoint(file_path, checkpoint_path)#
Restores a checkpoint by copying the specified checkpoint to a file.
- Parameters:
file_path (str) – Destination file path for the checkpoint.
checkpoint_path (str) – Source checkpoint path to restore.
- set_multi_select(state: bool)#
Sets the multi select state.
- Parameters:
state (bool) – Multi select state value.
- set_on_list_checkpoint_fn(fn)#
Sets a callback function for when checkpoints are listed.
- Parameters:
fn (callable) – Callback function for checkpoint listing.
- set_search(keywords)#
Updates the search keywords and triggers filtering.
- Parameters:
keywords (str) – Search keywords to filter items.
- set_url(url)#
Updates the incoming URL and refreshes checkpoints asynchronously.
- Parameters:
url (str) – New URL to set.
- property single_column#
Gets the single_column property value.
- Returns:
True if single column mode is active, False otherwise.
- Return type:
bool