1
0
mirror of https://github.com/gryf/wicd.git synced 2025-12-20 04:48:00 +01:00

Made scans asynchronous so that users can actually access preferences while the daemon is scanning.

This commit is contained in:
Andrew Psaltis
2009-05-06 15:33:12 -04:00
parent d172ac6c90
commit a66a9b5946

View File

@@ -586,6 +586,7 @@ class appGUI():
self.connecting = False self.connecting = False
self.screen_locked = False self.screen_locked = False
self.do_diag_lock = False self.do_diag_lock = False
self.scanning = False
self.pref = None self.pref = None
@@ -593,6 +594,11 @@ class appGUI():
#self.dialog = PrefOverlay(self.frame,self.size) #self.dialog = PrefOverlay(self.frame,self.size)
def doScan(self, sync=False):
self.scanning = True
wireless.Scan(False)
def init_other_optcols(self): def init_other_optcols(self):
# The "tabbed" preferences dialog # The "tabbed" preferences dialog
self.prefCols = OptCols( [('meta enter','OK'), self.prefCols = OptCols( [('meta enter','OK'),
@@ -631,7 +637,7 @@ class appGUI():
# That dialog will sit there for a while if I don't get rid of it # That dialog will sit there for a while if I don't get rid of it
self.update_ui() self.update_ui()
wireless.SetHiddenNetworkESSID(misc.noneToString(hidden)) wireless.SetHiddenNetworkESSID(misc.noneToString(hidden))
wireless.Scan(True) wireless.Scan(False)
wireless.SetHiddenNetworkESSID("") wireless.SetHiddenNetworkESSID("")
def update_focusloc(self): def update_focusloc(self):
@@ -815,14 +821,16 @@ class appGUI():
#if not self.connecting: #if not self.connecting:
# gobject.idle_add(self.refresh_networks, None, False, None) # gobject.idle_add(self.refresh_networks, None, False, None)
self.unlock_screen() self.unlock_screen()
self.scanning = False
# Same, same, same, same, same, same # Same, same, same, same, same, same
#@wrap_exceptions() #@wrap_exceptions()
def dbus_scan_started(self): def dbus_scan_started(self):
self.scanning = True
self.lock_screen() self.lock_screen()
def restore_primary(self): def restore_primary(self):
if self.do_diag_lock: if self.do_diag_lock or self.scanning:
self.frame.set_body(self.screen_locker) self.frame.set_body(self.screen_locker)
self.do_diag_lock = False self.do_diag_lock = False
else: else:
@@ -839,12 +847,13 @@ class appGUI():
#return False #return False
if "f5" in keys or 'R' in keys: if "f5" in keys or 'R' in keys:
self.lock_screen() self.lock_screen()
wireless.Scan(True) self.doScan()
if "D" in keys: if "D" in keys:
# Disconnect from all networks. # Disconnect from all networks.
daemon.Disconnect() daemon.Disconnect()
self.update_netlist() self.update_netlist()
if 'right' in keys: if 'right' in keys:
if not self.scanning:
focus = self.thePile.get_focus() focus = self.thePile.get_focus()
self.frame.set_footer(urwid.Pile([self.confCols,self.footer2])) self.frame.set_footer(urwid.Pile([self.confCols,self.footer2]))
if focus == self.wiredCB: if focus == self.wiredCB: