def _addSingleNotification(self, item): ctx = GetClanInfoCtx(item.getAccountID()) accountResponse = yield self.clansCtrl.sendRequest(ctx) isInCooldown = False if accountResponse.isSuccess(): accountInfo = ctx.getDataObj(accountResponse.data) isInCooldown = isInClanEnterCooldown( accountInfo.getClanCooldownTill()) self.__addUserNotification(ClanSingleAppDecorator, (item.getID(), item, isInCooldown), item)
def _addSingleNotification(self, item): ctx = GetClanInfoCtx(item.getAccountID()) self.__addUserNotification(ClanSingleAppDecorator, (item.getID(), item), item) accountResponse = yield self.webCtrl.sendRequest(ctx) if accountResponse.isSuccess(): accountInfo = ctx.getDataObj(accountResponse.data) isInCooldown = isInClanEnterCooldown(accountInfo.getClanCooldownTill()) if isInCooldown: model = self._model() appId = item.getApplicationID() clanSingleAppDecorator = model.getNotification(NOTIFICATION_TYPE.CLAN_APP, appId) if clanSingleAppDecorator: clanSingleAppDecorator.setClanEnterCooldown(isInCooldown) model.updateNotification(NOTIFICATION_TYPE.CLAN_APP, appId, clanSingleAppDecorator.getEntity(), False)
def __buildActionsSection(self, accountDbId, inviteStatus): acceptButtonEnabled = False declineButtonEnabled = False inviteButtonEnabled = False acceptButtonVisible = False declineButtonVisible = False inviteButtonVisible = False invBtnTooltip = None acceptButtonTooltip = None clanHasFreeSpaces = self.proxy.clanInfo.hasFreePlaces() if self.proxy.currentFilterName == CLANS_ALIASES.INVITE_WINDOW_FILTER_ACTUAL: if inviteStatus == CLAN_INVITE_STATES.ACTIVE: declineButtonVisible = True acceptButtonVisible = True declineButtonEnabled = self.isActionsAllowed() if not clanHasFreeSpaces: acceptButtonTooltip = self._makeTooltip(body=_ms(CLANS.CLANINVITESWINDOW_TOOLTIPS_TABLE_CANTSENDINVITE_BODY)) else: accInfo = self.__accountsInfo.get(accountDbId) if accInfo and isInClanEnterCooldown(accInfo.getClanCooldownTill()): acceptButtonTooltip = self._makeTooltip(body=_ms(text_styles.concatStylesToMultiLine(text_styles.standard(_ms(CLANS.CLANINVITESWINDOW_TOOLTIPS_TABLE_CANTACCEPTREQUESTDUETOCD_BODY)), text_styles.main(formatters.formatShortDateShortTimeString(accInfo.getClanCooldownTill()))))) else: acceptButtonEnabled = self.isActionsAllowed() elif self.proxy.currentFilterName == CLANS_ALIASES.INVITE_WINDOW_FILTER_EXPIRED: if inviteStatus == CLAN_INVITE_STATES.EXPIRED: inviteButtonVisible = True if not clanHasFreeSpaces: invBtnTooltip = CLANS.CLANINVITESWINDOW_TOOLTIPS_TABLE_CANTACCEPTREQUEST_BODY else: invBtnTooltip = CLANS.CLANINVITESWINDOW_TOOLTIPS_TABLE_INVITES_INVITEBUTTON inviteButtonEnabled = self.isActionsAllowed() elif self.proxy.currentFilterName == CLANS_ALIASES.INVITE_WINDOW_FILTER_PROCESSED: if inviteStatus == CLAN_INVITE_STATES.DECLINED: inviteButtonVisible = True if not clanHasFreeSpaces: invBtnTooltip = CLANS.CLANINVITESWINDOW_TOOLTIPS_TABLE_CANTACCEPTREQUEST_BODY else: invBtnTooltip = CLANS.CLANINVITESWINDOW_TOOLTIPS_TABLE_INVITES_INVITEBUTTON inviteButtonEnabled = self.isActionsAllowed() return {'acceptButtonEnabled': acceptButtonEnabled, 'declineButtonEnabled': declineButtonEnabled, 'inviteButtonEnabled': inviteButtonEnabled, 'acceptButtonVisible': acceptButtonVisible, 'declineButtonVisible': declineButtonVisible, 'inviteButtonVisible': inviteButtonVisible, 'inviteButtonText': _ms(CLANS.CLANINVITESWINDOW_TABLE_INVITEBUTTON), 'inviteButtonTooltip': self._makeTooltip(body=_ms(invBtnTooltip)), 'acceptButtonTooltip': acceptButtonTooltip}
def _addSingleNotification(self, item): """ Adds notification with type wgnc_settings.WGNC_DATA_PROXY_TYPE.CLAN_APP only! :param item: reference to gui.wgnc.proxy_data._ProxyDataItem """ ctx = GetClanInfoCtx(item.getAccountID()) self.__addUserNotification(ClanSingleAppDecorator, (item.getID(), item), item) accountResponse = yield self.clansCtrl.sendRequest(ctx) if accountResponse.isSuccess(): accountInfo = ctx.getDataObj(accountResponse.data) isInCooldown = isInClanEnterCooldown(accountInfo.getClanCooldownTill()) if isInCooldown: model = self._model() appId = item.getApplicationID() clanSingleAppDecorator = model.getNotification(NOTIFICATION_TYPE.CLAN_APP, appId) if clanSingleAppDecorator: clanSingleAppDecorator.setClanEnterCooldown(isInCooldown) model.updateNotification(NOTIFICATION_TYPE.CLAN_APP, appId, clanSingleAppDecorator.getEntity(), False)
def isInClanEnterCooldown(self): self.resyncWebClanInfo() return isInClanEnterCooldown(self.getClanCooldownTill( )) if self._vitalWebInfo[SYNC_KEYS.CLAN_INFO] else False