Ejemplo n.º 1
0
 def __handleExit(self):
     assert (MailboxScreen.notify.debug("__handleExit"))
     if self.numAtticAccepted == 0:
         self.__acceptExit()
     elif self.numAtticAccepted == 1:
         self.dialogBox = TTDialog.TTDialog(
             style=TTDialog.Acknowledge,
             text=TTLocalizer.CatalogAcceptInAttic,
             text_wordwrap=15,
             command=self.__acceptExit,
         )
         self.dialogBox.show()
     else:
         self.dialogBox = TTDialog.TTDialog(
             style=TTDialog.Acknowledge,
             text=TTLocalizer.CatalogAcceptInAtticP,
             text_wordwrap=15,
             command=self.__acceptExit,
         )
         self.dialogBox.show()
Ejemplo n.º 2
0
 def __revertBack(self, reason):
     if not self.resetDisplayProperties(self.origPipe, self.origProperties):
         self.notify.warning("Couldn't restore original display settings!")
         base.panda3dRenderError()
     self.clearBin()
     if reason == 0:
         revertText = TTLocalizer.DisplaySettingsRevertUser
     else:
         revertText = TTLocalizer.DisplaySettingsRevertFailed
     self.revertDialog = TTDialog.TTDialog(dialogName='DisplaySettingsRevert', style=TTDialog.Acknowledge, text=revertText, text_wordwrap=15, command=self.__revertDone)
     self.revertDialog.setBin('gui-popup', 0)
Ejemplo n.º 3
0
 def playTutorialReward_2(self, value):
     self.tutRewardDialog_1.cleanup()
     self.tutRewardDialog_2 = TTDialog.TTDialog(text=TTLocalizer.MovieTutorialReward2, command=self.playTutorialReward_3, style=TTDialog.Acknowledge, fadeScreen=None, pos=(0.65, 0, 0.5), scale=0.8)
     self.tutRewardDialog_2.hide()
     self._deleteTrack()
     self.track = Sequence(name='tutorial-reward-2')
     self.track.append(Wait(1.0))
     self.track += self.rewardPanel.getTrackIntervalList(base.localAvatar, SQUIRT_TRACK, 0, 1, 0)
     self.track.append(Func(self.tutRewardDialog_2.show))
     self.track.start()
     return
Ejemplo n.º 4
0
 def enter(self):
     """enter(phase)
     """
     # Make the toon stop running.
     base.localAvatar.loop("neutral")
     self.doneStatus = {'mode': 'incomplete'}
     msg = TTLocalizer.TutorialForceAcknowledgeMessage
     self.dialog = TTDialog.TTDialog(text=msg,
                                     command=self.handleOk,
                                     style=TTDialog.Acknowledge)
     return
Ejemplo n.º 5
0
    def __applyDone(self, command):
        self.applyDialog.cleanup()
        self.applyDialog = None

        # Restore our dialog to the top of the fade screen.
        self.setBin('gui-popup', 0)
        base.transitions.fadeScreen(.5)

        if command != DGG.DIALOG_OK:
            return

        # Now apply the new settings.
        self.origPipe = base.pipe
        self.origProperties = base.win.getProperties()

        pipe = self.apiPipes[self.apiMenu.selectedIndex]
        properties = WindowProperties()
        xSize, ySize = self.screenSizes[self.screenSizeIndex]
        properties.setSize(xSize, ySize)
        properties.setFullscreen(self.displayMode == self.FullscreenMode)
        fullscreen = self.displayMode == self.FullscreenMode
        embedded = self.displayMode == self.EmbeddedMode
        if embedded:
            if self.isEmbeddedPossible():
                # yeah you can go embedded
                pass
            else:
                self.notify.warning("how was the player able to choose embedded")
                embedded = False
        #if not self.resetDisplayProperties(pipe, properties):
        if not self.changeDisplayProperties(pipe, xSize, ySize, fullscreen, embedded):
            # If we couldn't open the window, go back without
            # bothering to prompt the user.
            self.__revertBack(1)
            return

        # And pop up a dialog giving the user a chance to acknowledge
        # that the new settings worked.

        # Move our dialog back under the fade screen.
        self.clearBin();

        self.timeoutDialog = TTDialog.TTDialog(
            dialogName = 'DisplaySettingsTimeout',
            style = TTDialog.TwoChoice,
            text = TTLocalizer.DisplaySettingsAccept % (self.ApplyTimeoutSeconds),
            text_wordwrap = 15,
            command = self.__timeoutDone
            )
        self.timeoutDialog.setBin('gui-popup', 0)
        self.timeoutRemaining = self.ApplyTimeoutSeconds
        self.timeoutStart = None
        taskMgr.add(self.__timeoutCountdown, self.TimeoutCountdownTask)
 def _MailboxScreen__acceptItemCallback(self, retcode, item, index):
     needtoUpdate = 0
     if self.acceptingIndex == None:
         needtoUpdate = 1
     
     if not hasattr(self, 'frame'):
         return None
     
     if retcode == ToontownGlobals.P_UserCancelled:
         print 'mailbox screen user canceled'
         self.acceptingIndex = None
         self._MailboxScreen__updateItems()
         return None
     
     if self.acceptingIndex != index:
         self.notify.warning('Got unexpected callback for index %s, expected %s.' % (index, self.acceptingIndex))
         return None
     
     self.acceptingIndex = None
     if retcode < 0:
         self.notify.info('Could not take item %s: retcode %s' % (item, retcode))
         if retcode == ToontownGlobals.P_NoTrunk:
             self.dialogBox = TTDialog.TTDialog(style = TTDialog.Acknowledge, text = TTLocalizer.CatalogAcceptNoTrunk, text_wordwrap = 15, command = self._MailboxScreen__acceptError)
         else:
             self.dialogBox = TTDialog.TTDialog(style = TTDialog.TwoChoiceCustom, text = item.getAcceptItemErrorText(retcode), text_wordwrap = 15, command = self._MailboxScreen__handleDiscard, buttonText = [
                 TTLocalizer.MailboxDiscard,
                 TTLocalizer.MailboxLeave])
         self.dialogBox.show()
     elif hasattr(item, 'storedInAttic') and item.storedInAttic():
         self.numAtticAccepted += 1
         self.itemIndex += 1
         if needtoUpdate == 1:
             self._MailboxScreen__updateItems()
         
     elif isinstance(item, InviteInfoBase):
         self._MailboxScreen__updateItems()
     
     callback = self._MailboxScreen__incIndexRemoveDialog
     self.dialogBox = TTDialog.TTDialog(style = TTDialog.Acknowledge, text = item.getAcceptItemErrorText(retcode), text_wordwrap = 15, command = callback)
     self.dialogBox.show()
Ejemplo n.º 7
0
    def __enterSphere(self, collisionEntry):
        if base.localAvatar.doId != self.furnitureMgr.ownerId:
            self.useKeyResponse(ToontownGlobals.CRATE_NOT_OWNER, 0)
            return
        elif not base.localAvatar.getCrateKeys():
            self.useKeyResponse(ToontownGlobals.CRATE_NO_KEYS, 0)
            return

        base.cr.playGame.getPlace().setState('stopped')
        self.dialog = TTDialog.TTDialog(style=TTDialog.TwoChoice,
                                        text=TTLocalizer.CrateAskToUse,
                                        fadeScreen=1,
                                        command=self.__handleDialogResponse)
 def _MailboxScreen__makeDiscardInterface(self):
     if self.itemIndex >= 0 and self.itemIndex < len(self.items):
         item = self.items[self.itemIndex]
         if isinstance(item, InviteInfoBase):
             itemText = TTLocalizer.MailBoxRejectVerify % self.getItemName(item)
             yesText = TTLocalizer.MailboxReject
         else:
             itemText = TTLocalizer.MailBoxDiscardVerify % self.getItemName(item)
             yesText = TTLocalizer.MailboxDiscard
         self.dialogBox = TTDialog.TTDialog(style = TTDialog.TwoChoiceCustom, text = itemText, text_wordwrap = 15, command = self._MailboxScreen__handleDiscard, buttonText = [
             yesText,
             TTLocalizer.MailboxLeave])
         self.dialogBox.show()
Ejemplo n.º 9
0
    def requestPurchase(self, phone, callback):
        from toontown.toontowngui import TTDialog
        avatar = base.localAvatar

        self.requestPurchaseCleanup()
        buttonCallback = PythonUtil.Functor(self.__handleFullPurchaseDialog,
                                            phone, callback)
        self.dialog = TTDialog.TTDialog(
            style=TTDialog.YesNo,
            text=TTLocalizer.CatalogPurchaseHouseType,
            text_wordwrap=15,
            command=buttonCallback)
        self.dialog.show()
Ejemplo n.º 10
0
    def __apply(self):
        self.cleanupDialogs()

        # Move our dialog under the fade screen.
        self.clearBin()

        self.applyDialog = TTDialog.TTDialog(
            dialogName = 'DisplaySettingsApply',
            style = TTDialog.TwoChoice,
            text = TTLocalizer.DisplaySettingsApplyWarning % (self.ApplyTimeoutSeconds),
            text_wordwrap = 15,
            command = self.__applyDone,
            )
        self.applyDialog.setBin('gui-popup', 0)
    def _DistributedGardenPlot__handleItemPlantingDone(self,
                                                       willPlant=0,
                                                       recipeStr='',
                                                       selectedSpecial=-1):
        self.ignore(self.plantingGuiDoneEvent)
        self.ignore('stoppedAsleep')
        self.plantingGui.destroy()
        self.plantingGui = None
        base.localAvatar.showGardeningGui()
        base.localAvatar.removeShovelRelatedDoId(self.doId)
        gardenSpecials = base.localAvatar.getGardenSpecials()
        special = -1
        if selectedSpecial >= 0:
            special = gardenSpecials[selectedSpecial][0]

        successPlanting = False
        successToonStatue = False
        if willPlant:
            recipeKey = GardenGlobals.getRecipeKey(recipeStr, special)
            if recipeKey >= 0:
                (species, variety
                 ) = GardenGlobals.getSpeciesVarietyGivenRecipe(recipeKey)
                if species >= 0 and variety >= 0:
                    if GardenGlobals.PlantAttributes[species][
                            'plantType'] == GardenGlobals.STATUARY_TYPE:
                        successPlanting = True
                        if species >= 205 and species <= 208:
                            successToonStatue = True
                        else:
                            self.sendUpdate('plantStatuary', [species])

            else:
                self.notify.debug('%s %d is not a valid recipe' %
                                  (recipeStr, special))
                burntBeans = len(recipeStr)
                self.sendUpdate('plantNothing', [burntBeans])

        if successPlanting:
            itemName = GardenGlobals.PlantAttributes[species]['name']
            stringToShow = TTLocalizer.getResultPlantedSomethingSentence(
                itemName)
        elif willPlant:
            self.resultDialog = TTDialog.TTDialog(
                style=TTDialog.Acknowledge,
                text=TTLocalizer.ResultPlantedNothing,
                command=self.popupItemPlantingGuiAgain)
        else:
            self.finishInteraction()
        if successToonStatue:
            self.popupToonStatueSelectionGui(species)
 def handlePicking(self):
     messenger.send('wakeup')
     if self.isFruiting() and self.canBeHarvested():
         self.startInteraction()
         self.doHarvesting()
         return
     fullName = self.name
     text = TTLocalizer.ConfirmRemoveTree % {'tree': fullName}
     if self.hasDependentTrees():
         text += TTLocalizer.ConfirmWontBeAbleToHarvest
     self.confirmDialog = TTDialog.TTDialog(style=TTDialog.YesNo,
                                            text=text,
                                            command=self.confirmCallback)
     self.confirmDialog.show()
     self.startInteraction()
Ejemplo n.º 13
0
    def __handleFlowerPlantingDone(self,
                                   willPlant=0,
                                   recipeStr="",
                                   special=-1):
        assert self.notify.debugStateCall(self)
        self.ignore(self.plantingGuiDoneEvent)
        self.ignore('stoppedAsleep')
        # Ask the AI to complete the sale
        #self.sendUpdate("completeFlowerSale", [sell])
        self.plantingGui.destroy()
        self.plantingGui = None
        base.localAvatar.showGardeningGui()
        base.localAvatar.removeShovelRelatedDoId(self.doId)

        successPlanting = False
        if willPlant:
            recipeKey = GardenGlobals.getRecipeKey(recipeStr, special)
            if recipeKey >= 0:
                species, variety = GardenGlobals.getSpeciesVarietyGivenRecipe(
                    recipeKey)
                if species >= 0 and variety >= 0:
                    self.sendUpdate('plantFlower', [species, variety])
                    successPlanting = True
            else:
                self.notify.debug("%s %d is not a valid recipe" %
                                  (recipeStr, special))
                burntBeans = len(recipeStr)
                self.sendUpdate('plantNothing', [burntBeans])

        if successPlanting:
            flowerName = GardenGlobals.getFlowerVarietyName(species, variety)
            stringToShow = TTLocalizer.getResultPlantedSomethingSentence(
                flowerName)

        #   the dialog will now come up after the planting movie
        #    self.resultDialog = TTDialog.TTDialog(
        #        style = TTDialog.Acknowledge,
        #        text = stringToShow,
        #        command = self.resultsCallback
        #        )
        elif willPlant:
            self.resultDialog = TTDialog.TTDialog(
                style=TTDialog.Acknowledge,
                text=TTLocalizer.ResultPlantedNothing,
                command=self.popupFlowerPlantingGuiAgain)
        else:
            #base.cr.playGame.getPlace().detectedGardenPlotDone()
            self.finishInteraction()
Ejemplo n.º 14
0
    def handlePicking(self):
        """
        Confirm if the player really wants to remove or pick the plower.
        """
        fullName = self.name

        #if we're clicking on buttons, we're not asleep
        messenger.send('wakeup')

        self.confirmDialog = TTDialog.TTDialog(
            style = TTDialog.YesNo,
            text = TTLocalizer.ConfirmRemoveStatuary % {'item': fullName},
            command = self.confirmCallback
            )
        self.confirmDialog.show()
        base.cr.playGame.getPlace().detectedGardenPlotUse()
Ejemplo n.º 15
0
    def requestPurchase(self, phone, callback):
        from toontown.toontowngui import TTDialog
        avatar = base.localAvatar
        itemsOnOrder = 0
        for item in avatar.onOrder + avatar.mailboxContents:
            if item.storedInAttic() and not item.replacesExisting():
                itemsOnOrder += 1

        numHouseItems = phone.numHouseItems + itemsOnOrder
        if numHouseItems >= ToontownGlobals.MaxHouseItems and not self.replacesExisting():
            self.requestPurchaseCleanup()
            buttonCallback = PythonUtil.Functor(self.__handleFullPurchaseDialog, phone, callback)
            self.dialog = TTDialog.TTDialog(style=TTDialog.YesNo, text=TTLocalizer.CatalogPurchaseHouseFull, text_wordwrap=15, command=buttonCallback)
            self.dialog.show()
        else:
            CatalogItem.CatalogItem.requestPurchase(self, phone, callback)
Ejemplo n.º 16
0
 def __apply(self):
     try:
         xSize = int(self.screenSizeWidthInput.get())
         ySize = int(self.screenSizeHeightInput.get())
     except ValueError:
         print 'Go suck on my t**s.'
         return
     self.cleanupDialogs()
     self.clearBin()
     self.applyDialog = TTDialog.TTDialog(
         dialogName='DisplaySettingsApply',
         style=TTDialog.TwoChoice,
         text=TTLocalizer.DisplaySettingsApplyWarning %
         self.ApplyTimeoutSeconds,
         text_wordwrap=15,
         command=self.__applyDone)
     self.applyDialog.setBin('gui-popup', 0)
Ejemplo n.º 17
0
 def handlePicking(self):
     messenger.send('wakeup')
     if self.isFruiting() and self.canBeHarvested():
         if self.velvetRoped():
             self._teaserPanel = TeaserPanel(pageName='pickGags')
             localAvatar._gagTreeVelvetRoped = None
         else:
             self.startInteraction()
             self.doHarvesting()
         return
     fullName = self.name
     text = TTLocalizer.ConfirmRemoveTree % {'tree': fullName}
     if self.hasDependentTrees():
         text += TTLocalizer.ConfirmWontBeAbleToHarvest
     self.confirmDialog = TTDialog.TTDialog(style=TTDialog.YesNo, text=text, command=self.confirmCallback)
     self.confirmDialog.show()
     self.startInteraction()