Ejemplo n.º 1
0
 def updateInvitation(self, hostsName, partyInfo):
     self.partyInfo = partyInfo
     hostsName = TTLocalizer.GetPossesive(hostsName)
     self.whosePartyLabel[
         'text'] = TTLocalizer.PartyPlannerInvitationWhoseSentence % hostsName
     if self.partyInfo.isPrivate:
         publicPrivateText = TTLocalizer.PartyPlannerPrivate.lower()
     else:
         publicPrivateText = TTLocalizer.PartyPlannerPublic.lower()
     activities = self.getActivitiesFormattedCorrectly()
     if self.noFriends:
         self.activityTextLabel[
             'text'] = TTLocalizer.PartyPlannerInvitationThemeWhatSentenceNoFriends % (
                 publicPrivateText, activities)
     else:
         self.activityTextLabel[
             'text'] = TTLocalizer.PartyPlannerInvitationThemeWhatSentence % (
                 publicPrivateText, activities)
     if self.noFriends:
         self.whenTextLabel[
             'text'] = TTLocalizer.PartyPlannerInvitationWhenSentenceNoFriends % (
                 PartyUtils.formatDate(self.partyInfo.startTime.year,
                                       self.partyInfo.startTime.month,
                                       self.partyInfo.startTime.day),
                 PartyUtils.formatTime(self.partyInfo.startTime.hour,
                                       self.partyInfo.startTime.minute))
     else:
         self.whenTextLabel[
             'text'] = TTLocalizer.PartyPlannerInvitationWhenSentence % (
                 PartyUtils.formatDate(self.partyInfo.startTime.year,
                                       self.partyInfo.startTime.month,
                                       self.partyInfo.startTime.day),
                 PartyUtils.formatTime(self.partyInfo.startTime.hour,
                                       self.partyInfo.startTime.minute))
     self.changeTheme(partyInfo.inviteTheme)
Ejemplo n.º 2
0
 def invitePartyClicked(self, item):
     if item.getPythonTag(
             'partyStatus') == PartyGlobals.PartyStatus.Started:
         self.invitePartyGoButton['state'] = DirectGuiGlobals.NORMAL
     else:
         self.invitePartyGoButton['state'] = DirectGuiGlobals.DISABLED
     if self.selectedInvitationItem is not None:
         self.selectedInvitationItem['state'] = DirectGuiGlobals.NORMAL
         self.selectedInvitationItem['text_bg'] = Vec4(0.0, 0.0, 0.0, 0.0)
     self.selectedInvitationItem = item
     self.selectedInvitationItem['state'] = DirectGuiGlobals.DISABLED
     self.selectedInvitationItem['text_bg'] = Vec4(1.0, 1.0, 0.0, 1.0)
     self.fillInviteActivityList(item.getPythonTag('activityIds'))
     startTime = item.getPythonTag('startTime')
     self.invitationDateTimeLabel[
         'text'] = TTLocalizer.EventsPageInvitedTabTime % (
             PartyUtils.formatDate(startTime.year, startTime.month,
                                   startTime.day),
             PartyUtils.formatTime(startTime.hour, startTime.minute))
     return
Ejemplo n.º 3
0
 def updateInvitation(self, hostsName, partyInfo):
     self.partyInfo = partyInfo
     hostsName = TTLocalizer.GetPossesive(hostsName)
     self.whosePartyLabel['text'] = TTLocalizer.PartyPlannerInvitationWhoseSentence % hostsName
     if self.partyInfo.isPrivate:
         publicPrivateText = TTLocalizer.PartyPlannerPrivate.lower()
     else:
         publicPrivateText = TTLocalizer.PartyPlannerPublic.lower()
     activities = self.getActivitiesFormattedCorrectly()
     if self.noFriends:
         self.activityTextLabel['text'] = TTLocalizer.PartyPlannerInvitationThemeWhatSentenceNoFriends % (publicPrivateText, activities)
     else:
         self.activityTextLabel['text'] = TTLocalizer.PartyPlannerInvitationThemeWhatSentence % (publicPrivateText, activities)
     if self.noFriends:
         self.whenTextLabel['text'] = TTLocalizer.PartyPlannerInvitationWhenSentenceNoFriends % (PartyUtils.formatDate(self.partyInfo.startTime.year, self.partyInfo.startTime.month, self.partyInfo.startTime.day), PartyUtils.formatTime(self.partyInfo.startTime.hour, self.partyInfo.startTime.minute))
     else:
         self.whenTextLabel['text'] = TTLocalizer.PartyPlannerInvitationWhenSentence % (PartyUtils.formatDate(self.partyInfo.startTime.year, self.partyInfo.startTime.month, self.partyInfo.startTime.day), PartyUtils.formatTime(self.partyInfo.startTime.hour, self.partyInfo.startTime.minute))
     self.changeTheme(partyInfo.inviteTheme)
Ejemplo n.º 4
0
    def loadHostedPartyInfo(self):
        self.unloadGuests()
        self.unloadActivities()
        self.unloadDecorations()
        self.hostedPartyInfo = None
        self.confirmCancelPartyGui.doneStatus = ''
        self.confirmCancelPartyGui.hide()
        self.cancelPartyResultGui.doneStatus = ''
        self.cancelPartyResultGui.hide()
        if base.localAvatar.hostedParties is not None and len(
                base.localAvatar.hostedParties) > 0:
            for partyInfo in base.localAvatar.hostedParties:
                if partyInfo.status == PartyGlobals.PartyStatus.Pending or partyInfo.status == PartyGlobals.PartyStatus.CanStart or partyInfo.status == PartyGlobals.PartyStatus.NeverStarted or partyInfo.status == PartyGlobals.PartyStatus.Started:
                    self.hostedPartyInfo = partyInfo
                    self.loadGuests()
                    self.loadActivities()
                    self.loadDecorations()
                    self.hostingDateLabel[
                        'text'] = TTLocalizer.EventsPageHostTabDateTimeLabel % (
                            PartyUtils.formatDate(partyInfo.startTime.year,
                                                  partyInfo.startTime.month,
                                                  partyInfo.startTime.day),
                            PartyUtils.formatTime(partyInfo.startTime.hour,
                                                  partyInfo.startTime.minute))
                    self.isPrivate = partyInfo.isPrivate
                    self.__setPublicPrivateButton()
                    if partyInfo.status == PartyGlobals.PartyStatus.CanStart:
                        self.partyGoButton['state'] = DirectGuiGlobals.NORMAL
                        self.partyGoButton['text'] = (
                            TTLocalizer.EventsPageGoButton, )
                    elif partyInfo.status == PartyGlobals.PartyStatus.Started:
                        place = base.cr.playGame.getPlace()
                        if isinstance(place, Party):
                            if hasattr(base, 'distributedParty'):
                                if base.distributedParty.partyInfo.hostId == base.localAvatar.doId:
                                    self.partyGoButton[
                                        'state'] = DirectGuiGlobals.DISABLED
                                else:
                                    self.partyGoButton[
                                        'state'] = DirectGuiGlobals.NORMAL
                            else:
                                self.partyGoButton[
                                    'state'] = DirectGuiGlobals.NORMAL
                                self.notify.warning(
                                    'base.distributedParty is not defined when base.cr.playGame.getPlace is party. This should never happen.'
                                )
                        else:
                            self.partyGoButton[
                                'state'] = DirectGuiGlobals.NORMAL
                        self.partyGoButton['text'] = (
                            TTLocalizer.EventsPageGoBackButton, )
                    else:
                        self.partyGoButton['text'] = (
                            TTLocalizer.EventsPageGoButton, )
                        self.partyGoButton['state'] = DirectGuiGlobals.DISABLED
                    if partyInfo.status not in (
                            PartyGlobals.PartyStatus.Pending,
                            PartyGlobals.PartyStatus.CanStart):
                        self.hostingCancelButton[
                            'state'] = DirectGuiGlobals.DISABLED
                    else:
                        self.hostingCancelButton[
                            'state'] = DirectGuiGlobals.NORMAL
                    self.hostingDateLabel.show()
                    self.hostedPartyDisplay.show()
                    return

        self.hostingDateLabel['text'] = TTLocalizer.EventsPageHostingTabNoParty
        self.hostingCancelButton['state'] = DirectGuiGlobals.DISABLED
        self.partyGoButton['state'] = DirectGuiGlobals.DISABLED
        self.publicButton['state'] = DirectGuiGlobals.DISABLED
        self.privateButton['state'] = DirectGuiGlobals.DISABLED
        self.hostedPartyDisplay.show()
        return
Ejemplo n.º 5
0
    def loadHostedPartyInfo(self):
        self.unloadGuests()
        self.unloadActivities()
        self.unloadDecorations()
        self.hostedPartyInfo = None
        self.confirmCancelPartyGui.doneStatus = ''
        self.confirmCancelPartyGui.hide()
        self.cancelPartyResultGui.doneStatus = ''
        self.cancelPartyResultGui.hide()
        if base.localAvatar.hostedParties is not None and len(base.localAvatar.hostedParties) > 0:
            for partyInfo in base.localAvatar.hostedParties:
                if partyInfo.status == PartyGlobals.PartyStatus.Pending or partyInfo.status == PartyGlobals.PartyStatus.CanStart or partyInfo.status == PartyGlobals.PartyStatus.NeverStarted or partyInfo.status == PartyGlobals.PartyStatus.Started:
                    self.hostedPartyInfo = partyInfo
                    self.loadGuests()
                    self.loadActivities()
                    self.loadDecorations()
                    self.hostingDateLabel['text'] = TTLocalizer.EventsPageHostTabDateTimeLabel % (PartyUtils.formatDate(partyInfo.startTime.year, partyInfo.startTime.month, partyInfo.startTime.day), PartyUtils.formatTime(partyInfo.startTime.hour, partyInfo.startTime.minute))
                    self.isPrivate = partyInfo.isPrivate
                    self.__setPublicPrivateButton()
                    if partyInfo.status == PartyGlobals.PartyStatus.CanStart:
                        self.partyGoButton['state'] = DirectGuiGlobals.NORMAL
                        self.partyGoButton['text'] = (TTLocalizer.EventsPageGoButton,)
                    elif partyInfo.status == PartyGlobals.PartyStatus.Started:
                        place = base.cr.playGame.getPlace()
                        if isinstance(place, Party):
                            if hasattr(base, 'distributedParty'):
                                if base.distributedParty.partyInfo.hostId == base.localAvatar.doId:
                                    self.partyGoButton['state'] = DirectGuiGlobals.DISABLED
                                else:
                                    self.partyGoButton['state'] = DirectGuiGlobals.NORMAL
                            else:
                                self.partyGoButton['state'] = DirectGuiGlobals.NORMAL
                                self.notify.warning('base.distributedParty is not defined when base.cr.playGame.getPlace is party. This should never happen.')
                        else:
                            self.partyGoButton['state'] = DirectGuiGlobals.NORMAL
                        self.partyGoButton['text'] = (TTLocalizer.EventsPageGoBackButton,)
                    else:
                        self.partyGoButton['text'] = (TTLocalizer.EventsPageGoButton,)
                        self.partyGoButton['state'] = DirectGuiGlobals.DISABLED
                    if partyInfo.status not in (PartyGlobals.PartyStatus.Pending, PartyGlobals.PartyStatus.CanStart):
                        self.hostingCancelButton['state'] = DirectGuiGlobals.DISABLED
                    else:
                        self.hostingCancelButton['state'] = DirectGuiGlobals.NORMAL
                    self.hostingDateLabel.show()
                    self.hostedPartyDisplay.show()
                    return

        self.hostingDateLabel['text'] = TTLocalizer.EventsPageHostingTabNoParty
        self.hostingCancelButton['state'] = DirectGuiGlobals.DISABLED
        self.partyGoButton['state'] = DirectGuiGlobals.DISABLED
        self.publicButton['state'] = DirectGuiGlobals.DISABLED
        self.privateButton['state'] = DirectGuiGlobals.DISABLED
        self.hostedPartyDisplay.show()
        return
Ejemplo n.º 6
0
 def invitePartyClicked(self, item):
     if item.getPythonTag('partyStatus') == PartyGlobals.PartyStatus.Started:
         self.invitePartyGoButton['state'] = DirectGuiGlobals.NORMAL
     else:
         self.invitePartyGoButton['state'] = DirectGuiGlobals.DISABLED
     if self.selectedInvitationItem is not None:
         self.selectedInvitationItem['state'] = DirectGuiGlobals.NORMAL
         self.selectedInvitationItem['text_bg'] = Vec4(0.0, 0.0, 0.0, 0.0)
     self.selectedInvitationItem = item
     self.selectedInvitationItem['state'] = DirectGuiGlobals.DISABLED
     self.selectedInvitationItem['text_bg'] = Vec4(1.0, 1.0, 0.0, 1.0)
     self.fillInviteActivityList(item.getPythonTag('activityIds'))
     startTime = item.getPythonTag('startTime')
     self.invitationDateTimeLabel['text'] = TTLocalizer.EventsPageInvitedTabTime % (PartyUtils.formatDate(startTime.year, startTime.month, startTime.day), PartyUtils.formatTime(startTime.hour, startTime.minute))
     return