1
0
mirror of https://github.com/gryf/wicd.git synced 2025-12-24 23:22:27 +01:00

merged connection-info

This commit is contained in:
Adam Blackburn
2009-11-21 11:55:50 -06:00
5 changed files with 396 additions and 36 deletions

View File

@@ -279,7 +279,8 @@ class ConnectionStatus(object):
self.reconnect_tries = 0
info = [str(wifi_ip), str(wireless.GetCurrentNetwork(iwconfig)),
str(self._get_printable_sig_strength()),
str(wireless.GetCurrentNetworkID(iwconfig))]
str(wireless.GetCurrentNetworkID(iwconfig)),
wireless.GetCurrentBitrate(iwconfig)]
elif state == misc.WIRED:
self.reconnect_tries = 0
info = [str(wired_ip)]

View File

@@ -58,6 +58,184 @@ def get_gettext():
# Generated automatically on Thu, 13 Aug 2009 12:10:26 CDT
_ = get_gettext()
language = {}
language['connect'] = _('Connect')
language['ip'] = _('IP')
language['netmask'] = _('Netmask')
language['gateway'] = _('Gateway')
language['dns'] = _('DNS')
language['use_static_ip'] = _('Use Static IPs')
language['use_static_dns'] = _('Use Static DNS')
language['use_encryption'] = _('Use Encryption')
language['advanced_settings'] = _('Advanced Settings')
language['properties'] = _('Properties')
language['wired_network'] = _('Wired Network')
language['wired_network_instructions'] = _('To connect to a wired network,'
' you must create a network profile. To create a network profile, type a'
' name that describes this network, and press Add.')
language['automatic_connect'] = _('Automatically connect to this network')
language['secured'] = _('Secured')
language['unsecured'] = _('Unsecured')
language['channel'] = _('Channel')
language['preferences'] = _('Preferences')
language['wpa_supplicant_driver'] = _('WPA Supplicant Driver')
language['wireless_interface'] = _('Wireless Interface')
language['wired_interface'] = _('Wired Interface')
language['hidden_network'] = _('Hidden Network')
language['hidden_network_essid'] = _('Hidden Network ESSID')
language['connected_to_wireless'] = _('Connected to $A at $B (IP: $C)')
language['tray_connected_to_wireless'] = _('Wireless Network\n$A at $B\nSpeed: $C\nIP $D')
language['connected_to_wired'] = _('Connected to wired network (IP: $A)')
language['tray_connected_to_wired'] = _('Wired Network\nIP: $A')
language['not_connected'] = _('Not connected')
language['conn_info_wired_labels'] = _('Wired\nIP:\nRX:\nTX:\n\n\n')
language['conn_info_wireless_labels'] = _('Wireless\nSSID:\nSpeed:\nIP:\nStrength:\nRX:\nTX:')
language['conn_info_wired'] = _('\n$A\n$B KB/s\n$C KB/s\n\n\n')
language['conn_info_wireless'] = _('\n$A\n$B\n$C\n$D\n$E KB/s\n$F KB/s')
language['conn_info_not_connected'] = _('\n\nNot Connected\n\n\n\n')
language['conn_info_connecting'] = _('\n\nConnecting...\n\n\n\n')
language['no_wireless_networks_found'] = _('No wireless networks found.')
language['killswitch_enabled'] = _('Wireless Kill Switch Enabled')
language['key'] = _('Key')
language['username'] = _('Username')
language['password'] = _('Password')
language['anonymous_identity'] = _('Anonymous Identity')
language['identity'] = _('Identity')
language['authentication'] = _('Authentication')
language['path_to_pac_file'] = _('Path to PAC File')
language['select_a_network'] = _('Choose from the networks below:')
#language['connecting...'] = _('Connecting...')
language['wired_always_on'] = _('Always show wired interface')
language['auto_reconnect'] = _('Automatically reconnect on connection loss')
language['create_adhoc_network'] = _('Create an Ad-Hoc Network')
language['essid'] = _('ESSID')
language['use_wep_encryption'] = _('Use Encryption (WEP only)')
language['before_script'] = _('Run script before connect')
language['after_script'] = _('Run script after connect')
language['disconnect_script'] = _('Run disconnect script')
language['script_settings'] = _('Scripts')
language['use_ics'] = _('Activate Internet Connection Sharing')
language['madwifi_for_adhoc'] = _('Check if using madwifi/atheros drivers')
language['default_wired'] = _('Use as default profile (overwrites any previous default)')
language['use_debug_mode'] = _('Enable debug mode')
language['use_global_dns'] = _('Use global DNS servers')
language['use_default_profile'] = _('Use default profile on wired autoconnect')
language['show_wired_list'] = _('Prompt for profile on wired autoconnect')
language['use_last_used_profile'] = _('Use last used profile on wired autoconnect')
language['choose_wired_profile'] = _('Select or create a wired profile to connect with')
language['wired_network_found'] = _('Wired connection detected')
language['stop_showing_chooser'] = _('Stop Showing Autoconnect pop-up temporarily')
language['display_type_dialog'] = _('Use dBm to measure signal strength')
language['scripts'] = _('Scripts')
language['invalid_address'] = _('Invalid address in $A entry.')
language['global_settings'] = _('Use these settings for all networks sharing this essid')
language['encrypt_info_missing'] = _('Required encryption information is missing.')
language['enable_encryption'] = _('This network requires encryption to be enabled.')
language['wicd_auto_config'] = _('Automatic (recommended)')
language["gen_settings"] = _('General Settings')
language["ext_programs"] = _('External Programs')
language["dhcp_client"] = _('DHCP Client')
language["wired_detect"] = _('Wired Link Detection')
language["route_flush"] = _('Route Table Flushing')
language["backend"] = _('Backend')
language["backend_alert"] = _('Changes to your backend won\'t occur until the daemon is restarted.')
language['dns_domain'] = _('DNS domain')
language['search_domain'] = _('Search domain')
language['global_dns_not_enabled'] = _('Global DNS has not been enabled in general preferences.')
language['scripts_need_pass'] = _('You must enter your password to configure scripts')
language['no_sudo_prog'] = _('Could not find a graphical sudo program. The script editor could not be launched.' +
' You\'ll have to edit scripts directly your configuration file.')
language['interface_down'] = _('Putting interface down...')
language['resetting_ip_address'] = _('Resetting IP address...')
language['interface_up'] = _('Putting interface up...')
language['setting_encryption_info'] = _('Setting encryption info')
language['removing_old_connection'] = _('Removing old connection...')
language['generating_psk'] = _('Generating PSK...')
language['generating_wpa_config'] = _('Generating WPA configuration file...')
language['flushing_routing_table'] = _('Flushing the routing table...')
language['configuring_interface'] = _('Configuring wireless interface...')
language['validating_authentication'] = _('Validating authentication...')
language['setting_broadcast_address'] = _('Setting broadcast address...')
language['setting_static_dns'] = _('Setting static DNS servers...')
language['setting_static_ip'] = _('Setting static IP addresses...')
language['running_dhcp'] = _('Obtaining IP address...')
language['dhcp_failed'] = _('Connection Failed: Unable to Get IP Address')
language['no_dhcp_offers'] = _('Connection Failed: No DHCP offers received.')
language['aborted'] = _('Connection Cancelled')
language['bad_pass'] = _('Connection Failed: Could not authenticate (bad password?)')
language['verifying_association'] = _("Verifying access point association...")
language['association_failed'] = _("Connection Failed: Could not contact the wireless access point.")
language['done'] = _('Done connecting...')
language['scanning'] = _('Scanning')
language['scanning_stand_by'] = _('Scanning networks... stand by...')
language['cannot_start_daemon'] = _('Unable to connect to wicd daemon DBus interface. " + \
"This typically means there was a problem starting the daemon. " + \
"Check the wicd log for more info')
language['lost_dbus'] = _('The wicd daemon has shut down, the UI will not function properly until it is restarted.')
language['access_denied'] = _("Unable to contact the wicd dameon due to an access denied error from DBus. Please check your DBus configuration.")
language['configuring_wireless'] = _('Configuring preferences for wireless network "$A" ($B)')
language['configuring_wired'] = _('Configuring preferences for wired profile "$A"')
language['scan'] = _('Scan')
language['always_switch_to_wired'] = _('Always switch to wired connection when available')
language['wired_autoconnect_settings'] = _('Wired Autoconnect Settings')
language['always_use_wext'] = _('You should almost always use wext as the WPA supplicant driver')
language['debugging'] = _('Debugging')
language['wpa_supplicant'] = _('WPA Supplicant')
language['automatic_reconnection'] = _('Automatic Reconnection')
language['global_dns_servers'] = _('Global DNS servers')
language['network_interfaces'] = _('Network Interfaces')
language['connecting_to_daemon'] = _('Connecting to daemon...')
language['cannot_connect_to_daemon'] = _('Can\'t connect to the daemon, trying to start it automatically...')
language['could_not_connect'] = _('Could not connect to wicd\'s D-Bus interface. Check the wicd log for error messages.')
language["exception"] = _('EXCEPTION! Please report this to the maintainer and file a bug report with the backtrace below:')
language["brought_to_you"] = _('Brought to you by:')
language["add_new_profile"] = _('Add a new profile')
language["add_new_wired_profile"] = _('Add a new wired profile')
language["no_delete_last_profile"] = _('wicd-curses does not support deleting the last wired profile. Try renaming it (\'F2\')')
language["rename_wired_profile"] = _('Rename wired profile')
language["select_hidden_essid"] = _('Select Hidden Network ESSID')
language["esc_to_cancel"] = _('Press ESC to cancel')
language["press_to_quit"] = _('Press F8 or Q to quit.')
language['terminated'] = _('Terminated by user')
language['wicd_curses'] = _('Wicd Curses Interface')
language['dbus_fail'] = _('DBus failure! This is most likely caused by the wicd daemon stopping while wicd-curses is running. Please restart the daemon, and then restart wicd-curses.')
# These are in the tray list, but not in the non-tray list
language['connecting'] = _('Connecting')
language['daemon_unavailable'] = _('The wicd daemon is unavailable, so your request cannot be completed')
language['no_daemon_tooltip'] = _('Wicd daemon unreachable')
# Translations added on Wed Mar 4 03:36:24 UTC 2009
language['make_wired_profile'] = _('To connect to a wired network, you must create a network profile. To create a network profile, type a name that describes this network, and press Add.')
language['access_cards'] = _('Wicd needs to access your computer\'s network cards.')
#language['CHANGE_ME'] = _('Create Ad-Hoc network')
#language['CHANGE_ME'] = _('Wired Autoconnect Setting:')
language['bad_pass'] = _('Connection Failed: Bad password')
language['cannot_edit_scripts_1'] = _('To avoid various complications, wicd-curses does not support directly editing the scripts directly. However, you can edit them manually. First, (as root)", open the "$A" config file, and look for the section labeled by the $B in question. In this case, this is:')
language['cannot_edit_scripts_2'] = _('Once there, you can adjust (or add) the "beforescript", "afterscript", and "disconnectscript" variables as needed, to change the preconnect, postconnect, and disconnect scripts respectively. Note that you will be specifying the full path to the scripts - not the actual script contents. You will need to add/edit the script contents separately. Refer to the wicd manual page for more information.')
language['cannot_edit_scripts_3'] = _('You can also configure the wireless networks by looking for the "[<ESSID>]" field in the config file.')
language['wired_networks'] = _('Wired Networks')
language['wireless_networks'] = _('Wireless Networks')
language['about'] = _('About Wicd')
language['more_help'] = _('For more detailed help, consult the wicd-curses(8) man page.')
language['case_sensitive'] = _('All controls are case sensitive')
language['help_help'] = _('Display this help dialog')
language['connect_help'] = _('Connect to selected network')
language['disconn_help'] = _('Disconnect from all networks')
language['about_help'] = _('Stop a network connection in progress')
language['refresh_help'] = _('Refresh network list')
language['prefs_help'] = _('Preferences dialog')
language['scan_help'] = _('Scan for hidden networks')
language['scripts_help'] = _('Select scripts')
language['adhoc_help'] = _('Set up Ad-hoc network')
language['config_help'] = _('Configure Selected Network')
#language[''] = _('Press H or ? for help') # Defunct in curses-uimod
language['raw_screen_arg'] = _('use urwid\'s raw screen controller')
language['ok'] = _('OK')
language['cancel'] = _('Cancel')
language['resetting_ip_address'] = _('''Resetting IP address...''')
language['prefs_help'] = _('''Preferences dialog''')
language['no_dhcp_offers'] = _('''Connection Failed: No DHCP offers received.''')

248
wicd/wicd-client.py Executable file → Normal file
View File

@@ -14,6 +14,8 @@ class TrayIcon() -- Parent class of TrayIconGUI and IconConnectionInfo.
class StatusTrayIconGUI() -- Implements the tray icon using a
gtk.StatusIcon.
class EggTrayIconGUI() -- Implements the tray icon using egg.trayicon.
def usage() -- Prints usage information.
def main() -- Runs the wicd frontend main loop.
"""
@@ -40,6 +42,7 @@ import gobject
import getopt
import os
import pango
import time
import atexit
from dbus import DBusException
@@ -122,11 +125,18 @@ class TrayIcon(object):
"""
def __init__(self, animate, displaytray=True):
self.cur_sndbytes = -1
self.cur_rcvbytes = -1
self.last_sndbytes = -1
self.last_rcvbytes = -1
self.max_snd_gain = 10000
self.max_rcv_gain = 10000
if USE_EGG:
self.tr = self.EggTrayIconGUI()
self.tr = self.EggTrayIconGUI(self)
else:
self.tr = self.StatusTrayIconGUI()
self.icon_info = self.TrayConnectionInfo(self.tr, animate)
self.tr = self.StatusTrayIconGUI(self)
self.icon_info = self.TrayConnectionInfo(self, self.tr, animate)
self.tr.icon_info = self.icon_info
print 'displaytray %s' % displaytray
self.tr.visible(displaytray)
@@ -136,11 +146,27 @@ class TrayIcon(object):
raise NotImplementedError()
else:
return self.tr.is_embedded()
def get_bandwidth_bytes(self):
""" Gets the amount of byte sent sine the last time I checked """
dev_dir = '/sys/class/net/'
iface = daemon.GetCurrentInterface()
for fldr in os.listdir(dev_dir):
if fldr == iface:
dev_dir = dev_dir + fldr + "/statistics/"
break
try:
self.cur_rcvbytes = int(open(dev_dir + "rx_bytes", "r").read().strip())
self.cur_sndbytes = int(open(dev_dir + "tx_bytes", "r").read().strip())
except:
self.cur_sndbytes = -1
self.cur_rcvbytes = -1
class TrayConnectionInfo(object):
""" Class for updating the tray icon status. """
def __init__(self, tr, animate=True):
def __init__(self, parent, tr, animate=True):
""" Initialize variables needed for the icon status methods. """
self.last_strength = -2
self.still_wired = False
@@ -154,6 +180,14 @@ class TrayIcon(object):
self.max_rcv_gain = 10000
self.animate = animate
self.parent = parent
self.network_name = '' # SSID
self.network_type = 'none' # Wired/Wireless/None
self.network_str = '' # Signal Strength
self.network_addr = '0.0.0.0' # IP Address
self.network_br = '' # Bitrate
# keep track of the last state to provide appropriate
# notifications
self._last_bubble = None
@@ -166,6 +200,31 @@ class TrayIcon(object):
handle_no_dbus()
self.set_not_connected_state()
# Initial update of the tooltip
self.update_tooltip()
def update_tooltip(self):
"""
Updates the trayicon tooltip based on current connection status
"""
if (self.network_type == "none"):
self.tr.set_tooltip(language['not_connected'])
elif (self.network_type == "wireless"):
self.tr.set_tooltip(language['connected_to_wireless']
.replace('$A', self.network_name)
.replace('$B', self.network_str)
.replace('$C', self.network_addr))
elif (self.network_type == "wired"):
self.tr.set_tooltip(language['tray_connected_to_wired']
.replace('$A', self.network_addr))
elif (self.network_type == "killswitch"):
self.tr.set_tooltip(language['not_connected'] + "(" +
language['killswitched_enabled'] + ")")
elif (self.network_type == "no_daemon"):
self.tr.set_tooltip(language['no_daemon_tooltip'])
return True
def _show_notification(self, title, details, image=None):
if self.should_notify:
if not self._last_bubble:
@@ -189,14 +248,18 @@ class TrayIcon(object):
def set_wired_state(self, info):
""" Sets the icon info for a wired state. """
wired_ip = info[0]
self.network_addr = str(info[0])
self.network_type = "wired"
self.tr.set_from_file(os.path.join(wpath.images, "wired.png"))
status_string = language['connected_to_wired'].replace('$A',
wired_ip)
self.tr.set_tooltip(status_string)
# status_string = language['connected_to_wired'].replace('$A',
#wired_ip)
# self.tr.set_tooltip(status_string)
self._show_notification(language['wired_network'],
language['connection_established'],
'network-wired')
self.update_tooltip()
@catchdbus
def set_wireless_state(self, info):
""" Sets the icon info for a wireless state. """
@@ -206,19 +269,27 @@ class TrayIcon(object):
strength = info[2]
cur_net_id = int(info[3])
sig_string = daemon.FormatSignalForPrinting(str(strength))
self.network_type = "wireless"
self.network_addr = str(info[0])
self.network_name = info[1]
self.network_str = sig_string
self.network_br = info[4]
self.set_signal_image(int(info[2]), lock)
if wireless.GetWirelessProperty(cur_net_id, "encryption"):
lock = "-lock"
status_string = (language['connected_to_wireless']
.replace('$A', self.network)
.replace('$B', sig_string)
.replace('$C', str(wireless_ip)))
self.tr.set_tooltip(status_string)
# status_string = (language['connected_to_wireless']
#.replace('$A', self.network)
# .replace('$B', sig_string)
# .replace('$C', str(wireless_ip)))
#self.tr.set_tooltip(status_string)
self.set_signal_image(int(strength), lock)
self._show_notification(self.network,
language['connection_established'],
'network-wireless')
self.update_tooltip()
def set_connecting_state(self, info):
""" Sets the icon info for a connecting state. """
@@ -230,7 +301,8 @@ class TrayIcon(object):
cur_network = info[1]
status_string = language['connecting'] + " to " + \
cur_network + "..."
self.tr.set_tooltip(status_string)
self.update_tooltip()
# self.tr.set_tooltip(status_string)
self.tr.set_from_file(os.path.join(wpath.images, "no-signal.png"))
if wired:
self._show_notification(cur_network,
@@ -253,8 +325,9 @@ class TrayIcon(object):
language['killswitch_enabled'] + ")")
else:
status = language['not_connected']
self.tr.set_tooltip(status)
# self.tr.set_tooltip(status)
self._show_notification(language['disconnected'], None, 'stop')
self.update_tooltip()
@catchdbus
def update_tray_icon(self, state=None, info=None):
@@ -287,7 +360,8 @@ class TrayIcon(object):
def set_signal_image(self, wireless_signal, lock):
""" Sets the tray icon image for an active wireless connection. """
if self.animate:
prefix = self.get_bandwidth_state()
TrayIcon.get_bandwidth_bytes(self.parent)
prefix = self.get_bandwidth_activity()
else:
prefix = 'idle-'
if daemon.GetSignalDisplayType() == 0:
@@ -313,7 +387,7 @@ class TrayIcon(object):
self.tr.set_from_file(img_file)
@catchdbus
def get_bandwidth_state(self):
def get_bandwidth_activity(self):
""" Determines what network activity state we are in. """
transmitting = False
receiving = False
@@ -335,18 +409,20 @@ class TrayIcon(object):
return 'idle-'
# Figure out receiving data info.
activity = self.is_network_active(rcvbytes, self.max_rcv_gain,
self.last_rcvbytes)
activity = self.is_network_active(self.parent.cur_rcvbytes,
self.parent.max_rcv_gain,
self.parent.last_rcvbytes)
receiving = activity[0]
self.max_rcv_gain = activity[1]
self.last_rcvbytes = activity[2]
self.parent.max_rcv_gain = activity[1]
self.parent.last_rcvbytes = activity[2]
# Figure out out transmitting data info.
activity = self.is_network_active(sndbytes, self.max_snd_gain,
self.last_sndbytes)
activity = self.is_network_active(self.parent.cur_sndbytes,
self.parent.max_snd_gain,
self.parent.last_sndbytes)
transmitting = activity[0]
self.max_snd_gain = activity[1]
self.last_sndbytes = activity[2]
self.parent.max_snd_gain = activity[1]
self.parent.last_sndbytes = activity[2]
if transmitting and receiving:
return 'both-'
@@ -392,7 +468,7 @@ class TrayIcon(object):
tray icons.
"""
def __init__(self):
def __init__(self, parent):
menu = """
<ui>
<menubar name="Menubar">
@@ -400,6 +476,7 @@ class TrayIcon(object):
<menu action="Connect">
</menu>
<separator/>
<menuitem action="Info"/>
<menuitem action="About"/>
<menuitem action="Quit"/>
</menu>
@@ -409,6 +486,9 @@ class TrayIcon(object):
actions = [
('Menu', None, 'Menu'),
('Connect', gtk.STOCK_CONNECT, "Connect"),
('Info', gtk.STOCK_INFO, "_Connection Info", None,
'Information about the current connection',
self.on_conn_info),
('About', gtk.STOCK_ABOUT, '_About...', None,
'About wicd-tray-icon', self.on_about),
('Quit',gtk.STOCK_QUIT,'_Quit',None,'Quit wicd-tray-icon',
@@ -427,6 +507,11 @@ class TrayIcon(object):
net_menuitem = self.manager.get_widget("/Menubar/Menu/Connect/")
net_menuitem.connect("activate", self.on_net_menu_activate)
self.parent = parent
self.time = 2 # Time between updates
self.cont = 'Stop'
self.conn_info_txt = ''
def tray_scan_started(self):
""" Callback for when a wireless scan is started. """
if not DBUS_AVAIL: return
@@ -460,6 +545,96 @@ class TrayIcon(object):
dialog.set_website('http://wicd.net')
dialog.run()
dialog.destroy()
def on_conn_info(self, data=None):
""" Opens the Connection Information Dialog """
window = gtk.Dialog("Wicd Connection Info", None, 0, (gtk.STOCK_OK, gtk.RESPONSE_CLOSE))
# Create labels
self.label = gtk.Label()
self.data = gtk.Label()
self.label.show()
self.data.show()
self.list = []
self.list.append(self.data)
self.list.append(self.label)
# Setup table
table = gtk.Table(1,2)
table.set_col_spacings(12)
table.attach(self.label, 0, 1, 0, 1)
table.attach(self.data, 1, 2, 0 ,1)
# Setup Window
content = window.get_content_area()
content.pack_start(table, True, True, 0)
content.show_all()
# Start updates
self.cont = 'Go'
gobject.timeout_add(5000, self.update_conn_info_win, self.list)
self.update_conn_info_win(self.list)
window.run()
# Destroy window and stop updates
window.destroy()
self.cont = 'Stop'
def update_conn_info_win(self, list):
""" Updates the information in the connection summary window """
if (self.cont == "Stop"):
return False
[state, info] = daemon.GetConnectionStatus()
[rx, tx] = self.get_current_bandwidth()
# Choose info for the data
if state == misc.WIRED:
text = (language['conn_info_wired']
.replace('$A', str(info[0])) #IP
.replace('$B', str(rx)) #RX
.replace('$C', str(tx))) #TX
elif state == misc.WIRELESS:
text = (language['conn_info_wireless']
.replace('$A', str(info[1])) #SSID
.replace('$B', str(info[4])) #Speed
.replace('$C', str(info[0])) #IP
.replace('$D', daemon.FormatSignalForPrinting(str(info[2])))
.replace('$E', str(rx))
.replace('$F', str(tx)))
else:
text = ''
# Choose info for the labels
self.list[0].set_text(text)
if state == misc.WIRED:
self.list[1].set_text(language['conn_info_wired_labels'])
elif state == misc.WIRELESS:
self.list[1].set_text(language['conn_info_wireless_labels'])
elif state == misc.CONNECTING:
self.list[1].set_text(language['conn_info_connecting'])
elif state in (misc.SUSPENDED, misc.NOT_CONNECTED):
self.list[1].set_text(language['conn_info_not_connected'])
return True
def get_current_bandwidth(self):
"""
Calculates the current bandwidth based on sent/received bytes
divided over time. Unit is in KB/s
"""
self.parent.get_bandwidth_bytes()
rxb = self.parent.cur_rcvbytes - self.parent.last_rcvbytes
txb = self.parent.cur_sndbytes - self.parent.last_sndbytes
self.parent.last_rcvbytes = self.parent.cur_rcvbytes
self.parent.last_sndbytes = self.parent.cur_sndbytes
rx_rate = float(rxb / (self.time * 1024))
tx_rate = float(txb / (self.time * 1024))
return (rx_rate, tx_rate)
def _add_item_to_menu(self, net_menu, lbl, type_, n_id, is_connecting,
is_active):
@@ -524,14 +699,19 @@ class TrayIcon(object):
signal_img = 'signal-25.png'
return wpath.images + signal_img
@catchdbus
def on_net_menu_activate(self, item):
""" Trigger a background scan to populate the network menu.
Clear the network menu, and schedule a method to be
called in .8 seconds to trigger a scan if the menu
is still being moused over.
Called when the network submenu is moused over. We
sleep briefly, clear pending gtk events, and if
we're still being moused over we trigger a scan.
This is to prevent scans when the user is just
mousing past the menu to select another menu item.
"""
def dummy(x=None): pass
if self._is_scanning:
return True
@@ -544,7 +724,7 @@ class TrayIcon(object):
while gtk.events_pending():
gtk.main_iteration()
if item.state != gtk.STATE_PRELIGHT:
return False
return True
wireless.Scan(False)
return False
@@ -632,9 +812,9 @@ class TrayIcon(object):
for machines running versions of GTK < 2.10.
"""
def __init__(self):
def __init__(self, parent):
"""Initializes the tray icon"""
TrayIcon.TrayIconGUI.__init__(self)
TrayIcon.TrayIconGUI.__init__(self, parent)
self.tooltip = gtk.Tooltips()
self.eb = gtk.EventBox()
self.tray = egg.trayicon.TrayIcon("WicdTrayIcon")
@@ -688,8 +868,8 @@ class TrayIcon(object):
Uses gtk.StatusIcon to implement a tray icon.
"""
def __init__(self):
TrayIcon.TrayIconGUI.__init__(self)
def __init__(self, parent):
TrayIcon.TrayIconGUI.__init__(self, parent)
gtk.StatusIcon.__init__(self)
self.current_icon_path = ''

View File

@@ -565,6 +565,7 @@ class WicdDaemon(dbus.service.Object):
info[1] = essid
info[2] = signal strength
info[3] = internal networkid
info[4] = bitrate
SUSPENDED - info[0] = ""

View File

@@ -60,7 +60,7 @@ wpa2_pattern = re.compile('(WPA2)', _re_mode)
#iwconfig-only regular expressions.
ip_pattern = re.compile(r'inet [Aa]d?dr[^.]*:([^.]*\.[^.]*\.[^.]*\.[0-9]*)', re.S)
bssid_pattern = re.compile('.*Access Point: (([0-9A-Z]{2}:){5}[0-9A-Z]{2})', _re_mode)
bitrate_pattern = re.compile('.*Bit Rate=(.*?/s)', _re_mode)
bitrate_pattern = re.compile('.*Bit Rate[=:](.*?/s)', _re_mode)
opmode_pattern = re.compile('.*Mode:(.*?) ', _re_mode)
authmethods_pattern = re.compile('.*Authentication capabilities :\n(.*?)Current', _re_mode)