Exemple #1
0
    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
 def load(self):
     self.weight = DirectLabel(parent=self,
                               pos=(0, 0, -0.28000000000000003),
                               relief=None,
                               state=DGG.NORMAL,
                               text='',
                               text_scale=0.050000000000000003,
                               text_fg=(0, 0, 0, 1),
                               text_pos=(0, 0.0, 0),
                               text_font=ToontownGlobals.getInterfaceFont(),
                               text_wordwrap=10.5)
     self.value = DirectLabel(parent=self,
                              pos=TTLocalizer.FPvaluePos,
                              relief=None,
                              state=DGG.NORMAL,
                              text='',
                              text_scale=TTLocalizer.FPvalue,
                              text_fg=(0, 0, 0, 1),
                              text_pos=(0, 0, 0),
                              text_font=ToontownGlobals.getInterfaceFont(),
                              text_wordwrap=10.5)
     self.mystery = DirectLabel(
         parent=self,
         pos=(-0.025000000000000001, 0, -0.055),
         relief=None,
         state=DGG.NORMAL,
         text='?',
         text_scale=0.25,
         text_fg=(0, 0, 0, 1),
         text_pos=(0, 0, 0),
         text_font=ToontownGlobals.getInterfaceFont(),
         text_wordwrap=10.5)
     self.extraLabel = DirectLabel(parent=self,
                                   relief=None,
                                   state=DGG.NORMAL,
                                   text='',
                                   text_fg=(0.20000000000000001,
                                            0.80000000000000004,
                                            0.40000000000000002, 1),
                                   text_font=ToontownGlobals.getSignFont(),
                                   text_scale=0.080000000000000002,
                                   pos=(0, 0, 0.26000000000000001))
     buttons = loader.loadModel('phase_3/models/gui/dialog_box_buttons_gui')
     self.cancel = DirectButton(parent=self,
                                pos=(0.27500000000000002, 0, -0.375),
                                relief=None,
                                state=DGG.NORMAL,
                                image=(buttons.find('**/CloseBtn_UP'),
                                       buttons.find('**/CloseBtn_DN'),
                                       buttons.find('**/CloseBtn_Rllvr')),
                                image_scale=(0.59999999999999998, 1,
                                             0.59999999999999998),
                                command=self.handleCancel)
     buttons.removeNode()
     self.photo = FlowerPhoto.FlowerPhoto(parent=self)
     self.update(self.flower)
    def setSpecies(self, species):
        assert self.notify.debugStateCall(self)
        if self.species == species:
            return
        self.species = species
        if self.species != None:
            # load the species image
            if self.flowerPanel:
                self.flowerPanel.destroy()
            #f = FishBase.FishBase(self.species, 0, 0)
            varietyToUse = self.flowerCollection.getInitialVariety(self.species)
            self.variety = varietyToUse
            self.flowerPanel = FlowerPhoto.FlowerPhoto(species = self.species, variety=varietyToUse, parent=self)
            #self.flowerPanel.setPos(-0.23, 1, -0.01)
            zAdj = 0.0131
            xAdj = -0.002
            self.flowerPanel.setPos(-0.229 + xAdj, 1,- 0.01 + zAdj)
            # This is carefully placed over the book image.  Please try to keep
            # this in sync with the book position:
            self.flowerPanel.setSwimBounds(-0.2461, 0.2367, -0.207 + zAdj , 0.2664 + zAdj)
            # Light blue-green water background:
            #self.flowerPanel.setSwimColor(0.47, 1.0, 0.99, 1.0)
            # dark green lawn background
            #self.flowerPanel.setSwimColor(0.25, 0.5, 0.25, 1.0)
            # light gray neutral background
            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:
                # even len's need a little shift down
                startPos -= offset / 2

            for variety in range(len(varietyList)):
                label = DirectButton(
                    parent=self,
                    frameSize = (0,0.445,-0.02,0.04),
                    relief=None, #DGG.RIDGE,
                    #borderWidth = (0.01,0.01),
                    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)
Exemple #4
0
    def load(self):
        assert self.notify.debugStateCall(self)
        # flower detail panel
        self.weight = DirectLabel(parent=self,
                                  pos=(0, 0, -0.28),
                                  relief=None,
                                  state=DGG.NORMAL,
                                  text="",
                                  text_scale=0.05,
                                  text_fg=(0, 0, 0, 1),
                                  text_pos=(0, 0., 0),
                                  text_font=ToontownGlobals.getInterfaceFont(),
                                  text_wordwrap=10.5)
        self.value = DirectLabel(parent=self,
                                 pos=TTLocalizer.FPvaluePos,
                                 relief=None,
                                 state=DGG.NORMAL,
                                 text="",
                                 text_scale=TTLocalizer.FPvalue,
                                 text_fg=(0, 0, 0, 1),
                                 text_pos=(0, 0, 0),
                                 text_font=ToontownGlobals.getInterfaceFont(),
                                 text_wordwrap=10.5)
        self.mystery = DirectLabel(
            parent=self,
            pos=(-0.025, 0, -0.055),
            relief=None,
            state=DGG.NORMAL,
            text="?",
            text_scale=0.25,
            text_fg=(0, 0, 0, 1),
            text_pos=(0, 0, 0),
            text_font=ToontownGlobals.getInterfaceFont(),
            text_wordwrap=10.5)

        self.extraLabel = DirectLabel(
            parent=self,
            relief=None,
            state=DGG.NORMAL,
            text="",
            text_fg=(0.2, 0.8, 0.4, 1),
            text_font=ToontownGlobals.getSignFont(),
            text_scale=0.08,
            pos=(0, 0, 0.26),
        )

        buttons = loader.loadModel('phase_3/models/gui/dialog_box_buttons_gui')
        # flower detail close button
        self.cancel = DirectButton(
            parent=self,
            pos=(0.275, 0, -0.375),
            relief=None,
            state=DGG.NORMAL,
            image=(buttons.find('**/CloseBtn_UP'),
                   buttons.find('**/CloseBtn_DN'),
                   buttons.find('**/CloseBtn_Rllvr')),
            image_scale=(0.6, 1, 0.6),
            command=self.handleCancel,
        )
        buttons.removeNode()
        self.photo = FlowerPhoto.FlowerPhoto(parent=self)
        # make the scroll list
        self.update(self.flower)