def update(self): if base.localAvatar.flowerCollection.hasSpecies(self.species): self.flowerPanel.show(showBackground=0) self['text'] = TTLocalizer.FlowerSpeciesNames[self.species] for variety in xrange( len(GardenGlobals.getFlowerVarieties(self.species))): if base.localAvatar.flowerCollection.hasFlower( self.species, variety): name = GardenGlobals.getFlowerVarietyName( self.species, variety) self.speciesLabels[variety]['text'] = name self.speciesLabels[variety]['state'] = DGG.NORMAL self.showRecipe()
def setSpecies(self, species): if self.species == species: return self.species = species if self.species != None: if self.flowerPanel: self.flowerPanel.destroy() varietyToUse = self.flowerCollection.getInitialVariety( self.species) self.variety = varietyToUse self.flowerPanel = FlowerPhoto.FlowerPhoto(species=self.species, variety=varietyToUse, parent=self) zAdj = 0.0131 xAdj = -0.002 self.flowerPanel.setPos(-0.229 + xAdj, 1, -0.01 + zAdj) self.flowerPanel.setSwimBounds(-0.2461, 0.2367, -0.207 + zAdj, 0.2664 + zAdj) self.flowerPanel.setSwimColor(0.75, 0.75, 0.75, 1.0) varietyList = GardenGlobals.getFlowerVarieties(self.species) self.speciesLabels = [] offset = 0.075 startPos = len(varietyList) / 2 * offset if not len(varietyList) % 2: startPos -= offset / 2 for variety in xrange(len(varietyList)): label = DirectButton( parent=self, frameSize=(0, 0.445, -0.02, 0.04), relief=None, state=DGG.DISABLED, pos=(0.06, 0, startPos - variety * offset), text=TTLocalizer.FlowerUnknown, text_fg=(0.2, 0.1, 0.0, 1), text_scale=(0.045, 0.045, 0.45), text_align=TextNode.ALeft, text_font=ToontownGlobals.getInterfaceFont(), command=self.changeVariety, extraArgs=[variety], text1_bg=Vec4(1, 1, 0, 1), text2_bg=Vec4(0.5, 0.9, 1, 1), text3_fg=Vec4(0.4, 0.8, 0.4, 1)) self.speciesLabels.append(label) return