コード例 #1
0
ファイル: PartyEditor.py プロジェクト: abtechmg/rttim
    def initElementList(self):
        self.activityIconsModel = loader.loadModel(
            'phase_4/models/parties/eventSignIcons')
        self.decorationModels = loader.loadModel(
            'phase_4/models/parties/partyDecorations')
        pos = self.partyPlanner.gui.find(
            '**/step_05_activitiesIcon_locator').getPos()
        self.elementList = DirectScrolledList(
            parent=self.parent,
            relief=None,
            decButton_image=(
                self.partyPlanner.gui.find('**/activitiesButtonUp_up'),
                self.partyPlanner.gui.find('**/activitiesButtonUp_down'),
                self.partyPlanner.gui.find('**/activitiesButtonUp_rollover'),
                self.partyPlanner.gui.find('**/activitiesButtonUp_inactive')),
            decButton_relief=None,
            decButton_pos=(-0.05, 0.0, -0.38),
            incButton_image=(
                self.partyPlanner.gui.find('**/activitiesButtonDown_up'),
                self.partyPlanner.gui.find('**/activitiesButtonDown_down'),
                self.partyPlanner.gui.find('**/activitiesButtonDown_rollover'),
                self.partyPlanner.gui.find('**/activitiesButtonDown_inactive')
            ),
            incButton_relief=None,
            incButton_pos=(-0.05, 0.0, -0.94),
            itemFrame_pos=(pos[0], pos[1], pos[2] + 0.04),
            itemFrame_relief=None,
            numItemsVisible=1,
            items=[])
        holidayIds = base.cr.newsManager.getHolidayIdList()
        isWinter = ToontownGlobals.WINTER_DECORATIONS in holidayIds or ToontownGlobals.WINTER_SNOWFALL in holidayIds
        isVictory = ToontownGlobals.VICTORY_PARTY_HOLIDAY in holidayIds
        isValentine = ToontownGlobals.VALENTINES_DAY in holidayIds
        for activityId in PartyGlobals.PartyEditorActivityOrder:
            if not isVictory and activityId in PartyGlobals.VictoryPartyActivityIds or not isWinter and activityId in PartyGlobals.WinterPartyActivityIds or not isValentine and activityId in PartyGlobals.ValentinePartyActivityIds:
                pass
            elif isVictory and activityId in PartyGlobals.VictoryPartyReplacementActivityIds or isWinter and activityId in PartyGlobals.WinterPartyReplacementActivityIds or isValentine and activityId in PartyGlobals.ValentinePartyReplacementActivityIds:
                pass
            else:
                pele = PartyEditorListElement(self, activityId)
                self.elementList.addItem(pele)
                if activityId == PartyGlobals.ActivityIds.PartyClock:
                    self.partyClockElement = pele

        for decorationId in PartyGlobals.DecorationIds:
            if not isVictory and decorationId in PartyGlobals.VictoryPartyDecorationIds or not isWinter and decorationId in PartyGlobals.WinterPartyDecorationIds or not isValentine and decorationId in PartyGlobals.ValentinePartyDecorationIds:
                pass
            elif isVictory and decorationId in PartyGlobals.VictoryPartyReplacementDecorationIds or isValentine and decorationId in PartyGlobals.ValentinePartyReplacementDecorationIds:
                pass
            elif decorationId in PartyGlobals.TTRUnreleasedDecor:
                pass
            else:
                pele = PartyEditorListElement(self,
                                              decorationId,
                                              isDecoration=True)
                self.elementList.addItem(pele)

        self.elementList.refresh()
        self.elementList['command'] = self.scrollItemChanged
        return
コード例 #2
0
ファイル: PartyEditor.py プロジェクト: satire6/Anesidora
    def initElementList(self):
        self.activityIconsModel = loader.loadModel(
            "phase_4/models/parties/eventSignIcons")
        self.decorationModels = loader.loadModel(
            "phase_4/models/parties/partyDecorations")
        pos = self.partyPlanner.gui.find(
            "**/step_05_activitiesIcon_locator").getPos()
        self.elementList = DirectScrolledList(
            parent=self.parent,
            relief=None,
            # inc and dec are DirectButtons
            decButton_image=(
                self.partyPlanner.gui.find("**/activitiesButtonUp_up"),
                self.partyPlanner.gui.find("**/activitiesButtonUp_down"),
                self.partyPlanner.gui.find("**/activitiesButtonUp_rollover"),
                self.partyPlanner.gui.find("**/activitiesButtonUp_inactive"),
            ),
            decButton_relief=None,
            decButton_pos=(-0.05, 0.0, -0.38),
            incButton_image=(
                self.partyPlanner.gui.find("**/activitiesButtonDown_up"),
                self.partyPlanner.gui.find("**/activitiesButtonDown_down"),
                self.partyPlanner.gui.find("**/activitiesButtonDown_rollover"),
                self.partyPlanner.gui.find("**/activitiesButtonDown_inactive"),
            ),
            incButton_relief=None,
            incButton_pos=(-0.05, 0.0, -0.94),

            # itemFrame is a DirectFrame
            itemFrame_pos=(pos[0], pos[1], pos[2] + 0.04),
            itemFrame_relief=None,
            # each item is a button with text on it
            numItemsVisible=1,
            items=[],
        )

        for activityId in PartyGlobals.PartyEditorActivityOrder:
            if activityId in PartyGlobals.VictoryPartyActivityIds:
                holidayIds = base.cr.newsManager.getHolidayIdList()
                if ToontownGlobals.VICTORY_PARTY_HOLIDAY in holidayIds:
                    pele = PartyEditorListElement(self, activityId)
                    self.elementList.addItem(pele)
            elif activityId in PartyGlobals.VictoryPartyReplacementActivityIds:
                holidayIds = base.cr.newsManager.getHolidayIdList()
                if not ToontownGlobals.VICTORY_PARTY_HOLIDAY in holidayIds:
                    pele = PartyEditorListElement(self, activityId)
                    self.elementList.addItem(pele)
            else:
                pele = PartyEditorListElement(self, activityId)
                self.elementList.addItem(pele)
                if activityId == PartyGlobals.ActivityIds.PartyClock:
                    self.partyClockElement = pele

        for decorationId in PartyGlobals.DecorationIds:
            decorName = PartyGlobals.DecorationIds.getString(decorationId)
            if (decorName == "HeartTarget") \
            or (decorName == "HeartBanner") \
            or (decorName == "FlyingHeart"):
                holidayIds = base.cr.newsManager.getHolidayIdList()
                if ToontownGlobals.VALENTINES_DAY in holidayIds:
                    pele = PartyEditorListElement(self,
                                                  decorationId,
                                                  isDecoration=True)
                    self.elementList.addItem(pele)
            elif decorationId in PartyGlobals.VictoryPartyDecorationIds:
                holidayIds = base.cr.newsManager.getHolidayIdList()
                if ToontownGlobals.VICTORY_PARTY_HOLIDAY in holidayIds:
                    pele = PartyEditorListElement(self,
                                                  decorationId,
                                                  isDecoration=True)
                    self.elementList.addItem(pele)
            elif decorationId in PartyGlobals.VictoryPartyReplacementDecorationIds:
                holidayIds = base.cr.newsManager.getHolidayIdList()
                if not ToontownGlobals.VICTORY_PARTY_HOLIDAY in holidayIds:
                    pele = PartyEditorListElement(self,
                                                  decorationId,
                                                  isDecoration=True)
                    self.elementList.addItem(pele)
            else:
                pele = PartyEditorListElement(self,
                                              decorationId,
                                              isDecoration=True)
                self.elementList.addItem(pele)
        self.elementList.refresh()
        self.elementList['command'] = self.scrollItemChanged