-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from ynput/enhancement/shortcut_to_open_template
Add shortcut to open template for current context
- Loading branch information
Showing
6 changed files
with
72 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
from .window import WorkfileBuildPlaceholderDialog | ||
from .lib import open_template_ui | ||
|
||
__all__ = ( | ||
"WorkfileBuildPlaceholderDialog", | ||
|
||
"open_template_ui" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import traceback | ||
|
||
from qtpy import QtWidgets | ||
|
||
from ayon_core.tools.utils.dialogs import show_message_dialog | ||
|
||
|
||
def open_template_ui(builder, main_window): | ||
"""Open template from `builder` | ||
Asks user about overwriting current scene and feedsback exceptions. | ||
""" | ||
result = QtWidgets.QMessageBox.question( | ||
main_window, | ||
"Opening template", | ||
"Caution! You will loose unsaved changes.\nDo you want to continue?", | ||
QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No | ||
) | ||
if result == QtWidgets.QMessageBox.Yes: | ||
try: | ||
builder.open_template() | ||
except Exception: | ||
show_message_dialog( | ||
title="Template Load Failed", | ||
message="".join(traceback.format_exc()), | ||
parent=main_window, | ||
level="critical" | ||
) |