API

  • SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.

  • SPDX-License-Identifier: Apache-2.0

  • Licensed under the Apache License, Version 2.0 (the “License”);

  • you may not use this file except in compliance with the License.

  • You may obtain a copy of the License at

  • https://www.apache.org/licenses/LICENSE-2.0

  • Unless required by applicable law or agreed to in writing, software

  • distributed under the License is distributed on an “AS IS” BASIS,

  • WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

  • See the License for the specific language governing permissions and

  • limitations under the License.

class omni.flux.wizard.widget.WizardModel(root_item: WizardPage)

Bases: object

__init__(root_item: WizardPage)

The model responsible for driving a WizardWidget

Parameters

root_item – The first item (WizardPage) the model should display.

destroy()

Destroy.

get_active_item() WizardPage

Get the currently active page

go_next() None

Go to the item’s next page or complete the wizard if there are no next pages

go_previous() None

Go to the item’s previous page

on_active_item_changed()

Trigger the “__on_active_item_changed” event

on_items_completed()

Trigger the on_items_completed event

reset_active_item() None

Reset the active page to the original page

subscribe_on_active_item_changed(function)

Return an object that will automatically unsubscribe when destroyed.

subscribe_on_items_completed(function)

Return the object that will automatically unsubscribe when destroyed. Called when the wizard is completed.

class omni.flux.wizard.widget.WizardPage(previous_page: Optional[omni.flux.wizard.widget.items.WizardPage] = None, next_page: Optional[omni.flux.wizard.widget.items.WizardPage] = None, next_text: str = 'Next', previous_text: str = 'Previous', done_text: str = 'Done', blocked: bool = False, hide_navigation: bool = False)

Bases: object

__init__(previous_page: Optional[omni.flux.wizard.widget.items.WizardPage] = None, next_page: Optional[omni.flux.wizard.widget.items.WizardPage] = None, next_text: str = 'Next', previous_text: str = 'Previous', done_text: str = 'Done', blocked: bool = False, hide_navigation: bool = False)

The items used by the WizardModel. An item is a page and is rendered inside the wizard. The create_ui method should be implemented to determine what the page will look like.

Parameters
  • previous_page – A reference to the page to render when going to the previous page. If None, the “Previous” button will be disabled.

  • next_page – A reference to the page to render when going to the next page. If None, the “Next” button will become the “Done” button.

  • next_text – Text to use for the “Next” button

  • previous_text – Text to use for the “Previous” button

  • done_text – Text to use for the “Done” button

  • blocked – Whether the widget navigation should be blocked or not

  • hide_navigation – Whether the widget navigation bar should be visible or not

property blocked: bool

Whether the page is blocked or is allowed move on to the next page

abstract create_ui()

The UI displayed in the Wizard should be defined in this method.

destroy()

Destroy.

property done_text: str

Text displayed in the “done” button of the wizard

property hide_navigation: bool

Whether the page should hide the navigation buttons in the wizard or not

property next_page: Optional[omni.flux.wizard.widget.items.WizardPage]

The page that follows this one. This can be dynamically adjusted in the create_ui method.

property next_text: str

Text displayed in the “next” button of the wizard

on_blocked_changed()

Trigger the “on_blocked_changed” event

property payload: Dict

The payload includes data from all previous pages.

property previous_page: Optional[omni.flux.wizard.widget.items.WizardPage]

The page that precedes this one

property previous_text: str

Text displayed in the “previous” button of the wizard

request_next()

Request the model to go next. The model must set the request_next_fn

request_previous()

Request the model to go previous. The model must set the request_previous_fn

set_request_next_fn(function)

Set a function to be called whenever the items requests to go next

set_request_previous_fn(function)

Set a function to be called whenever the items requests to go previous

subscribe_on_blocked_changed(function)

Return an object that will automatically unsubscribe when destroyed.

class omni.flux.wizard.widget.WizardWidget(model: WizardModel)

Bases: object

NAVIGATION_BUTTON_WIDTH = 96
WIZARD_PADDING = 8
__init__(model: WizardModel)

A flexible wizard widget where users sequentially go through pages.

Parameters

model – The WizardModel responsible for managing the pages and navigation

destroy()
queue_refresh()

Queue up an asynchronous refresh of the widget

subscribe_wizard_cancelled(function)

Return the object that will automatically unsubscribe when destroyed. Called when the wizard is completed.

subscribe_wizard_completed(function)

Return the object that will automatically unsubscribe when destroyed. Called when the wizard is completed.