indicator.py 文件源码

python
阅读 40 收藏 0 点赞 0 评论 0

项目:furi-kura 作者: benjamindean 项目源码 文件源码
def mail_notify(self, inbox_count):
        """
        If inbox_count is unchanged from last update - exit the function.
        If new inbox_count is smaller - user read the message
        somewhere else (browser, phone app, etc).
        """
        notification_config = self.config.get('notifications')
        local_inbox_count = self.local_data.get('inbox_count', 0)

        if inbox_count == local_inbox_count:
            return
        elif inbox_count < local_inbox_count:
            self.INDICATOR.set_status(AppIndicator3.IndicatorStatus.ACTIVE)
            return

        self.INDICATOR.set_status(AppIndicator3.IndicatorStatus.ATTENTION)

        if not notification_config:
            return

        if not self.services['notification']:
            self.services['notification'] = Notify.init(self.APPINDICATOR_ID)

        if notification_config == 1:
            message_data = self.request.get_last_message()
            header = "reddit mail from <b>{author}</b>".format(author=message_data['author'])
            body = message_data['body']
        else:
            header = "You have a new reddit mail"
            body = ''

        Notify.Notification.new(
            header,
            body,
            self.ICONS['main']
        ).show()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号