コード例 #1
0
    def notification(self, cmd):
        smType = SM_TYPE.lookup(cmd.type)
        if smType is None:
            raise WebCommandException("Unknown notification's type: %s!" %
                                      cmd.type)
        if cmd.hasMessage():
            pushMessage(cmd.message, type=smType, messageData=cmd.message_data)
        elif cmd.hasI18nKey():
            parameters = cmd.i18n_data
            params = {
                'type': smType,
                'key': cmd.i18n_key,
                'messageData': cmd.message_data
            }
            for key, value in parameters.iteritems():
                params[key] = value

            pushI18nMessage(**params)
        elif cmd.hasKey():
            custom_parameters = cmd.custom_parameters
            params = {
                'type': smType,
                'key': cmd.key,
                'messageData': cmd.message_data
            }
            for key, value in custom_parameters.iteritems():
                params[key] = value

            pushI18nMessage(**params)
        return
コード例 #2
0
ファイル: web_handlers.py プロジェクト: kusaku/wot_scripts
def handleNotificationCommand(command, ctx):
    """
    Shows notification according to command's parameters
    """
    type = SM_TYPE.lookup(command.type)
    if type is None:
        raise WebCommandException("Unknown notification's type: %s!" % command.type)
    if command.hasMessage():
        pushMessage(command.message, type=type, messageData=command.message_data)
    elif command.hasI18nKey():
        parameters = command.i18n_data
        params = {'type': type,
         'key': command.i18n_key,
         'messageData': command.message_data}
        for key, value in parameters.iteritems():
            params[key] = value

        pushI18nMessage(**params)
    elif command.hasKey():
        custom_parameters = command.custom_parameters
        params = {'type': type,
         'key': command.key,
         'messageData': command.message_data}
        for key, value in custom_parameters.iteritems():
            params[key] = value

        pushI18nMessage(**params)
    else:
        raise WebCommandException("'i18n_key' or 'message' parameter are missing!")
    return
コード例 #3
0
 def pushNewMessage(self, spaceID):
     if spaceID == GuiGlobalSpaceID.LOBBY:
         currentTime = datetime.datetime.now()
         if currentTime >= self.timeDelta:
             self.timeDelta = currentTime + datetime.timedelta(minutes=60)
             pushMessage(self.getDonateMessage(), type=SM_TYPE.Warning)
             logInfo("A donation message has been sent to the user. Repeated in 60 minutes.")
コード例 #4
0
def NewLobbyView_populate(self):
    OldLobbyView_populate(self)
    global Show
    if not Show:
        Show = True
        pushMessage(
            u'<a href="event:https://ekspoint-mods.ru/"><font color="#eb2222">ekspoint-mods.ru</font></a>',
            SM_TYPE.GameGreeting)
コード例 #5
0
 def _successHandler(self, code, ctx=None):
     featureName = FEATURE_BY_GROUP_ID[self.__groupID]
     resBase = R.strings.messenger.serviceChannelMessages.vehiclePostProgression.prebattleSwitchToggled
     if self.__enabled:
         stateStr = text_styles.greenText(backport.text(resBase.enabled()))
     else:
         stateStr = text_styles.yellowText(backport.text(resBase.disabled()))
     pushMessage(backport.text(resBase.dyn(featureName)(), tankName=self.__vehName, state=stateStr), type=SM_TYPE.MediumInfo)
     return super(SwitchPrebattleAmmoPanelAvailability, self)._successHandler(code, ctx)
コード例 #6
0
 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()
コード例 #7
0
def LobbyView_populateNew(self):
    LobbyView_populateOld(self)

    try:
        if not modRecentStat.notificationsShowed:
            modRecentStat.notificationsShowed = True

            pushMessage(modRecentStat.getWelcomeMessage(), SM_TYPE.Information)
            pushMessage(modRecentStat.getInfoMessage(), SM_TYPE.Information)
    except BaseException:
        logError("Error in LobbyView_populateNew", traceback.format_exc())
コード例 #8
0
ファイル: __init__.py プロジェクト: Pavel3333/Events
def hookedLobby(func, *args):
    func(*args)
    global showed
    if not showed:
        error_code = trajectorymod.trj.e() #get_error_code
        txt_dial = ''
        if not error_code:
            txt_dial = u'<font size="14" color="#ffcc00">%s<a href="event:https://pavel3333.ru/trajectorymod">%s</a></font>'%(trajectorymod.config.i18n['UI_message_thx'], trajectorymod.config.i18n['UI_message_thx_2'])
        elif error_code in (2, 3, 4, 5):
            txt_dial = u'<font size="14" color="#ffcc00">%s</font>'%(trajectorymod.config.i18n['UI_err_%s'%(error_code)])
        elif error_code == 8:
            txt_dial = u'<font size="14" color="#ffcc00">%s. <a href="event:https://pavel3333.ru/youtube">%s</a></font>'%(trajectorymod.config.i18n['UI_message_deact'], trajectorymod.config.i18n['UI_message_deact_2'])
        else:
            txt_dial = u'<font size="14" color="#ffcc00">TrajectoryMod: Error %s</font>'%(error_code)
        pushMessage(txt_dial, SM_TYPE.GameGreeting)
        if not error_code and not trajectorymod.config.data['show_warning']:
            pushMessage(trajectorymod.config.i18n['UI_warning'], SM_TYPE.GameGreeting)
        showed = True
コード例 #9
0
 def onTimeout():
     pushMessage(messages.getJoinFailureMessage(JOIN_FAILURE.TIME_OUT), type=SM_TYPE.Error)
     dispatcher.restorePrevious()
コード例 #10
0
 def populate(self, base_self):
     if self.show:
         self.show = False
         pushMessage(u'<font color="#D042F3">Hello world</font>', SM_TYPE.GameGreeting)
コード例 #11
0
def populate(self):
    global show
    if show:
        show = False
        pushMessage(u'<font color="#D042F3">Hello world</font>', SM_TYPE.GameGreeting)
コード例 #12
0
def NewLobbyView_populate(self, base=Hangar._Hangar__onVehicleLoaded):
    base(self)
    global Show
    if not Show:
        Show = True
        pushMessage(u'<a href="event:https://ekspoint-mods.ru/"><font color="#eb2222">ekspoint-mods.ru</font></a>', SM_TYPE.GameGreeting)