def load(self):
     if self.loaded:
         return
     self.loaded = 1
     self.verify = None
     self.pictureFrame = self.attachNewNode('pictureFrame')
     self.pictureFrame.setScale(0.15)
     self.itemIndex = 0
     self.ival = None
     typeCode = self['item'].getTypeCode()
     if self['item'].needsCustomize() and (
             typeCode == CatalogItemTypes.WALLPAPER_ITEM
             or typeCode == CatalogItemTypes.FLOORING_ITEM
             or typeCode == CatalogItemTypes.MOULDING_ITEM
             or typeCode == CatalogItemTypes.FURNITURE_ITEM
             or typeCode == CatalogItemTypes.WAINSCOTING_ITEM
             or typeCode == CatalogItemTypes.TOON_STATUE_ITEM):
         if typeCode == CatalogItemTypes.WALLPAPER_ITEM:
             self.items = getAllWallpapers(self['item'].patternIndex)
         elif typeCode == CatalogItemTypes.FLOORING_ITEM:
             self.items = getAllFloorings(self['item'].patternIndex)
         elif typeCode == CatalogItemTypes.MOULDING_ITEM:
             self.items = getAllMouldings(self['item'].patternIndex)
         elif typeCode == CatalogItemTypes.FURNITURE_ITEM:
             self.items = getAllFurnitures(self['item'].furnitureType)
         elif typeCode == CatalogItemTypes.TOON_STATUE_ITEM:
             self.items = self['item'].getAllToonStatues()
         elif typeCode == CatalogItemTypes.WAINSCOTING_ITEM:
             self.items = getAllWainscotings(self['item'].patternIndex)
         self.numItems = len(self.items)
         if self.numItems > 1:
             guiItems = loader.loadModel('phase_5.5/models/gui/catalog_gui')
             nextUp = guiItems.find('**/arrow_up')
             nextRollover = guiItems.find('**/arrow_Rollover')
             nextDown = guiItems.find('**/arrow_Down')
             prevUp = guiItems.find('**/arrowUp')
             prevDown = guiItems.find('**/arrowDown1')
             prevRollover = guiItems.find('**/arrowRollover')
             self.nextVariant = DirectButton(parent=self,
                                             relief=None,
                                             image=(nextUp, nextDown,
                                                    nextRollover, nextUp),
                                             image3_color=(1, 1, 1, 0.4),
                                             pos=(0.13, 0, 0),
                                             command=self.showNextVariant)
             self.prevVariant = DirectButton(parent=self,
                                             relief=None,
                                             image=(prevUp, prevDown,
                                                    prevRollover, prevUp),
                                             image3_color=(1, 1, 1, 0.4),
                                             pos=(-0.13, 0, 0),
                                             command=self.showPrevVariant,
                                             state=DGG.DISABLED)
             self.variantPictures = [(None, None)] * self.numItems
         else:
             self.variantPictures = [(None, None)]
         self.showCurrentVariant()
     else:
         picture, self.ival = self['item'].getPicture(base.localAvatar)
         if picture:
             picture.reparentTo(self)
             picture.setScale(0.15)
         self.items = [self['item']]
         self.variantPictures = [(picture, self.ival)]
     self.typeLabel = DirectLabel(
         parent=self,
         relief=None,
         pos=(0, 0, 0.24),
         scale=TTLocalizer.CIPtypeLabel,
         text=self['item'].getTypeName(),
         text_fg=(0.95, 0.95, 0, 1),
         text_shadow=(0, 0, 0, 1),
         text_font=ToontownGlobals.getInterfaceFont(),
         text_wordwrap=CATALOG_PANEL_WORDWRAP)
     self.auxText = DirectLabel(parent=self,
                                relief=None,
                                scale=0.05,
                                pos=(-0.2, 0, 0.16))
     self.auxText.setHpr(0, 0, -30)
     self.nameLabel = DirectLabel(
         parent=self,
         relief=None,
         text=self['item'].getDisplayName(),
         text_fg=(0, 0, 0, 1),
         text_font=ToontownGlobals.getInterfaceFont(),
         text_scale=TTLocalizer.CIPnameLabel,
         text_wordwrap=CATALOG_PANEL_WORDWRAP +
         TTLocalizer.CIPwordwrapOffset)
     if self['item'].getTypeCode() == CatalogItemTypes.CHAT_ITEM:
         self.nameLabel['text_wordwrap'] = CATALOG_PANEL_CHAT_WORDWRAP
         numRows = self.nameLabel.component('text0').textNode.getNumRows()
         if numRows == 1:
             namePos = (0, 0, -0.06)
         elif numRows == 2:
             namePos = (0, 0, -0.03)
         else:
             namePos = (0, 0, 0)
         nameScale = 0.063
     elif self['item'].getTypeCode() == CatalogItemTypes.ACCESSORY_ITEM:
         self.nameLabel['text_wordwrap'] = CATALOG_PANEL_ACCESSORY_WORDWRAP
         namePos = (0, 0, -.22)
         nameScale = 0.06
     else:
         namePos = (0, 0, -.22)
         nameScale = 0.06
     self.nameLabel.setPos(*namePos)
     self.nameLabel.setScale(nameScale)
     numericBeanPrice = self['item'].getPrice(self['type'])
     priceStr = str(numericBeanPrice) + ' ' + TTLocalizer.CatalogCurrency
     priceScale = 0.07
     if self['item'].isSaleItem():
         priceStr = TTLocalizer.CatalogSaleItem + priceStr
         priceScale = 0.06
     self.priceLabel = DirectLabel(parent=self,
                                   relief=None,
                                   pos=(0, 0, -0.3),
                                   scale=priceScale,
                                   text=priceStr,
                                   text_fg=(0.95, 0.95, 0, 1),
                                   text_shadow=(0, 0, 0, 1),
                                   text_font=ToontownGlobals.getSignFont(),
                                   text_align=TextNode.ACenter)
     self.createEmblemPrices(numericBeanPrice)
     buttonModels = loader.loadModel('phase_3.5/models/gui/inventory_gui')
     upButton = buttonModels.find('**/InventoryButtonUp')
     downButton = buttonModels.find('**/InventoryButtonDown')
     rolloverButton = buttonModels.find('**/InventoryButtonRollover')
     buyText = TTLocalizer.CatalogBuyText
     buyTextScale = TTLocalizer.CIPbuyButton
     if self['item'].isRental():
         buyText = TTLocalizer.CatalogRentText
     self.buyButton = DirectButton(parent=self,
                                   relief=None,
                                   pos=(0.2, 0, 0.15),
                                   scale=(0.7, 1, 0.8),
                                   text=buyText,
                                   text_scale=buyTextScale,
                                   text_pos=(-0.005, -0.01),
                                   image=(upButton, downButton,
                                          rolloverButton, upButton),
                                   image_color=(1.0, 0.2, 0.2, 1),
                                   image0_color=Vec4(1.0, 0.4, 0.4, 1),
                                   image3_color=Vec4(1.0, 0.4, 0.4, 0.4),
                                   command=self.__handlePurchaseRequest)
     soundIcons = loader.loadModel('phase_5.5/models/gui/catalogSoundIcons')
     soundOn = soundIcons.find('**/sound07')
     soundOff = soundIcons.find('**/sound08')
     self.soundOnButton = DirectButton(
         parent=self,
         relief=None,
         pos=(0.2, 0, -0.15),
         scale=(0.7, 1, 0.8),
         text_scale=buyTextScale,
         text_pos=(-0.005, -0.01),
         image=(upButton, downButton, rolloverButton, upButton),
         image_color=(0.2, 0.5, 0.2, 1),
         image0_color=Vec4(0.4, 0.5, 0.4, 1),
         image3_color=Vec4(0.4, 0.5, 0.4, 0.4),
         command=self.handleSoundOnButton)
     self.soundOnButton.hide()
     soundOn.setScale(0.1)
     soundOn.reparentTo(self.soundOnButton)
     self.soundOffButton = DirectButton(
         parent=self,
         relief=None,
         pos=(0.2, 0, -0.15),
         scale=(0.7, 1, 0.8),
         text_scale=buyTextScale,
         text_pos=(-0.005, -0.01),
         image=(upButton, downButton, rolloverButton, upButton),
         image_color=(0.2, 1.0, 0.2, 1),
         image0_color=Vec4(0.4, 1.0, 0.4, 1),
         image3_color=Vec4(0.4, 1.0, 0.4, 0.4),
         command=self.handleSoundOffButton)
     self.soundOffButton.hide()
     soundOff = self.soundOffButton.attachNewNode('soundOff')
     soundOn.copyTo(soundOff)
     soundOff.reparentTo(self.soundOffButton)
     upGButton = buttonModels.find('**/InventoryButtonUp')
     downGButton = buttonModels.find('**/InventoryButtonDown')
     rolloverGButton = buttonModels.find('**/InventoryButtonRollover')
     self.giftButton = DirectButton(parent=self,
                                    relief=None,
                                    pos=(0.2, 0, 0.15),
                                    scale=(0.7, 1, 0.8),
                                    text=TTLocalizer.CatalogGiftText,
                                    text_scale=buyTextScale,
                                    text_pos=(-0.005, -0.01),
                                    image=(upButton, downButton,
                                           rolloverButton, upButton),
                                    image_color=(1.0, 0.2, 0.2, 1),
                                    image0_color=Vec4(1.0, 0.4, 0.4, 1),
                                    image3_color=Vec4(1.0, 0.4, 0.4, 0.4),
                                    command=self.__handleGiftRequest)
     self.updateButtons()
     return
 def load(self):
     if self.loaded:
         return
     self.loaded = 1
     self.verify = None
     self.pictureFrame = self.attachNewNode('pictureFrame')
     self.pictureFrame.setScale(0.15)
     self.itemIndex = 0
     self.ival = None
     typeCode = self['item'].getTypeCode()
     if self['item'].needsCustomize() and (typeCode == CatalogItemTypes.WALLPAPER_ITEM or typeCode == CatalogItemTypes.FLOORING_ITEM or typeCode == CatalogItemTypes.MOULDING_ITEM or typeCode == CatalogItemTypes.FURNITURE_ITEM or typeCode == CatalogItemTypes.WAINSCOTING_ITEM or typeCode == CatalogItemTypes.TOON_STATUE_ITEM):
         if typeCode == CatalogItemTypes.WALLPAPER_ITEM:
             self.items = getAllWallpapers(self['item'].patternIndex)
         elif typeCode == CatalogItemTypes.FLOORING_ITEM:
             self.items = getAllFloorings(self['item'].patternIndex)
         elif typeCode == CatalogItemTypes.MOULDING_ITEM:
             self.items = getAllMouldings(self['item'].patternIndex)
         elif typeCode == CatalogItemTypes.FURNITURE_ITEM:
             self.items = getAllFurnitures(self['item'].furnitureType)
         elif typeCode == CatalogItemTypes.TOON_STATUE_ITEM:
             self.items = self['item'].getAllToonStatues()
         elif typeCode == CatalogItemTypes.WAINSCOTING_ITEM:
             self.items = getAllWainscotings(self['item'].patternIndex)
         self.numItems = len(self.items)
         if self.numItems > 1:
             guiItems = loader.loadModel('phase_5.5/models/gui/catalog_gui')
             nextUp = guiItems.find('**/arrow_up')
             nextRollover = guiItems.find('**/arrow_Rollover')
             nextDown = guiItems.find('**/arrow_Down')
             prevUp = guiItems.find('**/arrowUp')
             prevDown = guiItems.find('**/arrowDown1')
             prevRollover = guiItems.find('**/arrowRollover')
             self.nextVariant = DirectButton(parent=self, relief=None, image=(nextUp,
              nextDown,
              nextRollover,
              nextUp), image3_color=(1, 1, 1, 0.4), pos=(0.13, 0, 0), command=self.showNextVariant)
             self.prevVariant = DirectButton(parent=self, relief=None, image=(prevUp,
              prevDown,
              prevRollover,
              prevUp), image3_color=(1, 1, 1, 0.4), pos=(-0.13, 0, 0), command=self.showPrevVariant, state=DGG.DISABLED)
             self.variantPictures = [(None, None)] * self.numItems
         else:
             self.variantPictures = [(None, None)]
         self.showCurrentVariant()
     else:
         picture, self.ival = self['item'].getPicture(base.localAvatar)
         if picture:
             picture.reparentTo(self)
             picture.setScale(0.15)
         self.items = [self['item']]
         self.variantPictures = [(picture, self.ival)]
     self.typeLabel = DirectLabel(parent=self, relief=None, pos=(0, 0, 0.24), scale=TTLocalizer.CIPtypeLabel, text=self['item'].getTypeName(), text_fg=(0.95, 0.95, 0, 1), text_shadow=(0, 0, 0, 1), text_font=ToontownGlobals.getInterfaceFont(), text_wordwrap=CATALOG_PANEL_WORDWRAP)
     self.auxText = DirectLabel(parent=self, relief=None, scale=0.05, pos=(-0.2, 0, 0.16))
     self.auxText.setHpr(0, 0, -30)
     self.nameLabel = DirectLabel(parent=self, relief=None, text=self['item'].getDisplayName(), text_fg=(0, 0, 0, 1), text_font=ToontownGlobals.getInterfaceFont(), text_scale=TTLocalizer.CIPnameLabel, text_wordwrap=CATALOG_PANEL_WORDWRAP + TTLocalizer.CIPwordwrapOffset)
     if self['item'].getTypeCode() == CatalogItemTypes.CHAT_ITEM:
         self.nameLabel['text_wordwrap'] = CATALOG_PANEL_CHAT_WORDWRAP
         numRows = self.nameLabel.component('text0').textNode.getNumRows()
         if numRows == 1:
             namePos = (0, 0, -0.06)
         elif numRows == 2:
             namePos = (0, 0, -0.03)
         else:
             namePos = (0, 0, 0)
         nameScale = 0.063
     elif self['item'].getTypeCode() == CatalogItemTypes.ACCESSORY_ITEM:
         self.nameLabel['text_wordwrap'] = CATALOG_PANEL_ACCESSORY_WORDWRAP
         namePos = (0, 0, -.22)
         nameScale = 0.06
     else:
         namePos = (0, 0, -.22)
         nameScale = 0.06
     self.nameLabel.setPos(*namePos)
     self.nameLabel.setScale(nameScale)
     numericBeanPrice = self['item'].getPrice(self['type'])
     priceStr = str(numericBeanPrice) + ' ' + TTLocalizer.CatalogCurrency
     priceScale = 0.07
     if self['item'].isSaleItem():
         priceStr = TTLocalizer.CatalogSaleItem + priceStr
         priceScale = 0.06
     self.priceLabel = DirectLabel(parent=self, relief=None, pos=(0, 0, -0.3), scale=priceScale, text=priceStr, text_fg=(0.95, 0.95, 0, 1), text_shadow=(0, 0, 0, 1), text_font=ToontownGlobals.getSignFont(), text_align=TextNode.ACenter)
     self.createEmblemPrices(numericBeanPrice)
     buttonModels = loader.loadModel('phase_3.5/models/gui/inventory_gui')
     upButton = buttonModels.find('**/InventoryButtonUp')
     downButton = buttonModels.find('**/InventoryButtonDown')
     rolloverButton = buttonModels.find('**/InventoryButtonRollover')
     buyText = TTLocalizer.CatalogBuyText
     buyTextScale = TTLocalizer.CIPbuyButton
     if self['item'].isRental():
         buyText = TTLocalizer.CatalogRentText
     self.buyButton = DirectButton(parent=self, relief=None, pos=(0.2, 0, 0.15), scale=(0.7, 1, 0.8), text=buyText, text_scale=buyTextScale, text_pos=(-0.005, -0.01), image=(upButton,
      downButton,
      rolloverButton,
      upButton), image_color=(1.0, 0.2, 0.2, 1), image0_color=Vec4(1.0, 0.4, 0.4, 1), image3_color=Vec4(1.0, 0.4, 0.4, 0.4), command=self.__handlePurchaseRequest)
     soundIcons = loader.loadModel('phase_5.5/models/gui/catalogSoundIcons')
     soundOn = soundIcons.find('**/sound07')
     soundOff = soundIcons.find('**/sound08')
     self.soundOnButton = DirectButton(parent=self, relief=None, pos=(0.2, 0, -0.15), scale=(0.7, 1, 0.8), text_scale=buyTextScale, text_pos=(-0.005, -0.01), image=(upButton,
      downButton,
      rolloverButton,
      upButton), image_color=(0.2, 0.5, 0.2, 1), image0_color=Vec4(0.4, 0.5, 0.4, 1), image3_color=Vec4(0.4, 0.5, 0.4, 0.4), command=self.handleSoundOnButton)
     self.soundOnButton.hide()
     soundOn.setScale(0.1)
     soundOn.reparentTo(self.soundOnButton)
     self.soundOffButton = DirectButton(parent=self, relief=None, pos=(0.2, 0, -0.15), scale=(0.7, 1, 0.8), text_scale=buyTextScale, text_pos=(-0.005, -0.01), image=(upButton,
      downButton,
      rolloverButton,
      upButton), image_color=(0.2, 1.0, 0.2, 1), image0_color=Vec4(0.4, 1.0, 0.4, 1), image3_color=Vec4(0.4, 1.0, 0.4, 0.4), command=self.handleSoundOffButton)
     self.soundOffButton.hide()
     soundOff = self.soundOffButton.attachNewNode('soundOff')
     soundOn.copyTo(soundOff)
     soundOff.reparentTo(self.soundOffButton)
     upGButton = buttonModels.find('**/InventoryButtonUp')
     downGButton = buttonModels.find('**/InventoryButtonDown')
     rolloverGButton = buttonModels.find('**/InventoryButtonRollover')
     self.giftButton = DirectButton(parent=self, relief=None, pos=(0.2, 0, 0.15), scale=(0.7, 1, 0.8), text=TTLocalizer.CatalogGiftText, text_scale=buyTextScale, text_pos=(-0.005, -0.01), image=(upButton,
      downButton,
      rolloverButton,
      upButton), image_color=(1.0, 0.2, 0.2, 1), image0_color=Vec4(1.0, 0.4, 0.4, 1), image3_color=Vec4(1.0, 0.4, 0.4, 0.4), command=self.__handleGiftRequest)
     self.updateButtons()
     return
Exemple #3
0
    def load(self):
        # Loading is guarded so things only get loaded once
        if self.loaded:
            return
        self.loaded = 1
        # Init variables
        self.verify = None
        # Some items know how to draw themselves.  Put this first so
        # it will be below any text on the frame.
        # Add a picture Frame so draw order is preserved if you change
        # the picture
        self.pictureFrame = self.attachNewNode('pictureFrame')
        self.pictureFrame.setScale(0.15)
        self.itemIndex = 0
        self.ival = None
        # If this is an item that needs customization, add buttons
        # to scroll through variations
        typeCode = self['item'].getTypeCode()
        if (self['item'].needsCustomize()
                and ((typeCode == CatalogItemTypes.WALLPAPER_ITEM) or
                     (typeCode == CatalogItemTypes.FLOORING_ITEM) or
                     (typeCode == CatalogItemTypes.MOULDING_ITEM) or
                     (typeCode == CatalogItemTypes.FURNITURE_ITEM) or
                     (typeCode == CatalogItemTypes.WAINSCOTING_ITEM) or
                     (typeCode == CatalogItemTypes.TOON_STATUE_ITEM))):
            if typeCode == CatalogItemTypes.WALLPAPER_ITEM:
                self.items = getAllWallpapers(self['item'].patternIndex)
            elif typeCode == CatalogItemTypes.FLOORING_ITEM:
                self.items = getAllFloorings(self['item'].patternIndex)
            elif typeCode == CatalogItemTypes.MOULDING_ITEM:
                self.items = getAllMouldings(self['item'].patternIndex)
            elif typeCode == CatalogItemTypes.FURNITURE_ITEM:
                self.items = getAllFurnitures(self['item'].furnitureType)
            elif typeCode == CatalogItemTypes.TOON_STATUE_ITEM:
                self.items = self['item'].getAllToonStatues()
            elif typeCode == CatalogItemTypes.WAINSCOTING_ITEM:
                self.items = getAllWainscotings(self['item'].patternIndex)
            self.numItems = len(self.items)
            if self.numItems > 1:
                guiItems = loader.loadModel('phase_5.5/models/gui/catalog_gui')
                nextUp = guiItems.find('**/arrow_up')
                nextRollover = guiItems.find('**/arrow_Rollover')
                nextDown = guiItems.find('**/arrow_Down')
                prevUp = guiItems.find('**/arrowUp')
                prevDown = guiItems.find('**/arrowDown1')
                prevRollover = guiItems.find('**/arrowRollover')
                self.nextVariant = DirectButton(
                    parent=self,
                    relief=None,
                    image=(nextUp, nextDown, nextRollover, nextUp),
                    image3_color=(1, 1, 1, .4),
                    pos=(0.13, 0, 0),
                    command=self.showNextVariant,
                )
                self.prevVariant = DirectButton(
                    parent=self,
                    relief=None,
                    image=(prevUp, prevDown, prevRollover, prevUp),
                    image3_color=(1, 1, 1, .4),
                    pos=(-0.13, 0, 0),
                    command=self.showPrevVariant,
                    state=DGG.DISABLED,
                )
                self.variantPictures = [(None, None)] * self.numItems
            else:
                self.variantPictures = [(None, None)]
            self.showCurrentVariant()
        else:
            # Some items know how to draw themselves.  Put this first so
            # it will be below any text on the frame.

            picture, self.ival = self['item'].getPicture(base.localAvatar)
            if picture:
                picture.reparentTo(self)
                picture.setScale(0.15)

            self.items = [self['item']]
            self.variantPictures = [(picture, self.ival)]
        # type label
        self.typeLabel = DirectLabel(
            parent=self,
            relief=None,
            pos=(0, 0, 0.24),
            scale=0.075,
            text=self['item'].getTypeName(),
            text_fg=(0.95, 0.95, 0, 1),
            text_shadow=(0, 0, 0, 1),
            text_font=ToontownGlobals.getInterfaceFont(),
            text_wordwrap=CATALOG_PANEL_WORDWRAP,
        )
        # aux text label
        self.auxText = DirectLabel(
            parent=self,
            relief=None,
            scale=0.05,
            pos=(-0.20, 0, 0.16),
        )
        # Put this one at a jaunty angle
        self.auxText.setHpr(0, 0, -30)

        self.nameLabel = DirectLabel(
            parent=self,
            relief=None,
            text=self['item'].getDisplayName(),
            text_fg=(0, 0, 0, 1),
            text_font=ToontownGlobals.getInterfaceFont(),
            text_scale=TTLocalizer.CIPnameLabel,
            text_wordwrap=CATALOG_PANEL_WORDWRAP +
            TTLocalizer.CIPwordwrapOffset,
        )

        if self['item'].getTypeCode() == CatalogItemTypes.CHAT_ITEM:
            # adjust wordwrap as the bubbles are narrower
            self.nameLabel['text_wordwrap'] = CATALOG_PANEL_CHAT_WORDWRAP
            # Center the text vertically on the chat balloon based
            # on the number of rows of text
            numRows = self.nameLabel.component('text0').textNode.getNumRows()
            if numRows == 1:
                namePos = (0, 0, -0.06)
            elif numRows == 2:
                namePos = (0, 0, -0.03)
            else:
                namePos = (0, 0, 0)
            nameScale = 0.063
        else:
            namePos = (0, 0, -.22)
            nameScale = 0.06
        self.nameLabel.setPos(*namePos)
        self.nameLabel.setScale(nameScale)

        priceStr = str(self['item'].getPrice(
            self['type'])) + " " + TTLocalizer.CatalogCurrency
        priceScale = 0.07
        # prepend sale sign if necessary
        if self['item'].isSaleItem():
            priceStr = TTLocalizer.CatalogSaleItem + priceStr
            priceScale = 0.06
        # price label
        self.priceLabel = DirectLabel(
            parent=self,
            relief=None,
            pos=(0, 0, -0.3),
            scale=priceScale,
            text=priceStr,
            text_fg=(0.95, 0.95, 0, 1),
            text_shadow=(0, 0, 0, 1),
            text_font=ToontownGlobals.getSignFont(),
            text_align=TextNode.ACenter,
        )

        # buy button
        buttonModels = loader.loadModel("phase_3.5/models/gui/inventory_gui")
        upButton = buttonModels.find("**/InventoryButtonUp")
        downButton = buttonModels.find("**/InventoryButtonDown")
        rolloverButton = buttonModels.find("**/InventoryButtonRollover")

        buyText = TTLocalizer.CatalogBuyText

        if self['item'].isRental():
            buyText = TTLocalizer.CatalogRentText

        self.buyButton = DirectButton(
            parent=self,
            relief=None,
            pos=(0.2, 0, 0.15),
            scale=(0.7, 1, 0.8),
            text=buyText,
            text_scale=(0.06, 0.05),
            text_pos=(-0.005, -0.01),
            image=(
                upButton,
                downButton,
                rolloverButton,
                upButton,
            ),
            image_color=(1.0, 0.2, 0.2, 1),
            # Make the rollover button pop out
            image0_color=Vec4(1.0, 0.4, 0.4, 1),
            # Make the disabled button fade out
            image3_color=Vec4(1.0, 0.4, 0.4, 0.4),
            command=self.__handlePurchaseRequest,
        )
        #self.updateBuyButton()

        soundIcons = loader.loadModel('phase_5.5/models/gui/catalogSoundIcons')
        soundOn = soundIcons.find('**/sound07')

        soundOff = soundIcons.find('**/sound08')

        self.soundOnButton = DirectButton(
            parent=self,
            relief=None,
            pos=(0.2, 0, -0.15),
            scale=(0.7, 1, 0.8),
            #geom = soundOn,
            #text = TTLocalizer.CatalogSndOnText,
            text_scale=(0.06, 0.05),
            text_pos=(-0.005, -0.01),
            image=(
                upButton,
                downButton,
                rolloverButton,
                upButton,
            ),
            image_color=(0.2, 0.5, 0.2, 1),
            # Make the rollover button pop out
            image0_color=Vec4(0.4, 0.5, 0.4, 1),
            # Make the disabled button fade out
            image3_color=Vec4(0.4, 0.5, 0.4, 0.4),
            command=self.handleSoundOnButton,
        )
        self.soundOnButton.hide()
        soundOn.setScale(0.1)
        soundOn.reparentTo(self.soundOnButton)

        self.soundOffButton = DirectButton(
            parent=self,
            relief=None,
            pos=(0.2, 0, -0.15),
            scale=(0.7, 1, 0.8),
            #text = TTLocalizer.CatalogSndOffText,
            text_scale=(0.06, 0.05),
            text_pos=(-0.005, -0.01),
            image=(
                upButton,
                downButton,
                rolloverButton,
                upButton,
            ),
            image_color=(0.2, 1.0, 0.2, 1),
            # Make the rollover button pop out
            image0_color=Vec4(0.4, 1.0, 0.4, 1),
            # Make the disabled button fade out
            image3_color=Vec4(0.4, 1.0, 0.4, 0.4),
            command=self.handleSoundOffButton,
        )
        self.soundOffButton.hide()
        soundOff = self.soundOffButton.attachNewNode('soundOff')
        soundOn.copyTo(soundOff)
        #soundOff.setScale(0.1)
        soundOff.reparentTo(self.soundOffButton)

        upGButton = buttonModels.find("**/InventoryButtonUp")
        downGButton = buttonModels.find("**/InventoryButtonDown")
        rolloverGButton = buttonModels.find("**/InventoryButtonRollover")

        ##if len(base.localAvatar.friendsList) > 0:
        self.giftButton = DirectButton(
            parent=self,
            relief=None,
            pos=(0.2, 0, 0.15),
            scale=(0.7, 1, 0.8),
            text=TTLocalizer.CatalogGiftText,
            text_scale=(0.06, 0.05),
            text_pos=(-0.005, -0.01),
            image=(
                upButton,
                downButton,
                rolloverButton,
                upButton,
            ),
            image_color=(1.0, 0.2, 0.2, 1),
            # Make the rollover button pop out
            image0_color=Vec4(1.0, 0.4, 0.4, 1),
            # Make the disabled button fade out
            image3_color=Vec4(1.0, 0.4, 0.4, 0.4),
            command=self.__handleGiftRequest,
        )
        self.updateButtons()