Exemple #1
0
 def __init__(self, title, menu=None):
     SCElement.__init__(self)
     self.title = title
     scGui = loader.loadModel(SCMenu.GuiModelName)
     self.scArrow = scGui.find('**/chatArrow')
     self.menu = None
     self.setMenu(menu)
Exemple #2
0
 def privSetSettingsRef(self, settingsRef):
     SCElement.privSetSettingsRef(self, settingsRef)
     if self._handleWhisperModeFC is None:
         self._handleWhisperModeFC = FunctionCall(
             self._handleWhisperModeSVChanged, self._handleWhisperModeSV)
         self._handleWhisperModeFC.pushCurrentState()
     self._handleWhisperModeSV.set(self.settingsRef is not None
                                   and not self.isWhisperable())
Exemple #3
0
 def __init__(self, linkedEmote=None):
     SCElement.__init__(self)
     self.setLinkedEmote(linkedEmote)
     scGui = loader.loadModel(SCMenu.GuiModelName)
     self.emotionIcon = scGui.find('**/emotionIcon')
     self.setDisabled(False)
     self.__numCharges = -1
     self._handleWhisperModeSV = StateVar(False)
     self._handleWhisperModeFC = None
Exemple #4
0
 def enterActive(self):
     SCElement.enterActive(self)
     self.showMenu()
     if hasattr(self, 'button'):
         r, g, b = self.getColorScheme().getMenuHolderActiveColor()
         a = self.getColorScheme().getAlpha()
         self.button.frameStyle[DGG.BUTTON_READY_STATE].setColor(r, g, b, a)
         self.button.updateFrameStyle()
     else:
         self.notify.warning(
             'SCMenuHolder has no button (has finalize been called?).')
Exemple #5
0
 def finalize(self, dbArgs={}):
     if not self.isDirty():
         return
     r, g, b = self.getColorScheme().getArrowColor()
     a = self.getColorScheme().getAlpha()
     self.scArrow.setColorScale(r, g, b, a)
     if self.menu is not None:
         self.menu.setPos(self.getMenuOffset())
     if self.isActive():
         r, g, b = self.getColorScheme().getMenuHolderActiveColor()
         a = self.getColorScheme().getAlpha()
         frameColor = (r, g, b, a)
     else:
         frameColor = SCMenuHolder.DefaultFrameColor
     args = {
         'image': self.scArrow,
         'image_pos': (self.width - 0.5, 0, -self.height * 0.5),
         'frameColor': frameColor
     }
     args.update(dbArgs)
     SCElement.finalize(self, dbArgs=args)
Exemple #6
0
    def enterVisible(self):
        SCElement.enterVisible(self)
        if hasattr(self, 'lastEmoteIconColor'):
            if self.getEmoteIconColor() != self.lastEmoteIconColor:
                self.invalidate()

        def handleWhisperModeChange(whisperMode, self=self):
            if self.hasLinkedEmote():
                if self.isVisible() and not self.isWhispering():
                    self.updateEmoteIcon()

        self.accept(self.getEventName(SCWhisperModeChangeEvent),
                    handleWhisperModeChange)

        def handleEmoteEnableStateChange(self=self):
            if self.hasLinkedEmote():
                if self.isVisible() and not self.isWhispering():
                    self.updateEmoteIcon()

        if self.hasLinkedEmote():
            if Emote.globalEmote:
                self.accept(Emote.globalEmote.EmoteEnableStateChanged,
                            handleEmoteEnableStateChange)
Exemple #7
0
 def finalize(self, dbArgs={}):
     if not self.isDirty():
         return
     args = {}
     if self.hasLinkedEmote():
         self.lastEmoteIconColor = self.getEmoteIconColor()
         self.emotionIcon.setColorScale(*self.lastEmoteIconColor)
         args.update({
             'image': self.emotionIcon,
             'image_pos': (self.width - 0.6, 0, -self.height * 0.5)
         })
     if self.isDisabled():
         args.update({
             'rolloverColor': (0, 0, 0, 0),
             'pressedColor': (0, 0, 0, 0),
             'rolloverSound':
             None,
             'clickSound':
             None,
             'text_fg':
             self.getColorScheme().getTextDisabledColor() + (1, )
         })
     args.update(dbArgs)
     SCElement.finalize(self, dbArgs=args)
Exemple #8
0
 def exitActive(self):
     SCElement.exitActive(self)
     self.hideMenu()
     self.button.frameStyle[DGG.BUTTON_READY_STATE].setColor(
         *SCMenuHolder.DefaultFrameColor)
     self.button.updateFrameStyle()
Exemple #9
0
 def onMouseClick(self, event):
     SCElement.enterActive(self)
     self.parentMenu.memberSelected(self)
Exemple #10
0
    def destroy(self):
        if self.menu is not None:
            self.menu.destroy()
            self.menu = None

        SCElement.destroy(self)
Exemple #11
0
 def invalidate(self):
     SCElement.invalidate(self)
     if self.menu is not None:
         self.menu.invalidate()
Exemple #12
0
 def getMinDimensions(self):
     width, height = SCElement.getMinDimensions(self)
     width += 1.0
     return (width, height)
Exemple #13
0
 def getMinDimensions(self):
     width, height = SCElement.getMinDimensions(self)
     if self.hasLinkedEmote():
         width += 1.3
     return (width, height)
Exemple #14
0
 def onMouseClick(self, event):
     if not self.isDisabled():
         SCElement.onMouseClick(self, event)
         self.handleSelect()
Exemple #15
0
 def destroy(self):
     self._handleWhisperModeSV.set(False)
     if self._handleWhisperModeFC:
         self._handleWhisperModeFC.destroy()
     self._handleWhisperModeSV.destroy()
     SCElement.destroy(self)
Exemple #16
0
 def exitVisible(self):
     SCElement.exitVisible(self)
     self.ignore(self.getEventName(SCWhisperModeChangeEvent))
     if Emote.globalEmote:
         self.ignore(Emote.globalEmote.EmoteEnableStateChanged)