indicator_libmessaging pylint fixes

This commit is contained in:
lakshyacis 2019-09-23 16:07:04 +05:30
parent a6f951d37f
commit 36775ae88b
No known key found for this signature in database
GPG Key ID: D2C539C8EC63E9EB

View File

@ -1,4 +1,8 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
"""
src/plugins/indicator_libmessaging.py
=====================================
"""
import gi import gi
gi.require_version('MessagingMenu', '1.0') # noqa:E402 gi.require_version('MessagingMenu', '1.0') # noqa:E402
@ -9,6 +13,7 @@ from pybitmessage.tr import _translate
class IndicatorLibmessaging(object): class IndicatorLibmessaging(object):
"""Plugin for libmessage indicator"""
def __init__(self, form): def __init__(self, form):
try: try:
self.app = MessagingMenu.App(desktop_id='pybitmessage.desktop') self.app = MessagingMenu.App(desktop_id='pybitmessage.desktop')
@ -32,15 +37,18 @@ class IndicatorLibmessaging(object):
if self.app: if self.app:
self.app.unregister() self.app.unregister()
def activate(self, app, source): def activate(self, app, source): # pylint: disable=unused-argument
"""Activate the libmessaging indicator plugin"""
self.form.appIndicatorInbox( self.form.appIndicatorInbox(
self.new_message_item if source == 'messages' self.new_message_item if source == 'messages'
else self.new_broadcast_item else self.new_broadcast_item
) )
# show the number of unread messages and subscriptions
# on the messaging menu
def show_unread(self, draw_attention=False): def show_unread(self, draw_attention=False):
"""
show the number of unread messages and subscriptions
on the messaging menu
"""
for source, count in zip( for source, count in zip(
('messages', 'subscriptions'), ('messages', 'subscriptions'),
self.form.getUnread() self.form.getUnread()