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

Fixed bug where manually opened (not opened with the tray) gui.py would reopen when closed.

This commit is contained in:
imdano
2007-08-31 08:19:13 +00:00
parent 82958861a7
commit 7176183b47
2 changed files with 19 additions and 15 deletions

View File

@@ -421,7 +421,7 @@ class ConnectionWizard(dbus.service.Object):
print 'calling wired profile chooser' print 'calling wired profile chooser'
@dbus.service.signal(dbus_interface='org.wicd.daemon',signature='') @dbus.service.signal(dbus_interface='org.wicd.daemon',signature='')
def CloseGui(self): def CloseGui(self, killed):
''' Sends a dbus signal announcing the GUI is closing ''' ''' Sends a dbus signal announcing the GUI is closing '''
print 'sending close signal' print 'sending close signal'
@dbus.service.method('org.wicd.daemon') @dbus.service.method('org.wicd.daemon')
@@ -433,7 +433,7 @@ class ConnectionWizard(dbus.service.Object):
service.method and service.signal service.method and service.signal
''' '''
self.CloseGui() self.CloseGui(True)
########## WIRELESS FUNCTIONS ########## WIRELESS FUNCTIONS
################################# #################################
@@ -1196,7 +1196,6 @@ class ConnectionWizard(dbus.service.Object):
#end function ReadConfig #end function ReadConfig
def usage(): def usage():
print """ print """
wicd 1.33 wicd 1.33

29
edgy.py
View File

@@ -158,7 +158,7 @@ class TrayIconInfo():
wireless_ip = wireless.GetWirelessIP() wireless_ip = wireless.GetWirelessIP()
if wireless_ip is not None: if wireless_ip is not None:
self.check_for_wireless_connection(wireless_ip) self.check_for_wireless_connection(wireless_ip)
else: else: # No connection at all
tr.set_from_file("images/no-signal.png") tr.set_from_file("images/no-signal.png")
tr.set_tooltip(language['not_connected']) tr.set_tooltip(language['not_connected'])
self.auto_reconnect() self.auto_reconnect()
@@ -191,16 +191,12 @@ class TrayIconInfo():
should that fail will simply run AutoConnect() should that fail will simply run AutoConnect()
''' '''
# Auto-reconnect code - not sure how well this works. I know that if wireless.GetAutoReconnect() and \
# without the ForcedDisconnect check it reconnects you when a not daemon.CheckIfConnecting() and \
# disconnect is forced. People who have disconnection problems need not wireless.GetForcedDisconnect():
# to test it to determine if it actually works.
if wireless.GetAutoReconnect() == True and \
daemon.CheckIfConnecting() == False and \
wireless.GetForcedDisconnect() == False:
cur_net_id = wireless.GetCurrentNetworkID() cur_net_id = wireless.GetCurrentNetworkID()
if cur_net_id > -1: # Needs to be a valid network if cur_net_id > -1: # Needs to be a valid network
if self.tried_reconnect == False: if not self.tried_reconnect:
print 'Trying to autoreconnect to last used network' print 'Trying to autoreconnect to last used network'
wireless.ConnectWireless(cur_net_id) wireless.ConnectWireless(cur_net_id)
self.tried_reconnect = True self.tried_reconnect = True
@@ -284,14 +280,23 @@ class TrackerStatusIcon(gtk.StatusIcon):
self.current_icon_path = path self.current_icon_path = path
gtk.StatusIcon.set_from_file(self,path) gtk.StatusIcon.set_from_file(self,path)
def toggle_wicd_gui(self): def toggle_wicd_gui(self, killed = False):
''' Toggles the wicd GUI ''' ''' Toggles the wicd GUI
either opens or closes the gui, depending on
the situation.
killed is passed as True if the gui was manually
closed and a signal was sent from the daemon,
and is false otherwise.
'''
ret = 0 ret = 0
if self.last_win_id != 0: if self.last_win_id != 0:
# There may be a gui window already open, so try to kill it
os.kill(self.last_win_id, signal.SIGQUIT) os.kill(self.last_win_id, signal.SIGQUIT)
ret = os.waitpid(self.last_win_id, 0)[1] ret = os.waitpid(self.last_win_id, 0)[1]
self.last_win_id = 0 self.last_win_id = 0
if ret == 0: if ret == 0 and not killed:
self.last_win_id = os.spawnlpe(os.P_NOWAIT, './gui.py', os.environ) self.last_win_id = os.spawnlpe(os.P_NOWAIT, './gui.py', os.environ)