mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
added info message on context change
This commit is contained in:
parent
856f67e113
commit
69ca74f27b
3 changed files with 24 additions and 4 deletions
|
|
@ -232,3 +232,7 @@ def on_task_changed(*args):
|
|||
with maya.suspended_refresh():
|
||||
lib.set_context_settings()
|
||||
lib.update_content_on_context_change()
|
||||
|
||||
lib.show_message("Context was changed",
|
||||
("Context was changed to {}".format(
|
||||
avalon.Session["AVALON_ASSET"])))
|
||||
|
|
|
|||
|
|
@ -2611,3 +2611,18 @@ def update_content_on_context_change():
|
|||
new_data["frameEnd"],)
|
||||
except ValueError:
|
||||
pass
|
||||
|
||||
|
||||
def show_message(title, msg):
|
||||
from avalon.vendor.Qt import QtWidgets
|
||||
from ..widgets import message_window
|
||||
|
||||
# Find maya main window
|
||||
top_level_widgets = {w.objectName(): w for w in
|
||||
QtWidgets.QApplication.topLevelWidgets()}
|
||||
|
||||
parent = top_level_widgets.get("MayaWindow", None)
|
||||
if parent is None:
|
||||
pass
|
||||
else:
|
||||
message_window.message(title=title, message=msg, parent=parent)
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ log = logging.getLogger(__name__)
|
|||
|
||||
class Window(QtWidgets.QWidget):
|
||||
def __init__(self, parent, title, message, level):
|
||||
super().__init__()
|
||||
super(Window, self).__init__()
|
||||
self.parent = parent
|
||||
self.title = title
|
||||
self.message = message
|
||||
|
|
@ -48,9 +48,10 @@ class Window(QtWidgets.QWidget):
|
|||
return
|
||||
|
||||
|
||||
def message(title=None, message=None, level="info"):
|
||||
global app
|
||||
app = QtWidgets.QApplication(sys.argv)
|
||||
def message(title=None, message=None, level="info", parent=None):
|
||||
app = parent
|
||||
if not app:
|
||||
app = QtWidgets.QApplication(sys.argv)
|
||||
ex = Window(app, title, message, level)
|
||||
ex.show()
|
||||
# sys.exit(app.exec_())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue