Created
January 26, 2025 16:37
-
-
Save LiamHz/b6a48f45856e16ca9d9bfe8ea5a4dbdd to your computer and use it in GitHub Desktop.
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
import maya.OpenMayaUI as mui | |
import shiboken2 | |
from PySide2 import QtWidgets | |
def set_script_editor_wordwrap(): | |
# Get Maya's main window | |
ptr = mui.MQtUtil.mainWindow() | |
main_window = shiboken2.wrapInstance(int(ptr), QtWidgets.QMainWindow) | |
# Find feedback panel using type instead of name | |
feedback_panel = next( | |
(child for child in main_window.findChildren(QtWidgets.QPlainTextEdit) | |
if "cmdScrollFieldReporter" in child.objectName()), None | |
) | |
if feedback_panel: | |
feedback_panel.setLineWrapMode(QtWidgets.QPlainTextEdit.WidgetWidth) | |
else: | |
print("Could not find feedback panel") | |
# Find all executer tabs using partial name match | |
executer_tabs = [ | |
child for child in main_window.findChildren(QtWidgets.QPlainTextEdit) | |
if "cmdScrollFieldExecuter" in child.objectName() | |
] | |
for tab in executer_tabs: | |
tab.setLineWrapMode(QtWidgets.QPlainTextEdit.WidgetWidth) | |
print(f"Set word wrap on {len(executer_tabs)} Script Editor tabs") | |
# Run the function | |
set_script_editor_wordwrap() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment