def connect(self, wifi_key=None): if self._connection is not None: NetworkManager.ActivateConnection(self._connection._connection, self._device, "/") else: self._connection = self._new_connection(wifi_key=wifi_key)
def connect(self, wifi_key=None): if self._connection is not None: NetworkManager.ActivateConnection( self._connection._connection, self._device, "/") else: self._connection = self._new_connection(wifi_key=wifi_key) # FIXME: We should be able to do better than this, maybe with DBus # signals? Maybe the PropertiesChanged signal on the active # connection? attempt = 1 import time while attempt < 12: if self.connected: return time.sleep(1) attempt += 1 self._connection.forget() self._connection = None raise WifiError(_('Failed to connect to %s') % self.ssid)