commit 709efd2ac4fc9454162d87ac9adac6f3c369c49d Author: compwiz18 <> Date: Wed Jul 4 14:51:57 2007 +0000 trying to fix diff --git a/autoconnect.py b/autoconnect.py new file mode 100644 index 0000000..58529a2 --- /dev/null +++ b/autoconnect.py @@ -0,0 +1,24 @@ +#!/usr/bin/python + +import gobject +import dbus +import dbus.service +if getattr(dbus, 'version', (0,0,0)) >= (0,41,0): + import dbus.glib + +############# +#declare our connections to our daemon. +#without them nothing useful will happen +#the daemon should be running as root +bus = dbus.SystemBus() +proxy_obj = bus.get_object('org.wicd.daemon', '/org/wicd/daemon') +##we don't need some of these, so I just comment them out +daemon = dbus.Interface(proxy_obj, 'org.wicd.daemon') +wireless = dbus.Interface(proxy_obj, 'org.wicd.daemon.wireless') +wired = dbus.Interface(proxy_obj, 'org.wicd.daemon.wired') +#config = dbus.Interface(proxy_obj, 'org.wicd.daemon.config') +############# + +print daemon.Hello() +if wireless.CheckIfWirelessConnecting() == False and wired.CheckIfWiredConnecting() == False: + print wireless.AutoConnect(True) diff --git a/daemon.py b/daemon.py new file mode 100644 index 0000000..7edb3ce --- /dev/null +++ b/daemon.py @@ -0,0 +1,794 @@ +#!/usr/bin/python +#change to the directory that the file lives in +import os,sys +if __name__ == '__main__': + os.chdir(os.path.dirname(os.path.normpath(os.path.join(os.getcwd(),sys.argv[0])))) +#import the dbus stuff +import gobject +import dbus +import dbus.service +if getattr(dbus, 'version', (0,0,0)) >= (0,41,0): + import dbus.glib +#import the networking library +import networking +#import random other libraries +import ConfigParser, time +#import the random functions library +import misc + + +############################### +# GENERAL NOTES +# +# wicd Daemon +# Version 1.0.0 +# Suppliments wicd +# Written December/January 2006 +# +# Uses libraries also written by me +# for this program +# called networking.py and misc.py +# Will not function without them. +# +# CODE NOTES +# +# If a function has the "pass" statement in it +# this is usually because it is not complete. +# +# Runs on behalf of the wicd GUI +# to perform actions that require root. +# The GUI should be running as the current user +# +# This is released under the +# GNU General Public License +# The terms can be found at +# http://www.gnu.org/copyleft/gpl.html +# +# Copyright (C) 2007 Adam Blackburn +############################### + +logging_enabled = True + +class FlushWriter: + def __init__(self): + print os.getcwd() + self.file = open('data/wicd.log','w') + self.file.write(self.__getPrettyTime() + ' :: ') + + def write(self,data): + '''prepends a timestamp, writes the data, and then flushes the buffer''' + global logging_enabled + + if logging_enabled: + + #it appears that only one character at a time is written, but I don't trust it + #so if it isn't always one letter, make it so + #this code should never run + if len(data) > 1: + for letter in data: + self.write(letter) + return + + if data == '\n': + self.file.write('\n' + self.__getPrettyTime() + ' :: ') + else: + self.file.write(str(data)) + + self.file.flush() + + def __getPrettyTime(self): + '''generate a string with the time, and space numbers with 0s''' + x = time.localtime() + #year/month/day hours:minutes:seconds + pretty_time = str(x[0]).rjust(4,'0') + '/' + str(x[1]).rjust(2,'0') + '/'+str(x[2]).rjust(2,'0') + ' '+str(x[3]).rjust(2,'0') + ':' + str(x[4]).rjust(2,'0') + ':' + str(x[5]).rjust(2,'0') + #probably don't need to pad the year, but it makes it consistent + return pretty_time + + + def flush(self): + '''flushes the buffer''' + self.file.flush() + +class ConnectionWizard(dbus.service.Object): + + ########## VARIABLES AND STUFF + ################################# + + def __init__(self, bus_name, object_path='/org/wicd/daemon'): + dbus.service.Object.__init__(self, bus_name, object_path) + + #set variables needed to run - these probably won't be changed too often + self.app_conf = "data/manager-settings.conf" + self.wireless_conf = "data/wireless-settings.conf" + self.wired_conf = "data/wired-settings.conf" + self.hidden_essid = None + self.wifi = networking.Wireless() + self.wired = networking.Wired() + self.forced_disconnect = False + + #load the config file - it should have most of the stuff we need to run... + self.ReadConfig() + + #set some other stuff needed to run - these probably will be changed often + + #this will speed up the scanning process - if a client doesn't need a fresh scan, just + #feed them the old one. a fresh scan can be done by calling FreshScan(self,interface) + self.LastScan = None + + #make a variable that will hold the wired network profile + self.WiredNetwork = {} + + #scan since we just got started + + DoAutoConnect = True + + if len(sys.argv) > 1: + if sys.argv[1] == "--do-not-scan": + print "--do-not-scan detected, not autoconnecting..." + DoAutoConnect = False + + if DoAutoConnect: + print "autoconnecting...",str(self.GetWirelessInterface()[5:]) + print self.AutoConnect(True) + + #log file! all std:out is redirected to this log file, so we'll flush it from time to time + #see POI:500 for details (use the search feature to search for POI:500 in this file) + + ########## DAEMON FUNCTIONS + ################################# + + @dbus.service.method('org.wicd.daemon') + def Hello(self): + '''returns the version number''' + #returns a version number. + #this number is major-minor-micro + #major is only incremented if minor + #reaches > 9 + #minor is incremented if changes + #that break core stucture are implemented + #micro is for everything else. + #and micro may be anything >= 0 + #this number is effective starting wicd v1.2.0 + version = '1.3.0' + print 'returned version number',version + return version + + @dbus.service.method('org.wicd.daemon') + def SetWiredInterface(self,interface): + '''sets the wired interface for the daemon to use''' + print "setting wired interface" , str(interface) + self.wired.wired_interface = interface + self.wifi.wired_interface = interface + config = ConfigParser.ConfigParser() + config.read(self.app_conf) + config.set("Settings","wired_interface",interface) + config.write(open(self.app_conf,"w")) + + @dbus.service.method('org.wicd.daemon') + def SetWirelessInterface(self,interface): + '''sets the wireless interface the daemon will use''' + print "setting wireless interface" , str(interface) + self.wifi.wireless_interface = interface + self.wired.wireless_interface = interface + config = ConfigParser.ConfigParser() + config.read(self.app_conf) + config.set("Settings","wireless_interface",interface) + configfile = open(self.app_conf,"w") + config.write(configfile) + + @dbus.service.method('org.wicd.daemon') + def SetWPADriver(self,driver): + '''sets the wpa driver the wpa_supplicant will use''' + print "setting wpa driver" , str(driver) + self.wifi.wpa_driver = driver + config = ConfigParser.ConfigParser() + config.read(self.app_conf) + config.set("Settings","wpa_driver",driver) + configfile = open(self.app_conf,"w") + config.write(configfile) + + @dbus.service.method('org.wicd.daemon') + def GetWPADriver(self): + '''returns the wpa driver the daemon is using''' + print 'returned wpa driver' + return str(self.wifi.wpa_driver) + + @dbus.service.method('org.wicd.daemon') + def GetWiredInterface(self): + '''returns the wired interface''' + print 'returning wired interface' + return str(self.wired.wired_interface) + + @dbus.service.method('org.wicd.daemon') + def GetWirelessInterface(self): + '''returns the wireless interface the daemon is using''' + print 'returning wireless interface to client' + return str(self.wifi.wireless_interface) + + ########## WIRELESS FUNCTIONS + ################################# + + @dbus.service.method('org.wicd.daemon.wireless') + def SetHiddenNetworkESSID(self,essid): + '''sets the ESSID of a hidden network for use with ConnectionWizard.Scan''' + print 'setting hidden essid: ' + str(essid) + self.hidden_essid = str(misc.Noneify(essid)) + + @dbus.service.method('org.wicd.daemon.wireless') + def Scan(self): + '''scans for wireless networks, optionally using a (hidden) essid set with SetHiddenNetworkESSID''' + print 'scanning start' + scan = self.wifi.Scan(str(self.hidden_essid)) #_should_ already be a string but you never know... + self.LastScan = scan + print 'scanning done' + print 'found',str(len(scan)),'networks:', + for i in scan: + print i, + self.ReadWirelessNetworkProfile(i) + print + #end function FreshScan + + @dbus.service.method('org.wicd.daemon.wireless') + def DisconnectWireless(self): + self.SetForcedDisconnect(True) + self.wifi.Disconnect() + #end function DisconnectWireless + + @dbus.service.method('org.wicd.daemon.wireless') + def GetNumberOfNetworks(self): + '''returns number of networks''' + print 'returned number of networks...',len(self.LastScan) + return len(self.LastScan) + #end function GetNumberOfNetworks + + @dbus.service.method('org.wicd.daemon.wireless') + def CreateAdHocNetwork(self,essid,channel,ip,enctype,key,encused): + print 'attempting to create ad-hoc network...' + self.wifi.CreateAdHocNetwork(essid,channel,ip,enctype,key,encused) + #end function CreateAdHocNetwork + + @dbus.service.method('org.wicd.daemon.wireless') + def GetAutoReconnect(self): + do = bool(int(self.auto_reconnect)) + return self.__printReturn('returning automatically reconnect when connection drops',do) + #end function GetAutoReconnect + + @dbus.service.method('org.wicd.daemon.wireless') + def SetAutoReconnect(self,value): + print 'setting automatically reconnect when connection drops' + config = ConfigParser.ConfigParser() + config.read(self.app_conf) + config.set("Settings","auto_reconnect",value) + config.write(open(self.app_conf,"w")) + self.auto_reconnect = value + #end function SetAutoReconnect + + @dbus.service.method('org.wicd.daemon.wireless') + def AutoConnect(self,fresh): + '''autoconnects to a wireless network''' + print 'attempting to autoconnect to wireless network' + if fresh: + self.Scan() + if self.GetWirelessInterface() != None: + for x in self.LastScan: + if bool(self.LastScan[x]["has_profile"]): + print str(self.LastScan[x]["essid"]) + ' has profile' + if bool(self.LastScan[x].get('automatic')): + print 'automatically connecting to...',str(self.LastScan[x]["essid"]) + self.ConnectWireless(x) + time.sleep(1) + while self.CheckIfWirelessConnecting(): + print "autoconnecting... hold" + #not sure why I need to get IPs, but + #it solves the autoconnect problem + #i think it has something to do with + #making IO calls while threads are working...? + #if anyone knows why...email me at compwiz18@gmail.com + #only some people need these statements for autoconnect + #to function properly + self.GetWirelessIP() + ### + # removed line below for 1.3.0 - if there is trouble with + # connecting at boot, + # add back to file -- adam + ### + # as far as I can tell, it seems fine - what does everyone else + # think? -- adam + ### + #self.GetWiredIP() + time.sleep(1) + print "autoconnecting... done" + else: + print 'autoconnect failed because wireless interface == None' + #end function AutoConnect + + @dbus.service.method('org.wicd.daemon.wireless') + def GetWirelessProperty(self,networkid,property): + '''retrieves wireless property from the network specified''' + value = self.LastScan[networkid].get(property) + print 'returned wireless network',networkid,'property',property,'of value',value + return value + #end function GetWirelessProperty + + @dbus.service.method('org.wicd.daemon.wireless') + def SetWirelessProperty(self,networkid,property,value): + '''sets property to value in network specified''' + #simple - set the value of the item in our current data + #to the value the client asked for + print 'setting wireless network',networkid,'property',property,'to value',value + self.LastScan[networkid][property] = misc.Noneify(value) + #end function SetProperty + + @dbus.service.method('org.wicd.daemon.wireless') + def DetectWirelessInterface(self): + '''returns an automatically detected wireless interface''' + iface = self.wifi.DetectWirelessInterface() + print 'automatically detected wireless interface',iface + return str(iface) + #end function DetectWirelessInterface + + @dbus.service.method('org.wicd.daemon.wireless') + def GetCurrentSignalStrength(self): + '''returns the current signal strength''' + strength = int(self.wifi.GetSignalStrength()) + print 'returning current signal strength',strength + return strength + #end function GetCurrentSignalStrength + + @dbus.service.method('org.wicd.daemon.wireless') + def GetCurrentNetwork(self): + '''returns the current network''' + current_network = str(self.wifi.GetCurrentNetwork()) + print current_network + return current_network + #end function GetCurrentNetwork + + @dbus.service.method('org.wicd.daemon.wireless') + def GetCurrentNetworkID(self): + '''returns the id of the current network, or -1 if network is not found''' + currentESSID = self.GetCurrentNetwork() + for x in self.LastScan: + if self.LastScan[x]['essid'] == currentESSID: + print 'current network found, id is ',x + return x + print 'returning -1, current network not found' + return -1 + #end function GetCurrentNetwork + + @dbus.service.method('org.wicd.daemon.wireless') + def ConnectWireless(self,id): + '''connects the the wireless network specified by id''' + #will returned instantly, that way we don't hold up dbus + #CheckIfWirelessConnecting can be used to test if the connection + #is done + self.SetForcedDisconnect(False) + print 'connecting to wireless network',self.LastScan[id]["essid"] + return self.wifi.Connect(self.LastScan[id]) + #end function Connect + + @dbus.service.method('org.wicd.daemon.wireless') + def GetForcedDisconnect(self): + '''returns whether wireless was dropped by user, or for some other reason''' + return self.forced_disconnect + #end function GetForcedDisconnect + + @dbus.service.method('org.wicd.daemon.wireless') + def SetForcedDisconnect(self,value): + '''sets whether wireless has been disconnected by user since last connection''' + self.forced_disconnect = value + #end function SetForcedDisconnect + + @dbus.service.method('org.wicd.daemon.wireless') + def CheckIfWirelessConnecting(self): + '''reutrns True if wireless interface is connecting, otherwise False''' + if not self.wifi.ConnectingThread == None: + #if ConnectingThread exists, then check for it's + #status, if it doesn't, we aren't connecting + status = self.wifi.ConnectingThread.IsConnecting + print 'wireless connecting',status + return status + else: + print 'wireless connecting',False + return False + #end function CheckIfWirelessConnecting + + @dbus.service.method('org.wicd.daemon.wireless') + def GetWirelessIP(self): + '''returns the IP that the wireless interface has''' + ip = self.wifi.GetIP() + print 'returning wireless ip',ip + return ip + #end function GetWirelessIP + + @dbus.service.method('org.wicd.daemon.wireless') + def CheckWirelessConnectingMessage(self): + '''returns the wireless interface's status message''' + if not self.wifi.ConnectingThread == None: + stat = self.wifi.ConnectingThread.GetStatus() + print 'wireless connect status',stat + return stat + else: + print 'wireless connect status',False + return False + #end function CheckWirelessConnectingMessage + + @dbus.service.method('org.wicd.daemon.wireless') + def CancelConnect(self): + '''cancels the wireless connection attempt''' + print 'canceling connection attempt' + if not self.wifi.ConnectingThread == None: + self.wifi.ConnectingThread.ShouldDie = True + misc.Run("killall dhclient dhclient3 wpa_supplicant") + #end function CancelConnect + + ########## WIRED FUNCTIONS + ################################# + + @dbus.service.method('org.wicd.daemon.wired') + def GetWiredIP(self): + '''returns the wired interface's ip address''' + ip = self.wired.GetIP() + print 'returing wired ip',ip + return ip + + @dbus.service.method('org.wicd.daemon.wired') + def CheckIfWiredConnecting(self): + '''reutrns True if wired interface is connecting, otherwise False''' + if not self.wired.ConnectingThread == None: + #if ConnectingThread exists, then check for it's + #status, if it doesn't exist, we aren't connecting + status = self.wired.ConnectingThread.IsConnecting + print 'wired connecting',status + return status + else: + print 'wired connecting',False + return False + + + @dbus.service.method('org.wicd.daemon.wired') + def CheckWiredConnectingMessage(self): + '''returns the wired interface's status message''' + if not self.wired.ConnectingThread == None: + status = self.wired.ConnectingThread.GetStatus() + print 'wired connect status',status + return status + else: + print 'wired connect status',False + return False + + @dbus.service.method('org.wicd.daemon.wired') + def SetWiredProperty(self,property,value): + if self.WiredNetwork: + self.WiredNetwork[property] = misc.Noneify(value) + print 'set',property,'to',misc.Noneify(value) + return True + else: + print 'WiredNetwork does not exist' + return False + + @dbus.service.method('org.wicd.daemon.wired') + def GetWiredProperty(self,property): + if self.WiredNetwork: + value = self.WiredNetwork.get(property) + print 'returned',property,'with value of',value,'to client...' + return value + else: + print 'WiredNetwork does not exist' + return False + + @dbus.service.method('org.wicd.daemon.wired') + def SetAlwaysShowWiredInterface(self,value): + print 'setting always show wired interface' + config = ConfigParser.ConfigParser() + config.read(self.app_conf) + config.set("Settings","always_show_wired_interface",value) + config.write(open(self.app_conf,"w")) + self.always_show_wired_interface = value + + @dbus.service.method('org.wicd.daemon.wired') + def GetAlwaysShowWiredInterface(self): + do = bool(int(self.always_show_wired_interface)) + return self.__printReturn('returning always show wired interface',do) + + @dbus.service.method('org.wicd.daemon.wired') + def CheckPluggedIn(self): + if not self.wired.wired_interface == None: + return self.__printReturn('returing plugged in',self.wired.CheckPluggedIn()) + else: + return self.__printReturn("returning plugged in",None) + + @dbus.service.method('org.wicd.daemon.wired') + def ConnectWired(self): + '''connects to a wired network''' + #simple enough. + self.wired.Connect(self.WiredNetwork) + + ########## LOG FILE STUFF + ################################# + + @dbus.service.method('org.wicd.daemon.config') + def DisableLogging(self): + global logging_enabled + logging_enabled = False + + @dbus.service.method('org.wicd.daemon.config') + def EnableLogging(self): + global logging_enabled + logging_enabled = True + + ########## CONFIGURATION FILE FUNCTIONS + ################################# + + @dbus.service.method('org.wicd.daemon.config') + def CreateWiredNetworkProfile(self,profilename): + #should include: profilename,ip,netmask,gateway,dns1,dns2 + print "creating profile for " + str(profilename) + config = ConfigParser.ConfigParser() + config.read(self.wired_conf) + if config.has_section(profilename): + return False + config.add_section(profilename) + config.set(profilename,"ip",None) + config.set(profilename,"broadcast",None) + config.set(profilename,"netmask",None) + config.set(profilename,"gateway",None) + config.set(profilename,"dns1",None) + config.set(profilename,"dns2",None) + config.set(profilename,"dns3",None) + config.write( open(self.wired_conf,"w")) + return True + + @dbus.service.method('org.wicd.daemon.config') + def DeleteWiredNetworkProfile(self,profilename): + print "deleting profile for " + str(profilename) + config = ConfigParser.ConfigParser() + config.read(self.wired_conf) + if config.has_section(profilename): + config.remove_section(profilename) + else: + return "500: Profile does not exist" + config.write( open(self.wired_conf,"w")) + return "100: Profile Deleted" + + @dbus.service.method('org.wicd.daemon.config') + def SaveWiredNetworkProfile(self,profilename): + #should include: profilename,ip,netmask,gateway,dns1,dns2 + print "setting profile for " + str(profilename) + config = ConfigParser.ConfigParser() + config.read(self.wired_conf) + if config.has_section(profilename): + config.remove_section(profilename) + config.add_section(profilename) + for x in self.WiredNetwork: + config.set(profilename,x,self.WiredNetwork[x]) + config.write( open(self.wired_conf,"w")) + return "100: Profile Written" + + @dbus.service.method('org.wicd.daemon.config') + def ReadWiredNetworkProfile(self,profilename): + profile = {} + config = ConfigParser.ConfigParser() + config.read(self.wired_conf) + if config.has_section(profilename) == True: + for x in config.options(profilename): + profile[x] = misc.Noneify(config.get(profilename,x)) + self.WiredNetwork = profile + return "100: Loaded Profile" + else: + self.WiredNetwork = None + return "500: Profile Not Found" + + @dbus.service.method('org.wicd.daemon.config') + def GetWiredProfileList(self): + config = ConfigParser.ConfigParser() + config.read(self.wired_conf) + print config.sections() + if config.sections(): + return config.sections() + else: + return None + + @dbus.service.method('org.wicd.daemon.config') + def SaveWirelessNetworkProfile(self,id): + print "setting network profile" + config = ConfigParser.ConfigParser() + config.read(self.wireless_conf) + if config.has_section(self.LastScan[id]["bssid"]): + config.remove_section(self.LastScan[id]["bssid"]) + config.add_section(self.LastScan[id]["bssid"]) + #add the essid so that people reading the config can figure + #out which network is which. it will not be read + for x in self.LastScan[id]: + config.set(self.LastScan[id]["bssid"],x,self.LastScan[id][x]) + config.write( open(self.wireless_conf,"w")) + print "100: Profile Written" + + @dbus.service.method('org.wicd.daemon.config') + def SaveWirelessNetworkProperty(self,id,option): + print "setting network option " + str(option) + " to " + str(self.LastScan[id][option]) + config = ConfigParser.ConfigParser() + config.read(self.wireless_conf) + if config.has_section(self.LastScan[id]["bssid"]): + config.set(self.LastScan[id]["bssid"],option,str(self.LastScan[id][option])) + config.write(open(self.wireless_conf,"w")) + + @dbus.service.method('org.wicd.daemon.config') + def ReadWirelessNetworkProfile(self,id): + config = ConfigParser.ConfigParser() + config.read(self.wireless_conf) + print self.LastScan[id]["bssid"] + if config.has_section(self.LastScan[id]["bssid"]): + self.LastScan[id]["has_profile"] = True + #read the essid because we be needing to name those hidden + #wireless networks now - but only read it if it is hidden + if self.LastScan[id]["hidden"] == True: + self.LastScan[id]["essid"] = misc.Noneify(config.get(self.LastScan[id]["bssid"],"essid")) + + for x in config.options(self.LastScan[id]["bssid"]): + if self.LastScan[id].has_key(x) == False: + self.LastScan[id][x] = misc.Noneify(config.get(self.LastScan[id]["bssid"],x)) + return "100: Loaded Profile" + else: + self.LastScan[id]["has_profile"] = False + return "500: Profile Not Found" + + + + + ############################################# + ########## INTERNAL FUNCTIONS ############### + ############################################# + # so don't touch the stuff below # + # it read/writes the configuration files # + # and shouldn't need to be changed # + # unless you add a new property... # + # then be SURE YOU CHANGE IT # + ############################################# + + def __printReturn(self,text,value): + print text,value + return value + + def ReadConfig(self): + if os.path.isfile( self.app_conf ): + config = ConfigParser.ConfigParser() + config.read(self.app_conf) + if config.has_section("Settings"): + if config.has_option("Settings","wireless_interface"): + print "found wireless interface in configuration...", + self.SetWirelessInterface(config.get("Settings","wireless_interface")) + if config.has_option("Settings","wired_interface"): + print "found wired interface in configuration...", + self.SetWiredInterface(config.get("Settings","wired_interface")) + if config.has_option("Settings","wpa_driver"): + print "found wpa driver in configuration...", + self.SetWPADriver(config.get("Settings","wpa_driver")) + if config.has_option("Settings","always_show_wired_interface"): + self.always_show_wired_interface = config.get("Settings","always_show_wired_interface") + else: + config.set("Settings","always_show_wired_interface","False") + self.always_show_wired_interface = False + if config.has_option("Settings","auto_reconnect"): + self.auto_reconnect = config.get("Settings","auto_reconnect") + else: + config.set("Settings","auto_reconnect","False") + self.auto_reconnect = False + else: + print "configuration file exists, no settings found, adding defaults..." + configfile = open(self.app_conf,"w") + config.add_section("Settings") + config.set("Settings","wireless_interface","wlan0") + config.set("Settings","wired_interface","eth0") + config.set("Settings","wpa_driver","wext") + config.set("Settings","always_show_wired_interface","False") + config.set("Settings","auto_reconnect","False") + self.SetWirelessInterface(config.get("Settings","wireless_interface")) + self.SetWiredInterface(config.get("Settings","wired_interface")) + self.SetWPADriver(config.get("Settings","wpa_driver")) + config.write(configfile) + + else: + #write some defaults maybe? + print "configuration file not found, creating, adding defaults..." + config = ConfigParser.ConfigParser() + config.read(self.app_conf) + config.add_section("Settings") + config.set("Settings","wireless_interface","wlan0") + config.set("Settings","wired_interface","eth0") + config.set("Settings","always_show_wired_interface","False") + config.set("Settings","auto_reconnect","False") + iface = self.DetectWirelessInterface() + if iface: + config.set("Settings","wireless_interface",iface) + else: + print "couldn't detect a wireless interface..." + config.set("Settings","wireless_interface","wlan0") + config.set("Settings","wpa_driver","wext") + config.write(open(self.app_conf,"w")) + self.SetWirelessInterface(config.get("Settings","wireless_interface")) + self.SetWiredInterface(config.get("Settings","wired_interface")) + self.SetWPADriver(config.get("Settings","wpa_driver")) + self.SetAlwaysShowWiredInterface(False) + self.SetAutoReconnect(True) + #end If + + if os.path.isfile( self.wireless_conf ): + print "wireless configuration file found..." + #don't do anything since it is there + pass + else: + #we don't need to put anything in it, so just make it + print "wireless configuration file not found, creating..." + open( self.wireless_conf,"w" ).close() + #end If + + if os.path.isfile( self.wired_conf ): + print "wired configuration file found..." + #don't do anything since it is there + pass + else: + print "wired confguration file not found, creating..." + #we don't need to put anything in it, so just make it + open( self.wired_conf,"w" ).close() + #end If + + #hide the files, so the keys aren't exposed + print "chmoding configuration files 0600..." + os.chmod(self.app_conf,0600) + os.chmod(self.wireless_conf,0600) + os.chmod(self.wired_conf,0600) + + #make root own them + print "chowning configuration files root:root..." + os.chown(self.app_conf, 0, 0) + os.chown(self.wireless_conf, 0, 0) + os.chown(self.wired_conf, 0, 0) + + print "autodetected wireless interface...",self.DetectWirelessInterface() + print "using wireless interface...",self.GetWirelessInterface()[5:] + #end function ReadConfig + +## fork from the parent terminal + +if not True: #for easy disabling + try: + pid = os.fork() + if pid > 0: + # exit first parent + sys.exit(0) + except OSError, e: + print >>sys.stderr, "fork #1 failed: %d (%s)" % (e.errno, e.strerror) + sys.exit(1) + + # decouple from parent environment + os.setsid() + os.umask(0) + + # do second fork + try: + pid = os.fork() + if pid > 0: + print "wicd daemon: pid " + str(pid) + sys.exit(0) + except OSError, e: + print >>sys.stderr, "fork #2 failed: %d (%s)" % (e.errno, e.strerror) + sys.exit(1) + +#kill output +#POI:500 stdout redirection +output = FlushWriter() +#sys.stdout = output #open("data/wicd.log","w") +#sys.stderr = output + +print "---------------------------" +print "wicd initalizing..." +print "---------------------------" + +#open our dbus session +session_bus = dbus.SystemBus() +bus_name = dbus.service.BusName('org.wicd.daemon', bus=session_bus) +object = ConnectionWizard(bus_name) + +#enter the main loop +mainloop = gobject.MainLoop() +mainloop.run() diff --git a/dapper.py b/dapper.py new file mode 100644 index 0000000..ec25ddc --- /dev/null +++ b/dapper.py @@ -0,0 +1,73 @@ +######## +## DO NOT RUN THIS FILE DIRECTLY +## USE TRAY.PY INSTEAD +## nothing bad will happen if you do +## but that is not the preferred method +import os,sys +if __name__ == '__main__': + os.chdir(os.path.dirname(os.path.normpath(os.path.join(os.getcwd(),sys.argv[0])))) +import gtk +import egg.trayicon +import gobject, dbus, dbus.service +if getattr(dbus, 'version', (0,0,0)) >= (0,41,0): + import dbus.glib +############# +#declare the connections to our daemon. +#without them nothing useful will happen +#the daemon should be running as root +bus = dbus.SystemBus() +try: + print 'attempting to connect daemon...' + proxy_obj = bus.get_object('org.wicd.daemon', '/org/wicd/daemon') + print 'success' +except: + print 'daemon not running, running gksudo ./daemon.py...' + import misc,time + misc.PromptToStartDaemon() + time.sleep(1) + try: + proxy_obj = bus.get_object('org.wicd.daemon', '/org/wicd/daemon') + except: + print 'daemon still not running, aborting.' +#daemon = dbus.Interface(proxy_obj, 'org.wicd.daemon') +wireless = dbus.Interface(proxy_obj, 'org.wicd.daemon.wireless') +wired = dbus.Interface(proxy_obj, 'org.wicd.daemon.wired') +config = dbus.Interface(proxy_obj, 'org.wicd.daemon.config') +############# + +tooltip = gtk.Tooltips() +eb = gtk.EventBox() +t = egg.trayicon.TrayIcon("WicdTrayIcon") +pic = gtk.Image() + +def set_signal_image(): + config.DisableLogging() + signal = int(wireless.GetCurrentSignalStrength()) + if wired.CheckPluggedIn() == True: + pic.set_from_file("images/wired.png") + tooltip.set_tip(eb, "Wicd - Wired Connection") + elif signal > 75: + pic.set_from_file("images/high-signal.png") + tooltip.set_tip(eb, "Wicd - Wireless Connection - " + wireless.GetCurrentNetwork() + " - " + str(signal) + "%") + elif signal > 50: + pic.set_from_file("images/good-signal.png") + tooltip.set_tip(eb, "Wicd - Wireless Connection - " + wireless.GetCurrentNetwork() + " - " + str(signal) + "%") + elif signal > 25: + pic.set_from_file("images/low-signal.png") + tooltip.set_tip(eb, "Wicd - Wireless Connection - " + wireless.GetCurrentNetwork() + " - " + str(signal) + "%") + elif signal > 0: + pic.set_from_file("images/bad-signal.png") + tooltip.set_tip(eb, "Wicd - Wireless Connection - " + wireless.GetCurrentNetwork() + " - " + str(signal) + "%") + elif signal == 0: + pic.set_from_file("images/no-signal.png") + tooltip.set_tip(eb, "Wicd - No Connection") + config.EnableLogging() + return True + +gobject.timeout_add(1000,set_signal_image) +tooltip.set_tip(eb, "Wicd Systray") + +eb.add(pic) +t.add(eb) +t.show_all() +gtk.main() diff --git a/data/wicd.glade b/data/wicd.glade new file mode 100644 index 0000000..e9fe4b5 --- /dev/null +++ b/data/wicd.glade @@ -0,0 +1,220 @@ + + + + + + 580 + 600 + True + Wicd Manager + GTK_WIN_POS_CENTER_ALWAYS + wicd.png + GDK_GRAVITY_CENTER + + + + True + + + True + GTK_TOOLBAR_BOTH_HORIZ + GTK_ICON_SIZE_MENU + True + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + True + gtk-network + menu1 + + + False + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + True + gtk-disconnect + + + + False + + + + + True + True + gtk-refresh + + + + False + + + + + True + True + gtk-preferences + + + + False + + + + + True + True + gtk-about + + + + False + + + + + True + GDK_EXPOSURE_MASK | GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_MOTION_MASK | GDK_BUTTON1_MOTION_MASK | GDK_BUTTON2_MOTION_MASK | GDK_BUTTON3_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK | GDK_FOCUS_CHANGE_MASK | GDK_STRUCTURE_MASK | GDK_PROPERTY_CHANGE_MASK | GDK_VISIBILITY_NOTIFY_MASK | GDK_PROXIMITY_IN_MASK | GDK_PROXIMITY_OUT_MASK | GDK_SUBSTRUCTURE_MASK | GDK_SCROLL_MASK + True + gtk-quit + + + + False + + + + + False + + + + + True + 0 + 10 + 10 + Choose from the networks below: + True + + + False + 1 + + + + + True + False + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + + + True + GTK_SHADOW_NONE + + + True + 3 + + + + + + + + + + 2 + + + + + 4 + + + True + Connecting... + True + Connecting... + + + 3 + + + + + True + Cancel the current connection attempt + gtk-cancel + True + 0 + + + + False + 3 + 1 + + + + + False + 3 + + + + + True + + + False + 4 + + + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Hidden Network + True + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + network-wireless + + + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Create Ad-Hoc Network + True + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + gtk-add + + + + + + diff --git a/data/wicd.png b/data/wicd.png new file mode 100644 index 0000000..f81ee30 --- /dev/null +++ b/data/wicd.png @@ -0,0 +1 @@ +link /opt/wicd/images/wicd.png \ No newline at end of file diff --git a/edgy.py b/edgy.py new file mode 100644 index 0000000..ee7f8e5 --- /dev/null +++ b/edgy.py @@ -0,0 +1,214 @@ +######## +## DO NOT RUN THIS FILE DIRECTLY +## USE TRAY.PY INSTEAD +## nothing bad will happen if you do +## but that is not the preferred method +## tray.py automatically picks the correct version +## of the tray icon to use +######## + +######## +##thanks to Arne Brix for programming most of this +##released under the GNU Public License +##see http://www.gnu.org/copyleft/gpl.html for details +##this will only work in Edgy and above because of gtk requirements +##to run the tray icon +######## +import os,sys +if __name__ == '__main__': + os.chdir(os.path.dirname(os.path.normpath(os.path.join(os.getcwd(),sys.argv[0])))) +import gtk, gobject, dbus, dbus.service, os, sys, locale, gettext, signal, time +if getattr(dbus, 'version', (0,0,0)) >= (0,41,0): + import dbus.glib + +############# +#declare the connections to our daemon. +#without them nothing useful will happen +#the daemon should be running as root +#some connections aren't used so they are commented +bus = dbus.SystemBus() +try: + print 'attempting to connect daemon...' + proxy_obj = bus.get_object('org.wicd.daemon', '/org/wicd/daemon') + print 'success' +except: + print 'daemon not running, running gksudo ./daemon.py...' + import misc + misc.PromptToStartDaemon() + time.sleep(1) + try: + proxy_obj = bus.get_object('org.wicd.daemon', '/org/wicd/daemon') + except: + print 'daemon still not running, aborting.' +#daemon = dbus.Interface(proxy_obj, 'org.wicd.daemon') +wireless = dbus.Interface(proxy_obj, 'org.wicd.daemon.wireless') +wired = dbus.Interface(proxy_obj, 'org.wicd.daemon.wired') +config = dbus.Interface(proxy_obj, 'org.wicd.daemon.config') +############# + +local_path = os.path.realpath(os.path.dirname(sys.argv[0])) + '/translations' +langs = [] +lc, encoding = locale.getdefaultlocale() +if (lc): + langs = [lc] +osLanguage = os.environ.get('LANGUAGE', None) +if (osLanguage): + langs += osLanguage.split(":") +langs += ["en_US"] +lang = gettext.translation('wicd', local_path, languages=langs, fallback = True) +_ = lang.gettext +language = {} +language['connected_to_wireless'] = _('Connected to $A at $B% (IP: $C)') +language['connected_to_wired'] = _('Connected to wired network (IP: $A)') +language['not_connected'] = _('Not connected') + +tr=None +tooltip = gtk.Tooltips() +pic=None +lastWinId = 0 + +def open_wicd_gui(): + global lastWinId + ret = 0 + if lastWinId != 0: + os.kill(lastWinId,signal.SIGQUIT) + ret = os.waitpid(lastWinId,0)[1] + lastWinId = 0 + if ret == 0: + lastWinId = os.spawnlpe(os.P_NOWAIT, './gui.py', os.environ) + +def set_signal_image(): + global LastStrength + global stillWired #keeps us from resetting the wired info over and over (I think?) + global network #declared as global so it is initialized once before it gets used in the if statement below + + config.DisableLogging() + + wired_ip = wired.GetWiredIP() + if wired.CheckPluggedIn() == True and wired_ip: + if stillWired == False: + tr.set_from_file("images/wired.png") + tr.set_tooltip(language['connected_to_wired'].replace('$A',wired_ip)) + stillWired = True + lock = '' + else: + stillWired = False + wireless_ip = wireless.GetWirelessIP() + #If ip returns as None, we are probably returning from hibernation and need to force signal to 0 to avoid crashing + if wireless_ip != None: + signal = int(wireless.GetCurrentSignalStrength()) + else: + signal = 0 + + #only update if the signal strength has changed because doing I/O calls is expensive, + #and the icon flickers + if (signal != LastStrength or network != wireless.GetCurrentNetwork()) and wireless_ip != None: + LastStrength = signal + lock = '' #set the string to '' so that when it is put in "high-signal" + lock + ".png", there will be nothing + curNetID = wireless.GetCurrentNetworkID() #the network ID needs to be checked because a negative value here will break the tray + if signal > 0 and curNetID > -1 and wireless.GetWirelessProperty(curNetID,"encryption"): + lock = '-lock' #set the string to '-lock' so that it will display the lock picture + + network = str(wireless.GetCurrentNetwork()) + tr.set_tooltip(language['connected_to_wireless'].replace('$A',network).replace('$B',str(signal)).replace('$C',str(wireless_ip))) + if signal > 75: + tr.set_from_file("images/high-signal" + lock + ".png") + elif signal > 50: + tr.set_from_file("images/good-signal" + lock + ".png") + elif signal > 25: + tr.set_from_file("images/low-signal" + lock + ".png") + elif signal > 0: + tr.set_from_file("images/bad-signal" + lock + ".png") + elif signal == 0: + tr.set_from_file("images/no-signal.png") + elif wireless_ip == None: + tr.set_from_file("images/no-signal.png") + tr.set_tooltip(language['not_connected']) + #Auto-reconnect code - not sure how well this works. I know that without the ForcedDisconnect check it reconnects you when + #a disconnect is forced. People who have disconnection problems need to test it to determine if it actually works. + #First it will attempt to reconnect to the last known wireless network, and if that fails it should run a scan and try to + #connect to any network set to autoconnect. + if wireless.GetAutoReconnect() == True and wireless.CheckIfWirelessConnecting() == False and wireless.GetForcedDisconnect() == False: + curNetID = wireless.GetCurrentNetworkID() + if curNetID > -1: + wireless.ConnectWireless(wireless.GetCurrentNetworkID()) + if wireless.GetCurrentSignalStrength() != 0: + print "Successfully autoreconnected." + else: + print "Couldn't reconnect to last used network, scanning for an autoconnect network..." + print wireless.AutoConnect(True) + else: + print "networkID returned -1, waiting..." #This is usually only caused by hibernation + time.sleep(30) + config.EnableLogging() + return True + + +class TrackerStatusIcon(gtk.StatusIcon): + def __init__(self): + gtk.StatusIcon.__init__(self) + menu = ''' + + + + + + + + + + + ''' + actions = [ + ('Menu', None, 'Menu'), + ('Connect', gtk.STOCK_CONNECT, '_Connect...', None, 'Connect to network', self.on_preferences), + ('About', gtk.STOCK_ABOUT, '_About...', None, 'About wicd-tray-icon', self.on_about), + ('Quit',gtk.STOCK_QUIT,'_Quit',None,'Quit wicd-tray-icon', self.on_quit), + + ] + ag = gtk.ActionGroup('Actions') + ag.add_actions(actions) + self.manager = gtk.UIManager() + self.manager.insert_action_group(ag, 0) + self.manager.add_ui_from_string(menu) + self.menu = self.manager.get_widget('/Menubar/Menu/About').props.parent + self.current_icon_path = '' + self.set_from_file("images/no-signal.png") + self.set_visible(True) + self.connect('activate', self.on_activate) + self.connect('popup-menu', self.on_popup_menu) + + def on_activate(self, data): + open_wicd_gui() + + def on_quit(self,widget): + sys.exit() + + def on_popup_menu(self, status, button, time): + self.menu.popup(None, None, None, button, time) + + def on_preferences(self, data): + open_wicd_gui() + + def on_about(self, data): + dialog = gtk.AboutDialog() + dialog.set_name('wicd tray icon') + dialog.set_version('0.2') + dialog.set_comments('an icon that shows your network connectivity') + dialog.set_website('http://wicd.sourceforge.net') + dialog.run() + dialog.destroy() + + def set_from_file(self,path): + if path != self.current_icon_path: + self.current_icon_path = path + gtk.StatusIcon.set_from_file(self,path) + +LastStrength = -2 +stillWired = False +network = '' +tr=None + +tr=TrackerStatusIcon() +gobject.timeout_add(3000,set_signal_image) +gtk.main() diff --git a/encryption/templates/active b/encryption/templates/active new file mode 100644 index 0000000..87da577 --- /dev/null +++ b/encryption/templates/active @@ -0,0 +1,6 @@ +wpa +wep +leap +ttls +eap +peap diff --git a/encryption/templates/eap b/encryption/templates/eap new file mode 100644 index 0000000..243b104 --- /dev/null +++ b/encryption/templates/eap @@ -0,0 +1,18 @@ +name = EAP-FAST +author = Adam Blackburn +version = 2 +require username *Username password *Password pac_file *Path_To_PAC_File +----- +network={ + ssid="$_ESSID" + scan_ssid=$_SCAN + proto=RSN WPA + pairwise=CCMP TKIP + group=CCMP TKIP + key-mgmt=WPA-EAP + eap=FAST + identity=$_USERNAME + password=$_PASSWORD + phase1="fast_provisioning=1" + pac-file="$_PAC_FILE" +} diff --git a/encryption/templates/leap b/encryption/templates/leap new file mode 100644 index 0000000..a893f1d --- /dev/null +++ b/encryption/templates/leap @@ -0,0 +1,13 @@ +name = LEAP with WEP +author = Adam Blackburn +version = 1 +require username *Username password *Password +----- +network={ + ssid="$_ESSID" + scan_ssid=$_SCAN + eap=LEAP + key-mgmt=IEEE8021X + identity="$_USERNAME" + password="$_PASSWORD" +} diff --git a/encryption/templates/peap b/encryption/templates/peap new file mode 100644 index 0000000..fd5a763 --- /dev/null +++ b/encryption/templates/peap @@ -0,0 +1,14 @@ +name = PEAP with GTC +author = Adam Blackburn +version = 2 +require identity *Identity password *Password +----- +network={ + ssid="$_ESSID" + proto=RSN + key_mgmt=WPA-EAP + pairwise=CCMP + eap=PEAP + identity="$_IDENTITY" + password="$_PASSWORD" +} diff --git a/encryption/templates/ttls b/encryption/templates/ttls new file mode 100644 index 0000000..ad396ac --- /dev/null +++ b/encryption/templates/ttls @@ -0,0 +1,14 @@ +name = TTLS with WEP +author = Adam Blackburn +version = 1 +require anonymous_identity *Anonymous_Identity identity *Identity password *Password auth *Authentication +----- +network={ + ssid="$_ESSID" + scan_ssid=$_SCAN + eap=TTLS + key-mgmt=IEEE8021X + identity="$_USERNAME" + password="$_PASSWORD" + phase2="auth=$_AUTH" +} diff --git a/encryption/templates/wep b/encryption/templates/wep new file mode 100644 index 0000000..12c019a --- /dev/null +++ b/encryption/templates/wep @@ -0,0 +1,13 @@ +name = WEP +author = Adam Blackburn +version = 1 +require key *Key +----- +network={ + ssid="$_ESSID" + scan_ssid=$_SCAN + key_mgmt=NONE + wep_key0=$_KEY + wep_tx_keyidx=0 + priority=5 +} diff --git a/encryption/templates/wpa b/encryption/templates/wpa new file mode 100644 index 0000000..97c3271 --- /dev/null +++ b/encryption/templates/wpa @@ -0,0 +1,14 @@ +name = WPA 1/2 +author = Adam Blackburn +version = 1 +require key *Key +----- +network={ + ssid="$_ESSID" + scan_ssid=$_SCAN + proto=WPA RSN + key_mgmt=WPA-PSK + pairwise=CCMP TKIP + group=CCMP TKIP + psk=$_PSK +} diff --git a/gui.py b/gui.py new file mode 100644 index 0000000..bea470c --- /dev/null +++ b/gui.py @@ -0,0 +1,994 @@ +#!/usr/bin/python +import os,sys +if __name__ == '__main__': + os.chdir(os.path.dirname(os.path.normpath(os.path.join(os.getcwd(),sys.argv[0])))) +try: + import pygtk + pygtk.require("2.0") +except: + pass +try: + import gtk, gtk.glade +except: + print 'Missing GTK and gtk.glade. Aborting.' + sys.exit(1) + + +import time, os, misc, gettext, locale, gobject, dbus, dbus.service + +if getattr(dbus, 'version', (0,0,0)) >= (0,41,0): + import dbus.glib + +#declare the connections to the daemon, so that they may be accessed +#in any class +bus = dbus.SystemBus() +try: + print 'attempting to connect daemon...' + proxy_obj = bus.get_object('org.wicd.daemon', '/org/wicd/daemon') + print 'success' +except: + print 'daemon not running, running gksudo ./daemon.py...' + misc.PromptToStartDaemon() + time.sleep(1) + try: + proxy_obj = bus.get_object('org.wicd.daemon', '/org/wicd/daemon') + except: + print 'daemon still not running, aborting.' +daemon = dbus.Interface(proxy_obj, 'org.wicd.daemon') +wireless = dbus.Interface(proxy_obj, 'org.wicd.daemon.wireless') +wired = dbus.Interface(proxy_obj, 'org.wicd.daemon.wired') +config = dbus.Interface(proxy_obj, 'org.wicd.daemon.config') + +#Translation stuff +#borrowed from an excellent post on how to do this on +#http://www.learningpython.com/2006/12/03/translating-your-pythonpygtk-application/ +#which is also under GPLv2 + +#Get the local directory since we are not installing anything +local_path = os.path.realpath(os.path.dirname(sys.argv[0])) + '/translations' +# Init the list of languages to support +langs = list() +#Check the default locale +lc, encoding = locale.getdefaultlocale() +if (lc): + #If we have a default, it's the first in the list + langs = [lc] +# Now lets get all of the supported languages on the system +osLanguage = os.environ.get('LANGUAGE', None) +if (osLanguage): + #langage comes back something like en_CA:en_US:en_GB:en + #on linuxy systems, on Win32 it's nothing, so we need to + #split it up into a list + langs += osLanguage.split(":") + +#Now add on to the back of the list the translations that we +#know that we have, our defaults +langs += ["en_US"] # I add english because a lot of people can read it +#Now langs is a list of all of the languages that we are going +#to try to use. First we check the default, then what the system +#told us, and finally the 'known' list + +gettext.bindtextdomain('wicd', local_path) +gettext.textdomain('wicd') +# Get the language to use +lang = gettext.translation('wicd', local_path, languages=langs, fallback = True) + +#map _() to self.lang.gettext() which will translate them. +_ = lang.gettext + +#keep all the language strings in a dictionary +#by the english words +#I'm not sure this is the best way to do it +#but it works and makes it easy for me :) +########## +# translations are done at +# http://wicd.sourceforge.net/wiki/doku.php?id=translations +# please translate if you can! +########## +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['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['connected_to_wired'] = _('Connected to wired network (IP: $A)') +language['not_connected'] = _('Not connected') +language['no_wireless_networks_found'] = _('No wireless networks found.') +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['0'] = _('0') +language['1'] = _('1') +language['2'] = _('2') +language['3'] = _('3') +language['4'] = _('4') +language['5'] = _('5') +language['6'] = _('6') +language['7'] = _('7') +language['8'] = _('8') +language['9'] = _('9') + +language['interface_down'] = _('Putting interface down...') +language['resetting_ip_address'] = _('Resetting IP address...') +language['interface_up'] = _('Putting interface up...') +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['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['create_adhoc_network'] = _('Create an Ad-Hoc Network') +language['essid'] = _('ESSID') + + +language['done'] = _('Done connecting...') + +######################################## +##### GTK EXTENSION CLASSES +######################################## + +class LinkButton(gtk.EventBox): + label = None + def __init__(self): + gtk.EventBox.__init__(self) + self.connect("realize",self.__setHandCursor) #set the hand cursor when the box is initalized + label = gtk.Label() + label.set_markup(" " + language['connect'] + "") + label.set_alignment(0,.5) + label.show() + self.add(label) + self.show_all() + + def __setHandCursor(self,widget): + #we need this to set the cursor to a hand for the link labels + #I'm not entirely sure what it does :P + hand = gtk.gdk.Cursor(gtk.gdk.HAND1) + widget.window.set_cursor(hand) + +class SmallLabel(gtk.Label): + def __init__(self,text=''): + gtk.Label.__init__(self,text) + self.set_size_request(50,-1) + +class LabelEntry(gtk.HBox): + '''a label on the left with a textbox on the right''' + def __init__(self,text): + gtk.HBox.__init__(self) + self.entry = gtk.Entry() + self.entry.set_size_request(200,-1) + self.label = SmallLabel() + self.label.set_text(text) + self.label.set_size_request(170,-1) + self.pack_start(self.label,fill=False,expand=False) + self.pack_start(self.entry,fill=False,expand=False) + self.label.show() + self.entry.show() + self.entry.connect('focus-out-event',self.hide_characters) + self.entry.connect('focus-in-event',self.show_characters) + self.auto_hide_text = False + self.show() + + def set_text(self,text): + #for compatibility... + self.entry.set_text(text) + + def get_text(self): + return self.entry.get_text() + + def set_auto_hidden(self,value): + self.entry.set_visibility(False) + self.auto_hide_text = value + + def show_characters(self,widget=None,event=None): + #when the box has focus, show the characters + if self.auto_hide_text and widget: + self.entry.set_visibility(True) + + def hide_characters(self,widget=None,event=None): + #when the box looses focus, hide them + if self.auto_hide_text and widget: + self.entry.set_visibility(False) +class GreyLabel(gtk.Label): + def __init__(self): + gtk.Label.__init__(self) + def set_label(self,text): + self.set_markup("" + text + "") + self.set_alignment(0,0) + +######################################## +##### OTHER RANDOM FUNCTIONS +######################################## + +def noneToString(text): + '''used for putting text in a text box if the value to put in is 'None' the box will be blank''' + if text == None or text == "None" or text == "": + return "None" + else: + return str(text) + +def noneToBlankString(text): + '''if text is None, 'None', or '' then return '', otherwise return str(text)''' + if text == None or text == "None" or text == "": + return "" + else: + return str(text) + +def stringToNone(text): + '''performs opposite function of noneToString''' + if text == "" or text == "None" or text == None: + return None + else: + return str(text) + +def stringToBoolean(text): + '''turns a "True" to True or a "False" to False otherwise returns the text''' + if text == "True": + return True + if text == "False": + return False + return text + +######################################## +##### NETWORK LIST CLASSES +######################################## + + +class PrettyNetworkEntry(gtk.HBox): + '''adds an image and a connect button to a NetworkEntry''' + def __init__(self,expander): + gtk.HBox.__init__(self) + #add the stuff to the hbox (self) + self.expander = expander + self.expander.show() + self.expander.higherLevel = self #do this so that the expander can access the stuff inside me + self.tempVBox = gtk.VBox(False,1) + self.tempVBox.show() + self.connectButton = LinkButton() + self.connectButton.show() + self.tempVBox.pack_start(self.expander,fill=False,expand=False) + self.tempVBox.pack_start(self.connectButton,fill=False,expand=False) + self.pack_end(self.tempVBox) + +class PrettyWiredNetworkEntry(PrettyNetworkEntry): + def __init__(self): + PrettyNetworkEntry.__init__(self,WiredNetworkEntry()) + #center the picture and pad it a bit + self.image = gtk.Image() + self.image.set_alignment(.5,0) + + self.image.set_size_request(60,-1) + self.image.set_from_icon_name("network-wired",6) + self.image.show() + self.pack_start(self.image,fill=False,expand=False) + self.show() + self.expander.checkEnable() + self.expander.show() + + +class PrettyWirelessNetworkEntry(PrettyNetworkEntry): + def __init__(self,networkID): + PrettyNetworkEntry.__init__(self,WirelessNetworkEntry(networkID)) + self.image = gtk.Image() + self.image.set_padding(0,0) + self.image.set_alignment(.5,0) + self.image.set_size_request(60,-1) + self.image.set_from_icon_name("network-wired",6) + self.pack_start(self.image,fill=False,expand=False) + self.setSignalStrength(wireless.GetWirelessProperty(networkID,'quality')) + self.setMACAddress(wireless.GetWirelessProperty(networkID,'bssid')) + self.setMode(wireless.GetWirelessProperty(networkID,'mode')) + self.setChannel(wireless.GetWirelessProperty(networkID,'channel')) + self.setEncryption(wireless.GetWirelessProperty(networkID,'encryption'),wireless.GetWirelessProperty(networkID,'encryption_method')) + #show everything + self.show_all() + + def setSignalStrength(self,strength): + strength = int(strength) + if strength > 75: + self.image.set_from_file("images/signal-100.png") + elif strength > 50: + self.image.set_from_file("images/signal-75.png") + elif strength > 25: + self.image.set_from_file("images/signal-50.png") + else: + self.image.set_from_file("images/signal-25.png") + self.expander.setSignalStrength(strength) + + def setMACAddress(self,address): + self.expander.setMACAddress(address) + + def setEncryption(self,on,type): + self.expander.setEncryption(on,type) + + def setChannel(self,channel): + self.expander.setChannel(channel) + + def setMode(self,mode): + self.expander.setMode(mode) + +class NetworkEntry(gtk.Expander): + '''the basis for the entries in the network list''' + def __init__(self): + #make stuff exist, this is pretty long and boring + gtk.Expander.__init__(self) + self.txtIP = LabelEntry(language['ip']) + self.txtIP.entry.connect('focus-out-event',self.setDefaults) + self.txtNetmask = LabelEntry(language['netmask']) + self.txtGateway = LabelEntry(language['gateway']) + self.txtDNS1 = LabelEntry(language['dns'] + language['1']) + self.txtDNS2 = LabelEntry(language['dns'] + language['2']) + self.txtDNS3 = LabelEntry(language['dns'] + language['3']) + self.checkboxStaticIP = gtk.CheckButton(language['use_static_ip']) + self.checkboxStaticDNS = gtk.CheckButton(language['use_static_dns']) + self.expanderAdvanced = gtk.Expander(language['advanced_settings']) + self.vboxTop = gtk.VBox(False,0) + self.vboxAdvanced = gtk.VBox(False,0) + self.vboxAdvanced.pack_start(self.checkboxStaticIP,fill=False,expand=False) + self.vboxAdvanced.pack_start(self.txtIP,fill=False,expand=False) + self.vboxAdvanced.pack_start(self.txtNetmask,fill=False,expand=False) + self.vboxAdvanced.pack_start(self.txtGateway,fill=False,expand=False) + self.vboxAdvanced.pack_start(self.checkboxStaticDNS,fill=False,expand=False) + self.vboxAdvanced.pack_start(self.txtDNS1,fill=False,expand=False) + self.vboxAdvanced.pack_start(self.txtDNS2,fill=False,expand=False) + self.vboxAdvanced.pack_start(self.txtDNS3,fill=False,expand=False) + self.vboxTop.pack_end(self.expanderAdvanced,fill=False,expand=False) + self.expanderAdvanced.add(self.vboxAdvanced) + #connect the events to the actions + self.checkboxStaticIP.connect("toggled",self.toggleIPCheckbox) + self.checkboxStaticDNS.connect("toggled",self.toggleDNSCheckbox) + self.add(self.vboxTop) + #start with all disabled, then they will be enabled later + self.checkboxStaticIP.set_active(False) + self.checkboxStaticDNS.set_active(False) + + def setDefaults(self,widget=None,event=None): + #after the user types in the IP address, + #help them out a little + ipAddress = self.txtIP.get_text() #for easy typing :) + netmask = self.txtNetmask + gateway = self.txtGateway + + if ipAddress != None: #make sure the is an IP in the box + if ipAddress.count('.') == 3: #make sure the IP can be parsed + ipNumbers = ipAddress.split('.') #split it up + if not '' in ipNumbers: #make sure the IP isn't something like 127..0.1 + if stringToNone(gateway.get_text()) == None: #make sure the gateway box is blank + #fill it in with a .1 at the end + gateway.set_text('.'.join(ipNumbers[0:3]) + '.1') + + if stringToNone(netmask.get_text()) == None: #make sure the netmask is blank + netmask.set_text('255.255.255.0') #fill in the most common one + + + def resetStaticCheckboxes(self): + #enable the right stuff + if not stringToNone(self.txtIP.get_text()) == None: + self.checkboxStaticIP.set_active(True) + self.checkboxStaticDNS.set_active(True) + self.checkboxStaticDNS.set_sensitive(False) + print 'enabling ip' + else: + self.checkboxStaticIP.set_active(False) + self.checkboxStaticDNS.set_active(False) + self.checkboxStaticDNS.set_sensitive(True) + print 'disabling ip' + + if not stringToNone(self.txtDNS1.get_text()) == None: + self.checkboxStaticDNS.set_active(True) + print 'enabling dns' + else: + self.checkboxStaticDNS.set_active(False) + print 'disabling dns' + + #blankify stuff! + #this will properly disable + #unused boxes + self.toggleIPCheckbox() + self.toggleDNSCheckbox() + + def toggleIPCheckbox(self,widget=None): + #should disable the static IP text boxes + #and also enable the DNS checkbox when + #disabled and disable when enabled + + if self.checkboxStaticIP.get_active(): + self.checkboxStaticDNS.set_active(True) + self.checkboxStaticDNS.set_sensitive(False) + else: + self.checkboxStaticDNS.set_sensitive(True) + + self.txtIP.set_sensitive(self.checkboxStaticIP.get_active()) + self.txtNetmask.set_sensitive(self.checkboxStaticIP.get_active()) + self.txtGateway.set_sensitive(self.checkboxStaticIP.get_active()) + + def toggleDNSCheckbox(self,widget=None): + #should disable the static DNS boxes + if self.checkboxStaticIP.get_active() == True: + self.checkboxStaticDNS.set_active(self.checkboxStaticIP.get_active()) + self.checkboxStaticDNS.set_sensitive(False) + + self.txtDNS1.set_sensitive(self.checkboxStaticDNS.get_active()) + self.txtDNS2.set_sensitive(self.checkboxStaticDNS.get_active()) + self.txtDNS3.set_sensitive(self.checkboxStaticDNS.get_active()) +class WiredNetworkEntry(NetworkEntry): + #creates the wired network expander + def __init__(self): + NetworkEntry.__init__(self) + self.set_label(language['wired_network']) + self.resetStaticCheckboxes() + self.comboProfileNames = gtk.combo_box_entry_new_text() + profileList = config.GetWiredProfileList() + if profileList: #make sure there is something in it... + for x in config.GetWiredProfileList(): #add all the names to the combobox + self.comboProfileNames.append_text(x) + hboxTemp = gtk.HBox(False,0) + self.profileHelp = gtk.Label(language['wired_network_instructions']) + self.profileHelp.set_width_chars(5) #the default is a tad too long + self.profileHelp.set_padding(10,10) + self.profileHelp.set_justify(gtk.JUSTIFY_LEFT) + self.profileHelp.set_line_wrap(True) + self.vboxTop.pack_start(self.profileHelp,fill=False,expand=False) + hboxTemp.pack_start(self.comboProfileNames,fill=True,expand=True) + buttonOK = gtk.Button(stock=gtk.STOCK_ADD) + self.buttonDelete = gtk.Button(stock=gtk.STOCK_DELETE) + hboxTemp.pack_start(buttonOK,fill=False,expand=False) + hboxTemp.pack_start(self.buttonDelete,fill=False,expand=False) + buttonOK.connect("clicked",self.addProfile) #hook up our buttons + self.buttonDelete.connect("clicked",self.removeProfile) + self.comboProfileNames.connect("changed",self.changeProfile) + self.vboxTop.pack_start(hboxTemp) + self.show_all() + self.profileHelp.hide() + if profileList != None: + self.comboProfileNames.set_active(0) + print "wired profiles found" + self.set_expanded(False) + else: + print "no wired profiles found" + if not wired.GetAlwaysShowWiredInterface(): + self.set_expanded(True) + self.profileHelp.show() + def checkEnable(self): + profileList = config.GetWiredProfileList() + if profileList == None: + self.buttonDelete.set_sensitive(False) + self.higherLevel.connectButton.set_sensitive(False) + self.vboxAdvanced.set_sensitive(False) + def addProfile(self,widget): + print "adding profile" + profileName = self.comboProfileNames.get_active_text() + profileList = config.GetWiredProfileList() + if profileList: + if profileName in profileList: + return False + if profileName != "": + self.profileHelp.hide() + config.CreateWiredNetworkProfile(profileName) + self.comboProfileNames.prepend_text(profileName) + self.comboProfileNames.set_active(0) + self.buttonDelete.set_sensitive(True) + self.vboxAdvanced.set_sensitive(True) + self.higherLevel.connectButton.set_sensitive(True) + + def removeProfile(self,widget): + print "removing profile" + config.DeleteWiredNetworkProfile(self.comboProfileNames.get_active_text()) + self.comboProfileNames.remove_text(self.comboProfileNames.get_active()) + self.comboProfileNames.set_active(0) + if config.GetWiredProfileList() == None: + self.profileHelp.show() + entry = self.comboProfileNames.child + entry.set_text("") + self.buttonDelete.set_sensitive(False) + self.vboxAdvanced.set_sensitive(False) + self.higherLevel.connectButton.set_sensitive(False) + else: + self.profileHelp.hide() + + def changeProfile(self,widget): + if self.comboProfileNames.get_active() > -1: #this way the name doesn't change + # #everytime someone types something in + print "changing profile..." + profileName = self.comboProfileNames.get_active_text() + print profileName + config.ReadWiredNetworkProfile(profileName) + + self.txtIP.set_text(noneToBlankString(wired.GetWiredProperty("ip"))) + self.txtNetmask.set_text(noneToBlankString(wired.GetWiredProperty("netmask"))) + self.txtGateway.set_text(noneToBlankString(wired.GetWiredProperty("gateway"))) + + self.txtDNS1.set_text(noneToBlankString(wired.GetWiredProperty("dns1"))) + self.txtDNS2.set_text(noneToBlankString(wired.GetWiredProperty("dns2"))) + self.txtDNS3.set_text(noneToBlankString(wired.GetWiredProperty("dns3"))) + + self.resetStaticCheckboxes() +class WirelessNetworkEntry(NetworkEntry): + #this class is respsponsible for creating the expander + #in each wirelessnetwork entry + def __init__(self,networkID): + self.networkID = networkID + #create the data labels + NetworkEntry.__init__(self) + print "ESSID : " + wireless.GetWirelessProperty(networkID,"essid") + self.set_label(wireless.GetWirelessProperty(networkID,"essid")) + self.essid = wireless.GetWirelessProperty(networkID,"essid") + print "making a new network entry..." + + #make the vbox to hold the encryption stuff + self.vboxEncryptionInformation = gtk.VBox(False,0) + #make the combo box + self.comboEncryption = gtk.combo_box_new_text() + self.checkboxEncryption = gtk.CheckButton(language['use_encryption']) + self.lblStrength = GreyLabel() + self.lblEncryption = GreyLabel() + self.lblMAC = GreyLabel() + self.lblChannel = GreyLabel() + self.lblMode = GreyLabel() + self.hboxStatus = gtk.HBox(False,5) + self.checkboxAutoConnect = gtk.CheckButton(language['automatic_connect']) + self.checkboxAutoConnect.connect("toggled",self.updateAutoConnect) #so that the autoconnect box is + #toggled + + self.hboxStatus.pack_start(self.lblStrength,fill=False,expand=True) + self.hboxStatus.pack_start(self.lblEncryption,fill=False,expand=True) + self.hboxStatus.pack_start(self.lblMAC,fill=False,expand=True) + self.hboxStatus.pack_start(self.lblMode,fill=False,expand=True) + self.hboxStatus.pack_start(self.lblChannel,fill=False,expand=True) + + self.vboxTop.pack_start(self.checkboxAutoConnect,fill=False,expand=False) + self.vboxTop.pack_start(self.hboxStatus,fill=True,expand=False) + + self.vboxAdvanced.pack_start(self.checkboxEncryption,fill=False,expand=False) + + self.txtIP.set_text(noneToBlankString(wireless.GetWirelessProperty(networkID,"ip"))) + self.txtNetmask.set_text(noneToBlankString(wireless.GetWirelessProperty(networkID,"netmask"))) + self.txtGateway.set_text(noneToBlankString(wireless.GetWirelessProperty(networkID,"gateway"))) + + self.txtDNS1.set_text(noneToBlankString(wireless.GetWirelessProperty(networkID,"dns1"))) + self.txtDNS2.set_text(noneToBlankString(wireless.GetWirelessProperty(networkID,"dns2"))) + self.txtDNS3.set_text(noneToBlankString(wireless.GetWirelessProperty(networkID,"dns3"))) + + self.resetStaticCheckboxes() + encryptionTypes = misc.LoadEncryptionMethods() + + self.checkboxEncryption.set_active(False) + self.comboEncryption.set_sensitive(False) + + if stringToBoolean(wireless.GetWirelessProperty(networkID,"automatic")) == True: + self.checkboxAutoConnect.set_active(True) + else: + self.checkboxAutoConnect.set_active(False) + #set it up right, with disabled stuff + self.toggleEncryption() + + #add the names to the menu + activeID = -1 #set the menu to this item when we are done + for x in encryptionTypes: + self.comboEncryption.append_text(encryptionTypes[x][0]) + if encryptionTypes[x][1] == wireless.GetWirelessProperty(networkID,"enctype"): + activeID = x + + self.comboEncryption.set_active(activeID) + if activeID != -1: + self.checkboxEncryption.set_active(True) + self.comboEncryption.set_sensitive(True) + self.vboxEncryptionInformation.set_sensitive(True) + else: + self.comboEncryption.set_active(0) + + self.vboxAdvanced.pack_start(self.comboEncryption) + self.vboxAdvanced.pack_start(self.vboxEncryptionInformation) + self.changeEncryptionMethod() + self.checkboxEncryption.connect("toggled",self.toggleEncryption) + self.comboEncryption.connect("changed",self.changeEncryptionMethod) + self.show_all() + + def updateAutoConnect(self,widget): + wireless.SetWirelessProperty(self.networkID,"automatic",self.checkboxAutoConnect.get_active()) + config.SaveWirelessNetworkProperty(self.networkID,"automatic") + + def toggleEncryption(self,widget=None): + active = self.checkboxEncryption.get_active() + self.vboxEncryptionInformation.set_sensitive(active) + self.comboEncryption.set_sensitive(active) + + def changeEncryptionMethod(self,widget=None): + for z in self.vboxEncryptionInformation: + z.destroy() #remove stuff in there already + ID = self.comboEncryption.get_active() + methods = misc.LoadEncryptionMethods() + self.encryptionInfo = {} + if ID == -1: + #in case nothing is selected + self.comboEncryption.set_active(0) + ID == 0 + for x in methods[ID][2]: + print x + box = None + if language.has_key(methods[ID][2][x][0]): + box = LabelEntry(language[methods[ID][2][x][0].lower().replace(' ','_')]) + else: + box = LabelEntry(methods[ID][2][x][0].replace('_',' ')) + box.set_auto_hidden(True) + self.vboxEncryptionInformation.pack_start(box) + #add the data to any array, so that the information + #can be easily accessed by giving the name of the wanted + #data + self.encryptionInfo[methods[ID][2][x][1]] = box.entry + + box.entry.set_text(noneToBlankString(wireless.GetWirelessProperty(self.networkID,methods[ID][2][x][1]))) + self.vboxEncryptionInformation.show_all() + + def setSignalStrength(self,strength): + self.lblStrength.set_label(str(strength) + "%") + + def setMACAddress(self,address): + self.lblMAC.set_label(str(address)) + + def setEncryption(self,on,type): + if on and type: + self.lblEncryption.set_label(language['secured'] + " " + str(type)) + self.set_use_markup(True) + self.set_label(self.essid + ' ' + str(type) + '') + if on and not type: + self.lblEncryption.set_label(language['secured']) + self.set_label(self.essid + ' Secured') + if not on: + self.lblEncryption.set_label(language['unsecured']) + + def setChannel(self,channel): + self.lblChannel.set_label(language['channel'] + ' ' + str(channel)) + + def setMode(self,mode): + self.lblMode.set_label(str(mode)) + +class appGui: + + def __init__(self): + print "starting..." + gladefile = "data/wicd.glade" + self.windowname = "gtkbench" + self.wTree = gtk.glade.XML(gladefile) + + dic = { "refresh_clicked" : self.refresh_networks, "quit_clicked" : self.exit, 'disconnect_clicked' : self.disconnect_wireless, "main_exit" : self.exit, "cancel_clicked" : self.cancel_connect, "connect_clicked" : self.connect_hidden, "preferences_clicked" : self.settings_dialog, "about_clicked" : self.about_dialog, 'create_adhoc_network_button_button' : self.create_adhoc_network} + self.wTree.signal_autoconnect(dic) + + #set some strings in the GUI - they may be translated + + self.wTree.get_widget("label_instructions").set_label(language['select_a_network']) + #I don't know how to translate a menu entry + #more specifically, I don't know how to set a menu entry's text + #self.wTree.get_widget("connect_button").modify_text(language['hidden_network']) + self.wTree.get_widget("progressbar").set_text(language['connecting']) + + self.network_list = self.wTree.get_widget("network_list_vbox") + self.status_area = self.wTree.get_widget("connecting_hbox") + self.status_bar = self.wTree.get_widget("statusbar") + self.refresh_networks(fresh=False) + + self.statusID = None + + gobject.timeout_add(300,self.update_statusbar) + gobject.timeout_add(100,self.pulse_progress_bar) + + def create_adhoc_network(self,widget=None): + #create a new adhoc network here. + print 'create adhoc network' + dialog = gtk.Dialog(title=language['create_adhoc_network'], flags = gtk.DIALOG_MODAL, buttons=(gtk.STOCK_OK,1,gtk.STOCK_CANCEL,2)) + dialog.set_has_separator(False) + dialog.set_size_request(400,-1) + self.useEncryptionCheckbox = gtk.CheckButton(language['use_encryption']) + self.useEncryptionCheckbox.set_active(False) + self.useEncryptionCheckbox.show() + ipEntry = LabelEntry(language['ip'] + ':') + essidEntry = LabelEntry(language['essid'] + ':') + channelEntry = LabelEntry(language['channel'] + ':') + self.keyEntry = LabelEntry(language['key'] + ':') + self.keyEntry.set_sensitive(False) + self.keyEntry.entry.set_visibility(False) + + self.useEncryptionCheckbox.connect("toggled",self.toggleEncryptionCheck) + channelEntry.entry.set_text('3') + essidEntry.entry.set_text('My_Adhoc_Network') + + vboxA = gtk.VBox(False,0) + vboxA.pack_start(self.useEncryptionCheckbox,fill=False,expand=False) + vboxA.pack_start(self.keyEntry,fill=False,expand=False) + vboxA.show() + dialog.vbox.pack_start(essidEntry) + dialog.vbox.pack_start(ipEntry) + dialog.vbox.pack_start(channelEntry) + dialog.vbox.pack_start(vboxA) + dialog.vbox.set_spacing(5) + response = dialog.run() + if response == 1: + wireless.CreateAdHocNetwork(essidEntry.entry.get_text(),channelEntry.entry.get_text(),ipEntry.entry.get_text(),"WEP",self.keyEntry.entry.get_text(),self.useEncryptionCheckbox.get_active()) + dialog.destroy() + + def toggleEncryptionCheck(self,widget=None): + self.keyEntry.set_sensitive(self.useEncryptionCheckbox.get_active()) + + def disconnect_wireless(self,widget=None): + wireless.DisconnectWireless() + + def about_dialog(self,widget,event=None): + dialog = gtk.AboutDialog() + dialog.set_name("Wicd") + dialog.set_version(daemon.Hello()) + dialog.set_authors([ "Adam Blackburn" ]) + dialog.set_website("http://wicd.sourceforge.net") + dialog.run() + dialog.destroy() + + def settings_dialog(self,widget,event=None): + dialog = gtk.Dialog(title=language['preferences'], flags=gtk.DIALOG_MODAL, buttons=(gtk.STOCK_OK,1,gtk.STOCK_CANCEL,2)) + dialog.set_has_separator(False) + dialog.set_size_request(375,-1) + wiredcheckbox = gtk.CheckButton(language['wired_always_on']) + wiredcheckbox.set_active(wired.GetAlwaysShowWiredInterface()) + reconnectcheckbox = gtk.CheckButton(language['auto_reconnect']) + reconnectcheckbox.set_active(wireless.GetAutoReconnect()) + wpadriverlabel = SmallLabel(language['wpa_supplicant_driver'] + ':') + wpadrivercombo = gtk.combo_box_new_text() + wpadrivercombo.set_size_request(50,-1) + wpadrivers = [ "hostap","hermes","madwifi","atmel","wext","ndiswrapper","broadcom","ipw" ] + i = 0 + found = False + for x in wpadrivers: + if x == daemon.GetWPADriver() and found == False: + found = True + else: + if found == False: + i+=1 + wpadrivercombo.append_text(x) + #set active here. + #if we set active an item to active, then add more items + #it loses the activeness + wpadrivercombo.set_active(i) + #select wext as the default driver, because + #it works for most cards + wpabox = gtk.HBox(False,1) + wpabox.pack_start(wpadriverlabel) + wpabox.pack_start(wpadrivercombo) + + entryWirelessInterface = LabelEntry(language['wireless_interface'] + ':') + entryWiredInterface = LabelEntry(language['wired_interface'] + ':') + + entryWirelessInterface.entry.set_text(daemon.GetWirelessInterface()) + entryWiredInterface.entry.set_text(daemon.GetWiredInterface()) + + dialog.vbox.pack_start(wpabox) + dialog.vbox.pack_start(entryWirelessInterface) + dialog.vbox.pack_start(entryWiredInterface) + dialog.vbox.pack_start(wiredcheckbox) + dialog.vbox.pack_start(reconnectcheckbox) + dialog.vbox.set_spacing(5) + dialog.show_all() + response = dialog.run() + if response == 1: + daemon.SetWirelessInterface(entryWirelessInterface.entry.get_text()) + daemon.SetWiredInterface(entryWiredInterface.entry.get_text()) + print "setting: " + wpadrivers[wpadrivercombo.get_active()] + daemon.SetWPADriver(wpadrivers[wpadrivercombo.get_active()]) + wired.SetAlwaysShowWiredInterface(wiredcheckbox.get_active()) + wireless.SetAutoReconnect(reconnectcheckbox.get_active()) + print wiredcheckbox.get_active() + print reconnectcheckbox.get_active() + dialog.destroy() + else: + dialog.destroy() + + def connect_hidden(self,widget): + #should display a dialog asking + #for the ssid of a hidden network + #and displaying connect/cancel buttons + dialog = gtk.Dialog(title=language['hidden_network'], flags=gtk.DIALOG_MODAL, buttons=(gtk.STOCK_CONNECT,1,gtk.STOCK_CANCEL,2)) + dialog.set_has_separator(False) + dialog.lbl = gtk.Label(language['hidden_network_essid']) + dialog.textbox = gtk.Entry() + dialog.vbox.pack_start(dialog.lbl) + dialog.vbox.pack_start(dialog.textbox) + dialog.show_all() + button = dialog.run() + if button == 1: + answer = dialog.textbox.get_text() + dialog.destroy() + self.refresh_networks(None,True,answer) + else: + dialog.destroy() + + def cancel_connect(self,widget): + #should cancel a connection if there + #is one in progress + cancelButton = self.wTree.get_widget("cancel_button") + cancelButton.set_sensitive(False) + wireless.CancelConnect() + wireless.SetForcedDisconnect(True) #Prevents automatic reconnecting if that option is enabled + + def pulse_progress_bar(self): + self.wTree.get_widget("progressbar").pulse() + return True + + def update_statusbar(self): + #should update the status bar + #every couple hundred milliseconds + config.DisableLogging() #stop log file spam + wireless_ip = wireless.GetWirelessIP() #do this so that it doesn't lock up. don't know how or why this works + #but it does so we leave it alone :) + wiredConnecting = wired.CheckIfWiredConnecting() + wirelessConnecting = wireless.CheckIfWirelessConnecting() + if wirelessConnecting == True or wiredConnecting == True: + self.network_list.set_sensitive(False) + self.status_area.show_all() + if self.statusID: + self.status_bar.remove(1,self.statusID) + if wirelessConnecting: + self.statusID = self.status_bar.push(1,language[str(wireless.CheckWirelessConnectingMessage())]) + if wiredConnecting: + self.statusID = self.status_bar.push(1,language[str(wired.CheckWiredConnectingMessage())]) + else: + self.network_list.set_sensitive(True) + self.status_area.hide_all() + if self.statusID: + self.status_bar.remove(1,self.statusID) + #use the chain approach to save calls to external programs + #external programs are quite CPU intensive + if wireless_ip: + network = wireless.GetCurrentNetwork() + if network: + strength = wireless.GetCurrentSignalStrength() + if strength != None: #do this because if strength is 0, if strength: doesn't work + network = str(network) + strength = str(strength) + ip = str(wireless_ip) + self.statusID=self.status_bar.push(1,language['connected_to_wireless'].replace('$A',network).replace('$B',strength).replace('$C',wireless_ip)) + return True + wired_ip = wired.GetWiredIP() + if wired_ip: + if wired.GetAlwaysShowWiredInterface() or wired.CheckPluggedIn(): + self.statusID = self.status_bar.push(1,language['connected_to_wired'].replace('$A',wired_ip)) + return True + self.statusID = self.status_bar.push(1,language['not_connected']) + config.EnableLogging() #reenable logging + return True + + def refresh_networks(self,widget=None,fresh=True,hidden=None): + print "refreshing..." + + printLine = False #so that we don't print the first line... + #remove stuff already in there. + for z in self.network_list: + z.destroy() + + if wired.CheckPluggedIn() or wired.GetAlwaysShowWiredInterface(): + printLine = True #so that a horizontal line is printed if there are wireless networks + wiredNetwork = PrettyWiredNetworkEntry() + self.network_list.pack_start(wiredNetwork,fill=False,expand=False) + wiredNetwork.connectButton.connect("button-press-event",self.connect,"wired",0,wiredNetwork) + #scan! + if fresh: + #even if it is None, it can still be passed + wireless.SetHiddenNetworkESSID(noneToString(hidden)) + wireless.Scan() + + print wireless.GetNumberOfNetworks() + + instructLabel = self.wTree.get_widget("label_instructions") + if wireless.GetNumberOfNetworks() > 0: + instructLabel.show() + for x in range(0,wireless.GetNumberOfNetworks()): + if printLine: + sep = gtk.HSeparator() + self.network_list.pack_start(sep,padding=10,expand=False,fill=False) + sep.show() + else: + printLine = True + tempNetwork = PrettyWirelessNetworkEntry(x) + tempNetwork.show_all() + self.network_list.pack_start(tempNetwork,expand=False,fill=False) + tempNetwork.connectButton.connect("button-press-event",self.connect,"wireless",x,tempNetwork) + else: + instructLabel.hide() + label = gtk.Label(language['no_wireless_networks_found']) + self.network_list.pack_start(label) + label.show() + + def connect(self,widget,event,type,networkid,networkentry): + cancelButton = self.wTree.get_widget("cancel_button") + cancelButton.set_sensitive(True) + if type == "wireless": + wireless.SetWirelessProperty(networkid,"automatic",noneToString(networkentry.expander.checkboxAutoConnect.get_active())) + if networkentry.expander.checkboxStaticIP.get_active() == True: + wireless.SetWirelessProperty(networkid,"ip",noneToString(networkentry.expander.txtIP.get_text())) + wireless.SetWirelessProperty(networkid,"netmask",noneToString(networkentry.expander.txtNetmask.get_text())) + wireless.SetWirelessProperty(networkid,"gateway",noneToString(networkentry.expander.txtGateway.get_text())) + else: + #blank the values + wireless.SetWirelessProperty(networkid,"ip",'') + wireless.SetWirelessProperty(networkid,"netmask",'') + wireless.SetWirelessProperty(networkid,"gateway",'') + + if networkentry.expander.checkboxStaticDNS.get_active() == True: + wireless.SetWirelessProperty(networkid,"dns1",noneToString(networkentry.expander.txtDNS1.get_text())) + wireless.SetWirelessProperty(networkid,"dns2",noneToString(networkentry.expander.txtDNS2.get_text())) + wireless.SetWirelessProperty(networkid,"dns3",noneToString(networkentry.expander.txtDNS3.get_text())) + else: + #blank the values + wireless.SetWirelessProperty(networkid,"dns1",'') + wireless.SetWirelessProperty(networkid,"dns2",'') + wireless.SetWirelessProperty(networkid,"dns3",'') + + + if networkentry.expander.checkboxEncryption.get_active() == True: + print "setting encryption info..." + encryptionInfo = networkentry.expander.encryptionInfo + #set the encryption type. without the encryption type, nothing is gonna happen + wireless.SetWirelessProperty(networkid,"enctype",misc.LoadEncryptionMethods()[networkentry.expander.comboEncryption.get_active()][1]) + for x in encryptionInfo: + wireless.SetWirelessProperty(networkid,x,noneToString(encryptionInfo[x].get_text())) + else: + print "no encryption specified..." + wireless.SetWirelessProperty(networkid,"enctype",noneToString(None)) + + print "connecting to wireless network..." + config.SaveWirelessNetworkProfile(networkid) + wireless.ConnectWireless(networkid) + + if type == "wired": + print "wired" + if networkentry.expander.checkboxStaticIP.get_active() == True: + wired.SetWiredProperty("ip",noneToString(networkentry.expander.txtIP.get_text())) + wired.SetWiredProperty("netmask",noneToString(networkentry.expander.txtNetmask.get_text())) + wired.SetWiredProperty("gateway",noneToString(networkentry.expander.txtGateway.get_text())) + else: + wired.SetWiredProperty("ip",'') + wired.SetWiredProperty("netmask",'') + wired.SetWiredProperty("gateway",'') + + if networkentry.expander.checkboxStaticDNS.get_active() == True: + wired.SetWiredProperty("dns1",noneToString(networkentry.expander.txtDNS1.get_text())) + wired.SetWiredProperty("dns2",noneToString(networkentry.expander.txtDNS2.get_text())) + wired.SetWiredProperty("dns3",noneToString(networkentry.expander.txtDNS3.get_text())) + else: + wired.SetWiredProperty("dns1",'') + wired.SetWiredProperty("dns2",'') + wired.SetWiredProperty("dns3",'') + + config.SaveWiredNetworkProfile(networkentry.expander.comboProfileNames.get_active_text()) + wired.ConnectWired() + + def exit(self,widget,event=None): + sys.exit(0) + +#start the app +app = appGui() +gtk.main() diff --git a/images/bad-signal-lock.png b/images/bad-signal-lock.png new file mode 100644 index 0000000..83999b1 Binary files /dev/null and b/images/bad-signal-lock.png differ diff --git a/images/bad-signal.png b/images/bad-signal.png new file mode 100644 index 0000000..9896fb0 Binary files /dev/null and b/images/bad-signal.png differ diff --git a/images/good-signal-lock.png b/images/good-signal-lock.png new file mode 100644 index 0000000..5273ab3 Binary files /dev/null and b/images/good-signal-lock.png differ diff --git a/images/good-signal.png b/images/good-signal.png new file mode 100644 index 0000000..3e09cdb Binary files /dev/null and b/images/good-signal.png differ diff --git a/images/high-signal-lock.png b/images/high-signal-lock.png new file mode 100644 index 0000000..91a9bc5 Binary files /dev/null and b/images/high-signal-lock.png differ diff --git a/images/high-signal.png b/images/high-signal.png new file mode 100644 index 0000000..4fb76f1 Binary files /dev/null and b/images/high-signal.png differ diff --git a/images/low-signal-lock.png b/images/low-signal-lock.png new file mode 100644 index 0000000..0a8b0fd Binary files /dev/null and b/images/low-signal-lock.png differ diff --git a/images/low-signal.png b/images/low-signal.png new file mode 100644 index 0000000..53325d4 Binary files /dev/null and b/images/low-signal.png differ diff --git a/images/no-signal.png b/images/no-signal.png new file mode 100644 index 0000000..a410637 Binary files /dev/null and b/images/no-signal.png differ diff --git a/images/signal-100.png b/images/signal-100.png new file mode 100644 index 0000000..da3aa0d Binary files /dev/null and b/images/signal-100.png differ diff --git a/images/signal-25.png b/images/signal-25.png new file mode 100644 index 0000000..19e5d29 Binary files /dev/null and b/images/signal-25.png differ diff --git a/images/signal-50.png b/images/signal-50.png new file mode 100644 index 0000000..10dde52 Binary files /dev/null and b/images/signal-50.png differ diff --git a/images/signal-75.png b/images/signal-75.png new file mode 100644 index 0000000..ef9cd39 Binary files /dev/null and b/images/signal-75.png differ diff --git a/images/wicd-blue.png b/images/wicd-blue.png new file mode 100644 index 0000000..460b80f Binary files /dev/null and b/images/wicd-blue.png differ diff --git a/images/wicd-green.png b/images/wicd-green.png new file mode 100644 index 0000000..67dde2b Binary files /dev/null and b/images/wicd-green.png differ diff --git a/images/wicd-orange.png b/images/wicd-orange.png new file mode 100644 index 0000000..a0c87ed Binary files /dev/null and b/images/wicd-orange.png differ diff --git a/images/wicd-purple.png b/images/wicd-purple.png new file mode 100644 index 0000000..bc78156 Binary files /dev/null and b/images/wicd-purple.png differ diff --git a/images/wicd-red.png b/images/wicd-red.png new file mode 100644 index 0000000..42eb9aa Binary files /dev/null and b/images/wicd-red.png differ diff --git a/images/wicd.png b/images/wicd.png new file mode 100644 index 0000000..bd65c73 --- /dev/null +++ b/images/wicd.png @@ -0,0 +1 @@ +link /opt/wicd/images/wicd-purple.png \ No newline at end of file diff --git a/images/wired.png b/images/wired.png new file mode 100644 index 0000000..b7f593c Binary files /dev/null and b/images/wired.png differ diff --git a/misc.py b/misc.py new file mode 100644 index 0000000..bb97c0c --- /dev/null +++ b/misc.py @@ -0,0 +1,124 @@ +#misc functions for wicd +#pretty much useless to anyone else... +#but if it is useful, feel free to use under the terms of the GPL +# +# This is released under the +# GNU General Public License +# The terms can be found at +# http://www.gnu.org/copyleft/gpl.html +# +# Copyright (C) 2007 Adam Blackburn +# + +import os,sys +if __name__ == '__main__': + os.chdir(os.path.dirname(os.path.normpath(os.path.join(os.getcwd(),sys.argv[0])))) +import re +def Run(cmd,include_std_error=False): + if not include_std_error: + f = os.popen( cmd , "r") + return f.read() + else: + input,out_err = os.popen4( cmd, 'r') + return out_err.read() + +def PromptToStartDaemon(): + gksudo_args = ['gksudo', '--message', 'Wicd needs to access your computer\'s network cards.','--','./daemon.py'] + os.spawnvpe(os.P_WAIT, 'gksudo', gksudo_args, os.environ) + +def RunRegex(regex,string): + m = regex.search( string ) + if m: + return m.groups()[0] + else: + return None + +def WriteLine(file,text): + file.write(text + "\n") + +def ReadFile(filename): + if not os.path.exists(filename): + return None + file = open(filename,'r') + data = file.read().strip() + file.close() + return str(data) + +def Noneify(variable): + #set string Nones to real Nones + if variable == "None" or variable == "": + return None + if variable == "True": # or variable == "1": # or variable == 1: + return True + if variable == "False": #or variable == "0": # or variable == 0: + return False + #if str(variable).isdigit() == True: + # return int(variable) + if str(variable) == "1": + return True + if str(variable) == "0": + return False + #otherwise... + return variable + +def ParseEncryption(network): + #list = open("encryption/templates/active","r") + #types = list.readlines() + #for i in types: + enctemplate = open("encryption/templates/" + network["enctype"]) + template = enctemplate.readlines() + #set these to nothing so that we can hold them outside the loop + z = "ap_scan=1\n" + y = 0 + #loop through the lines in the template, selecting ones to use + for x in template: + x = x.strip("\n") + if y>4: + #blah blah replace stuff + x = x.replace("$_SCAN","0") + for t in network: + if Noneify(network[t]) != None: #don't bother if z's value is None cause it will cause errors + x = x.replace("$_" + str(t).upper(),str(network[t])) + z = z + "\n" + x + y+=1 + #write the data to the files + #then chmod them so they can't be read by evil little munchkins + fileness = open("encryption/configurations/" + network["bssid"].replace(":","").lower(),"w") + os.chmod("encryption/configurations/" + network["bssid"].replace(":","").lower(),0600) + os.chown("encryption/configurations/" + network["bssid"].replace(":","").lower(), 0, 0) + #we could do this above, but we'd like to permod (permission mod) them before we write, so that it can't be read + fileness.write(z) + fileness.close() + +def LoadEncryptionMethods(): + encryptionTypes = {} + types = open("encryption/templates/active","r") + enctypes = types.readlines() + for x in enctypes: + #skip some lines, we don't care who the author is/was, etc + #we don't care about version either + x = x.strip("\n") + current = open("encryption/templates/" + x,"r") + line = current.readlines() + typeID = len(encryptionTypes) #this is so we know where in the array to add data + encryptionTypes[typeID] = {} + encryptionTypes[typeID][0] = line[0][7:].strip("\n") + encryptionTypes[typeID][1] = x + encryptionTypes[typeID][2] = {} + requiredFields = line[3][8:] + requiredFields = requiredFields.strip("\n") + requiredFields = requiredFields.split(" ") + index = -1 + for current in requiredFields: + #the pretty names will start with an * so we can + #seperate them with that + if current[0] == "*": + #make underscores spaces + #and remove the * + encryptionTypes[typeID][2][index][0] = current.replace("_"," ").lstrip("*") + else: + #add to the list of things that are required + index = len(encryptionTypes[typeID][2]) + encryptionTypes[typeID][2][index] = {} + encryptionTypes[typeID][2][index][1] = current + return encryptionTypes diff --git a/networking.py b/networking.py new file mode 100644 index 0000000..156f68d --- /dev/null +++ b/networking.py @@ -0,0 +1,548 @@ +## THE NETWORKING CLASS +## WRITTEN DECEMBER 18TH, 2006 +## RELEASED UNDER THE GNU General Public License + +## WRITTEN IN PYTHON, CAN NOT BE USED ALONE +## MUST BE IMPORTED VIA import networking +## TO ANOTHER PROJECT IF YOU WISH TO USE IT + +import os,sys +if __name__ == '__main__': + os.chdir(os.path.dirname(os.path.normpath(os.path.join(os.getcwd(),sys.argv[0])))) + +#import the library of random functions that we need here +#this is also written by me, for this purpose +import misc +#import some other random libraries that we're gonna need +import re,sys,threading,thread + +#much thanks to wieman01 for help and support with various types of encyption +#also thanks to foxy123, yopnono, and the many others who reported bugs helped +#and helped keep this project moving + +class Wireless: + + wireless_interface = None + wired_interface = None + wpa_driver = None + ConnectingThread = None + + #Create a function to scan for wireless networks + def Scan(self,essid=None): + + #we ask for an essid, because then we can see hidden networks + + ##### + ## DECLARE THE REGEX PATTERNS + ##### + + #init the regex patterns that will be used to search the output of iwlist scan for info + #these are well tested, should work on most cards + essid_pattern = re.compile('.*ESSID:"(.*?)"\n',re.DOTALL | re.I | re.M | re.S) + ap_mac_pattern = re.compile('.*Address: (.*?)\n',re.DOTALL | re.I | re.M | re.S) + channel_pattern = re.compile('.*Channel:? ?(\d\d?)',re.DOTALL | re.I | re.M | re.S) + strength_pattern = re.compile('.*Quality:?=? ?(\d\d*)',re.DOTALL | re.I | re.M | re.S) + mode_pattern = re.compile('.*Mode:(.*?)\n',re.DOTALL | re.I | re.M | re.S) + + wep_pattern = re.compile('.*Encryption key:(.*?)\n',re.DOTALL | re.I | re.M | re.S) + wpa1_pattern = re.compile('(WPA Version 1)',re.DOTALL | re.I | re.M | re.S) + wpa2_pattern = re.compile('(WPA2)',re.DOTALL | re.I | re.M | re.S) + + ##### + ## PREPARE THE INTERFACE + ##### + + #prepare the interface for scanning + #note that this must be run as root, otherwise we're gonna have trouble + misc.Run('ifconfig ' + self.wireless_interface + ' up') + + essid = misc.Noneify(essid) + if not essid == None: + #if there is a hidden essid, we need to tell the computer what it is + #then when it is scanned it will be recognized + print "setting hidden essid..." + essid + misc.Run('iwconfig ' + self.wireless_interface + ' essid "' + essid + '"') + + ##### + ## RUN THE SCAN + ##### + + #run iwlist scan and get the avaliable networks + #save them to scan_data - all in one big string + scandata = misc.Run('iwlist ' + self.wireless_interface + ' scan') + + ##### + ## PROCESS THE DATA + ##### + + #split the networks apart, using Cell as our split point + #this way we can look at only one network at a time + networks = scandata.split( ' Cell ' ) + + #declare + i=0 + #make an array for the aps + aps = {} + for cell in networks: + #search to see if there is an essid in this section + #if there isn't, that means that it is useless + #so we don't use it then + + #set essid to the value, this is just a temp variable + if cell.count("ESSID:") > 0: + #since an essid was found, + #we will extract the rest of the info + #make a dictionary for the data + CurrentNetwork = {} + + #use the RunRegex function to neaten up our code + #all it does for us is run the regex on the string + #and return the result + #but it makes this code look pretty + + CurrentNetwork["essid"] = misc.RunRegex(essid_pattern,cell) + + if CurrentNetwork["essid"] == "": + CurrentNetwork["hidden"] = True + #change the name so it doesn't screw stuff up + #because it looks like HTML - GTK no like + CurrentNetwork["essid"] = "Hidden" + else: + CurrentNetwork["hidden"] = False + + CurrentNetwork["channel"] = misc.RunRegex(channel_pattern,cell) + CurrentNetwork["bssid"] = misc.RunRegex(ap_mac_pattern,cell) + print " ##### " + CurrentNetwork["bssid"] + CurrentNetwork["mode"] = misc.RunRegex(mode_pattern,cell) + + #since encryption needs a True or False + #we have to do a simple if then to set it + if misc.RunRegex(wep_pattern,cell) == "on": + CurrentNetwork["encryption"] = True + #set this, because if it is something else this will be overwritten + CurrentNetwork["encryption_method"] = "WEP" + + if misc.RunRegex(wpa1_pattern,cell) == "WPA Version 1": + CurrentNetwork["encryption_method"] = "WPA" + + if misc.RunRegex(wpa2_pattern,cell) == "WPA2": + CurrentNetwork["encryption_method"] = "WPA2" + else: + CurrentNetwork["encryption"] = False + #end If + + #since stength needs a -1 if the quality isn't found + #we need a simple if then to set it + if misc.RunRegex(strength_pattern,cell): + CurrentNetwork["quality"] = misc.RunRegex(strength_pattern,cell) + else: + CurrentNetwork["quality"] = -1 + #end If + + #add this network to the list of networks + aps[ i ] = CurrentNetwork + #now increment the counter + i+=1 + #end For + + #run a bubble sort + #to list networks by signal strength + going = True + + while going: + sorted = False + for i in aps: + #set x to the current number + x = int(i) + #set y to the next number + y = int(i+1) + + #only run this if we actually have another element after the current one + if (len(aps) > i+1): + + #move around depending on qualities + #we want the lower qualities at the bottom of the list + #so we check to see if the quality below the current one + #is higher the current one + #if it is, we swap them + + if (int(aps[int(y)]["quality"]) > int(aps[int(x)]["quality"])): + #set sorted to true so we don't exit + sorted=True + #do the move + temp=aps[y] + aps[y]=aps[x] + aps[x]=temp + #end If + #end If + #end For + + if (sorted == False): + going = False + #end If + #end While + + #return the list of sorted access points + return aps + + #end Function Scan + + def Connect(self,network): + #call the thread, so we don't hang up the entire works + self.ConnectingThread = self.ConnectThread(network,self.wireless_interface,self.wired_interface,self.wpa_driver) + self.ConnectingThread.start() + return True + + class ConnectThread(threading.Thread): + IsConnecting = None + ConnectingMessage = None + ShouldDie = False + lock = thread.allocate_lock() + + def __init__(self,network,wireless,wired,wpa_driver): + threading.Thread.__init__(self) + self.network = network + self.wireless_interface = wireless + self.wired_interface = wired + self.wpa_driver = wpa_driver + self.IsConnecting = False + self.lock.acquire() + self.ConnectingMessage = 'interface_down' + self.lock.release() + #lock = thread.allocate_lock() + + def GetStatus(self): + print "status request" + print "acqlock",self.lock.acquire() + print " ...lock acquired..." + message = self.ConnectingMessage + #return "bob" #self.ConnectingMessage + self.lock.release() + print " ...lock released..." + return message + + def run(self): + #note that we don't put the wired interface down + #but we do flush all wired entries from the routing table + #so it shouldn't be used at all. + + self.IsConnecting = True + network = self.network + + #put it down + print "interface down..." + self.lock.acquire() + self.ConnectingMessage = 'interface_down' + self.lock.release() + #misc.Run("ifconfig " + self.wireless_interface + " down") + + #set a false ip so that when we set the real one, the correct + #routing entry is created + print "Setting false ip..." + self.lock.acquire() + self.ConnectingMessage = 'resetting_ip_address' + self.lock.release() + + misc.Run("ifconfig " + self.wired_interface + " 0.0.0.0") + misc.Run("ifconfig " + self.wireless_interface + " 0.0.0.0") + + #bring it up + print "interface up..." + self.lock.acquire() + self.ConnectingMessage = 'interface_up' + self.lock.release() + + print misc.Run("ifconfig " + self.wireless_interface + " up") + + print "killing wpa_supplicant, dhclient, dhclient3" + self.lock.acquire() + self.ConnectingMessage = 'removing_old_connection' + self.lock.release() + + misc.Run("killall dhclient dhclient3 wpa_supplicant") + + #check to see if we need to generate a PSK + + if not network.get('key')== None: + self.lock.acquire() + self.ConnectingMessage = 'generating_psk' + self.lock.release() + + print "generating psk..." + key_pattern = re.compile('network={.*?\spsk=(.*?)\n}.*',re.DOTALL | re.I | re.M | re.S) + network["psk"] = misc.RunRegex(key_pattern,misc.Run('wpa_passphrase "' + network["essid"] + '" "' + network["key"] + '"')) + #generate the wpa_supplicant file... + if not network.get('enctype') == None: + self.lock.acquire() + self.ConnectingMessage = 'generating_wpa_config' + self.lock.release() + + print "generating wpa_supplicant configuration file..." + misc.ParseEncryption(network) + print "wpa_supplicant -B -i " + self.wireless_interface + " -c \"encryption/configurations/" + network["bssid"].replace(":","").lower() + "\" -D " + self.wpa_driver + misc.Run("wpa_supplicant -B -i " + self.wireless_interface + " -c \"encryption/configurations/" + network["bssid"].replace(":","").lower() + "\" -D " + self.wpa_driver) + + print "flushing the routing table..." + self.lock.acquire() + + self.ConnectingMessage = 'flushing_routing_table' + self.lock.release() + + misc.Run("ip route flush dev " + self.wireless_interface) + misc.Run("ip route flush dev " + self.wired_interface) + + print "configuring the wireless interface..." + self.lock.acquire() + + self.ConnectingMessage = 'configuring_interface' + self.lock.release() + + if network["mode"].lower() == "master": + misc.Run("iwconfig " + self.wireless_interface + " mode managed") + else: + misc.Run("iwconfig " + self.wireless_interface + " mode " + network["mode"]) + + misc.Run("iwconfig " + self.wireless_interface + " essid \"" + network["essid"] + "\" channel " + str(network["channel"])) + " ap " + network["bssid"] + + if not network.get('broadcast') == None: + self.lock.acquire() + + self.ConnectingMessage = 'setting_broadcast_address' + self.lock.release() + + print "setting the broadcast address..." + network["broadcast"] + misc.Run("ifconfig " + self.wireless_interface + " broadcast " + network["broadcast"]) + + + if not network.get('dns1') == None: + self.lock.acquire() + + self.ConnectingMessage = 'setting_static_dns' + self.lock.release() + # dns1) + print "setting the first and second dns servers..." + resolv = open("/etc/resolv.conf","w") + misc.WriteLine(resolv,"nameserver " + network["dns1"]) + misc.WriteLine(resolv,"nameserver " + network["dns2"]) + if not network["dns3"] == None: + print "setting the third dns server..." + misc.WriteLine(resolv,"nameserver " + network["dns3"]) + + if not network.get('ip') == None: + self.lock.acquire() + + self.ConnectingMessage = 'setting_static_ip' + self.lock.release() + + print "setting static ips..." + misc.Run("ifconfig " + self.wireless_interface + " " + network["ip"] ) + misc.Run("ifconfig " + self.wireless_interface + " netmask " + network["netmask"] ) + print "adding default gateway..." + network["gateway"] + misc.Run("route add default gw " + network["gateway"]) + else: + #run dhcp... + self.lock.acquire() + + self.ConnectingMessage = 'running_dhcp' + self.lock.release() + + print "running dhcp..." + if not self.ShouldDie: + misc.Run("dhclient " + self.wireless_interface) + + self.lock.acquire() + self.ConnectingMessage = 'done' + self.lock.release() + + print "done" + self.IsConnecting = False + + + + #end function Connect + #end class Connect + + def GetSignalStrength(self): + output = misc.Run("iwconfig " + self.wireless_interface) + strength_pattern = re.compile('.*Quality:?=? ?(\d+)',re.DOTALL | re.I | re.M | re.S) + return misc.RunRegex(strength_pattern,output) + #end function GetSignalStrength#end function GetSignalStrength + + def GetCurrentNetwork(self): + output = misc.Run("iwconfig " + self.wireless_interface) + essid_pattern = re.compile('.*ESSID:"(.*?)"',re.DOTALL | re.I | re.M | re.S) + return misc.RunRegex(essid_pattern,output) + #end function GetCurrentNetwork + + def GetIP(self): + output = misc.Run("ifconfig " + self.wireless_interface) + ip_pattern = re.compile(r'inet [Aa]d?dr[^.]*:([^.]*\.[^.]*\.[^.]*\.[0-9]*)',re.S) + return misc.RunRegex(ip_pattern,output) + + def CreateAdHocNetwork(self,essid,channel,ip,enctype,key,encused): + misc.Run("killall dhclient dhclient3 wpa_supplicant") #remove wpa_supplicant, as it can cause the connection to revert to + #previous networks... + misc.Run('ifconfig ' + self.wireless_interface + ' down') + misc.Run('iwconfig ' + self.wireless_interface + ' mode ad-hoc') + misc.Run('iwconfig ' + self.wireless_interface + ' channel ' + channel) + misc.Run('iwconfig ' + self.wireless_interface + ' essid ' + essid) + #Right now it just assumes you're using WEP + if encused == True: + misc.Run('iwconfig ' + self.wireless_interface + ' key ' + key) + misc.Run('ifconfig ' + self.wireless_interface + ' up') + misc.Run('ifconfig ' + self.wireless_interface + ' inet ' + ip) + #end function CreateAdHocNetwork + + def DetectWirelessInterface(self): + return misc.RunRegex(re.compile('(\w*)\s*\w*\s*[a-zA-Z0-9.-_]*\s*(?=ESSID)',re.DOTALL | re.I | re.M | re.S),misc.Run("iwconfig")) + + def Disconnect(self): + misc.Run('ifconfig ' + self.wired_interface + ' 0.0.0.0') + misc.Run('ifconfig ' + self.wired_interface + ' down') + misc.Run('ifconfig ' + self.wireless_interface + ' 0.0.0.0') + misc.Run('ifconfig ' + self.wireless_interface + ' down') + + +#end class Wireless + +class Wired: + + wireless_interface = None + wired_interface = None + ConnectingThread = None + + def GetIP(self): + output = misc.Run("ifconfig " + self.wired_interface) + ip_pattern = re.compile(r'inet [Aa]d?dr[^.]*:([^.]*\.[^.]*\.[^.]*\.[0-9]*)',re.S) + return misc.RunRegex(ip_pattern,output) + + def CheckPluggedIn(self): + mii_tool_data = misc.Run( 'mii-tool ' + self.wired_interface,True) + if not misc.RunRegex(re.compile('(Invalid argument)',re.DOTALL | re.I | re.M | re.S),mii_tool_data) == None: + print 'wired interface appears down, putting up for mii-tool check' + misc.Run( 'ifconfig ' + self.wired_interface + ' up' ) + mii_tool_data = misc.Run( 'mii-tool ' + self.wired_interface) + if not misc.RunRegex(re.compile('(link ok)',re.DOTALL | re.I | re.M | re.S),mii_tool_data) == None: + return True + else: + return False + #end function CheckPluggedIn + + def Connect(self,network): + #call the thread, so we don't hang up the entire works + self.ConnectingThread = self.ConnectThread(network,self.wireless_interface,self.wired_interface) + self.ConnectingThread.start() + return True + #end function Connect + + class ConnectThread(threading.Thread): + #wired interface connect thread + lock = thread.allocate_lock() + ConnectingMessage = None + ShouldDie = False + + def __init__(self,network,wireless,wired): + threading.Thread.__init__(self) + self.network = network + self.wireless_interface = wireless + self.wired_interface = wired + self.IsConnecting = False + self.lock.acquire() + self.ConnectingMessage = 'interface_down' + self.lock.release() + #end function __init__ + + def GetStatus(self): + self.lock.acquire() + print " ...lock acquired..." + message = self.ConnectingMessage + self.lock.release() + print " ...lock released..." + return message + + def run(self): + #we don't touch the wifi interface + #but we do remove all wifi entries from the + #routing table + + self.IsConnecting = True + network = self.network + + #put it down + self.lock.acquire() + self.ConnectingMessage = 'interface_down' + self.lock.release() + print "interface down...", self.wired_interface + misc.Run("ifconfig " + self.wired_interface + " down") + + #set a false ip so that when we set the real one, the correct + #routing entry is created + self.lock.acquire() + self.ConnectingMessage = 'resetting_ip_address' + self.lock.release() + print "setting false ip... 0.0.0.0 on", self.wired_interface + misc.Run("ifconfig " + self.wired_interface + " 0.0.0.0") + misc.Run("ifconfig " + self.wireless_interface + " 0.0.0.0") + + #bring it up + self.lock.acquire() + self.ConnectingMessage = 'interface_up' + self.lock.release() + print "interface up...", self.wired_interface + misc.Run("ifconfig " + self.wired_interface + " up") + + print "killing wpa_supplicant, dhclient, dhclient3" + self.lock.acquire() + self.ConnectingMessage = 'removing_old_connection' + self.lock.release() + misc.Run("killall dhclient dhclient3 wpa_supplicant") + + print "flushing the routing table..." + self.lock.acquire() + self.ConnectingMessage = 'flushing_routing_table' + self.lock.release() + misc.Run("ip route flush dev " + self.wireless_interface) + misc.Run("ip route flush dev " + self.wired_interface) + + if not network.get("broadcast") == None: + self.lock.acquire() + self.ConnectingMessage = 'setting_broadcast_address' + self.lock.release() + print "setting the broadcast address..." + network["broadcast"] + misc.Run("ifconfig " + self.wired_interface + " broadcast " + network["broadcast"]) + + if not network.get("dns1") == None: + self.lock.acquire() + self.ConnectingMessage = 'setting_static_dns' + self.lock.release() + print "setting the first and second dns servers...", network["dns2"], network["dns2"] + resolv = open("/etc/resolv.conf","w") + misc.WriteLine(resolv,"nameserver " + network["dns1"]) + misc.WriteLine(resolv,"nameserver " + network["dns2"]) + if not network.get("dns3") == None: + print "setting the third dns server..." + misc.WriteLine(resolv,"nameserver " + network["dns3"]) + + if not network.get("ip") == None: + self.lock.acquire() + self.ConnectingMessage = 'setting_static_ip' + self.lock.release() + print "setting static ips...", network["ip"] + misc.Run("ifconfig " + self.wired_interface + " " + network["ip"]) + misc.Run("ifconfig " + self.wired_interface + " netmask " + network["netmask"]) + print "adding default gateway..." + network["gateway"] + misc.Run("route add default gw " + network["gateway"]) + else: + #run dhcp... + self.lock.acquire() + self.ConnectingMessage = 'running_dhcp' + self.lock.release() + print "running dhcp..." + if not self.ShouldDie: + misc.Run("dhclient " + self.wired_interface) + + self.lock.acquire() + self.ConnectingMessage = 'done' + self.lock.release() + self.IsConnecting = False + #end function run diff --git a/translations/en_US.po b/translations/en_US.po new file mode 100644 index 0000000..b10e8e5 --- /dev/null +++ b/translations/en_US.po @@ -0,0 +1,252 @@ +# English translations for PACKAGE package. +# Copyright (C) 2007 THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# root , 2007. +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2007-04-13 20:40+0900\n" +"PO-Revision-Date: 2007-04-13 20:41+0900\n" +"Last-Translator: Adam Blackburn \n" +"Language-Team: English \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=ASCII\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: gui.py:36 +msgid "Connect" +msgstr "Connect" + +#: gui.py:37 +msgid "IP" +msgstr "IP" + +#: gui.py:38 +msgid "Netmask" +msgstr "Netmask" + +#: gui.py:39 +msgid "Gateway" +msgstr "Gateway" + +#: gui.py:40 +msgid "DNS" +msgstr "DNS" + +#: gui.py:41 +msgid "Use Static IPs" +msgstr "Use Static IPs" + +#: gui.py:42 +msgid "Use Static DNS" +msgstr "Use Static DNS" + +#: gui.py:43 +msgid "Use Encryption" +msgstr "Use Encryption" + +#: gui.py:44 +msgid "Advanced Settings" +msgstr "Advanced Settings" + +#: gui.py:45 +msgid "Wired Network" +msgstr "Wired Network" + +#: gui.py:46 +msgid "" +"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" +msgstr "" +"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" + +#: gui.py:47 +msgid "Automatically connect to this network" +msgstr "Automatically connect to this network" + +#: gui.py:48 +msgid "Secured" +msgstr "Secured" + +#: gui.py:49 +msgid "Unsecured" +msgstr "Unsecured" + +#: gui.py:50 +msgid "Channel" +msgstr "Channel" + +#: gui.py:51 +msgid "Preferences" +msgstr "Preferences" + +#: gui.py:52 +msgid "WPA Supplicant Driver" +msgstr "WPA Supplicant Driver" + +#: gui.py:53 +msgid "Wireless Interface" +msgstr "Wireless Interface" + +#: gui.py:54 +msgid "Wired Interface" +msgstr "Wired Interface" + +#: gui.py:55 +msgid "Hidden Network" +msgstr "Hidden Network" + +#: gui.py:56 +msgid "Hidden Network ESSID" +msgstr "Hidden Network ESSID" + +#: gui.py:57 +msgid "Connected to $A at $B% (IP: $C)" +msgstr "Connected to $A at $B% (IP: $C)" + +#: gui.py:58 +msgid "Connected to wired network (IP: $A)" +msgstr "Connected to wired network (IP: $A)" + +#: gui.py:59 +msgid "Not connected" +msgstr "Not connected" + +#: gui.py:60 +msgid "No wireless networks found." +msgstr "No wireless networks found." + +#: gui.py:61 +msgid "Key" +msgstr "Key" + +#: gui.py:62 +msgid "Username" +msgstr "Username" + +#: gui.py:63 +msgid "Password" +msgstr "Password" + +#: gui.py:64 +msgid "Anonymous Identity" +msgstr "Anonymous Identity" + +#: gui.py:65 +msgid "Identity" +msgstr "Identity" + +#: gui.py:66 +msgid "Authentication" +msgstr "Authentication" + +#: gui.py:67 +msgid "Path to PAC File" +msgstr "Path to PAC File" + +#: gui.py:68 +msgid "Choose from the networks below:" +msgstr "Choose from the networks below:" + +#: gui.py:69 +msgid "Connecting..." +msgstr "Connecting..." + +#: gui.py:71 +msgid "0" +msgstr "0" + +#: gui.py:72 +msgid "1" +msgstr "1" + +#: gui.py:73 +msgid "2" +msgstr "2" + +#: gui.py:74 +msgid "3" +msgstr "3" + +#: gui.py:75 +msgid "4" +msgstr "4" + +#: gui.py:76 +msgid "5" +msgstr "5" + +#: gui.py:77 +msgid "6" +msgstr "6" + +#: gui.py:78 +msgid "7" +msgstr "7" + +#: gui.py:79 +msgid "8" +msgstr "8" + +#: gui.py:80 +msgid "9" +msgstr "9" + +#: gui.py:82 +msgid "Putting interface down..." +msgstr "Putting interface down..." + +#: gui.py:83 +msgid "Resetting IP address..." +msgstr "Resetting IP address..." + +#: gui.py:84 +msgid "Putting interface up..." +msgstr "Putting interface up..." + +#: gui.py:85 +msgid "Removing old connection..." +msgstr "Removing old connection..." + +#: gui.py:86 +msgid "Generating PSK..." +msgstr "Generating PSK..." + +#: gui.py:87 +msgid "Generating WPA configuration file..." +msgstr "Generating WPA configuration file..." + +#: gui.py:88 +msgid "Flushing the routing table..." +msgstr "Flushing the routing table..." + +#: gui.py:89 +msgid "Configuring wireless interface..." +msgstr "Configuring wireless interface..." + +#: gui.py:90 +msgid "Setting broadcast address..." +msgstr "Setting broadcast address..." + +#: gui.py:91 +msgid "Setting static DNS servers..." +msgstr "Setting static DNS servers..." + +#: gui.py:92 +msgid "Setting static IP addresses..." +msgstr "Setting static IP addresses..." + +#: gui.py:93 +msgid "Obtaining IP address..." +msgstr "Obtaining IP address..." + +#: gui.py:95 +msgid "Done connecting..." +msgstr "Done connecting..." + +msgid "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." +msgstr "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." diff --git a/translations/en_US/LC_MESSAGES/wicd.mo b/translations/en_US/LC_MESSAGES/wicd.mo new file mode 100644 index 0000000..4552571 Binary files /dev/null and b/translations/en_US/LC_MESSAGES/wicd.mo differ diff --git a/translations/es_ES.po b/translations/es_ES.po new file mode 100644 index 0000000..0e7abbd --- /dev/null +++ b/translations/es_ES.po @@ -0,0 +1,191 @@ +# Spanish translations for PACKAGE package. +# Copyright (C) 2007 THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# Adam Blackburn , 2007. +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2007-04-13 20:40+0900\n" +"PO-Revision-Date: 2007-04-26 20:58+0900\n" +"Last-Translator: Adam Blackburn \n" +"Language-Team: Spanish \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +msgid "English" +msgstr "Español" + +msgid "Connect" +msgstr "Conectar" + +msgid "IP" +msgstr "IP" + +msgid "Netmask" +msgstr "Máscara de subred" + +msgid "Gateway" +msgstr "Puerta de enlace" + +msgid "DNS" +msgstr "DNS" + +msgid "Use Static IPs" +msgstr "Utilizar IP estática" + +msgid "Use Static DNS" +msgstr "Utilizar DNS estática" + +msgid "Use Encryption" +msgstr "Utilizar cifrado" + +msgid "Advanced Settings" +msgstr "Opciones Avanzadas" + +msgid "Wired Network" +msgstr "Red cableada" + +msgid "Automatically connect to this network" +msgstr "Conectarse automáticamente a esta red" + +msgid "Secured" +msgstr "Segura" + +msgid "Unsecured" +msgstr "No segura" + +msgid "Channel" +msgstr "Canal" + +msgid "Preferences" +msgstr "Preferencias" + +msgid "WPA Supplicant Driver" +msgstr "Driver WPA supplicant" + +msgid "Wireless Interface" +msgstr "Interfaz inalámbrica" + +msgid "Wired Interface" +msgstr "Interfaz cableada" + +msgid "Hidden Network" +msgstr "Red oculta" + +msgid "Hidden Network ESSID" +msgstr "ESSID de red oculta" + +msgid "Connected to $A at $B% (IP: $C)" +msgstr "Conectado a $A a $B% (IP: $C)" + +msgid "Connected to wired network (IP: $A)" +msgstr "Conectado a red cableada (IP: $A)" + +msgid "Not connected" +msgstr "No conectado" + +msgid "No wireless networks found." +msgstr "No se encontraron redes inalámbricas." + +msgid "Key" +msgstr "Clave" + +msgid "Username" +msgstr "Nombre de usuario" + +msgid "Password" +msgstr "Contraseña" + +msgid "Anonymous Identity" +msgstr "Identidad anónima" + +msgid "Identity" +msgstr "Identidad" + +msgid "Authentication" +msgstr "Autentificación" + +msgid "Path to PAC File" +msgstr "Ruta al archivo PAC" + +msgid "Choose from the networks below:" +msgstr "Seleccione una de las siguientes redes:" + +msgid "Connecting..." +msgstr "Conectando..." + +msgid "0" +msgstr "0" + +msgid "1" +msgstr "1" + +msgid "2" +msgstr "2" + +msgid "3" +msgstr "3" + +msgid "4" +msgstr "4" + +msgid "5" +msgstr "5" + +msgid "6" +msgstr "6" + +msgid "7" +msgstr "7" + +msgid "8" +msgstr "8" + +msgid "9" +msgstr "9" + +msgid "Putting interface down..." +msgstr "Desconectando interfaz..." + +msgid "Resetting IP address..." +msgstr "Reseteando dirección IP..." + +msgid "Putting interface up..." +msgstr "Levantando interfaz..." + +msgid "Removing old connection..." +msgstr "Eliminando conexión antigua..." + +msgid "Generating PSK..." +msgstr "Generando PSK..." + +msgid "Generating WPA configuration file..." +msgstr "Generando archivo de configuración WPA..." + +msgid "Flushing the routing table..." +msgstr "Liberando tabla de rutas..." + +msgid "Configuring wireless interface..." +msgstr "Configurando red inalámbrica..." + +msgid "Setting broadcast address..." +msgstr "Especificando dirección broadcast..." + +msgid "Setting static DNS servers..." +msgstr "Especificando direcciones DNS estáticas..." + +msgid "Setting static IP addresses..." +msgstr "Especificando direcciones IP estáticas..." + +msgid "Obtaining IP address..." +msgstr "Obteniendo dirección IP..." + +msgid "Done connecting..." +msgstr "Conexión realizada..." + +msgid "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" +msgstr "Para conectarse a una red cableada, debe crear un perfil de red. Para hacerlo, escriba un nombre que describa la red y pulse añadir" + diff --git a/translations/es_ES/LC_MESSAGES/wicd.mo b/translations/es_ES/LC_MESSAGES/wicd.mo new file mode 100644 index 0000000..e811e2c Binary files /dev/null and b/translations/es_ES/LC_MESSAGES/wicd.mo differ diff --git a/translations/fi_FI.po b/translations/fi_FI.po new file mode 100644 index 0000000..7bc7b73 --- /dev/null +++ b/translations/fi_FI.po @@ -0,0 +1,186 @@ +# Finnish translations for Wicd package. +# Copyright (C) 2007 Adam Blackburn +# This file is distributed under the same license as the PACKAGE package. +# Adam Blackburn , 2007. +# +msgid "" +msgstr "" +"Project-Id-Version: Wicd 1.2.6\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2007-04-13 20:40+0900\n" +"PO-Revision-Date: 2007-04-22 00:09+0300\n" +"Last-Translator: Jari Rahkonen \n" +"Language-Team: Finnish\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +msgid "Connect" +msgstr "Yhdistä" + +msgid "IP" +msgstr "IP" + +msgid "Netmask" +msgstr "Verkon peite" + +msgid "Gateway" +msgstr "Yhdyskäytävä" + +msgid "DNS" +msgstr "DNS" + +msgid "Use Static IPs" +msgstr "Kiinteä IP" + +msgid "Use Static DNS" +msgstr "Kiinteä DNS" + +msgid "Use Encryption" +msgstr "Käytä salausta" + +msgid "Advanced Settings" +msgstr "Lisäasetukset" + +msgid "Wired Network" +msgstr "Lähiverkko" + +msgid "Automatically connect to this network" +msgstr "Yhdistä tähän verkkoon automaattisesti" + +msgid "Secured" +msgstr "Salattu" + +msgid "Unsecured" +msgstr "Salaamaton" + +msgid "Channel" +msgstr "Kanava" + +msgid "Preferences" +msgstr "Asetukset" + +msgid "WPA Supplicant Driver" +msgstr "WPA Supplicant -ajuri" + +msgid "Wireless Interface" +msgstr "Langaton verkkolaite" + +msgid "Wired Interface" +msgstr "Lähiverkkolaite" + +msgid "Hidden Network" +msgstr "Piilotettu verkko" + +msgid "Hidden Network ESSID" +msgstr "Piilotetun verkon ESSID" + +msgid "Connected to $A at $B% (IP: $C)" +msgstr "Yhdistetty verkkoon $A vahvuudella $B% (IP: $C)" + +msgid "Connected to wired network (IP: $A)" +msgstr "Yhdistetty lähiverkkoon (IP: $A)" + +msgid "Not connected" +msgstr "Ei yhdistetty" + +msgid "No wireless networks found." +msgstr "Langattomia verkkoja ei löydy." + +msgid "Key" +msgstr "Avain" + +msgid "Username" +msgstr "Käyttäjä" + +msgid "Password" +msgstr "Salasana" + +msgid "Anonymous Identity" +msgstr "Anonyymi identiteetti" + +msgid "Identity" +msgstr "Identiteetti" + +msgid "Authentication" +msgstr "Autentikointi" + +msgid "Path to PAC File" +msgstr "PAC-tiedoston polku" + +msgid "Choose from the networks below:" +msgstr "Valitse verkko:" + +msgid "Connecting..." +msgstr "Yhdistetään..." + +msgid "0" +msgstr "0" + +msgid "1" +msgstr "1" + +msgid "2" +msgstr "2" + +msgid "3" +msgstr "3" + +msgid "4" +msgstr "4" + +msgid "5" +msgstr "5" + +msgid "6" +msgstr "6" + +msgid "7" +msgstr "7" + +msgid "8" +msgstr "8" + +msgid "9" +msgstr "9" + +msgid "Putting interface down..." +msgstr "Suljetaan verkkolaite..." + +msgid "Resetting IP address..." +msgstr "Palautetaan IP-osoite..." + +msgid "Putting interface up..." +msgstr "Käynnistetään verkkolaite..." + +msgid "Removing old connection..." +msgstr "Poistetaan vanha yhteys..." + +msgid "Generating PSK..." +msgstr "Luodaan PSK..." + +msgid "Generating WPA configuration file..." +msgstr "Luodaan WPA-asetustiedosto..." + +msgid "Flushing the routing table..." +msgstr "Tyhjennetään reititystaulu..." + +msgid "Configuring wireless interface..." +msgstr "Asetetaan langaton verkkolaite..." + +msgid "Setting broadcast address..." +msgstr "Asetetaan lähetysosoite..." + +msgid "Setting static DNS servers..." +msgstr "Asetetaan kiinteä DNS-palvelin..." + +msgid "Setting static IP addresses..." +msgstr "Asetetaan kiinteä IP-osoite..." + +msgid "Obtaining IP address..." +msgstr "Haetaan IP-osoite..." + +msgid "Done connecting..." +msgstr "Yhdistetty..." + +msgid "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." +msgstr "Yhdistääksesi langalliseen lähiverkkoon sinun täytyy luoda verkkoprofiili. Tee se kirjoittamalla verkkoa kuvaava nimi ja napsauttamalla Lisää-painiketta." diff --git a/translations/fi_FI/LC_MESSAGES/wicd.mo b/translations/fi_FI/LC_MESSAGES/wicd.mo new file mode 100644 index 0000000..3146050 Binary files /dev/null and b/translations/fi_FI/LC_MESSAGES/wicd.mo differ diff --git a/translations/it_IT.po b/translations/it_IT.po new file mode 100644 index 0000000..0d918f5 --- /dev/null +++ b/translations/it_IT.po @@ -0,0 +1,191 @@ +# Italian translations for PACKAGE package. +# Copyright (C) 2007 THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# Adam Blackburn , 2007. +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2007-04-13 20:40+0900\n" +"PO-Revision-Date: 2007-04-26 20:59+0900\n" +"Last-Translator: Adam Blackburn \n" +"Language-Team: Italian \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +msgid "English" +msgstr "Italiano" + +msgid "Connect" +msgstr "Connetti" + +msgid "IP" +msgstr "IP" + +msgid "Netmask" +msgstr "Netmask" + +msgid "Gateway" +msgstr "Gateway" + +msgid "DNS" +msgstr "DNS" + +msgid "Use Static IPs" +msgstr "Usa IP statici" + +msgid "Use Static DNS" +msgstr "Usa DNS statici" + +msgid "Use Encryption" +msgstr "Usa cifratura" + +msgid "Advanced Settings" +msgstr "Opzioni Avanzate" + +msgid "Wired Network" +msgstr "Rete cablata" + +msgid "Automatically connect to this network" +msgstr "Connetti automaticamente a questa rete" + +msgid "Secured" +msgstr "Sicura" + +msgid "Unsecured" +msgstr "Insicura" + +msgid "Channel" +msgstr "Canale" + +msgid "Preferences" +msgstr "Opzioni" + +msgid "WPA Supplicant Driver" +msgstr "Driver WPA Supplicant" + +msgid "Wireless Interface" +msgstr "Interfaccia Wireless" + +msgid "Wired Interface" +msgstr "Interfaccia Cablata" + +msgid "Hidden Network" +msgstr "Rete Nascosta" + +msgid "Hidden Network ESSID" +msgstr "ESSID Rete Nascosta" + +msgid "Connected to $A at $B% (IP: $C)" +msgstr "Connesso a $A a $B% (IP: $C)" + +msgid "Connected to wired network (IP: $A)" +msgstr "Connesso a rete cablata" + +msgid "Not connected" +msgstr "Non connesso" + +msgid "No wireless networks found." +msgstr "Nessuna rete wireless trovata" + +msgid "Key" +msgstr "Chiave" + +msgid "Username" +msgstr "Username" + +msgid "Password" +msgstr "Password" + +msgid "Anonymous Identity" +msgstr "Identità Anonima" + +msgid "Identity" +msgstr "Identità" + +msgid "Authentication" +msgstr "Autenticazione" + +msgid "Path to PAC File" +msgstr "Indirizzo del file PAC" + +msgid "Choose from the networks below:" +msgstr "Scegliere dalle seguenti reti:" + +msgid "Connecting..." +msgstr "Connessione in corso..." + +msgid "0" +msgstr "0" + +msgid "1" +msgstr "1" + +msgid "2" +msgstr "2" + +msgid "3" +msgstr "3" + +msgid "4" +msgstr "4" + +msgid "5" +msgstr "5" + +msgid "6" +msgstr "6" + +msgid "7" +msgstr "7" + +msgid "8" +msgstr "8" + +msgid "9" +msgstr "9" + +msgid "Putting interface down..." +msgstr "Disabilitazione interfaccia in corso..." + +msgid "Resetting IP address..." +msgstr "Reimpostazione indirizzo IP in corso..." + +msgid "Putting interface up..." +msgstr "Abilitazione interfaccia in corso..." + +msgid "Removing old connection..." +msgstr "Eliminazione vecchia connessione in corso..." + +msgid "Generating PSK..." +msgstr "Creazione PSK in corso..." + +msgid "Generating WPA configuration file..." +msgstr "Creazione file di configurazione WPA in corso..." + +msgid "Flushing the routing table..." +msgstr "Pulizia tabelle di routing in corso..." + +msgid "Configuring wireless interface..." +msgstr "Configurazione interfaccia wireless in corso..." + +msgid "Setting broadcast address..." +msgstr "Impostazione indirizzo di broadcast in corso..." + +msgid "Setting static DNS servers..." +msgstr "Impostazione server DNS statici in corso..." + +msgid "Setting static IP addresses..." +msgstr "Impostazione indirizzi IP statici in corso..." + +msgid "Obtaining IP address..." +msgstr "Attesa indirizzo IP..." + +msgid "Done connecting..." +msgstr "Connessione completata..." + +msgid "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." +msgstr "Per connettersi ad una rete cablata è necessario creare un profilo di rete. Per creare un profilo di rete, inserire un nome descrittivo della rete e premere aggiungi" + diff --git a/translations/it_IT/LC_MESSAGES/wicd.mo b/translations/it_IT/LC_MESSAGES/wicd.mo new file mode 100644 index 0000000..e10a618 Binary files /dev/null and b/translations/it_IT/LC_MESSAGES/wicd.mo differ diff --git a/translations/nl_NL.po b/translations/nl_NL.po new file mode 100644 index 0000000..4109350 --- /dev/null +++ b/translations/nl_NL.po @@ -0,0 +1,186 @@ +# Dutch translations for PACKAGE package. +# Copyright (C) 2007 THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# Adam Blackburn , 2007. +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2007-04-18 20:40+0900\n" +"PO-Revision-Date: 2007-04-19 07:57+0900\n" +"Last-Translator: Ravan \n" +"Language-Team: Dutch\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +msgid "Connect" +msgstr "Verbinden" + +msgid "IP" +msgstr "IP" + +msgid "Netmask" +msgstr "Netmasker" + +msgid "Gateway" +msgstr "Gateway" + +msgid "DNS" +msgstr "DNS" + +msgid "Use Static IPs" +msgstr "Gebruik Statisch IP" + +msgid "Use Static DNS" +msgstr "Gebruik Statische DNS" + +msgid "Use Encryption" +msgstr "Gebruik Encryptie" + +msgid "Advanced Settings" +msgstr "Geavanceerde Instellingen" + +msgid "Wired Network" +msgstr "Locaal Netwerk" + +msgid "Automatically connect to this network" +msgstr "Automatisch verbinden met dit netwerk" + +msgid "Secured" +msgstr "Beveiligd" + +msgid "Unsecured" +msgstr "Onbeveiligd" + +msgid "Channel" +msgstr "Kanaal" + +msgid "Preferences" +msgstr "Voorkeuren" + +msgid "WPA Supplicant Driver" +msgstr "WPA Supplicant Stuurprogramma" + +msgid "Wireless Interface" +msgstr "Draadloze Aansluiting" + +msgid "Wired Interface" +msgstr "Draad Aansluiting" + +msgid "Hidden Network" +msgstr "Verborgen Netwerk" + +msgid "Hidden Network ESSID" +msgstr "Verborgen Netwerk ESSID" + +msgid "Connected to $A at $B% (IP: $C)" +msgstr "Verbonden met $A op $B% (IP: $C)" + +msgid "Connected to wired network (IP: $A)" +msgstr "Verbonden met LAN (IP: $A)" + +msgid "Not connected" +msgstr "Niet verbonden" + +msgid "No wireless networks found." +msgstr "Geen draadloze netwerken gevonden." + +msgid "Key" +msgstr "Sleutel" + +msgid "Username" +msgstr "Gebruikersnaam" + +msgid "Password" +msgstr "Wachtwoord" + +msgid "Anonymous Identity" +msgstr "Anonieme Identiteit" + +msgid "Identity" +msgstr "Identiteit" + +msgid "Authentication" +msgstr "Verificatie" + +msgid "Path to PAC File" +msgstr "Pad naar PAC bestand" + +msgid "Choose from the networks below:" +msgstr "Kies uit de volgende netwerken:" + +msgid "Connecting..." +msgstr "Verbinden..." + +msgid "0" +msgstr "0" + +msgid "1" +msgstr "1" + +msgid "2" +msgstr "2" + +msgid "3" +msgstr "3" + +msgid "4" +msgstr "4" + +msgid "5" +msgstr "5" + +msgid "6" +msgstr "6" + +msgid "7" +msgstr "7" + +msgid "8" +msgstr "8" + +msgid "9" +msgstr "9" + +msgid "Putting interface down..." +msgstr "Aansluiting verbreken..." + +msgid "Resetting IP address..." +msgstr "Herstellen IP adress..." + +msgid "Putting interface up..." +msgstr "Aansluiting verbinden..." + +msgid "Removing old connection..." +msgstr "Verwijderen oude verbinding..." + +msgid "Generating PSK..." +msgstr "Genereren PSK..." + +msgid "Generating WPA configuration file..." +msgstr "Genereren WPA configuratiebestand..." + +msgid "Flushing the routing table..." +msgstr "Opschonen routing tabellen..." + +msgid "Configuring wireless interface..." +msgstr "Configureren draadloze aansluiting..." + +msgid "Setting broadcast address..." +msgstr "Instellen broadcast adres..." + +msgid "Setting static DNS servers..." +msgstr "Instellen statische DNS server..." + +msgid "Setting static IP addresses..." +msgstr "Instellen statisch IP adress..." + +msgid "Obtaining IP address..." +msgstr "Verkrijgen IP adres..." + +msgid "Done connecting..." +msgstr "Aansluiten gereed..." + +msgid "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." +msgstr "Om met een bedraad netwerk te verbinding moet een netwerkprofiel worden aangemaakt. Type hiervoor een naam om het netwerk te beschrijven en klik Toevoegen." diff --git a/translations/nl_NL/LC_MESSAGES/wicd.mo b/translations/nl_NL/LC_MESSAGES/wicd.mo new file mode 100644 index 0000000..c699a15 Binary files /dev/null and b/translations/nl_NL/LC_MESSAGES/wicd.mo differ diff --git a/translations/pl_PL.po b/translations/pl_PL.po new file mode 100644 index 0000000..697c4fa --- /dev/null +++ b/translations/pl_PL.po @@ -0,0 +1,189 @@ +# Polish translations for PACKAGE package. +# Copyright (C) 2007 THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# , 2007. +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2007-04-13 20:40+0900\n" +"PO-Revision-Date: 2007-05-27 16:52+0900\n" +"Last-Translator: \n" +"Language-Team: Polish \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 " +"|| n%100>=20) ? 1 : 2);\n" +msgid "Connect" +msgstr "Połącz" + +msgid "IP" +msgstr "IP" + +msgid "Netmask" +msgstr "Maska podsieci" + +msgid "Gateway" +msgstr "Brama" + +msgid "DNS" +msgstr "DNS" + +msgid "Use Static IPs" +msgstr "Użyj Statycznych IP" + +msgid "Use Static DNS" +msgstr "Użyj Statycznych DNS" + +msgid "Use Encryption" +msgstr "Użyj Szyfrowania" + +msgid "Advanced Settings" +msgstr "Ustawienia Zaawansowane" + +msgid "Wired Network" +msgstr "Sieć Przewodowa" + +msgid "Automatically connect to this network" +msgstr "Automatycznie połącz z tą siecią" + +msgid "Secured" +msgstr "Zabezpieczona" + +msgid "Unsecured" +msgstr "Niezabezpieczona" + +msgid "Channel" +msgstr "Kanał" + +msgid "Preferences" +msgstr "Preferencje" + +msgid "WPA Supplicant Driver" +msgstr "Sterownik WPA Supplicant" + +msgid "Wireless Interface" +msgstr "Interfejs Bezprzewodowy" + +msgid "Wired Interface" +msgstr "Interfejs Przewodowy" + +msgid "Hidden Network" +msgstr "Ukryta Sieć" + +msgid "Hidden Network ESSID" +msgstr "ESSID Ukrytej Sieci" + +msgid "Connected to $A at $B% (IP: $C)" +msgstr "Połączony z $A sygnał $B% (IP: $C)" + +msgid "Connected to wired network (IP: $A)" +msgstr "Połączony z siecią przewodową (IP: $A)" + +msgid "Not connected" +msgstr "Brak połączenia" + +msgid "No wireless networks found." +msgstr "Nie znaleziono sieci bezprzewodowych." + +msgid "Key" +msgstr "Klucz" + +msgid "Username" +msgstr "Nazwa Użytkownika" + +msgid "Password" +msgstr "Hasło" + +msgid "Anonymous Identity" +msgstr "Anonimowa Tożsamość" + +msgid "Identity" +msgstr "Tożsamość" + +msgid "Authentication" +msgstr "Autentykacja" + +msgid "Path to PAC File" +msgstr "Ścieżka do pliku PAC" + +msgid "Choose from the networks below:" +msgstr "Wybierz sieci:" + +msgid "Connecting..." +msgstr "Łączenie..." + +msgid "0" +msgstr "0" + +msgid "1" +msgstr "1" + +msgid "2" +msgstr "2" + +msgid "3" +msgstr "3" + +msgid "4" +msgstr "4" + +msgid "5" +msgstr "5" + +msgid "6" +msgstr "6" + +msgid "7" +msgstr "7" + +msgid "8" +msgstr "8" + +msgid "9" +msgstr "9" + +msgid "Putting interface down..." +msgstr "Wyłączanie interfejsu..." + +msgid "Resetting IP address..." +msgstr "Resetowanie adresu IP..." + +msgid "Putting interface up..." +msgstr "Włączanie interfejsu..." + +msgid "Removing old connection..." +msgstr "Usuwanie starego połączenia..." + +msgid "Generating PSK..." +msgstr "Generowanie PSK..." + +msgid "Generating WPA configuration file..." +msgstr "Generowanie pliku konfiguracyjnego WPA..." + +msgid "Flushing the routing table..." +msgstr "Czyszczenie tablicy tras..." + +msgid "Configuring wireless interface..." +msgstr "Konfigurowanie interfejsu bezprzewodowego..." + +msgid "Setting broadcast address..." +msgstr "Ustawianie adresu rozgłaszania..." + +msgid "Setting static DNS servers..." +msgstr "Ustawianie statycznych DNS..." + +msgid "Setting static IP addresses..." +msgstr "Ustawianie statycznych adresów IP..." + +msgid "Obtaining IP address..." +msgstr "Ustalanie adresu IP..." + +msgid "Done connecting..." +msgstr "Połączono..." + +msgid "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." +msgstr "Aby połączyć się z siecią przewodową musisz stworzyć profil sieciowy. Aby stworzyć profil sieciowy wpisz nazwę opisującą sieć i naciśnij Dodaj." + diff --git a/translations/pl_PL/LC_MESSAGES/wicd.mo b/translations/pl_PL/LC_MESSAGES/wicd.mo new file mode 100644 index 0000000..e2a2a11 Binary files /dev/null and b/translations/pl_PL/LC_MESSAGES/wicd.mo differ diff --git a/translations/sv_SE.po b/translations/sv_SE.po new file mode 100644 index 0000000..9906f70 --- /dev/null +++ b/translations/sv_SE.po @@ -0,0 +1,186 @@ +# Northern Sami translations for PACKAGE package. +# Copyright (C) 2007 THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# Adam Blackburn , 2007. +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2007-04-13 20:40+0900\n" +"PO-Revision-Date: 2007-04-14 07:57+0900\n" +"Last-Translator: Adam Blackburn \n" +"Language-Team: Northern Sami\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +msgid "Connect" +msgstr "Anslut" + +msgid "IP" +msgstr "IP" + +msgid "Netmask" +msgstr "Subnät" + +msgid "Gateway" +msgstr "Gateway" + +msgid "DNS" +msgstr "DNS" + +msgid "Use Static IPs" +msgstr "Använd Fast IP" + +msgid "Use Static DNS" +msgstr "Använd Statisk DNS" + +msgid "Use Encryption" +msgstr "Använd Kryptering" + +msgid "Advanced Settings" +msgstr "Avancerade Inställningar" + +msgid "Wired Network" +msgstr "Lokalt Nätverk" + +msgid "Automatically connect to this network" +msgstr "Anslut automatiskt till detta nätverk " + +msgid "Secured" +msgstr "Krypterat" + +msgid "Unsecured" +msgstr "Okrypterat" + +msgid "Channel" +msgstr "Kanal" + +msgid "Preferences" +msgstr "Egenskaper" + +msgid "WPA Supplicant Driver" +msgstr "WPA Supplicant Drivrutin" + +msgid "Wireless Interface" +msgstr "Trådlöst Nätverk" + +msgid "Wired Interface" +msgstr "Ethernet" + +msgid "Hidden Network" +msgstr "Dold Nätverk" + +msgid "Hidden Network ESSID" +msgstr "Dold Nätverks ESSID" + +msgid "Connected to $A at $B% (IP: $C)" +msgstr "Anslut till $A Signal $B% (IP: $C)" + +msgid "Connected to wired network (IP: $A)" +msgstr "Anslut till lokalt nätverk(IP: $A)" + +msgid "Not connected" +msgstr "Ej ansluten" + +msgid "No wireless networks found." +msgstr "Inga trådlösa nätverk funna." + +msgid "Key" +msgstr "Nyckel" + +msgid "Username" +msgstr "Användar namn" + +msgid "Password" +msgstr "Lösenord" + +msgid "Anonymous Identity" +msgstr "Anonym Identitet" + +msgid "Identity" +msgstr "Identitet" + +msgid "Authentication" +msgstr "Verifiering" + +msgid "Path to PAC File" +msgstr "Sökväg till PAC fil" + +msgid "Choose from the networks below:" +msgstr "Välj från nätverken nedan:" + +msgid "Connecting..." +msgstr "Ansluter..." + +msgid "0" +msgstr "0" + +msgid "1" +msgstr "1" + +msgid "2" +msgstr "2" + +msgid "3" +msgstr "3" + +msgid "4" +msgstr "4" + +msgid "5" +msgstr "5" + +msgid "6" +msgstr "6" + +msgid "7" +msgstr "7" + +msgid "8" +msgstr "8" + +msgid "9" +msgstr "9" + +msgid "Putting interface down..." +msgstr "Kopplar ner ansluting..." + +msgid "Resetting IP address..." +msgstr "Återställer IP adress..." + +msgid "Putting interface up..." +msgstr "Kopplar upp anslutning..." + +msgid "Removing old connection..." +msgstr "Tar bort gamla anslutningen..." + +msgid "Generating PSK..." +msgstr "Genererar PSK..." + +msgid "Generating WPA configuration file..." +msgstr "Genererar WPA Konfigurations fil..." + +msgid "Flushing the routing table..." +msgstr "Tömmer routing tabellen..." + +msgid "Configuring wireless interface..." +msgstr "Konfigurerar trådlös anslutning..." + +msgid "Setting broadcast address..." +msgstr "Sätter broadcast adress..." + +msgid "Setting static DNS servers..." +msgstr "Sätter statisk DNS server..." + +msgid "Setting static IP addresses..." +msgstr "Sätter statisk IP adress..." + +msgid "Obtaining IP address..." +msgstr "Väntar på IP adress..." + +msgid "Done connecting..." +msgstr "Ansluting klar..." + +msgid "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." +msgstr "För att ansluta till ett lokalt nätverk, måste du skapa en profile. För att skapa en profile, ange ett namn / beskrivning för detta nätverk, sedan tryck på lägg till." diff --git a/translations/sv_SE/LC_MESSAGES/wicd.mo b/translations/sv_SE/LC_MESSAGES/wicd.mo new file mode 100644 index 0000000..fc5e874 Binary files /dev/null and b/translations/sv_SE/LC_MESSAGES/wicd.mo differ diff --git a/translations/wicd.pot b/translations/wicd.pot new file mode 100644 index 0000000..82bb544 --- /dev/null +++ b/translations/wicd.pot @@ -0,0 +1,247 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2007-04-13 20:40+0900\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#: gui.py:36 +msgid "Connect" +msgstr "" + +#: gui.py:37 +msgid "IP" +msgstr "" + +#: gui.py:38 +msgid "Netmask" +msgstr "" + +#: gui.py:39 +msgid "Gateway" +msgstr "" + +#: gui.py:40 +msgid "DNS" +msgstr "" + +#: gui.py:41 +msgid "Use Static IPs" +msgstr "" + +#: gui.py:42 +msgid "Use Static DNS" +msgstr "" + +#: gui.py:43 +msgid "Use Encryption" +msgstr "" + +#: gui.py:44 +msgid "Advanced Settings" +msgstr "" + +#: gui.py:45 +msgid "Wired Network" +msgstr "" + +#: gui.py:46 +msgid "" +"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" +msgstr "" + +#: gui.py:47 +msgid "Automatically connect to this network" +msgstr "" + +#: gui.py:48 +msgid "Secured" +msgstr "" + +#: gui.py:49 +msgid "Unsecured" +msgstr "" + +#: gui.py:50 +msgid "Channel" +msgstr "" + +#: gui.py:51 +msgid "Preferences" +msgstr "" + +#: gui.py:52 +msgid "WPA Supplicant Driver" +msgstr "" + +#: gui.py:53 +msgid "Wireless Interface" +msgstr "" + +#: gui.py:54 +msgid "Wired Interface" +msgstr "" + +#: gui.py:55 +msgid "Hidden Network" +msgstr "" + +#: gui.py:56 +msgid "Hidden Network ESSID" +msgstr "" + +#: gui.py:57 +msgid "Connected to $A at $B% (IP: $C)" +msgstr "" + +#: gui.py:58 +msgid "Connected to wired network (IP: $A)" +msgstr "" + +#: gui.py:59 +msgid "Not connected" +msgstr "" + +#: gui.py:60 +msgid "No wireless networks found." +msgstr "" + +#: gui.py:61 +msgid "Key" +msgstr "" + +#: gui.py:62 +msgid "Username" +msgstr "" + +#: gui.py:63 +msgid "Password" +msgstr "" + +#: gui.py:64 +msgid "Anonymous Identity" +msgstr "" + +#: gui.py:65 +msgid "Identity" +msgstr "" + +#: gui.py:66 +msgid "Authentication" +msgstr "" + +#: gui.py:67 +msgid "Path to PAC File" +msgstr "" + +#: gui.py:68 +msgid "Choose from the networks below:" +msgstr "" + +#: gui.py:69 +msgid "Connecting..." +msgstr "" + +#: gui.py:71 +msgid "0" +msgstr "" + +#: gui.py:72 +msgid "1" +msgstr "" + +#: gui.py:73 +msgid "2" +msgstr "" + +#: gui.py:74 +msgid "3" +msgstr "" + +#: gui.py:75 +msgid "4" +msgstr "" + +#: gui.py:76 +msgid "5" +msgstr "" + +#: gui.py:77 +msgid "6" +msgstr "" + +#: gui.py:78 +msgid "7" +msgstr "" + +#: gui.py:79 +msgid "8" +msgstr "" + +#: gui.py:80 +msgid "9" +msgstr "" + +#: gui.py:82 +msgid "Putting interface down..." +msgstr "" + +#: gui.py:83 +msgid "Resetting IP address..." +msgstr "" + +#: gui.py:84 +msgid "Putting interface up..." +msgstr "" + +#: gui.py:85 +msgid "Removing old connection..." +msgstr "" + +#: gui.py:86 +msgid "Generating PSK..." +msgstr "" + +#: gui.py:87 +msgid "Generating WPA configuration file..." +msgstr "" + +#: gui.py:88 +msgid "Flushing the routing table..." +msgstr "" + +#: gui.py:89 +msgid "Configuring wireless interface..." +msgstr "" + +#: gui.py:90 +msgid "Setting broadcast address..." +msgstr "" + +#: gui.py:91 +msgid "Setting static DNS servers..." +msgstr "" + +#: gui.py:92 +msgid "Setting static IP addresses..." +msgstr "" + +#: gui.py:93 +msgid "Obtaining IP address..." +msgstr "" + +#: gui.py:95 +msgid "Done connecting..." +msgstr "" diff --git a/tray-dapper.py b/tray-dapper.py new file mode 100644 index 0000000..5413720 --- /dev/null +++ b/tray-dapper.py @@ -0,0 +1 @@ +link tray.py \ No newline at end of file diff --git a/tray-edgy.py b/tray-edgy.py new file mode 100644 index 0000000..5413720 --- /dev/null +++ b/tray-edgy.py @@ -0,0 +1 @@ +link tray.py \ No newline at end of file diff --git a/tray.py b/tray.py new file mode 100644 index 0000000..f9385c5 --- /dev/null +++ b/tray.py @@ -0,0 +1,9 @@ +#!/usr/bin/python +import os,sys +if __name__ == '__main__': + os.chdir(os.path.dirname(os.path.normpath(os.path.join(os.getcwd(),sys.argv[0])))) +import gtk +if gtk.gtk_version[0] >= 2 and gtk.gtk_version[1] >= 10: + import edgy +else: + import dapper