Hi all,
I am trying to "fix" the spacing/ fonts in the Script Editor of Maya 2017
version as I am used to the format and style of Maya 2016 versions and
before.
After some searching, I created the script for the change as well as
created a userSetup.py that will load and executes the script that I did
whenever a new Maya 2017 is boot up.
Currently I have a problem in which, while it seems to run correctly for
the first run, but as soon as I close the current script editor and re-open
it, the space/ font etc, got reverted back to the default state. While I
can rectify the issue by creating a new shelf button with the code I did,
are there any ways that I can force Maya to only load the custom settings
that I have done?
This is the script that I have done:
# script name : script_editor_fix.py
from maya import OpenMayaUI as omui
from PySide2 import QtWidgets
from shiboken2 import wrapInstance
def get_maya_ui_element(ui_element):
omui.MQtUtil.mainWindow()
ptr = omui.MQtUtil.findControl(ui_element)
widget = wrapInstance(long(ptr), QtWidgets.QWidget)
return widget
def change_ui_font(ui_element):
widget = get_maya_ui_element(ui_element)
widget.setStyleSheet(
"font-family: {0}; font-weight: {1}; font-style: {2}; font-size:
{3}px;".format(
"FreeMono",
"normal",
"normal",
12
)
)
def main():
change_ui_font(ui_element="scriptEditorPanel1Window")
This is the userSetup.py that I have done:
# script name : userSetup.py
from maya import cmds
import script_editor_fix
cmds.evalDeferred("script_editor_fix.main()", lowestPriority=True)
--
You received this message because you are subscribed to the Google Groups
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/python_inside_maya/f359fe16-c462-4f70-ae31-ef8e2ecd984f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.