mirror of
https://github.com/gryf/wicd.git
synced 2025-12-20 04:48:00 +01:00
Increased time allowed for wpa_supplicant to complete authentication.
Reduced external calls (when possible) in update_status_bar. pulse_progress_bar is now only run when connecting to a network. Only check encryption settings on connect, instead of all of them, which shouldn't be necessary.
This commit is contained in:
43
gui.py
43
gui.py
@@ -1148,6 +1148,7 @@ class appGui:
|
|||||||
self.first_dialog_load = True
|
self.first_dialog_load = True
|
||||||
self.vpn_connection_pipe = None
|
self.vpn_connection_pipe = None
|
||||||
self.is_visible = True
|
self.is_visible = True
|
||||||
|
self.pulse_active = False
|
||||||
|
|
||||||
self.window.connect('delete_event', self.exit)
|
self.window.connect('delete_event', self.exit)
|
||||||
|
|
||||||
@@ -1166,8 +1167,7 @@ class appGui:
|
|||||||
if width > -1 and height > -1:
|
if width > -1 and height > -1:
|
||||||
self.window.resize(int(width), int(height))
|
self.window.resize(int(width), int(height))
|
||||||
|
|
||||||
gobject.timeout_add(800, self.update_statusbar)
|
gobject.timeout_add(700, self.update_statusbar)
|
||||||
gobject.timeout_add(250, self.pulse_progress_bar)
|
|
||||||
|
|
||||||
def create_adhoc_network(self, widget=None):
|
def create_adhoc_network(self, widget=None):
|
||||||
""" Shows a dialog that creates a new adhoc network. """
|
""" Shows a dialog that creates a new adhoc network. """
|
||||||
@@ -1440,6 +1440,8 @@ class appGui:
|
|||||||
|
|
||||||
def pulse_progress_bar(self):
|
def pulse_progress_bar(self):
|
||||||
""" Pulses the progress bar while connecting to a network. """
|
""" Pulses the progress bar while connecting to a network. """
|
||||||
|
if not self.pulse_active:
|
||||||
|
return False
|
||||||
if not self.is_visible:
|
if not self.is_visible:
|
||||||
return True
|
return True
|
||||||
try:
|
try:
|
||||||
@@ -1453,17 +1455,20 @@ class appGui:
|
|||||||
if not self.is_visible:
|
if not self.is_visible:
|
||||||
return True
|
return True
|
||||||
|
|
||||||
iwconfig = wireless.GetIwconfig()
|
|
||||||
wireless_ip = wireless.GetWirelessIP()
|
|
||||||
wiredConnecting = wired.CheckIfWiredConnecting()
|
wiredConnecting = wired.CheckIfWiredConnecting()
|
||||||
wirelessConnecting = wireless.CheckIfWirelessConnecting()
|
wirelessConnecting = wireless.CheckIfWirelessConnecting()
|
||||||
|
|
||||||
if wirelessConnecting or wiredConnecting:
|
if wirelessConnecting or wiredConnecting:
|
||||||
|
if not self.pulse_active:
|
||||||
|
self.pulse_active = True
|
||||||
|
gobject.timeout_add(100, self.pulse_progress_bar)
|
||||||
|
|
||||||
self.network_list.set_sensitive(False)
|
self.network_list.set_sensitive(False)
|
||||||
self.status_area.show_all()
|
self.status_area.show_all()
|
||||||
if self.statusID:
|
if self.statusID:
|
||||||
self.status_bar.remove(1, self.statusID)
|
self.status_bar.remove(1, self.statusID)
|
||||||
if wirelessConnecting:
|
if wirelessConnecting:
|
||||||
|
iwconfig = wireless.GetIwconfig()
|
||||||
self.set_status(wireless.GetCurrentNetwork(iwconfig) + ': ' +
|
self.set_status(wireless.GetCurrentNetwork(iwconfig) + ': ' +
|
||||||
language[str(wireless.CheckWirelessConnectingMessage())])
|
language[str(wireless.CheckWirelessConnectingMessage())])
|
||||||
if wiredConnecting:
|
if wiredConnecting:
|
||||||
@@ -1471,16 +1476,17 @@ class appGui:
|
|||||||
language[str(wired.CheckWiredConnectingMessage())])
|
language[str(wired.CheckWiredConnectingMessage())])
|
||||||
else:
|
else:
|
||||||
self.network_list.set_sensitive(True)
|
self.network_list.set_sensitive(True)
|
||||||
|
self.pulse_active = False
|
||||||
self.status_area.hide_all()
|
self.status_area.hide_all()
|
||||||
if self.statusID:
|
if self.statusID:
|
||||||
self.status_bar.remove(1, self.statusID)
|
self.status_bar.remove(1, self.statusID)
|
||||||
|
|
||||||
# Determine connection status.
|
# Determine connection status.
|
||||||
if self.check_for_wireless(iwconfig, wireless_ip):
|
if self.check_for_wired(wired.GetWiredIP()):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
wired_ip = wired.GetWiredIP()
|
if self.check_for_wireless(wireless.GetIwconfig(),
|
||||||
if self.check_for_wired(wired_ip):
|
wireless.GetWirelessIP()):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
self.set_status(language['not_connected'])
|
self.set_status(language['not_connected'])
|
||||||
@@ -1751,18 +1757,33 @@ class appGui:
|
|||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
def check_encryption_valid(self, entry):
|
||||||
|
""" Make sure that encryption settings are properly filled in. """
|
||||||
|
# Make sure no entries are left blank
|
||||||
|
if entry.chkbox_encryption.get_active():
|
||||||
|
encryption_info = entry.encryption_info
|
||||||
|
for x in encryption_info:
|
||||||
|
if encryption_info[x].get_text() == "":
|
||||||
|
misc.error(self.window, language['encrypt_info_missing'])
|
||||||
|
return False
|
||||||
|
# Make sure the checkbox is checked when it should be
|
||||||
|
elif not entry.chkbox_encryption.get_active() and \
|
||||||
|
wireless.GetWirelessProperty(networkid, "encryption"):
|
||||||
|
misc.error(self.window, language['enable_encryption'])
|
||||||
|
return False
|
||||||
|
return True
|
||||||
|
|
||||||
def connect(self, widget, event, nettype, networkid, networkentry):
|
def connect(self, widget, event, nettype, networkid, networkentry):
|
||||||
""" Initiates the connection process in the daemon. """
|
""" Initiates the connection process in the daemon. """
|
||||||
cancel_button = self.wTree.get_widget("cancel_button")
|
cancel_button = self.wTree.get_widget("cancel_button")
|
||||||
cancel_button.set_sensitive(True)
|
cancel_button.set_sensitive(True)
|
||||||
|
|
||||||
if not self.save_settings(nettype, networkid, networkentry):
|
|
||||||
return False
|
|
||||||
|
|
||||||
if nettype == "wireless":
|
if nettype == "wireless":
|
||||||
|
if not self.check_encryption_valid(networkentry.advanced_dialog):
|
||||||
|
return False
|
||||||
wireless.ConnectWireless(networkid)
|
wireless.ConnectWireless(networkid)
|
||||||
elif nettype == "wired":
|
elif nettype == "wired":
|
||||||
wired.ConnectWired()
|
wired.ConnectWired()
|
||||||
|
self.update_statusbar()
|
||||||
|
|
||||||
def exit(self, widget=None, event=None):
|
def exit(self, widget=None, event=None):
|
||||||
""" Hide the wicd GUI.
|
""" Hide the wicd GUI.
|
||||||
|
|||||||
@@ -806,7 +806,7 @@ class WirelessInterface(Interface):
|
|||||||
if self.wpa_driver == RALINK_DRIVER:
|
if self.wpa_driver == RALINK_DRIVER:
|
||||||
return True
|
return True
|
||||||
|
|
||||||
MAX_TIME = 5
|
MAX_TIME = 10
|
||||||
MAX_DISCONNECTED_TIME = 3
|
MAX_DISCONNECTED_TIME = 3
|
||||||
while (time.time() - auth_time) < MAX_TIME:
|
while (time.time() - auth_time) < MAX_TIME:
|
||||||
cmd = 'wpa_cli -i ' + self.iface + ' status'
|
cmd = 'wpa_cli -i ' + self.iface + ' status'
|
||||||
|
|||||||
Reference in New Issue
Block a user