add headless abstraction into command.py

This commit is contained in:
Kayla Man 2023-06-23 00:10:34 +08:00
parent 5c399cbc17
commit 22ee8e1f93
3 changed files with 12 additions and 11 deletions

View file

@ -2,6 +2,8 @@ import logging
import contextlib
import nuke
from qtpy import QtWidgets
log = logging.getLogger(__name__)
@ -19,3 +21,11 @@ def viewer_update_and_undo_stop():
yield
finally:
nuke.Undo.enable()
def is_headless():
"""
Returns:
bool: headless
"""
return QtWidgets.QApplication.instance() is None