Last active
February 5, 2016 15:40
-
-
Save oglops/b38cc9c666d6b486f813 to your computer and use it in GitHub Desktop.
set maya script editor font size on hidpi laptop screen
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
from PyQt4 import QtGui,QtCore | |
from maya import cmds | |
import maya.OpenMayaUI as apiUI | |
import sip | |
ptr = apiUI.MQtUtil.mainWindow() | |
mwin=sip.wrapinstance(long(ptr), QtCore.QObject) | |
cmdReporters = cmds.lsUI(type='cmdScrollFieldReporter') | |
cmdReporter = mwin.findChild(QtGui.QTextEdit, cmdReporters[0]) | |
font=cmdReporter.font() | |
# default is 12 | |
font.setPixelSize(16) | |
cmdReporter.setFont(font) | |
# for cmdScrollFieldExecuters, this return a list | |
cmdExecuters = cmds.lsUI(type='cmdScrollFieldExecuter') | |
# 但是似乎这样就不能滚轮缩放了 | |
app = QtGui.QApplication.instance() | |
# 把 stylesheet 只用到script editor 上也会让滚轮不能用了 | |
# ptr = apiUI.MQtUtil.findControl('scriptEditorPanel1Window') | |
# win = sip.wrapinstance(long(ptr), QtCore.QObject) | |
styleSheet = ''' | |
QTextEdit { | |
font-family: "Courier New"; | |
font: normal %spx; | |
} | |
''' % '16' | |
app.setStyleSheet(styleSheet) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment