本文整理汇总了Python中SCObject.SCObject.finalize方法的典型用法代码示例。如果您正苦于以下问题:Python SCObject.finalize方法的具体用法?Python SCObject.finalize怎么用?Python SCObject.finalize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SCObject.SCObject
的用法示例。
在下文中一共展示了SCObject.finalize方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: finalize
# 需要导入模块: from SCObject import SCObject [as 别名]
# 或者: from SCObject.SCObject import finalize [as 别名]
def finalize(self, dbArgs = { }):
if not self.isDirty():
return None
SCObject.finalize(self)
if hasattr(self, 'button'):
self.button.destroy()
del self.button
halfHeight = self.height / 2.0
textX = 0
if dbArgs.has_key('text_align'):
if dbArgs['text_align'] == TextNode.ACenter:
textX = self.width / 2.0
args = {
'text': self.getDisplayText(),
'frameColor': (0, 0, 0, 0),
'rolloverColor': self.getColorScheme().getRolloverColor() + (1,),
'pressedColor': self.getColorScheme().getPressedColor() + (1,),
'text_font': OTPGlobals.getInterfaceFont(),
'text_align': TextNode.ALeft,
'text_fg': self.getColorScheme().getTextColor() + (1,),
'text_pos': (textX, -0.25 - halfHeight, 0),
'relief': DGG.FLAT,
'pressEffect': 0 }
args.update(dbArgs)
rolloverColor = args['rolloverColor']
pressedColor = args['pressedColor']
del args['rolloverColor']
del args['pressedColor']
btn = DirectButton(parent = self, frameSize = (0, self.width, -(self.height), 0), **None)
btn.frameStyle[DGG.BUTTON_ROLLOVER_STATE].setColor(*rolloverColor)
btn.frameStyle[DGG.BUTTON_DEPRESSED_STATE].setColor(*pressedColor)
btn.updateFrameStyle()
btn.bind(DGG.ENTER, self.onMouseEnter)
btn.bind(DGG.EXIT, self.onMouseLeave)
btn.bind(DGG.B1PRESS, self.onMouseClick)
self.button = btn
self.lastWidth = self.width
self.lastHeight = self.height
self.validate()
示例2: finalize
# 需要导入模块: from SCObject import SCObject [as 别名]
# 或者: from SCObject.SCObject import finalize [as 别名]
def finalize(self):
if not self.isDirty():
return
self.inFinalize = 1
SCObject.finalize(self)
visibleMembers = []
for member in self:
if member.isViewable():
visibleMembers.append(member)
member.reparentTo(self)
else:
member.reparentTo(hidden)
if self.activeMember is member:
self.__setActiveMember(None)
maxWidth = 0.0
maxHeight = 0.0
for member in visibleMembers:
width, height = member.getMinDimensions()
maxWidth = max(maxWidth, width)
maxHeight = max(maxHeight, height)
holder = self.getHolder()
if holder is not None:
widthToCover = holder.getMinSubmenuWidth()
maxWidth = max(maxWidth, widthToCover)
memberWidth, memberHeight = maxWidth, maxHeight
self.width = maxWidth
for i in xrange(len(visibleMembers)):
member = visibleMembers[i]
member.setPos(0, 0, -i * maxHeight)
member.setDimensions(memberWidth, memberHeight)
member.finalize()
if len(visibleMembers) > 0:
z1 = visibleMembers[0].getZ(aspect2d)
visibleMembers[0].setZ(-maxHeight)
z2 = visibleMembers[0].getZ(aspect2d)
visibleMembers[0].setZ(0)
actualHeight = (z2 - z1) * len(visibleMembers)
bottomZ = self.getZ(aspect2d) + actualHeight
if bottomZ < -1.0:
overlap = bottomZ - -1.0
self.setZ(aspect2d, self.getZ(aspect2d) - overlap)
if self.getZ(aspect2d) > 1.0:
self.setZ(aspect2d, 1.0)
sX = memberWidth
sZ = memberHeight * len(visibleMembers)
self.bgMiddle.setScale(sX, 1, sZ)
self.bgTop.setScale(sX, 1, 1)
self.bgBottom.setScale(sX, 1, 1)
self.bgLeft.setScale(1, 1, sZ)
self.bgRight.setScale(1, 1, sZ)
self.bgBottomLeft.setZ(-sZ)
self.bgBottom.setZ(-sZ)
self.bgTopRight.setX(sX)
self.bgRight.setX(sX)
self.bgBottomRight.setX(sX)
self.bgBottomRight.setZ(-sZ)
sB = 0.15
self.bgTopLeft.setSx(aspect2d, sB)
self.bgTopLeft.setSz(aspect2d, sB)
self.bgBottomRight.setSx(aspect2d, sB)
self.bgBottomRight.setSz(aspect2d, sB)
self.bgBottomLeft.setSx(aspect2d, sB)
self.bgBottomLeft.setSz(aspect2d, sB)
self.bgTopRight.setSx(aspect2d, sB)
self.bgTopRight.setSz(aspect2d, sB)
self.bgTop.setSz(aspect2d, sB)
self.bgBottom.setSz(aspect2d, sB)
self.bgLeft.setSx(aspect2d, sB)
self.bgRight.setSx(aspect2d, sB)
r, g, b = self.getColorScheme().getFrameColor()
a = self.getColorScheme().getAlpha()
self.bg.setColorScale(r, g, b, a)
if self.activeMember is not None:
self.activeMember.reparentTo(self)
self.validate()
self.inFinalize = 0
return