Skip to content

Instantly share code, notes, and snippets.

@BigRoy
Created November 14, 2024 11:21
Show Gist options
  • Save BigRoy/37ed50ff22a12f34d37ae28ce948609a to your computer and use it in GitHub Desktop.
Save BigRoy/37ed50ff22a12f34d37ae28ce948609a to your computer and use it in GitHub Desktop.
Force enable Word Wrap in Maya's script editor output
import maya.OpenMayaUI as mui
import shiboken2
from PySide2 import QtWidgets
# <-- get maya main window QMainWindow -->
ptr = mui.MQtUtil.mainWindow()
main_window = shiboken2.wrapInstance(int(ptr), QtWidgets.QMainWindow)
# <-- set wordWrap on script editor feedback field -->
cmdScrollFieldReporter = main_window.findChild(QtWidgets.QPlainTextEdit, "cmdScrollFieldReporter1")
cmdScrollFieldReporter.setLineWrapMode(QtWidgets.QPlainTextEdit.WidgetWidth)
# <-- set wordWrap on each scriptEditor tab -->
for i in range(1000):
cmdScrollFieldExecuter = main_window.findChild(QtWidgets.QPlainTextEdit, f"cmdScrollFieldExecuter{i}")
if cmdScrollFieldExecuter is not None:
cmdScrollFieldExecuter.setLineWrapMode(QtWidgets.QPlainTextEdit.WidgetWidth)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment