本文整理汇总了Python中Gaffer.getReadOnly方法的典型用法代码示例。如果您正苦于以下问题:Python Gaffer.getReadOnly方法的具体用法?Python Gaffer.getReadOnly怎么用?Python Gaffer.getReadOnly使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gaffer
的用法示例。
在下文中一共展示了Gaffer.getReadOnly方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testReadOnly
# 需要导入模块: import Gaffer [as 别名]
# 或者: from Gaffer import getReadOnly [as 别名]
def testReadOnly(self):
n = GafferTest.AddNode()
self.assertEqual(Gaffer.getReadOnly(n), False)
self.assertEqual(Gaffer.getReadOnly(n["op1"]), False)
self.assertEqual(Gaffer.readOnly(n), False)
self.assertEqual(Gaffer.readOnly(n["op1"]), False)
Gaffer.setReadOnly(n["op1"], True)
self.assertEqual(Gaffer.getReadOnly(n), False)
self.assertEqual(Gaffer.getReadOnly(n["op1"]), True)
self.assertEqual(Gaffer.readOnly(n), False)
self.assertEqual(Gaffer.readOnly(n["op1"]), True)
Gaffer.setReadOnly(n, True)
self.assertEqual(Gaffer.getReadOnly(n), True)
self.assertEqual(Gaffer.getReadOnly(n["op1"]), True)
self.assertEqual(Gaffer.readOnly(n), True)
self.assertEqual(Gaffer.readOnly(n["op1"]), True)
Gaffer.setReadOnly(n["op1"], False)
self.assertEqual(Gaffer.getReadOnly(n), True)
self.assertEqual(Gaffer.getReadOnly(n["op1"]), False)
self.assertEqual(Gaffer.readOnly(n), True)
self.assertEqual(Gaffer.readOnly(n["op1"]), True)
示例2: _popupMenuDefinition
# 需要导入模块: import Gaffer [as 别名]
# 或者: from Gaffer import getReadOnly [as 别名]
def _popupMenuDefinition( self ) :
menuDefinition = IECore.MenuDefinition()
if hasattr( self.getPlug(), "getValue" ) :
applicationRoot = self.getPlug().ancestor( Gaffer.ApplicationRoot )
menuDefinition.append(
"/Copy Value", {
"command" : Gaffer.WeakMethod( self.__copyValue ),
"active" : applicationRoot is not None
}
)
pasteValue = None
if applicationRoot is not None :
pasteValue = self._convertValue( applicationRoot.getClipboardContents() )
menuDefinition.append(
"/Paste Value", {
"command" : functools.partial( Gaffer.WeakMethod( self.__setValue ), pasteValue ),
"active" : self._editable() and pasteValue is not None
}
)
menuDefinition.append( "/CopyPasteDivider", { "divider" : True } )
if self.getPlug().getInput() is not None :
menuDefinition.append( "/Edit input...", { "command" : Gaffer.WeakMethod( self.__editInput ) } )
menuDefinition.append( "/EditInputDivider", { "divider" : True } )
menuDefinition.append(
"/Remove input", {
"command" : Gaffer.WeakMethod( self.__removeInput ),
"active" : self.getPlug().acceptsInput( None ) and not self.getReadOnly() and not Gaffer.readOnly( self.getPlug() ),
}
)
if hasattr( self.getPlug(), "defaultValue" ) and self.getPlug().direction() == Gaffer.Plug.Direction.In :
menuDefinition.append(
"/Default", {
"command" : functools.partial( Gaffer.WeakMethod( self.__setValue ), self.getPlug().defaultValue() ),
"active" : self._editable()
}
)
if Gaffer.NodeAlgo.hasUserDefault( self.getPlug() ) and self.getPlug().direction() == Gaffer.Plug.Direction.In :
menuDefinition.append(
"/User Default", {
"command" : Gaffer.WeakMethod( self.__applyUserDefault ),
"active" : self._editable()
}
)
if Gaffer.NodeAlgo.presets( self.getPlug() ) :
menuDefinition.append(
"/Preset", {
"subMenu" : Gaffer.WeakMethod( self.__presetsSubMenu ),
"active" : self._editable()
}
)
if len( menuDefinition.items() ) :
menuDefinition.append( "/LockDivider", { "divider" : True } )
readOnly = Gaffer.getReadOnly( self.getPlug() ) or self.getPlug().getFlags( Gaffer.Plug.Flags.ReadOnly )
menuDefinition.append(
"/Unlock" if readOnly else "/Lock",
{
"command" : functools.partial( Gaffer.WeakMethod( self.__applyReadOnly ), not readOnly ),
"active" : not self.getReadOnly() and not Gaffer.readOnly( self.getPlug().parent() ),
}
)
self.popupMenuSignal()( menuDefinition, self )
return menuDefinition