示例#1
0
 def updateSpeedChatStyle(self):
     nameKey, arrowColor, rolloverColor, frameColor = speedChatStyles[
         self.speedChatStyleIndex]
     newSCColorScheme = SCColorScheme.SCColorScheme(
         arrowColor=arrowColor,
         rolloverColor=rolloverColor,
         frameColor=frameColor)
     self.speedChatStyleText.setColorScheme(newSCColorScheme)
     self.speedChatStyleText.clearMenu()
     colorName = SCStaticTextTerminal.SCStaticTextTerminal(nameKey)
     self.speedChatStyleText.append(colorName)
     self.speedChatStyleText.finalize()
     self.speedChatStyleText.setPos(
         0.445 -
         self.speedChatStyleText.getWidth() * self.speed_chat_scale / 2, 0,
         self.speedChatStyleText.getPos()[2])
     if self.speedChatStyleIndex > 0:
         self.speedChatStyleLeftArrow['state'] = DGG.NORMAL
     else:
         self.speedChatStyleLeftArrow['state'] = DGG.DISABLED
     if self.speedChatStyleIndex < len(speedChatStyles) - 1:
         self.speedChatStyleRightArrow['state'] = DGG.NORMAL
     else:
         self.speedChatStyleRightArrow['state'] = DGG.DISABLED
     base.localAvatar.b_setSpeedChatStyleIndex(self.speedChatStyleIndex)
示例#2
0
    def updateSpeedChatStyle(self):
        # update the text color and value
        nameKey, arrowColor, rolloverColor, frameColor = \
                 speedChatStyles[self.speedChatStyleIndex]
        # create the new color scheme object for the text label
        newSCColorScheme = SCColorScheme.SCColorScheme(
            arrowColor=arrowColor,
            rolloverColor=rolloverColor,
            frameColor=frameColor,
            )
        # set the new color scheme
        self.speedChatStyleText.setColorScheme(newSCColorScheme)
        # set the new text
        self.speedChatStyleText.clearMenu()
        colorName = SCStaticTextTerminal.SCStaticTextTerminal(nameKey)
        self.speedChatStyleText.append(colorName)
        # we must finalize to get the accurate width
        self.speedChatStyleText.finalize()
        # manual horizonal centering
        self.speedChatStyleText.setPos(
            0.445 - self.speedChatStyleText.getWidth() * self.speed_chat_scale / 2, 0, self.speedChatStyleText.getPos()[2]) # -0.27)

        # show the appropriate arrows
        if self.speedChatStyleIndex > 0:
            self.speedChatStyleLeftArrow['state'] = DGG.NORMAL
        else:
            self.speedChatStyleLeftArrow['state'] = DGG.DISABLED
        if self.speedChatStyleIndex < len(speedChatStyles) - 1:
            self.speedChatStyleRightArrow['state'] = DGG.NORMAL
        else:
            self.speedChatStyleRightArrow['state'] = DGG.DISABLED

        # actually cause the speed chat color to change and propagate to the DB
        # this function is actually found in DistributedToon.py
        base.localAvatar.b_setSpeedChatStyleIndex(self.speedChatStyleIndex)