omni.flux.utils.dialog#
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
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.utils.dialog.ErrorPopup(
- title,
- message,
- details: str = None,
- yes_no: bool = False,
- window_size: tuple[int, int] = (400, 300),
Creates a modal window with a status label and a progress bar inside. :param title: Title of this window. :type title: str :param message: Error message to display in a label. :type message: str :param details: Error details to display in a string field. :type details: str :param yes_no: Show a Yes/No :type yes_no: bool
- subscribe_no_clicked(func)#
Return the object that will automatically unsubscribe when destroyed.
- subscribe_yes_clicked(func)#
Return the object that will automatically unsubscribe when destroyed.
- class omni.flux.utils.dialog.ProgressPopup(
- title,
- cancel_button_text='Cancel',
- cancel_button_fn=None,
- status_text='',
- modal=True,
Creates a modal window with a status label and a progress bar inside. :param title: Title of this window. :type title: str :param cancel_button_text: It will have a cancel button by default. This is the title of it. :type cancel_button_text: str :param cancel_button_fn: The callback after cancel button is clicked. :type cancel_button_fn: function :param status_text: The status text. :type status_text: str :param min_value: The min value of the progress bar. It’s 0 by default. :param max_value: The max value of the progress bar. It’s 100 by default. :param dark_style: If it’s to use dark style or light style. It’s dark stye by default.
- report_progress(
- current: int,
- total: int,
- status: object = None,
Show a processed count and an optional status. A total of zero or less keeps the bar where it is.
- async classmethod run_cancellable(
- title: str,
- status_text: str,
- work: Callable[[...], Awaitable[Any]],
Show a popup while work runs, and let the user cancel it.
- Parameters:
title – Popup title.
status_text – Status shown until work reports its own.
work – Called with the keywords progress, which takes report_progress() arguments, and is_cancelled, which returns whether the user clicked Cancel.
- Returns:
The result of work, and whether the user cancelled.
- omni.flux.utils.dialog.show_popup(title: str, positive_text: str, negative_text: str, build_fn: ~collections.abc.Callable[[], None], positive_callback: ~collections.abc.Callable[[], bool] = <function <lambda>>, negative_callback: ~collections.abc.Callable[[], bool] = <function <lambda>>, width: int = 300, height: int = 200, flags: int = 2283798574)#
Display a modal popup window with customizable content and actions.
- Parameters:
title – The title of the popup window.
positive_text – The label for the positive/confirmation button.
negative_text – The label for the negative/cancellation button.
build_fn – Callback to build the content inside the popup.
positive_callback (optional) – Function called when confirming; should return True to close the popup.
negative_callback (optional) – Function called when cancelling; should return True to close the popup.
width (optional) – Popup width in pixels.
height (optional) – Popup height in pixels.
flags (optional) – Flags for the window.