def showWarningDialog(self, dialogID, settings, isCloseWnd):
        def callback(isOk):
            if not self.isDisposed():
                if isOk:
                    self.applySettings(settings, False)
                self.as_confirmWarningDialogS(isOk, dialogID)
                if isCloseWnd and isOk:
                    self.onWindowClose()

        ctx = None
        if dialogID == SETTINGS_DIALOGS.MINIMAP_ALPHA_NOTIFICATION:
            ctx = {
                'icon':
                icons.alert(),
                'alert':
                makeHtmlString(
                    'html_templates:lobby/dialogs', 'minimapAlphaNotification',
                    {
                        'message':
                        backport.text(R.strings.dialogs.
                                      minimapAlphaNotification.message.alert())
                    })
            }
        DialogsInterface.showI18nConfirmDialog(dialogID, callback, ctx)
        return
Example #2
0
 def __onGUISpaceEntered(self, spaceID):
     if spaceID != GUI_GLOBAL_SPACE_ID.LOGIN:
         return
     g_appLoader.onGUISpaceEntered -= self.__onGUISpaceEntered
     from gui import DialogsInterface
     DialogsInterface.showI18nConfirmDialog(
         'replayNotification', self.__onClientVersionConfirmDlgClosed)
 def __relogin(self, peripheryID):
     if g_preDefinedHosts.isRoamingPeriphery(peripheryID):
         success = yield DialogsInterface.showI18nConfirmDialog('changeRoamingPeriphery')
     else:
         success = yield DialogsInterface.showI18nConfirmDialog('changePeriphery')
     if success:
         self.relogin.doRelogin(peripheryID, extraChainSteps=self.__ctx.getExtraChainSteps())
Example #4
0
 def relogin(self, peripheryID):
     if g_preDefinedHosts.isRoamingPeriphery(peripheryID):
         success = yield DialogsInterface.showI18nConfirmDialog('changeRoamingPeriphery')
     else:
         success = yield DialogsInterface.showI18nConfirmDialog('changePeriphery')
     if success:
         game_control.g_instance.roaming.relogin(peripheryID)
     self.as_setPeripheryChangingS(success)
Example #5
0
 def unlockItem(self, unlockCD, vehCD, unlockIdx, xpCost):
     if self._validateItem2Unlock(unlockCD, vehCD, unlockIdx, xpCost):
         costCtx = self._getXPCostCtx(self._data.getVehXP(vehCD), xpCost)
         DialogsInterface.showI18nConfirmDialog(
             'confirmUnlock',
             partial(self._doUnlockItem, unlockCD, vehCD, unlockIdx,
                     xpCost),
             meta=self._getUnlockConfirmMeta(unlockCD, costCtx))
Example #6
0
    def onEscape(self):

        def buttonHandler(isOk):
            if isOk:
                self.destroy()
                BigWorld.quit()

        DialogsInterface.showI18nConfirmDialog('quit', buttonHandler, focusedID=DIALOG_BUTTON_ID.CLOSE)
 def __relogin(self, peripheryID):
     self.__isGuiUpdateSuppressed = True
     if g_preDefinedHosts.isRoamingPeriphery(peripheryID):
         success = yield DialogsInterface.showI18nConfirmDialog('changeRoamingPeriphery')
     else:
         success = yield DialogsInterface.showI18nConfirmDialog('changePeriphery')
     if success:
         game_control.g_instance.relogin.doRelogin(peripheryID, extraChainSteps=self.__ctx.getExtraChainSteps())
Example #8
0
 def onWindowClose(self):
     if not self.__applied:
         DialogsInterface.showI18nConfirmDialog(
             'quit',
             self.__onConfirmClosed,
             focusedID=DialogsInterface.DIALOG_BUTTON_ID.CLOSE)
     else:
         self.destroy()
Example #9
0
    def onEscape(self):
        def buttonHandler(isOk):
            if isOk:
                self.destroy()
                BigWorld.quit()

        DialogsInterface.showI18nConfirmDialog(
            'quit', buttonHandler, focusedID=DIALOG_BUTTON_ID.CLOSE)
 def __relogin(self, peripheryID):
     self.__isGuiUpdateSuppressed = True
     if g_preDefinedHosts.isRoamingPeriphery(peripheryID):
         success = yield DialogsInterface.showI18nConfirmDialog('changeRoamingPeriphery')
     else:
         success = yield DialogsInterface.showI18nConfirmDialog('changePeriphery')
     if success:
         game_control.g_instance.relogin.doRelogin(peripheryID, extraChainSteps=self.__ctx.getExtraChainSteps())
Example #11
0
    def showWarningDialog(self, dialogID, settings, isCloseWnd):
        def callback(isOk):
            if isOk:
                self.applySettings(settings, False)
            self.as_confirmWarningDialogS(isOk, dialogID)
            if isCloseWnd and isOk:
                self.onWindowClose()

        DialogsInterface.showI18nConfirmDialog(dialogID, callback)
    def showWarningDialog(self, dialogID, settings, isCloseWnd):
        def callback(isOk):
            if isOk:
                self.applySettings(settings, False)
            self.as_confirmWarningDialogS(isOk, dialogID)
            if isCloseWnd and isOk:
                self.onWindowClose()

        DialogsInterface.showI18nConfirmDialog(dialogID, callback)
Example #13
0
 def relogin(self, peripheryID):
     if g_preDefinedHosts.isRoamingPeriphery(peripheryID):
         LOG_DEBUG('g_preDefinedHosts.isRoamingPeriphery(peripheryID)', peripheryID)
         success = yield DialogsInterface.showI18nConfirmDialog('changeRoamingPeriphery')
     else:
         success = yield DialogsInterface.showI18nConfirmDialog('changePeriphery')
     if success:
         self.reloginCtrl.doRelogin(peripheryID, self.__onReloing)
     else:
         self.as_changePeripheryFailedS()
Example #14
0
 def relogin(self, peripheryID):
     if g_preDefinedHosts.isRoamingPeriphery(peripheryID):
         LOG_DEBUG('g_preDefinedHosts.isRoamingPeriphery(peripheryID)', peripheryID)
         success = yield DialogsInterface.showI18nConfirmDialog('changeRoamingPeriphery')
     else:
         success = yield DialogsInterface.showI18nConfirmDialog('changePeriphery')
     if success:
         game_control.g_instance.relogin.doRelogin(peripheryID)
     if not success:
         self.as_changePeripheryFailedS()
Example #15
0
 def relogin(self, peripheryID):
     self.__isGuiUpdateSuppressed = True
     if g_preDefinedHosts.isRoamingPeriphery(peripheryID):
         success = yield DialogsInterface.showI18nConfirmDialog('changeRoamingPeriphery')
     else:
         success = yield DialogsInterface.showI18nConfirmDialog('changePeriphery')
     if success:
         game_control.g_instance.relogin.doRelogin(peripheryID)
     self.__isGuiUpdateSuppressed = False
     self.as_setPeripheryChangingS(success)
Example #16
0
 def relogin(self, peripheryID):
     if g_preDefinedHosts.isRoamingPeriphery(peripheryID):
         LOG_DEBUG('g_preDefinedHosts.isRoamingPeriphery(peripheryID)', peripheryID)
         success = yield DialogsInterface.showI18nConfirmDialog('changeRoamingPeriphery')
     else:
         success = yield DialogsInterface.showI18nConfirmDialog('changePeriphery')
     if success:
         game_control.g_instance.relogin.doRelogin(peripheryID)
     if not success:
         self.as_changePeripheryFailedS()
Example #17
0
 def relogin(self, peripheryID):
     self.__isGuiUpdateSuppressed = True
     if g_preDefinedHosts.isRoamingPeriphery(peripheryID):
         success = yield DialogsInterface.showI18nConfirmDialog(
             'changeRoamingPeriphery')
     else:
         success = yield DialogsInterface.showI18nConfirmDialog(
             'changePeriphery')
     if success:
         game_control.g_instance.relogin.doRelogin(peripheryID)
     self.__isGuiUpdateSuppressed = False
     self.as_setPeripheryChangingS(success)
    def canSelectAcousticType(self, index):
        index = int(index)
        option = self.settingsCore.options.getSetting(settings_constants.SOUND.SOUND_SPEAKERS)
        if not option.isPresetSupportedByIndex(index):

            def _apply(result):
                LOG_DEBUG('Player result', result)
                self.as_onSoundSpeakersPresetApplyS(result)

            DialogsInterface.showI18nConfirmDialog('soundSpeakersPresetDoesNotMatch', callback=_apply)
            return False
        return True
Example #19
0
 def onReplayFinished(self):
     if not self.scriptModalWindowsEnabled:
         self.stop()
         return
     if self.__isPlayingPlayList:
         self.stop()
         BigWorld.callback(1.0, self.play)
         return
     self.__isMenuShowed = False
     from gui import DialogsInterface
     DialogsInterface.showI18nConfirmDialog(
         'replayStopped', self.__replayFinishedDlgCallback)
     self.__isFinished = True
     self.setPlaybackSpeedIdx(0)
Example #20
0
    def applySettings(self, settings, isCloseWnd):
        settings = flashObject2Dict(settings)
        applyMethod = self.params.getApplyMethod(settings)

        def confirmHandler(isOk):
            self.__commitSettings(settings, isOk)
            if isOk and isCloseWnd:
                self.closeWindow()

        if applyMethod == APPLY_METHOD.RESTART:
            DialogsInterface.showI18nConfirmDialog('graphicsPresetRestartConfirmation', confirmHandler)
        elif applyMethod == APPLY_METHOD.DELAYED:
            DialogsInterface.showI18nConfirmDialog('graphicsPresetDelayedConfirmation', confirmHandler)
        else:
            confirmHandler(True)
 def handleAction(self, model, entityID, action):
     super(AcceptPrbInviteHandler,
           self).handleAction(model, entityID, action)
     yield lambda callback: callback(None)
     postActions = []
     invite = self.prbInvites.getInvite(entityID)
     state = self.prbDispatcher.getFunctionalState()
     if state.doLeaveToAcceptInvite(invite.type):
         postActions.append(actions.LeavePrbModalEntity())
     if invite and invite.anotherPeriphery:
         success = True
         if g_preDefinedHosts.isRoamingPeriphery(invite.peripheryID):
             success = yield DialogsInterface.showI18nConfirmDialog(
                 'changeRoamingPeriphery')
         if not success:
             return
         postActions.append(actions.DisconnectFromPeriphery())
         postActions.append(actions.ConnectToPeriphery(invite.peripheryID))
         postActions.append(actions.PrbInvitesInit())
         postActions.append(actions.LeavePrbEntity())
     g_eventBus.handleEvent(events.PrbInvitesEvent(
         events.PrbInvitesEvent.ACCEPT,
         inviteID=entityID,
         postActions=postActions),
                            scope=EVENT_BUS_SCOPE.LOBBY)
Example #22
0
 def dropCurrentItemInSection(self, section, kind):
     if g_currentVehicle.isLocked():
         SystemMessages.pushI18nMessage(
             SYSTEM_MESSAGES.CUSTOMIZATION_VEHICLE_LOCKED,
             type=SystemMessages.SM_TYPE.Error)
         return
     elif g_currentVehicle.isBroken():
         SystemMessages.pushI18nMessage(
             SYSTEM_MESSAGES.customization_vehicle(
                 g_currentVehicle.item.getState()),
             type=SystemMessages.SM_TYPE.Error)
         return
     else:
         dialog = 'customization/{0:>s}Drop'.format(section)
         isConfirmed = yield DialogsInterface.showI18nConfirmDialog(dialog)
         if isConfirmed:
             interface = self.__interfaces.get(section)
             if interface is not None:
                 self.__returnHangar = False
                 self.__lockUpdate = True
                 Waiting.show('customizationDrop')
                 interface.drop(g_currentVehicle.invID, kind)
             else:
                 LOG_ERROR('Drop operation, section not found', section)
         return
Example #23
0
 def confirmator(callback=None):
     BigWorld.callback(
         0.0,
         lambda: DialogsInterface.showI18nConfirmDialog(
             'graphicsChangeConfirmation', callback,
             TimerConfirmDialogMeta(
                 'graphicsChangeConfirmation', timer=15)))
Example #24
0
 def refuseTraining(self):
     isOk = yield DialogsInterface.showI18nConfirmDialog('refuseTraining')
     if isOk:
         g_eventBus.handleEvent(events.TutorialEvent(
             events.TutorialEvent.STOP_TRAINING),
                                scope=EVENT_BUS_SCOPE.GLOBAL)
     self.destroy()
Example #25
0
def handleJoinBattle(command, ctx):

    def doJoin(restoreOnError):
        dispatcher = g_prbLoader.getDispatcher()

        @process
        def onError(errorData):
            if restoreOnError:
                dispatcher.restorePrevious()
            else:
                yield dispatcher.doSelectAction(PrbAction(PREBATTLE_ACTION_NAME.STRONGHOLDS_BATTLES_LIST))
            try:
                message = errorData['extra_data']['title']
                pushMessage(message, type=SM_TYPE.Error)
            except (KeyError, TypeError):
                LOG_CURRENT_EXCEPTION()

        _doJoinBattle(dispatcher, command.unit_id, onError)

    connectionMgr = dependency.instance(IConnectionManager)
    if connectionMgr.peripheryID != command.periphery_id:
        success = yield DialogsInterface.showI18nConfirmDialog('changePeriphery')
        if success:
            reloginCtrl = dependency.instance(IReloginController)
            reloginCtrl.doRelogin(command.periphery_id, extraChainSteps=(actions.OnLobbyInitedAction(onInited=partial(doJoin, False)),))
    else:
        doJoin(True)
Example #26
0
 def doAction(self):
     result = yield DialogsInterface.showI18nConfirmDialog(
         'replayNotification')
     if result:
         _acceptVersionDiffering()
     else:
         _stopBattleReplay()
Example #27
0
    def _applySettings(self, settings, isCloseWnd):
        applyMethod = self.params.getApplyMethod(settings)

        def confirmHandler(isOk):
            self.as_ConfirmationOfApplicationS(isOk)
            if isOk:
                self.__commitSettings(settings, isOk, isCloseWnd)
            else:
                self.params.revert()
                self._update()

        if applyMethod == APPLY_METHOD.RESTART:
            DialogsInterface.showI18nConfirmDialog('graphicsPresetRestartConfirmation', confirmHandler)
        elif applyMethod == APPLY_METHOD.DELAYED:
            DialogsInterface.showI18nConfirmDialog('graphicsPresetDelayedConfirmation', confirmHandler)
        else:
            confirmHandler(True)
 def handleAction(self, model, entityID, action):
     super(AcceptClubInviteHandler, self).handleAction(model, entityID, action)
     yield lambda callback: callback(None)
     invite = self.clubsCtrl.getProfile().getInvite(entityID)
     if invite:
         success = yield DialogsInterface.showI18nConfirmDialog('clubInvite')
         if success:
             yield self.clubsCtrl.sendRequest(club_ctx.AcceptInviteCtx(invite.getClubDbID(), entityID, waitingID='clubs/invite/accept'), allowDelay=True)
Example #29
0
    def applySettings(self, settings, isCloseWnd):
        settings = flashObject2Dict(settings)
        applyMethod = self.params.getApplyMethod(settings)

        def confirmHandler(isOk):
            self.__commitSettings(settings, isOk)
            if isOk and isCloseWnd:
                self.closeWindow()

        if applyMethod == APPLY_METHOD.RESTART:
            DialogsInterface.showI18nConfirmDialog(
                'graphicsPresetRestartConfirmation', confirmHandler)
        elif applyMethod == APPLY_METHOD.DELAYED:
            DialogsInterface.showI18nConfirmDialog(
                'graphicsPresetDelayedConfirmation', confirmHandler)
        else:
            confirmHandler(True)
Example #30
0
 def __confirmHeaderNavigation(self, callback):
     purchaseItems = self.getPurchaseItems()
     cart = getTotalPurchaseInfo(purchaseItems)
     if cart.numTotal:
         result = yield DialogsInterface.showI18nConfirmDialog('customization/close')
     else:
         result = True
     callback(result)
Example #31
0
    def _applySettings(self, settings, isCloseWnd):
        applyMethod = self.params.getApplyMethod(settings)

        def confirmHandler(isOk):
            self.as_ConfirmationOfApplicationS(isOk)
            if isOk:
                self.__commitSettings(settings, isOk, isCloseWnd)
            else:
                self.params.revert()
                self._update()

        if applyMethod == APPLY_METHOD.RESTART:
            DialogsInterface.showI18nConfirmDialog('graphicsPresetRestartConfirmation', confirmHandler)
        elif applyMethod == APPLY_METHOD.DELAYED:
            DialogsInterface.showI18nConfirmDialog('graphicsPresetDelayedConfirmation', confirmHandler)
        else:
            confirmHandler(True)
 def handleAction(self, model, entityID, action):
     super(AcceptClubInviteHandler, self).handleAction(model, entityID, action)
     yield lambda callback: callback(None)
     invite = self.clubsCtrl.getProfile().getInvite(entityID)
     if invite:
         success = yield DialogsInterface.showI18nConfirmDialog('clubInvite')
         if success:
             yield self.clubsCtrl.sendRequest(club_ctx.AcceptInviteCtx(invite.getClubDbID(), entityID, waitingID='clubs/invite/accept'), allowDelay=True)
def checkAmmoLevel(vehicles, callback):
    showAmmoWarning = False
    ammoWarningMessage = 'lowAmmo'

    def _validateMoneyForLayouts(vehicle):
        from gui.shared.gui_items.processors.plugins import MoneyValidator
        shellsPrice = MONEY_UNDEFINED
        eqsPrice = MONEY_UNDEFINED
        for shell in vehicle.shells:
            if shell.defaultCount:
                shellPrice = shell.getBuyPrice().price
                shellsPrice += shellPrice * (
                    shell.defaultCount - shell.inventoryCount - shell.count)

        for idx, eq in enumerate(vehicle.equipmentLayout.regularConsumables):
            if eq is not None:
                vehEquipment = vehicle.equipment.regularConsumables[idx]
                if vehEquipment:
                    eqPrice = eq.getBuyPrice().price
                    eqsPrice += eqPrice

        return MoneyValidator(shellsPrice + eqsPrice).validate()

    def _autoFillLayouts(vehicle):
        from gui.shared.gui_items.items_actions import factory as ItemsActionsFactory
        shellsLayout = []
        eqsLayout = []
        for shell in vehicle.shells:
            shellsLayout.extend(shell.defaultLayoutValue)

        for eq in vehicle.equipmentLayout.regularConsumables:
            if eq is not None:
                eqsLayout.extend(eq.defaultLayoutValue)
            eqsLayout.extend((0, 0))

        LOG_DEBUG('setVehicleLayouts', shellsLayout, eqsLayout)
        ItemsActionsFactory.doAction(ItemsActionsFactory.SET_VEHICLE_LAYOUT,
                                     vehicle, shellsLayout, eqsLayout)
        return

    for vehicle in vehicles:
        if vehicle.isReadyToFight:
            showAmmoWarning = showAmmoWarning or not vehicle.isAmmoFull
        if showAmmoWarning:
            validateResult = _validateMoneyForLayouts(vehicle)
            if vehicle.isAutoLoadFull() or not validateResult.success:
                ammoWarningMessage = 'lowAmmoAutoLoad'
            from gui import DialogsInterface
            success = yield DialogsInterface.showI18nConfirmDialog(
                ammoWarningMessage)
            if success:
                if not vehicle.isAutoLoadFull(
                ) or not vehicle.isAutoEquipFull() and validateResult.success:
                    _autoFillLayouts(vehicle)
            callback(success)
        yield lambda callback: callback(None)
        callback(True)
 def __confirmHeaderNavigation(self, callback):
     if self.__ctx.isOutfitsModified():
         result = yield DialogsInterface.showI18nConfirmDialog(
             'customization/close')
     else:
         result = True
     if result:
         self.__onCloseWindow(proceed=True)
     callback(result)
Example #35
0
 def participateClick(self, eventID):
     eventData = self.__eventsData.getEvent(eventID)
     started = eventData.isStarted()
     self.as_setWaitingVisibleS(True)
     dialog = 'leaveEvent' if started else 'leaveStartedEvent'
     success = yield DialogsInterface.showI18nConfirmDialog(dialog)
     if success:
         yield self.eventsController.leaveEvent(eventID)
         yield self._onEventsUpdateAsync()
     self.as_setWaitingVisibleS(False)
 def changeStatus(self):
     if self.__status == PROFILE_CONSTANTS.HOF_RESULTS_SHOW:
         success = yield DialogsInterface.showI18nConfirmDialog('hof/excludeRating')
         if success:
             self.__makeRequest(self._clansController.getClanDossier().requestHofUserExclude, PROFILE_CONSTANTS.HOF_RESULTS_EXCLUSION, lambda errorCode: self.__getRatingStatus())
     elif self.__status == PROFILE_CONSTANTS.HOF_RESULTS_HIDE:
         self.__makeRequest(self._clansController.getClanDossier().requestHofUserRestore, PROFILE_CONSTANTS.HOF_RESULTS_INCLUSION, lambda errorCode: self.__getRatingStatus())
     else:
         LOG_WARNING('Something went wrong! Getting actual status.')
         self.__getRatingStatus()
Example #37
0
 def onWindowClose(self):
     isOk = yield DialogsInterface.showI18nConfirmDialog('interviewQuit', focusedID=DIALOG_BUTTON_ID.SUBMIT)
     if isOk:
         item = g_wgncProvider.getNotItemByName(self.__notID, self.__target)
         if not item:
             return
         button = item.getCancelButton()
         if not button:
             return
         g_wgncProvider.doAction(self.__notID, button.action, self.__target)
         self.destroy()
 def acceptInvite(self):
     yield lambda callback: callback(None)
     prbID = self._inviteInfo.getID()
     invite = self.prbAutoInvites.getInvite(prbID)
     postActions = [actions.LeavePrbModalEntity()]
     finishActions = [_DisableNotify(channel_num_gen.getClientID4LazyChannel(LAZY_CHANNEL.SPECIAL_BATTLES))]
     if g_preDefinedHosts.isRoamingPeriphery(invite.peripheryID):
         success = yield DialogsInterface.showI18nConfirmDialog('changeRoamingPeriphery')
         if not success:
             return
     self.prbPeripheriesHandler.join(invite.peripheryID, JoinBattleSessionCtx(prbID, invite.prbType, 'prebattle/join'), postActions, finishActions)
Example #39
0
def checkAmmoLevel(callback):
    """
    Check ammo for current vehicle, if it is lower then 20% shows message dialog
    Example:
            isAmmoOk = yield checkAmmoLevel()
            if isAmmoOk:
                    do something...
    
    @return: True if ammo level is ok or user confirm, False otherwise
    """
    showAmmoWarning = False
    from CurrentVehicle import g_currentVehicle
    if g_currentVehicle.isReadyToFight():
        vehicle = g_currentVehicle.item
        if not g_currentVehicle.isAutoLoadFull(
        ) or not g_currentVehicle.isAutoEquipFull():
            from gui import SystemMessages
            from gui.shared.gui_items.processors.vehicle import VehicleLayoutProcessor
            shellsLayout = []
            eqsLayout = []
            for shell in vehicle.shells:
                shellsLayout.append(shell.intCD if not shell.isBoughtForCredits
                                    else -shell.intCD)
                shellsLayout.append(shell.defaultCount)

            for eq in vehicle.eqsLayout:
                if eq is not None:
                    eqsLayout.append(
                        eq.intCD if not eq.isBoughtForCredits else -eq.intCD)
                    eqsLayout.append(1)
                else:
                    eqsLayout.append(0)
                    eqsLayout.append(0)

            LOG_DEBUG('setVehicleLayouts', shellsLayout, eqsLayout)
            result = yield VehicleLayoutProcessor(vehicle, shellsLayout,
                                                  eqsLayout).request()
            if result and result.auxData:
                for m in result.auxData:
                    SystemMessages.g_instance.pushI18nMessage(
                        m.userMsg, type=m.sysMsgType)

            if result and len(result.userMsg):
                SystemMessages.g_instance.pushI18nMessage(
                    result.userMsg, type=result.sysMsgType)
        showAmmoWarning = not g_currentVehicle.item.isAmmoFull
    if showAmmoWarning:
        from gui import DialogsInterface
        success = yield DialogsInterface.showI18nConfirmDialog('lowAmmo')
        callback(success)
    else:
        yield lambda callback: callback(None)
        callback(True)
    return
Example #40
0
 def acceptInvite(self):
     yield lambda callback: callback(None)
     prbID = self._inviteInfo.getID()
     invite = self.prbAutoInvites.getInvite(prbID)
     postActions = []
     if self.prbDispatcher.hasModalEntity():
         postActions.append(actions.LeavePrbModalEntity())
     finishActions = [_DisableNotify(channel_num_gen.getClientID4LazyChannel(LAZY_CHANNEL.SPECIAL_BATTLES))]
     if g_preDefinedHosts.isRoamingPeriphery(invite.peripheryID):
         success = yield DialogsInterface.showI18nConfirmDialog('changeRoamingPeriphery')
         if not success:
             return
     self.prbPeripheriesHandler.join(invite.peripheryID, JoinBattleSessionCtx(prbID, invite.prbType, 'prebattle/join'), postActions, finishActions)
Example #41
0
def checkAmmoLevel(callback):
    """
    Check ammo for current vehicle, if it is lower then 20% shows message dialog
    Example:
            isAmmoOk = yield checkAmmoLevel()
            if isAmmoOk:
                    do something...
    
    @return: True if ammo level is ok or user confirm, False otherwise
    """
    showAmmoWarning = False
    from CurrentVehicle import g_currentVehicle
    if g_currentVehicle.isReadyToFight():
        vehicle = g_currentVehicle.item
        if not g_currentVehicle.isAutoLoadFull() or not g_currentVehicle.isAutoEquipFull():
            from gui import SystemMessages
            from gui.shared.gui_items.processors.vehicle import VehicleLayoutProcessor
            shellsLayout = []
            eqsLayout = []
            for shell in vehicle.shells:
                shellsLayout.append(shell.intCD if not shell.isBoughtForCredits else -shell.intCD)
                shellsLayout.append(shell.defaultCount)

            for eq in vehicle.eqsLayout:
                if eq is not None:
                    eqsLayout.append(eq.intCD if not eq.isBoughtForCredits else -eq.intCD)
                    eqsLayout.append(1)
                else:
                    eqsLayout.append(0)
                    eqsLayout.append(0)

            LOG_DEBUG('setVehicleLayouts', shellsLayout, eqsLayout)
            result = yield VehicleLayoutProcessor(vehicle, shellsLayout, eqsLayout).request()
            if result and result.auxData:
                for m in result.auxData:
                    SystemMessages.g_instance.pushI18nMessage(m.userMsg, type=m.sysMsgType)

            if result and len(result.userMsg):
                SystemMessages.g_instance.pushI18nMessage(result.userMsg, type=result.sysMsgType)
        showAmmoWarning = not g_currentVehicle.item.isAmmoFull
    if showAmmoWarning:
        from gui import DialogsInterface
        success = yield DialogsInterface.showI18nConfirmDialog('lowAmmo')
        callback(success)
    else:
        yield lambda callback: callback(None)
        callback(True)
    return
Example #42
0
def checkAmmoLevel(vehicles, callback):
    """
    Check ammo for current vehicle, if it is lower then 20% shows message dialog
    Example:
            isAmmoOk = yield checkAmmoLevel()
            if isAmmoOk:
                    do something...
    
    @return: True if ammo level is ok or user confirm, False otherwise
    """
    showAmmoWarning = False
    for vehicle in vehicles:
        if vehicle.isReadyToFight:
            if not vehicle.isAutoLoadFull() or not vehicle.isAutoEquipFull():
                from gui import SystemMessages
                from gui.shared.gui_items.processors.vehicle import VehicleLayoutProcessor

                shellsLayout = []
                eqsLayout = []
                for shell in vehicle.shells:
                    shellsLayout.extend(shell.defaultLayoutValue)

                for eq in vehicle.eqsLayout:
                    if eq is not None:
                        eqsLayout.extend(eq.defaultLayoutValue)
                    else:
                        eqsLayout.extend((0, 0))

                LOG_DEBUG("setVehicleLayouts", shellsLayout, eqsLayout)
                result = yield VehicleLayoutProcessor(vehicle, shellsLayout, eqsLayout).request()
                if result and result.auxData:
                    for m in result.auxData:
                        SystemMessages.g_instance.pushI18nMessage(m.userMsg, type=m.sysMsgType)

                if result and len(result.userMsg):
                    SystemMessages.g_instance.pushI18nMessage(result.userMsg, type=result.sysMsgType)
            showAmmoWarning = showAmmoWarning or not vehicle.isAmmoFull

    if showAmmoWarning:
        from gui import DialogsInterface

        success = yield DialogsInterface.showI18nConfirmDialog("lowAmmo")
        callback(success)
    else:
        yield lambda callback: callback(None)
        callback(True)
    return
Example #43
0
    def sendRequest(self, ctx, callback, allowDelay = None):
        yield lambda callback: callback(None)
        if ctx.getConfirmID():
            success = yield DialogsInterface.showI18nConfirmDialog(ctx.getConfirmID())
            if not success:
                return

        def _cbWrapper(result):
            isNeedToChangeState = False
            if not result.isSuccess():
                isNeedToChangeState = result.code in WEB_CMD_RESULT.WEB_UNAVAILABLE_ERRORS
                _showError(result, ctx)
            callback(result)
            if isNeedToChangeState:
                self._accountProfile._changeState(states.UnavailableClubsState())

        self._requestsCtrl.request(ctx, callback=_cbWrapper, allowDelay=allowDelay)
 def handleAction(self, model, entityID, action):
     super(AcceptPrbInviteHandler, self).handleAction(model, entityID, action)
     yield lambda callback: callback(None)
     postActions = []
     invite = self.prbInvites.getInvite(entityID)
     state = self.prbDispatcher.getFunctionalState()
     if state.doLeaveToAcceptInvite(invite.type):
         postActions.append(actions.LeavePrbModalEntity())
     if invite and invite.anotherPeriphery:
         success = True
         if g_preDefinedHosts.isRoamingPeriphery(invite.peripheryID):
             success = yield DialogsInterface.showI18nConfirmDialog('changeRoamingPeriphery')
         if not success:
             return
         postActions.append(actions.DisconnectFromPeriphery())
         postActions.append(actions.ConnectToPeriphery(invite.peripheryID))
         postActions.append(actions.PrbInvitesInit())
     self.prbInvites.acceptInvite(entityID, postActions=postActions)
 def dropCurrentItemInSection(self, section, kind):
     if g_currentVehicle.isLocked():
         SystemMessages.pushI18nMessage(SYSTEM_MESSAGES.CUSTOMIZATION_VEHICLE_LOCKED, type=SystemMessages.SM_TYPE.Error)
         return
     elif g_currentVehicle.isBroken():
         SystemMessages.pushI18nMessage(SYSTEM_MESSAGES.customization_vehicle(g_currentVehicle.item.getState()), type=SystemMessages.SM_TYPE.Error)
         return
     else:
         dialog = 'customization/{0:>s}Drop'.format(section)
         isConfirmed = yield DialogsInterface.showI18nConfirmDialog(dialog)
         if isConfirmed:
             interface = self.__interfaces.get(section)
             if interface is not None:
                 self.__returnHangar = False
                 self.__lockUpdate = True
                 Waiting.show('customizationDrop')
                 interface.drop(g_currentVehicle.invID, kind)
             else:
                 LOG_ERROR('Drop operation, section not found', section)
         return
Example #46
0
 def logoffClick(self):
     isOk = yield DialogsInterface.showI18nConfirmDialog('disconnect', focusedID=DialogsInterface.DIALOG_BUTTON_ID.CLOSE)
     if isOk:
         self.destroy()
         self.app.logoff()
Example #47
0
 def onWindowClose(self):
     if not self.__applied:
         DialogsInterface.showI18nConfirmDialog('quit', self.__onConfirmClosed, focusedID=DialogsInterface.DIALOG_BUTTON_ID.CLOSE)
     else:
         self.destroy()
Example #48
0
 def __showI18nDialog(self, key, callback):
     from gui import DialogsInterface
     return DialogsInterface.showI18nConfirmDialog(key, callback)
Example #49
0
 def onHandleUpdateClientSoftwareNeeded(self):
     success = yield DialogsInterface.showI18nConfirmDialog('updateNeeded')
     if success and not BigWorld.wg_quitAndStartLauncher():
         self.__setStatus(i18n.convert(i18n.makeString(MENU.LOGIN_STATUS_LAUNCHERNOTFOUND)), 0)
 def __loginOnLoadCallback(self):
     DialogsInterface.showI18nConfirmDialog('replayNotification', self.__onClientVersionConfirmDlgClosed)
Example #51
0
 def logoffClick(self):
     isOk = yield DialogsInterface.showI18nConfirmDialog('disconnect', focusedID=DIALOG_BUTTON_ID.CLOSE)
     if isOk:
         self.destroy()
         g_appLoader.goToLoginByRQ()
Example #52
0
 def refuseTraining(self):
     isOk = yield DialogsInterface.showI18nConfirmDialog('refuseTraining')
     if isOk:
         g_eventBus.handleEvent(events.TutorialEvent(events.TutorialEvent.STOP_TRAINING), scope=EVENT_BUS_SCOPE.GLOBAL)
     self.destroy()
Example #53
0
 def onEscape(self):
     DialogsInterface.showI18nConfirmDialog('quit', self.__onConfirmClosed, focusedID=DIALOG_BUTTON_ID.CLOSE)
Example #54
0
 def __loginRejectedUpdateNeeded(self):
     success = yield DialogsInterface.showI18nConfirmDialog('updateNeeded')
     if success and not BigWorld.wg_quitAndStartLauncher():
         self.as_setErrorMessageS(_ms(MENU.LOGIN_STATUS_LAUNCHERNOTFOUND), INVALID_FIELDS.ALL_VALID)
Example #55
0
def reportBugOpenConfirm(accountId):
    isOk = yield DialogsInterface.showI18nConfirmDialog('reportBug', focusedID=DIALOG_BUTTON_ID.SUBMIT)
    if isOk:
        game_control.g_instance.links.open(getForumURL(accountId))
Example #56
0
 def quitClick(self):
     isOk = yield DialogsInterface.showI18nConfirmDialog('quit', focusedID=DIALOG_BUTTON_ID.CLOSE)
     if isOk:
         self.destroy()
         g_appLoader.quitFromGame()
 def confirmator(callback = None):
     BigWorld.callback(0.0, lambda : DialogsInterface.showI18nConfirmDialog('graphicsChangeConfirmation', callback, TimerConfirmDialogMeta('graphicsChangeConfirmation', timer=15)))
Example #58
0
 def __onGUISpaceEntered(self, spaceID):
     if spaceID != GUI_GLOBAL_SPACE_ID.LOGIN:
         return
     g_appLoader.onGUISpaceEntered -= self.__onGUISpaceEntered
     from gui import DialogsInterface
     DialogsInterface.showI18nConfirmDialog('replayNotification', self.__onClientVersionConfirmDlgClosed)
Example #59
0
 def quitClick(self):
     isOk = yield DialogsInterface.showI18nConfirmDialog('quit', focusedID=DialogsInterface.DIALOG_BUTTON_ID.CLOSE)
     if isOk:
         self.destroy()
         self.app.quit()