[wicd] Fix pylint errors

This commit is contained in:
Philipp Hörist
2018-11-02 19:45:12 +01:00
parent 38b0aa5d76
commit 4a4faefbd7

View File

@@ -1,17 +1,19 @@
import os import os
from gajim.common import app from gajim.common import app
from gajim.common import dbus_support
from gajim.plugins import GajimPlugin from gajim.plugins import GajimPlugin
from gajim.plugins.helpers import log_calls from gajim.plugins.helpers import log_calls
from gajim.plugins.plugins_i18n import _ from gajim.plugins.plugins_i18n import _
from gajim.common import dbus_support
class WicdPlugin(GajimPlugin): class WicdPlugin(GajimPlugin):
@log_calls('WicdPlugin') @log_calls('WicdPlugin')
def init(self): def init(self):
self.description = _('Support for autodetection of network status ' self.description = _(
'for Wicd Network Manager.\nRequires wicd and python-dbus.') 'Support for autodetection of network status '
'for Wicd Network Manager.\nRequires wicd and python-dbus.')
self.config_dialog = None self.config_dialog = None
self.test_activatable() self.test_activatable()
@@ -24,7 +26,7 @@ class WicdPlugin(GajimPlugin):
if not dbus_support.supported: if not dbus_support.supported:
self.activatable = False self.activatable = False
self.available_text += _('python-dbus is missing! ' self.available_text += _('python-dbus is missing! '
'Install python-dbus.') 'Install python-dbus.')
@log_calls('WicdPlugin') @log_calls('WicdPlugin')
def activate(self): def activate(self):
@@ -37,27 +39,33 @@ class WicdPlugin(GajimPlugin):
if 'org.wicd.daemon' not in self.bus.list_names(): if 'org.wicd.daemon' not in self.bus.list_names():
return return
wicd_object = self.bus.get_object('org.wicd.daemon', wicd_object = self.bus.get_object('org.wicd.daemon',
'/org/wicd/daemon') '/org/wicd/daemon')
self.props = dbus.Interface(wicd_object, self.props = dbus.Interface(wicd_object,
"org.freedesktop.DBus.Properties") 'org.freedesktop.DBus.Properties')
self.bus.add_signal_receiver(self.state_changed, 'StatusChanged', self.bus.add_signal_receiver(self.state_changed,
'org.wicd.daemon', 'org.wicd.daemon', '/org/wicd/daemon') 'StatusChanged',
'org.wicd.daemon',
'org.wicd.daemon',
'/org/wicd/daemon')
except dbus.DBusException: except dbus.DBusException:
pass pass
@log_calls('WicdPlugin') @log_calls('WicdPlugin')
def deactivate(self): def deactivate(self):
self.bus.remove_signal_receiver(self.state_changed, 'StatusChanged', self.bus.remove_signal_receiver(self.state_changed,
'org.wicd.daemon', 'org.wicd.daemon','/org/wicd/daemon') 'StatusChanged',
'org.wicd.daemon',
'org.wicd.daemon',
'/org/wicd/daemon')
def state_changed(self, state, info): def state_changed(self, state, _info):
# Connection state constants # Connection state constants
#NOT_CONNECTED = 0 # NOT_CONNECTED = 0
#CONNECTING = 1 # CONNECTING = 1
#WIRELESS = 2 # WIRELESS = 2
#WIRED = 3 # WIRED = 3
#SUSPENDED = 4 # SUSPENDED = 4
if state == 2 or state == 3: if state in (2, 3):
for connection in app.connections.values(): for connection in app.connections.values():
if app.config.get_per('accounts', connection.name, if app.config.get_per('accounts', connection.name,
'listen_to_network_manager') and connection.time_to_reconnect: 'listen_to_network_manager') and connection.time_to_reconnect: