def _make(self, invite=None, settings=None): invite = invite or self.prbInvites.getInvite(self._entityID) if not invite: LOG_ERROR('Invite not found', self._entityID) self._vo = {} self._settings = NotificationGuiSettings( False, NotificationPriorityLevel.LOW, showAt=_makeShowTime()) return if not invite.showAt or invite.isActive(): if invite.showAt > 0: self._isOrderChanged = True invite.showAt = _makeShowTime() if invite.isActive(): self._settings = NotificationGuiSettings( True, NotificationPriorityLevel.HIGH, showAt=invite.showAt) else: self._settings = NotificationGuiSettings( False, NotificationPriorityLevel.LOW, showAt=invite.showAt) formatter = getPrbInviteHtmlFormatter(invite) canAccept = self.prbInvites.canAcceptInvite(invite) canDecline = self.prbInvites.canDeclineInvite(invite) if canAccept or canDecline: submitState = cancelState = NOTIFICATION_BUTTON_STATE.VISIBLE if canAccept: submitState |= NOTIFICATION_BUTTON_STATE.ENABLED if canDecline: cancelState |= NOTIFICATION_BUTTON_STATE.ENABLED else: submitState = cancelState = 0 message = g_settings.msgTemplates.format( 'invite', ctx={'text': formatter.getText(invite)}, data={ 'timestamp': invite.createTime, 'icon': makePathToIcon(formatter.getIconName(invite)), 'defaultIcon': makePathToIcon('prebattleInviteIcon'), 'buttonsStates': { 'submit': submitState, 'cancel': cancelState } }) message = self.__updateTooltips(canAccept, message) self._vo = { 'typeID': self.getType(), 'entityID': self.getID(), 'message': message, 'notify': self.isNotify(), 'auxData': [] }
def _make(self, invite=None, settings=None): invite = invite or self.prbInvites.getInvite(self._entityID) if not invite: LOG_ERROR("Invite not found", self._entityID) self._vo = {} self._settings = NotificationGuiSettings(False, NotificationPriorityLevel.LOW, showAt=_makeShowTime()) return if not invite.showAt or invite.isActive(): if invite.showAt > 0: self._isOrderChanged = True invite.showAt = _makeShowTime() if invite.isActive(): self._settings = NotificationGuiSettings(True, NotificationPriorityLevel.HIGH, showAt=invite.showAt) else: self._settings = NotificationGuiSettings(False, NotificationPriorityLevel.LOW, showAt=invite.showAt) formatter = getPrbInviteHtmlFormatter(invite) canAccept = self.prbInvites.canAcceptInvite(invite) canDecline = self.prbInvites.canDeclineInvite(invite) if canAccept or canDecline: submitState = cancelState = NOTIFICATION_BUTTON_STATE.VISIBLE if canAccept: submitState |= NOTIFICATION_BUTTON_STATE.ENABLED if canDecline: cancelState |= NOTIFICATION_BUTTON_STATE.ENABLED else: submitState = cancelState = 0 message = g_settings.msgTemplates.format( "invite", ctx={"text": formatter.getText(invite)}, data={ "timestamp": self._createdAt, "icon": makePathToIcon(formatter.getIconName(invite)), "defaultIcon": makePathToIcon("prebattleInviteIcon"), "buttonsStates": {"submit": submitState, "cancel": cancelState}, }, ) self._vo = { "typeID": self.getType(), "entityID": self.getID(), "message": message, "notify": self.isNotify(), "auxData": [], }
def _make(self, invite = None, settings = None): invite = invite or self.prbInvites.getInvite(self._entityID) if not invite: LOG_ERROR('Invite not found', self._entityID) self._vo = {} self._settings = NotificationGuiSettings(False, NotificationPriorityLevel.LOW, showAt=_makeShowTime()) return if not invite.showAt or invite.isActive(): if invite.showAt > 0: self._isOrderChanged = True invite.showAt = _makeShowTime() if invite.isActive(): self._settings = NotificationGuiSettings(True, NotificationPriorityLevel.HIGH, showAt=invite.showAt) else: self._settings = NotificationGuiSettings(False, NotificationPriorityLevel.LOW, showAt=invite.showAt) formatter = getPrbInviteHtmlFormatter(invite) canAccept = self.prbInvites.canAcceptInvite(invite) canDecline = self.prbInvites.canDeclineInvite(invite) if canAccept or canDecline: submitState = cancelState = NOTIFICATION_BUTTON_STATE.VISIBLE if canAccept: submitState |= NOTIFICATION_BUTTON_STATE.ENABLED if canDecline: cancelState |= NOTIFICATION_BUTTON_STATE.ENABLED else: submitState = cancelState = 0 message = g_settings.msgTemplates.format('invite', ctx={'text': formatter.getText(invite)}, data={'timestamp': self._createdAt, 'icon': makePathToIcon(formatter.getIconName(invite)), 'defaultIcon': makePathToIcon('prebattleInviteIcon'), 'buttonsStates': {'submit': submitState, 'cancel': cancelState}}) self._vo = {'typeID': self.getType(), 'entityID': self.getID(), 'message': message, 'notify': self.isNotify(), 'auxData': []}