mirror of
https://github.com/gryf/wicd.git
synced 2025-12-22 14:07:59 +01:00
Fixed bug where network entry settings weren't being saved correctly because of overloading the variable "type", which is a built in python function.
Cleaned up some formatting in gui.py and daemon.py Fixed some bad daemon calls in the setting saving process.
This commit is contained in:
@@ -554,13 +554,18 @@ class ConnectionWizard(dbus.service.Object):
|
|||||||
|
|
||||||
@dbus.service.method('org.wicd.daemon.wireless')
|
@dbus.service.method('org.wicd.daemon.wireless')
|
||||||
def SetHiddenNetworkESSID(self, essid):
|
def SetHiddenNetworkESSID(self, essid):
|
||||||
'''sets the ESSID of a hidden network for use with ConnectionWizard.Scan'''
|
''' Sets the ESSID of a hidden network for use with Scan(). '''
|
||||||
print 'setting hidden essid: ' + str(essid)
|
print 'setting hidden essid: ' + str(essid)
|
||||||
self.hidden_essid = str(misc.Noneify(essid))
|
self.hidden_essid = str(misc.Noneify(essid))
|
||||||
|
|
||||||
@dbus.service.method('org.wicd.daemon.wireless')
|
@dbus.service.method('org.wicd.daemon.wireless')
|
||||||
def Scan(self):
|
def Scan(self):
|
||||||
'''scans for wireless networks, optionally using a (hidden) essid set with SetHiddenNetworkESSID'''
|
''' Scan for wireless networks.
|
||||||
|
|
||||||
|
Scans for wireless networks,optionally using a (hidden) essid
|
||||||
|
set with SetHiddenNetworkESSID.
|
||||||
|
|
||||||
|
'''
|
||||||
print 'scanning start'
|
print 'scanning start'
|
||||||
scan = self.wifi.Scan(str(self.hidden_essid))
|
scan = self.wifi.Scan(str(self.hidden_essid))
|
||||||
self.LastScan = scan
|
self.LastScan = scan
|
||||||
|
|||||||
373
gui.py
373
gui.py
@@ -191,7 +191,7 @@ class LinkButton(gtk.EventBox):
|
|||||||
label = None
|
label = None
|
||||||
def __init__(self, txt):
|
def __init__(self, txt):
|
||||||
gtk.EventBox.__init__(self)
|
gtk.EventBox.__init__(self)
|
||||||
self.connect("realize",self.__setHandCursor) #set the hand cursor when the box is initalized
|
self.connect("realize", self.__setHandCursor) #set the hand cursor when the box is initalized
|
||||||
label = gtk.Label()
|
label = gtk.Label()
|
||||||
label.set_markup("[ <span color=\"blue\">" + txt + "</span> ]")
|
label.set_markup("[ <span color=\"blue\">" + txt + "</span> ]")
|
||||||
label.set_alignment(0,.5)
|
label.set_alignment(0,.5)
|
||||||
@@ -201,7 +201,7 @@ class LinkButton(gtk.EventBox):
|
|||||||
|
|
||||||
def __setHandCursor(self,widget):
|
def __setHandCursor(self,widget):
|
||||||
# We need this to set the cursor to a hand for the link labels.
|
# We need this to set the cursor to a hand for the link labels.
|
||||||
#I'm not entirely sure what it does :P
|
# I'm not entirely sure what it does :P
|
||||||
hand = gtk.gdk.Cursor(gtk.gdk.HAND1)
|
hand = gtk.gdk.Cursor(gtk.gdk.HAND1)
|
||||||
widget.window.set_cursor(hand)
|
widget.window.set_cursor(hand)
|
||||||
|
|
||||||
@@ -228,27 +228,27 @@ class LabelEntry(gtk.HBox):
|
|||||||
self.auto_hide_text = False
|
self.auto_hide_text = False
|
||||||
self.show()
|
self.show()
|
||||||
|
|
||||||
def set_text(self,text):
|
def set_text(self, text):
|
||||||
# For compatibility...
|
# For compatibility...
|
||||||
self.entry.set_text(text)
|
self.entry.set_text(text)
|
||||||
|
|
||||||
def get_text(self):
|
def get_text(self):
|
||||||
return self.entry.get_text()
|
return self.entry.get_text()
|
||||||
|
|
||||||
def set_auto_hidden(self,value):
|
def set_auto_hidden(self, value):
|
||||||
self.entry.set_visibility(False)
|
self.entry.set_visibility(False)
|
||||||
self.auto_hide_text = value
|
self.auto_hide_text = value
|
||||||
|
|
||||||
def show_characters(self,widget=None,event=None):
|
def show_characters(self, widget=None, event=None):
|
||||||
# When the box has focus, show the characters
|
# When the box has focus, show the characters
|
||||||
if self.auto_hide_text and widget:
|
if self.auto_hide_text and widget:
|
||||||
self.entry.set_visibility(True)
|
self.entry.set_visibility(True)
|
||||||
|
|
||||||
def set_sensitive(self,value):
|
def set_sensitive(self, value):
|
||||||
self.entry.set_sensitive(value)
|
self.entry.set_sensitive(value)
|
||||||
self.label.set_sensitive(value)
|
self.label.set_sensitive(value)
|
||||||
|
|
||||||
def hide_characters(self,widget=None,event=None):
|
def hide_characters(self, widget=None, event=None):
|
||||||
# When the box looses focus, hide them
|
# When the box looses focus, hide them
|
||||||
if self.auto_hide_text and widget:
|
if self.auto_hide_text and widget:
|
||||||
self.entry.set_visibility(False)
|
self.entry.set_visibility(False)
|
||||||
@@ -305,13 +305,13 @@ def checkboxTextboxToggle(checkbox,textboxes):
|
|||||||
|
|
||||||
class PrettyNetworkEntry(gtk.HBox):
|
class PrettyNetworkEntry(gtk.HBox):
|
||||||
'''Adds an image and a connect button to a NetworkEntry'''
|
'''Adds an image and a connect button to a NetworkEntry'''
|
||||||
def __init__(self,expander):
|
def __init__(self, expander):
|
||||||
gtk.HBox.__init__(self)
|
gtk.HBox.__init__(self)
|
||||||
# Add the stuff to the hbox (self)
|
# Add the stuff to the hbox (self)
|
||||||
self.expander = expander
|
self.expander = expander
|
||||||
self.expander.show()
|
self.expander.show()
|
||||||
self.expander.higherLevel = self # Do this so that the expander can access the stuff inside me
|
self.expander.higherLevel = self # Do this so that the expander can access the stuff inside me
|
||||||
self.tempVBox = gtk.VBox(False,1)
|
self.tempVBox = gtk.VBox(False, 1)
|
||||||
self.tempVBox.show()
|
self.tempVBox.show()
|
||||||
self.connectButton = gtk.Button(stock=gtk.STOCK_CONNECT)
|
self.connectButton = gtk.Button(stock=gtk.STOCK_CONNECT)
|
||||||
connect_hbox = gtk.HBox(False, 2)
|
connect_hbox = gtk.HBox(False, 2)
|
||||||
@@ -319,23 +319,23 @@ class PrettyNetworkEntry(gtk.HBox):
|
|||||||
#connect_hbox.pack_start(self.expander.scriptButton, False, False)
|
#connect_hbox.pack_start(self.expander.scriptButton, False, False)
|
||||||
#connect_hbox.pack_start(self.expander.advancedButton, False, False)
|
#connect_hbox.pack_start(self.expander.advancedButton, False, False)
|
||||||
connect_hbox.show()
|
connect_hbox.show()
|
||||||
self.tempVBox.pack_start(self.expander,fill=False,expand=False)
|
self.tempVBox.pack_start(self.expander, fill=False, expand=False)
|
||||||
self.tempVBox.pack_start(connect_hbox, fill=False, expand=False)
|
self.tempVBox.pack_start(connect_hbox, fill=False, expand=False)
|
||||||
self.pack_end(self.tempVBox)
|
self.pack_end(self.tempVBox)
|
||||||
#self.expander.scriptButton.show()
|
#self.expander.scriptButton.show()
|
||||||
#self.expander.advancedButton.show()
|
#self.expander.advancedButton.show()
|
||||||
|
|
||||||
|
|
||||||
class PrettyWiredNetworkEntry(PrettyNetworkEntry):
|
class PrettyWiredNetworkEntry(PrettyNetworkEntry):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
PrettyNetworkEntry.__init__(self,WiredNetworkEntry())
|
PrettyNetworkEntry.__init__(self, WiredNetworkEntry())
|
||||||
# Center the picture and pad it a bit
|
# Center the picture and pad it a bit
|
||||||
self.image = gtk.Image()
|
self.image = gtk.Image()
|
||||||
self.image.set_alignment(.5,0)
|
self.image.set_alignment(.5, 0)
|
||||||
self.image.set_size_request(60,-1)
|
self.image.set_size_request(60, -1)
|
||||||
self.image.set_from_icon_name("network-wired",6)
|
self.image.set_from_icon_name("network-wired", 6)
|
||||||
self.image.show()
|
self.image.show()
|
||||||
self.pack_start(self.image,fill=False,expand=False)
|
self.pack_start(self.image, fill=False, expand=False)
|
||||||
self.show()
|
self.show()
|
||||||
self.expander.checkEnable()
|
self.expander.checkEnable()
|
||||||
self.expander.show()
|
self.expander.show()
|
||||||
@@ -344,20 +344,20 @@ class PrettyWiredNetworkEntry(PrettyNetworkEntry):
|
|||||||
|
|
||||||
class PrettyWirelessNetworkEntry(PrettyNetworkEntry):
|
class PrettyWirelessNetworkEntry(PrettyNetworkEntry):
|
||||||
def __init__(self,networkID):
|
def __init__(self,networkID):
|
||||||
PrettyNetworkEntry.__init__(self,WirelessNetworkEntry(networkID))
|
PrettyNetworkEntry.__init__(self, WirelessNetworkEntry(networkID))
|
||||||
self.image = gtk.Image()
|
self.image = gtk.Image()
|
||||||
self.image.set_padding(0,0)
|
self.image.set_padding(0, 0)
|
||||||
self.image.set_alignment(.5,0)
|
self.image.set_alignment(.5 ,0)
|
||||||
self.image.set_size_request(60,-1)
|
self.image.set_size_request(60, -1)
|
||||||
self.image.set_from_icon_name("network-wired",6)
|
self.image.set_from_icon_name("network-wired",6)
|
||||||
self.pack_start(self.image,fill=False,expand=False)
|
self.pack_start(self.image, fill=False, expand=False)
|
||||||
self.setSignalStrength(wireless.GetWirelessProperty(networkID,'quality'),
|
self.setSignalStrength(wireless.GetWirelessProperty(networkID, 'quality'),
|
||||||
wireless.GetWirelessProperty(networkID,'strength'))
|
wireless.GetWirelessProperty(networkID, 'strength'))
|
||||||
self.setMACAddress(wireless.GetWirelessProperty(networkID,'bssid'))
|
self.setMACAddress(wireless.GetWirelessProperty(networkID, 'bssid'))
|
||||||
self.setMode(wireless.GetWirelessProperty(networkID,'mode'))
|
self.setMode(wireless.GetWirelessProperty(networkID, 'mode'))
|
||||||
self.setChannel(wireless.GetWirelessProperty(networkID,'channel'))
|
self.setChannel(wireless.GetWirelessProperty(networkID, 'channel'))
|
||||||
self.setEncryption(wireless.GetWirelessProperty(networkID,'encryption'),
|
self.setEncryption(wireless.GetWirelessProperty(networkID, 'encryption'),
|
||||||
wireless.GetWirelessProperty(networkID,'encryption_method'))
|
wireless.GetWirelessProperty(networkID, 'encryption_method'))
|
||||||
self.expander.set_use_markup(True)
|
self.expander.set_use_markup(True)
|
||||||
self.expander.set_label(self.expander.essid + " " +
|
self.expander.set_label(self.expander.essid + " " +
|
||||||
self.expander.lblEncryption.get_label() + " "
|
self.expander.lblEncryption.get_label() + " "
|
||||||
@@ -365,7 +365,7 @@ class PrettyWirelessNetworkEntry(PrettyNetworkEntry):
|
|||||||
# Show everything
|
# Show everything
|
||||||
self.show_all()
|
self.show_all()
|
||||||
|
|
||||||
def setSignalStrength(self,strength, dbm_strength):
|
def setSignalStrength(self, strength, dbm_strength):
|
||||||
if strength is not None:
|
if strength is not None:
|
||||||
strength = int(strength)
|
strength = int(strength)
|
||||||
else:
|
else:
|
||||||
@@ -401,16 +401,16 @@ class PrettyWirelessNetworkEntry(PrettyNetworkEntry):
|
|||||||
self.image.set_from_file(wpath.images + signal_img)
|
self.image.set_from_file(wpath.images + signal_img)
|
||||||
self.expander.setSignalStrength(strength, dbm_strength)
|
self.expander.setSignalStrength(strength, dbm_strength)
|
||||||
|
|
||||||
def setMACAddress(self,address):
|
def setMACAddress(self, address):
|
||||||
self.expander.setMACAddress(address)
|
self.expander.setMACAddress(address)
|
||||||
|
|
||||||
def setEncryption(self,on,type):
|
def setEncryption(self, on, ttype):
|
||||||
self.expander.setEncryption(on,type)
|
self.expander.setEncryption(on, ttype)
|
||||||
|
|
||||||
def setChannel(self,channel):
|
def setChannel(self, channel):
|
||||||
self.expander.setChannel(channel)
|
self.expander.setChannel(channel)
|
||||||
|
|
||||||
def setMode(self,mode):
|
def setMode(self, mode):
|
||||||
self.expander.setMode(mode)
|
self.expander.setMode(mode)
|
||||||
|
|
||||||
|
|
||||||
@@ -420,7 +420,7 @@ class NetworkEntry(gtk.Expander):
|
|||||||
# Make stuff exist, this is pretty long and boring.
|
# Make stuff exist, this is pretty long and boring.
|
||||||
gtk.Expander.__init__(self)
|
gtk.Expander.__init__(self)
|
||||||
self.txtIP = LabelEntry(language['ip'])
|
self.txtIP = LabelEntry(language['ip'])
|
||||||
self.txtIP.entry.connect('focus-out-event',self.setDefaults)
|
self.txtIP.entry.connect('focus-out-event', self.setDefaults)
|
||||||
self.txtNetmask = LabelEntry(language['netmask'])
|
self.txtNetmask = LabelEntry(language['netmask'])
|
||||||
self.txtGateway = LabelEntry(language['gateway'])
|
self.txtGateway = LabelEntry(language['gateway'])
|
||||||
self.txtDNS1 = LabelEntry(language['dns'] + ' ' + language['1'])
|
self.txtDNS1 = LabelEntry(language['dns'] + ' ' + language['1'])
|
||||||
@@ -457,17 +457,17 @@ class NetworkEntry(gtk.Expander):
|
|||||||
hboxDNS.pack_start(self.checkboxStaticDNS)
|
hboxDNS.pack_start(self.checkboxStaticDNS)
|
||||||
hboxDNS.pack_start(self.checkboxGlobalDNS)
|
hboxDNS.pack_start(self.checkboxGlobalDNS)
|
||||||
|
|
||||||
self.vboxAdvanced = gtk.VBox(False,0)
|
self.vboxAdvanced = gtk.VBox(False, 0)
|
||||||
self.vboxAdvanced.pack_start(self.checkboxStaticIP, fill=False,
|
self.vboxAdvanced.pack_start(self.checkboxStaticIP, fill=False,
|
||||||
expand=False)
|
expand=False)
|
||||||
self.vboxAdvanced.pack_start(self.txtIP,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.txtNetmask, fill=False, expand=False)
|
||||||
self.vboxAdvanced.pack_start(self.txtGateway,fill=False,expand=False)
|
self.vboxAdvanced.pack_start(self.txtGateway, fill=False, expand=False)
|
||||||
self.vboxAdvanced.pack_start(hboxDNS, fill=False, expand=False)
|
self.vboxAdvanced.pack_start(hboxDNS, fill=False, expand=False)
|
||||||
self.vboxAdvanced.pack_start(self.txtDNS1,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.txtDNS2, fill=False, expand=False)
|
||||||
self.vboxAdvanced.pack_start(self.txtDNS3,fill=False,expand=False)
|
self.vboxAdvanced.pack_start(self.txtDNS3, fill=False, expand=False)
|
||||||
|
|
||||||
settings_hbox = gtk.HBox(False, 3)
|
settings_hbox = gtk.HBox(False, 3)
|
||||||
settings_hbox.set_border_width(5)
|
settings_hbox.set_border_width(5)
|
||||||
settings_hbox.pack_start(self.scriptButton, fill=False, expand=False)
|
settings_hbox.pack_start(self.scriptButton, fill=False, expand=False)
|
||||||
@@ -476,15 +476,15 @@ class NetworkEntry(gtk.Expander):
|
|||||||
self.vboxTop.pack_end(settings_hbox, fill=False, expand=False)
|
self.vboxTop.pack_end(settings_hbox, fill=False, expand=False)
|
||||||
|
|
||||||
# Connect the events to the actions
|
# Connect the events to the actions
|
||||||
self.checkboxStaticIP.connect("toggled",self.toggleIPCheckbox)
|
self.checkboxStaticIP.connect("toggled", self.toggleIPCheckbox)
|
||||||
self.checkboxStaticDNS.connect("toggled",self.toggleDNSCheckbox)
|
self.checkboxStaticDNS.connect("toggled", self.toggleDNSCheckbox)
|
||||||
self.checkboxGlobalDNS.connect("toggled",self.toggleGlobalDNSCheckbox)
|
self.checkboxGlobalDNS.connect("toggled", self.toggleGlobalDNSCheckbox)
|
||||||
|
|
||||||
# Start with all disabled, then they will be enabled later.
|
# Start with all disabled, then they will be enabled later.
|
||||||
self.checkboxStaticIP.set_active(False)
|
self.checkboxStaticIP.set_active(False)
|
||||||
self.checkboxStaticDNS.set_active(False)
|
self.checkboxStaticDNS.set_active(False)
|
||||||
|
|
||||||
def setDefaults(self,widget=None,event=None):
|
def setDefaults(self, widget=None, event=None):
|
||||||
# After the user types in the IP address,
|
# After the user types in the IP address,
|
||||||
# help them out a little.
|
# help them out a little.
|
||||||
ipAddress = self.txtIP.get_text() # For easy typing :)
|
ipAddress = self.txtIP.get_text() # For easy typing :)
|
||||||
@@ -496,8 +496,8 @@ class NetworkEntry(gtk.Expander):
|
|||||||
# Fill it in with a .1 at the end
|
# Fill it in with a .1 at the end
|
||||||
gateway.set_text('.'.join(ip_parts[0:3]) + '.1')
|
gateway.set_text('.'.join(ip_parts[0:3]) + '.1')
|
||||||
|
|
||||||
if stringToNone(netmask.get_text()) == None: # Make sure the netmask is blank
|
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
|
netmask.set_text('255.255.255.0') # Fill in the most common one
|
||||||
elif ipAddress != "":
|
elif ipAddress != "":
|
||||||
misc.error(None, "Invalid IP Address Entered.")
|
misc.error(None, "Invalid IP Address Entered.")
|
||||||
|
|
||||||
@@ -524,7 +524,7 @@ class NetworkEntry(gtk.Expander):
|
|||||||
self.toggleDNSCheckbox()
|
self.toggleDNSCheckbox()
|
||||||
self.toggleGlobalDNSCheckbox()
|
self.toggleGlobalDNSCheckbox()
|
||||||
|
|
||||||
def toggleIPCheckbox(self,widget=None):
|
def toggleIPCheckbox(self, widget=None):
|
||||||
# Should disable the static IP text boxes,
|
# Should disable the static IP text boxes,
|
||||||
# and also enable the DNS checkbox when
|
# and also enable the DNS checkbox when
|
||||||
# disabled and disable when enabled.
|
# disabled and disable when enabled.
|
||||||
@@ -539,7 +539,7 @@ class NetworkEntry(gtk.Expander):
|
|||||||
self.txtNetmask.set_sensitive(self.checkboxStaticIP.get_active())
|
self.txtNetmask.set_sensitive(self.checkboxStaticIP.get_active())
|
||||||
self.txtGateway.set_sensitive(self.checkboxStaticIP.get_active())
|
self.txtGateway.set_sensitive(self.checkboxStaticIP.get_active())
|
||||||
|
|
||||||
def toggleDNSCheckbox(self,widget=None):
|
def toggleDNSCheckbox(self, widget=None):
|
||||||
# Should disable the static DNS boxes
|
# Should disable the static DNS boxes
|
||||||
if self.checkboxStaticIP.get_active() == True:
|
if self.checkboxStaticIP.get_active() == True:
|
||||||
self.checkboxStaticDNS.set_active(self.checkboxStaticIP.get_active())
|
self.checkboxStaticDNS.set_active(self.checkboxStaticIP.get_active())
|
||||||
@@ -557,7 +557,7 @@ class NetworkEntry(gtk.Expander):
|
|||||||
self.txtDNS3.set_sensitive(False)
|
self.txtDNS3.set_sensitive(False)
|
||||||
self.checkboxGlobalDNS.set_active(False)
|
self.checkboxGlobalDNS.set_active(False)
|
||||||
|
|
||||||
def toggleGlobalDNSCheckbox(self,widget=None):
|
def toggleGlobalDNSCheckbox(self, widget=None):
|
||||||
if daemon.GetUseGlobalDNS() and self.checkboxStaticDNS.get_active():
|
if daemon.GetUseGlobalDNS() and self.checkboxStaticDNS.get_active():
|
||||||
self.txtDNS1.set_sensitive(not self.checkboxGlobalDNS.get_active())
|
self.txtDNS1.set_sensitive(not self.checkboxGlobalDNS.get_active())
|
||||||
self.txtDNS2.set_sensitive(not self.checkboxGlobalDNS.get_active())
|
self.txtDNS2.set_sensitive(not self.checkboxGlobalDNS.get_active())
|
||||||
@@ -576,8 +576,8 @@ class WiredNetworkEntry(NetworkEntry):
|
|||||||
if self.profileList: # Make sure there is something in it...
|
if self.profileList: # Make sure there is something in it...
|
||||||
for x in config.GetWiredProfileList(): # Add all the names to the combobox
|
for x in config.GetWiredProfileList(): # Add all the names to the combobox
|
||||||
self.comboProfileNames.append_text(x)
|
self.comboProfileNames.append_text(x)
|
||||||
self.hboxTemp = gtk.HBox(False,0)
|
self.hboxTemp = gtk.HBox(False, 0)
|
||||||
hboxDef = gtk.HBox(False,0)
|
hboxDef = gtk.HBox(False, 0)
|
||||||
buttonAdd = gtk.Button(stock=gtk.STOCK_ADD)
|
buttonAdd = gtk.Button(stock=gtk.STOCK_ADD)
|
||||||
buttonDelete = gtk.Button(stock=gtk.STOCK_DELETE)
|
buttonDelete = gtk.Button(stock=gtk.STOCK_DELETE)
|
||||||
self.profileHelp = gtk.Label(language['wired_network_instructions'])
|
self.profileHelp = gtk.Label(language['wired_network_instructions'])
|
||||||
@@ -586,15 +586,15 @@ class WiredNetworkEntry(NetworkEntry):
|
|||||||
self.profileHelp.set_justify(gtk.JUSTIFY_LEFT)
|
self.profileHelp.set_justify(gtk.JUSTIFY_LEFT)
|
||||||
self.profileHelp.set_line_wrap(True)
|
self.profileHelp.set_line_wrap(True)
|
||||||
|
|
||||||
self.vboxTop.pack_start(self.profileHelp,fill=True,expand=True)
|
self.vboxTop.pack_start(self.profileHelp, fill=True, expand=True)
|
||||||
self.hboxTemp.pack_start(self.comboProfileNames, fill=True, expand=True)
|
self.hboxTemp.pack_start(self.comboProfileNames, fill=True, expand=True)
|
||||||
self.hboxTemp.pack_start(buttonAdd, fill=False, expand=False)
|
self.hboxTemp.pack_start(buttonAdd, fill=False, expand=False)
|
||||||
self.hboxTemp.pack_start(buttonDelete, fill=False, expand=False)
|
self.hboxTemp.pack_start(buttonDelete, fill=False, expand=False)
|
||||||
hboxDef.pack_start(self.checkboxDefaultProfile,fill=False,expand=False)
|
hboxDef.pack_start(self.checkboxDefaultProfile, fill=False, expand=False)
|
||||||
|
|
||||||
buttonAdd.connect("clicked", self.addProfile)
|
buttonAdd.connect("clicked", self.addProfile)
|
||||||
buttonDelete.connect("clicked", self.removeProfile)
|
buttonDelete.connect("clicked", self.removeProfile)
|
||||||
self.comboProfileNames.connect("changed",self.changeProfile)
|
self.comboProfileNames.connect("changed", self.changeProfile)
|
||||||
self.scriptButton.connect("button-press-event", self.editScripts)
|
self.scriptButton.connect("button-press-event", self.editScripts)
|
||||||
self.vboxTop.pack_start(hboxDef)
|
self.vboxTop.pack_start(hboxDef)
|
||||||
self.vboxTop.pack_start(self.hboxTemp)
|
self.vboxTop.pack_start(self.hboxTemp)
|
||||||
@@ -603,19 +603,19 @@ class WiredNetworkEntry(NetworkEntry):
|
|||||||
self.checkboxDefaultProfile.set_active(True)
|
self.checkboxDefaultProfile.set_active(True)
|
||||||
else:
|
else:
|
||||||
self.checkboxDefaultProfile.set_active(False)
|
self.checkboxDefaultProfile.set_active(False)
|
||||||
self.checkboxDefaultProfile.connect("toggled",self.toggleDefaultProfile)
|
self.checkboxDefaultProfile.connect("toggled", self.toggleDefaultProfile)
|
||||||
|
|
||||||
self.show_all()
|
self.show_all()
|
||||||
self.profileHelp.hide()
|
self.profileHelp.hide()
|
||||||
if self.profileList != None:
|
if self.profileList != None:
|
||||||
prof = config.GetDefaultWiredNetwork()
|
prof = config.GetDefaultWiredNetwork()
|
||||||
if prof != None: # Make sure the default profile gets displayed.
|
if prof != None: # Make sure the default profile gets displayed.
|
||||||
i=0
|
i = 0
|
||||||
while self.comboProfileNames.get_active_text() != prof:
|
while self.comboProfileNames.get_active_text() != prof:
|
||||||
self.comboProfileNames.set_active(i)
|
self.comboProfileNames.set_active(i)
|
||||||
i+= 1
|
i += 1
|
||||||
else:
|
else:
|
||||||
self.comboProfileNames.set_active(0)
|
self.comboProfileNames.set_active(0)
|
||||||
print "wired profiles found"
|
print "wired profiles found"
|
||||||
self.set_expanded(False)
|
self.set_expanded(False)
|
||||||
else:
|
else:
|
||||||
@@ -636,7 +636,7 @@ class WiredNetworkEntry(NetworkEntry):
|
|||||||
self.higherLevel.connectButton.set_sensitive(False)
|
self.higherLevel.connectButton.set_sensitive(False)
|
||||||
self.vboxAdvanced.set_sensitive(False)
|
self.vboxAdvanced.set_sensitive(False)
|
||||||
|
|
||||||
def addProfile(self,widget):
|
def addProfile(self, widget):
|
||||||
print "adding profile"
|
print "adding profile"
|
||||||
profileName = self.comboProfileNames.get_active_text()
|
profileName = self.comboProfileNames.get_active_text()
|
||||||
profileList = config.GetWiredProfileList()
|
profileList = config.GetWiredProfileList()
|
||||||
@@ -653,7 +653,7 @@ class WiredNetworkEntry(NetworkEntry):
|
|||||||
self.vboxAdvanced.set_sensitive(True)
|
self.vboxAdvanced.set_sensitive(True)
|
||||||
self.higherLevel.connectButton.set_sensitive(True)
|
self.higherLevel.connectButton.set_sensitive(True)
|
||||||
|
|
||||||
def removeProfile(self,widget):
|
def removeProfile(self, widget):
|
||||||
print "removing profile"
|
print "removing profile"
|
||||||
config.DeleteWiredNetworkProfile(self.comboProfileNames.get_active_text())
|
config.DeleteWiredNetworkProfile(self.comboProfileNames.get_active_text())
|
||||||
self.comboProfileNames.remove_text(self.comboProfileNames.get_active())
|
self.comboProfileNames.remove_text(self.comboProfileNames.get_active())
|
||||||
@@ -669,7 +669,7 @@ class WiredNetworkEntry(NetworkEntry):
|
|||||||
else:
|
else:
|
||||||
self.profileHelp.hide()
|
self.profileHelp.hide()
|
||||||
|
|
||||||
def toggleDefaultProfile(self,widget):
|
def toggleDefaultProfile(self, widget):
|
||||||
if self.checkboxDefaultProfile.get_active():
|
if self.checkboxDefaultProfile.get_active():
|
||||||
print 'unsetting previous default profile...'
|
print 'unsetting previous default profile...'
|
||||||
# Make sure there is only one default profile at a time
|
# Make sure there is only one default profile at a time
|
||||||
@@ -678,7 +678,7 @@ class WiredNetworkEntry(NetworkEntry):
|
|||||||
self.checkboxDefaultProfile.get_active())
|
self.checkboxDefaultProfile.get_active())
|
||||||
config.SaveWiredNetworkProfile(self.comboProfileNames.get_active_text())
|
config.SaveWiredNetworkProfile(self.comboProfileNames.get_active_text())
|
||||||
|
|
||||||
def changeProfile(self,widget):
|
def changeProfile(self, widget):
|
||||||
# Make sure the name doesn't change everytime someone types something
|
# Make sure the name doesn't change everytime someone types something
|
||||||
if self.comboProfileNames.get_active() > -1:
|
if self.comboProfileNames.get_active() > -1:
|
||||||
if self.isFullGUI == False:
|
if self.isFullGUI == False:
|
||||||
@@ -706,16 +706,16 @@ class WiredNetworkEntry(NetworkEntry):
|
|||||||
class WirelessNetworkEntry(NetworkEntry):
|
class WirelessNetworkEntry(NetworkEntry):
|
||||||
# This class is respsponsible for creating the expander
|
# This class is respsponsible for creating the expander
|
||||||
# in each wirelessnetwork entry.
|
# in each wirelessnetwork entry.
|
||||||
def __init__(self,networkID):
|
def __init__(self, networkID):
|
||||||
self.networkID = networkID
|
self.networkID = networkID
|
||||||
# Create the data labels
|
# Create the data labels
|
||||||
NetworkEntry.__init__(self)
|
NetworkEntry.__init__(self)
|
||||||
print "ESSID : " + wireless.GetWirelessProperty(networkID,"essid")
|
self.essid = wireless.GetWirelessProperty(networkID, "essid")
|
||||||
self.set_label(wireless.GetWirelessProperty(networkID,"essid"))
|
print "ESSID : " + self.essid
|
||||||
self.essid = wireless.GetWirelessProperty(networkID,"essid")
|
self.set_label(self.essid)
|
||||||
|
|
||||||
# Make the vbox to hold the encryption stuff.
|
# Make the vbox to hold the encryption stuff.
|
||||||
self.vboxEncryptionInformation = gtk.VBox(False,0)
|
self.vboxEncryptionInformation = gtk.VBox(False, 0)
|
||||||
# Make the combo box.
|
# Make the combo box.
|
||||||
self.comboEncryption = gtk.combo_box_new_text()
|
self.comboEncryption = gtk.combo_box_new_text()
|
||||||
self.checkboxEncryption = gtk.CheckButton(language['use_encryption'])
|
self.checkboxEncryption = gtk.CheckButton(language['use_encryption'])
|
||||||
@@ -724,20 +724,20 @@ class WirelessNetworkEntry(NetworkEntry):
|
|||||||
self.lblMAC = GreyLabel()
|
self.lblMAC = GreyLabel()
|
||||||
self.lblChannel = GreyLabel()
|
self.lblChannel = GreyLabel()
|
||||||
self.lblMode = GreyLabel()
|
self.lblMode = GreyLabel()
|
||||||
self.hboxStatus = gtk.HBox(False,5)
|
self.hboxStatus = gtk.HBox(False, 5)
|
||||||
self.checkboxAutoConnect = gtk.CheckButton(language['automatic_connect'])
|
self.checkboxAutoConnect = gtk.CheckButton(language['automatic_connect'])
|
||||||
self.checkboxAutoConnect.connect("toggled",self.updateAutoConnect)
|
self.checkboxAutoConnect.connect("toggled", self.updateAutoConnect)
|
||||||
|
|
||||||
self.hboxStatus.pack_start(self.lblStrength,fill=False,expand=True)
|
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.lblEncryption, fill=False, expand=True)
|
||||||
self.hboxStatus.pack_start(self.lblMAC,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.lblMode, fill=False, expand=True)
|
||||||
self.hboxStatus.pack_start(self.lblChannel,fill=False,expand=True)
|
self.hboxStatus.pack_start(self.lblChannel, fill=False, expand=True)
|
||||||
|
|
||||||
self.vboxTop.pack_start(self.checkboxAutoConnect, fill=False,
|
self.vboxTop.pack_start(self.checkboxAutoConnect, fill=False,
|
||||||
expand=False)
|
expand=False)
|
||||||
self.vboxTop.pack_start(self.hboxStatus,fill=True,expand=True)
|
self.vboxTop.pack_start(self.hboxStatus, fill=True, expand=True)
|
||||||
|
|
||||||
self.vboxAdvanced.pack_start(self.checkboxEncryption, fill=False,
|
self.vboxAdvanced.pack_start(self.checkboxEncryption, fill=False,
|
||||||
expand=False)
|
expand=False)
|
||||||
|
|
||||||
@@ -790,8 +790,8 @@ class WirelessNetworkEntry(NetworkEntry):
|
|||||||
self.vboxAdvanced.pack_start(self.vboxEncryptionInformation)
|
self.vboxAdvanced.pack_start(self.vboxEncryptionInformation)
|
||||||
self.changeEncryptionMethod()
|
self.changeEncryptionMethod()
|
||||||
self.scriptButton.connect("button-press-event", self.editScripts)
|
self.scriptButton.connect("button-press-event", self.editScripts)
|
||||||
self.checkboxEncryption.connect("toggled",self.toggleEncryption)
|
self.checkboxEncryption.connect("toggled", self.toggleEncryption)
|
||||||
self.comboEncryption.connect("changed",self.changeEncryptionMethod)
|
self.comboEncryption.connect("changed", self.changeEncryptionMethod)
|
||||||
self.show_all()
|
self.show_all()
|
||||||
|
|
||||||
def format_entry(self, networkid, label):
|
def format_entry(self, networkid, label):
|
||||||
@@ -803,17 +803,17 @@ class WirelessNetworkEntry(NetworkEntry):
|
|||||||
print result
|
print result
|
||||||
|
|
||||||
def updateAutoConnect(self, widget=None):
|
def updateAutoConnect(self, widget=None):
|
||||||
wireless.SetWirelessProperty(self.networkID,"automatic",
|
wireless.SetWirelessProperty(self.networkID, "automatic",
|
||||||
noneToString(self.checkboxAutoConnect.get_active()))
|
noneToString(self.checkboxAutoConnect.get_active()))
|
||||||
|
|
||||||
config.SaveWirelessNetworkProperty(self.networkID,"automatic")
|
config.SaveWirelessNetworkProperty(self.networkID, "automatic")
|
||||||
|
|
||||||
def toggleEncryption(self,widget=None):
|
def toggleEncryption(self, widget=None):
|
||||||
active = self.checkboxEncryption.get_active()
|
active = self.checkboxEncryption.get_active()
|
||||||
self.vboxEncryptionInformation.set_sensitive(active)
|
self.vboxEncryptionInformation.set_sensitive(active)
|
||||||
self.comboEncryption.set_sensitive(active)
|
self.comboEncryption.set_sensitive(active)
|
||||||
|
|
||||||
def changeEncryptionMethod(self,widget=None):
|
def changeEncryptionMethod(self, widget=None):
|
||||||
for z in self.vboxEncryptionInformation:
|
for z in self.vboxEncryptionInformation:
|
||||||
z.destroy() # Remove stuff in there already
|
z.destroy() # Remove stuff in there already
|
||||||
ID = self.comboEncryption.get_active()
|
ID = self.comboEncryption.get_active()
|
||||||
@@ -840,7 +840,7 @@ class WirelessNetworkEntry(NetworkEntry):
|
|||||||
wireless.GetWirelessProperty(self.networkID,methods[ID][2][x][1])))
|
wireless.GetWirelessProperty(self.networkID,methods[ID][2][x][1])))
|
||||||
self.vboxEncryptionInformation.show_all()
|
self.vboxEncryptionInformation.show_all()
|
||||||
|
|
||||||
def setSignalStrength(self,strength, dbm_strength):
|
def setSignalStrength(self, strength, dbm_strength):
|
||||||
display_type = daemon.GetSignalDisplayType()
|
display_type = daemon.GetSignalDisplayType()
|
||||||
if daemon.GetWPADriver() == 'ralink legacy' or display_type == 1:
|
if daemon.GetWPADriver() == 'ralink legacy' or display_type == 1:
|
||||||
ending = "dBm"
|
ending = "dBm"
|
||||||
@@ -850,21 +850,21 @@ class WirelessNetworkEntry(NetworkEntry):
|
|||||||
disp_strength = str(strength)
|
disp_strength = str(strength)
|
||||||
self.lblStrength.set_label(disp_strength + ending)
|
self.lblStrength.set_label(disp_strength + ending)
|
||||||
|
|
||||||
def setMACAddress(self,address):
|
def setMACAddress(self, address):
|
||||||
self.lblMAC.set_label(str(address))
|
self.lblMAC.set_label(str(address))
|
||||||
|
|
||||||
def setEncryption(self,on,type):
|
def setEncryption(self, on, ttype):
|
||||||
if on and type:
|
if on and ttype:
|
||||||
self.lblEncryption.set_label(str(type))
|
self.lblEncryption.set_label(str(ttype))
|
||||||
if on and not type:
|
if on and not ttype:
|
||||||
self.lblEncryption.set_label(language['secured'])
|
self.lblEncryption.set_label(language['secured'])
|
||||||
if not on:
|
if not on:
|
||||||
self.lblEncryption.set_label(language['unsecured'])
|
self.lblEncryption.set_label(language['unsecured'])
|
||||||
|
|
||||||
def setChannel(self,channel):
|
def setChannel(self, channel):
|
||||||
self.lblChannel.set_label(language['channel'] + ' ' + str(channel))
|
self.lblChannel.set_label(language['channel'] + ' ' + str(channel))
|
||||||
|
|
||||||
def setMode(self,mode):
|
def setMode(self, mode):
|
||||||
self.lblMode.set_label(str(mode))
|
self.lblMode.set_label(str(mode))
|
||||||
|
|
||||||
class WiredProfileChooser:
|
class WiredProfileChooser:
|
||||||
@@ -881,12 +881,12 @@ class WiredProfileChooser:
|
|||||||
buttons = (gtk.STOCK_CONNECT, 1,
|
buttons = (gtk.STOCK_CONNECT, 1,
|
||||||
gtk.STOCK_CANCEL, 2))
|
gtk.STOCK_CANCEL, 2))
|
||||||
dialog.set_has_separator(False)
|
dialog.set_has_separator(False)
|
||||||
dialog.set_size_request(400,150)
|
dialog.set_size_request(400, 150)
|
||||||
instructLabel = gtk.Label(language['choose_wired_profile'] + ':\n')
|
instructLabel = gtk.Label(language['choose_wired_profile'] + ':\n')
|
||||||
stoppopcheckbox = gtk.CheckButton(language['stop_showing_chooser'])
|
stoppopcheckbox = gtk.CheckButton(language['stop_showing_chooser'])
|
||||||
|
|
||||||
wiredNetEntry.isFullGUI = False
|
wiredNetEntry.isFullGUI = False
|
||||||
instructLabel.set_alignment(0,0)
|
instructLabel.set_alignment(0, 0)
|
||||||
stoppopcheckbox.set_active(False)
|
stoppopcheckbox.set_active(False)
|
||||||
|
|
||||||
# Remove widgets that were added to the normal
|
# Remove widgets that were added to the normal
|
||||||
@@ -895,12 +895,12 @@ class WiredProfileChooser:
|
|||||||
wiredNetEntry.vboxTop.remove(wiredNetEntry.hboxTemp)
|
wiredNetEntry.vboxTop.remove(wiredNetEntry.hboxTemp)
|
||||||
wiredNetEntry.vboxTop.remove(wiredNetEntry.profileHelp)
|
wiredNetEntry.vboxTop.remove(wiredNetEntry.profileHelp)
|
||||||
|
|
||||||
dialog.vbox.pack_start(instructLabel,fill=False,expand=False)
|
dialog.vbox.pack_start(instructLabel, fill=False, expand=False)
|
||||||
dialog.vbox.pack_start(wiredNetEntry.profileHelp, fill=False,
|
dialog.vbox.pack_start(wiredNetEntry.profileHelp, fill=False,
|
||||||
expand=False)
|
expand=False)
|
||||||
dialog.vbox.pack_start(wiredNetEntry.hboxTemp, fill=False,
|
dialog.vbox.pack_start(wiredNetEntry.hboxTemp, fill=False,
|
||||||
expand=False)
|
expand=False)
|
||||||
dialog.vbox.pack_start(stoppopcheckbox,fill=False,expand=False)
|
dialog.vbox.pack_start(stoppopcheckbox, fill=False, expand=False)
|
||||||
dialog.show_all()
|
dialog.show_all()
|
||||||
|
|
||||||
wired_profiles = wiredNetEntry.comboProfileNames
|
wired_profiles = wiredNetEntry.comboProfileNames
|
||||||
@@ -957,7 +957,7 @@ class appGui:
|
|||||||
|
|
||||||
self.status_area.hide_all()
|
self.status_area.hide_all()
|
||||||
|
|
||||||
self.statusID = None
|
self.statusID = None
|
||||||
self.first_dialog_load = False
|
self.first_dialog_load = False
|
||||||
self.vpn_connection_pipe = None
|
self.vpn_connection_pipe = None
|
||||||
self.is_visible = True
|
self.is_visible = True
|
||||||
@@ -973,14 +973,14 @@ class appGui:
|
|||||||
gobject.timeout_add(600, self.update_statusbar)
|
gobject.timeout_add(600, self.update_statusbar)
|
||||||
gobject.timeout_add(100, self.pulse_progress_bar)
|
gobject.timeout_add(100, self.pulse_progress_bar)
|
||||||
|
|
||||||
def create_adhoc_network(self,widget=None):
|
def create_adhoc_network(self, widget=None):
|
||||||
""" Shows a dialog that creates a new adhoc network. """
|
""" Shows a dialog that creates a new adhoc network. """
|
||||||
print "Starting the Ad-Hoc Network Creation Process..."
|
print "Starting the Ad-Hoc Network Creation Process..."
|
||||||
dialog = gtk.Dialog(title = language['create_adhoc_network'],
|
dialog = gtk.Dialog(title = language['create_adhoc_network'],
|
||||||
flags = gtk.DIALOG_MODAL,
|
flags = gtk.DIALOG_MODAL,
|
||||||
buttons=(gtk.STOCK_OK, 1, gtk.STOCK_CANCEL, 2))
|
buttons=(gtk.STOCK_OK, 1, gtk.STOCK_CANCEL, 2))
|
||||||
dialog.set_has_separator(False)
|
dialog.set_has_separator(False)
|
||||||
dialog.set_size_request(400,-1)
|
dialog.set_size_request(400, -1)
|
||||||
self.useEncryptionCheckbox = gtk.CheckButton(language['use_wep_encryption'])
|
self.useEncryptionCheckbox = gtk.CheckButton(language['use_wep_encryption'])
|
||||||
self.useEncryptionCheckbox.set_active(False)
|
self.useEncryptionCheckbox.set_active(False)
|
||||||
ipEntry = LabelEntry(language['ip'] + ':')
|
ipEntry = LabelEntry(language['ip'] + ':')
|
||||||
@@ -998,9 +998,9 @@ class appGui:
|
|||||||
essidEntry.entry.set_text('My_Adhoc_Network')
|
essidEntry.entry.set_text('My_Adhoc_Network')
|
||||||
ipEntry.entry.set_text('169.254.12.10') #Just a random IP
|
ipEntry.entry.set_text('169.254.12.10') #Just a random IP
|
||||||
|
|
||||||
vboxA = gtk.VBox(False,0)
|
vboxA = gtk.VBox(False, 0)
|
||||||
vboxA.pack_start(self.useEncryptionCheckbox,fill=False,expand=False)
|
vboxA.pack_start(self.useEncryptionCheckbox, fill=False, expand=False)
|
||||||
vboxA.pack_start(self.keyEntry,fill=False,expand=False)
|
vboxA.pack_start(self.keyEntry, fill=False, expand=False)
|
||||||
vboxA.show()
|
vboxA.show()
|
||||||
dialog.vbox.pack_start(essidEntry)
|
dialog.vbox.pack_start(essidEntry)
|
||||||
dialog.vbox.pack_start(ipEntry)
|
dialog.vbox.pack_start(ipEntry)
|
||||||
@@ -1019,15 +1019,15 @@ class appGui:
|
|||||||
False) #useICSCheckbox.get_active())
|
False) #useICSCheckbox.get_active())
|
||||||
dialog.destroy()
|
dialog.destroy()
|
||||||
|
|
||||||
def toggleEncryptionCheck(self,widget=None):
|
def toggleEncryptionCheck(self, widget=None):
|
||||||
""" Toggles the encryption key entry box for the ad-hoc dialog. """
|
""" Toggles the encryption key entry box for the ad-hoc dialog. """
|
||||||
self.keyEntry.set_sensitive(self.useEncryptionCheckbox.get_active())
|
self.keyEntry.set_sensitive(self.useEncryptionCheckbox.get_active())
|
||||||
|
|
||||||
def disconnect(self,widget=None):
|
def disconnect(self, widget=None):
|
||||||
""" Disconnects from any active network. """
|
""" Disconnects from any active network. """
|
||||||
daemon.Disconnect()
|
daemon.Disconnect()
|
||||||
|
|
||||||
def about_dialog(self,widget,event=None):
|
def about_dialog(self, widget, event=None):
|
||||||
""" Displays an about dialog. """
|
""" Displays an about dialog. """
|
||||||
dialog = gtk.AboutDialog()
|
dialog = gtk.AboutDialog()
|
||||||
dialog.set_name("Wicd")
|
dialog.set_name("Wicd")
|
||||||
@@ -1037,7 +1037,7 @@ class appGui:
|
|||||||
dialog.run()
|
dialog.run()
|
||||||
dialog.destroy()
|
dialog.destroy()
|
||||||
|
|
||||||
def settings_dialog(self,widget,event=None):
|
def settings_dialog(self, widget, event=None):
|
||||||
""" Displays a general settings dialog. """
|
""" Displays a general settings dialog. """
|
||||||
dialog = self.wTree.get_widget("pref_dialog")
|
dialog = self.wTree.get_widget("pref_dialog")
|
||||||
dialog.set_title(language['preferences'])
|
dialog.set_title(language['preferences'])
|
||||||
@@ -1072,14 +1072,14 @@ class appGui:
|
|||||||
showlistradiobutton.set_active(True)
|
showlistradiobutton.set_active(True)
|
||||||
elif wired.GetWiredAutoConnectMethod() == 3:
|
elif wired.GetWiredAutoConnectMethod() == 3:
|
||||||
lastusedradiobutton.set_active(True)
|
lastusedradiobutton.set_active(True)
|
||||||
|
|
||||||
self.set_label("pref_driver_label", language['wpa_supplicant_driver'] +
|
self.set_label("pref_driver_label", language['wpa_supplicant_driver'] +
|
||||||
':')
|
':')
|
||||||
# Hack to get the combo box we need, which you can't do with glade.
|
# Hack to get the combo box we need, which you can't do with glade.
|
||||||
if not self.first_dialog_load:
|
if not self.first_dialog_load:
|
||||||
self.first_dialog_load = True
|
self.first_dialog_load = True
|
||||||
wpa_hbox = self.wTree.get_widget("hbox_wpa")
|
wpa_hbox = self.wTree.get_widget("hbox_wpa")
|
||||||
wpadrivercombo = gtk.combo_box_new_text()
|
wpadrivercombo = gtk.combo_box_new_text()
|
||||||
wpa_hbox.pack_end(wpadrivercombo)
|
wpa_hbox.pack_end(wpadrivercombo)
|
||||||
|
|
||||||
wpadrivers = ["hostap", "hermes", "madwifi", "atmel", "wext",
|
wpadrivers = ["hostap", "hermes", "madwifi", "atmel", "wext",
|
||||||
@@ -1090,7 +1090,7 @@ class appGui:
|
|||||||
if x == daemon.GetWPADriver() and not found:
|
if x == daemon.GetWPADriver() and not found:
|
||||||
found = True
|
found = True
|
||||||
elif not found:
|
elif not found:
|
||||||
i+=1
|
i += 1
|
||||||
wpadrivercombo.append_text(x)
|
wpadrivercombo.append_text(x)
|
||||||
|
|
||||||
# Set the active choice here. Doing it before all the items are
|
# Set the active choice here. Doing it before all the items are
|
||||||
@@ -1135,9 +1135,9 @@ class appGui:
|
|||||||
dns3Entry.set_sensitive(False)
|
dns3Entry.set_sensitive(False)
|
||||||
|
|
||||||
# Bold/Align the Wired Autoconnect label.
|
# Bold/Align the Wired Autoconnect label.
|
||||||
entryWiredAutoMethod.set_alignment(0,0)
|
entryWiredAutoMethod.set_alignment(0, 0)
|
||||||
atrlist = pango.AttrList()
|
atrlist = pango.AttrList()
|
||||||
atrlist.insert(pango.AttrWeight(pango.WEIGHT_BOLD,0,50))
|
atrlist.insert(pango.AttrWeight(pango.WEIGHT_BOLD, 0, 50))
|
||||||
entryWiredAutoMethod.set_attributes(atrlist)
|
entryWiredAutoMethod.set_attributes(atrlist)
|
||||||
dialog.show_all()
|
dialog.show_all()
|
||||||
|
|
||||||
@@ -1166,7 +1166,7 @@ class appGui:
|
|||||||
""" Sets the label for the given widget in wicd.glade. """
|
""" Sets the label for the given widget in wicd.glade. """
|
||||||
self.wTree.get_widget(glade_str).set_label(label)
|
self.wTree.get_widget(glade_str).set_label(label)
|
||||||
|
|
||||||
def connect_hidden(self,widget):
|
def connect_hidden(self, widget):
|
||||||
""" Prompts the user for a hidden network, then scans for it. """
|
""" Prompts the user for a hidden network, then scans for it. """
|
||||||
# Should display a dialog asking
|
# Should display a dialog asking
|
||||||
# for the ssid of a hidden network
|
# for the ssid of a hidden network
|
||||||
@@ -1187,7 +1187,7 @@ class appGui:
|
|||||||
else:
|
else:
|
||||||
dialog.destroy()
|
dialog.destroy()
|
||||||
|
|
||||||
def cancel_connect(self,widget):
|
def cancel_connect(self, widget):
|
||||||
""" Alerts the daemon to cancel the connection process. """
|
""" Alerts the daemon to cancel the connection process. """
|
||||||
#should cancel a connection if there
|
#should cancel a connection if there
|
||||||
#is one in progress
|
#is one in progress
|
||||||
@@ -1346,7 +1346,7 @@ class appGui:
|
|||||||
self.network_list.pack_start(label)
|
self.network_list.pack_start(label)
|
||||||
label.show()
|
label.show()
|
||||||
|
|
||||||
def save_settings(self, type, networkid, networkentry):
|
def save_settings(self, nettype, networkid, networkentry):
|
||||||
""" Verifies and saves the settings for the network entry. """
|
""" Verifies and saves the settings for the network entry. """
|
||||||
entry = networkentry.expander
|
entry = networkentry.expander
|
||||||
entlist = []
|
entlist = []
|
||||||
@@ -1367,65 +1367,19 @@ class appGui:
|
|||||||
for lblent in entlist:
|
for lblent in entlist:
|
||||||
if not misc.IsValidIP(lblent.get_text()):
|
if not misc.IsValidIP(lblent.get_text()):
|
||||||
misc.error(self.window, language['invalid_address'].
|
misc.error(self.window, language['invalid_address'].
|
||||||
replace('$A', lblent.label.get_label()))
|
replace('$A', lblent.label.get_label()))
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# Now save the settings.
|
# Now save the settings.
|
||||||
if type == "wireless":
|
if nettype == "wireless":
|
||||||
wireless.SetWirelessProperty(networkid, "automatic",
|
self.save_wireless_settings(networkid, entry)
|
||||||
noneToString(entry.checkboxAutoConnect.get_active()))
|
|
||||||
|
elif nettype == "wired":
|
||||||
|
self.save_wired_settings(entry)
|
||||||
|
|
||||||
if entry.checkboxStaticIP.get_active():
|
return True
|
||||||
wireless.SetWirelessProperty(networkid, "ip",
|
|
||||||
noneToString(entry.txtIP.get_text()))
|
def save_wired_settings(self, entry):
|
||||||
wireless.SetWirelessProperty(networkid, "netmask",
|
|
||||||
noneToString(entry.txtNetmask.get_text()))
|
|
||||||
wireless.SetWirelessProperty(networkid, "gateway",
|
|
||||||
noneToString(entry.txtGateway.get_text()))
|
|
||||||
else:
|
|
||||||
# Blank the values
|
|
||||||
wireless.SetWirelessProperty(networkid, "ip", '')
|
|
||||||
wireless.SetWirelessProperty(networkid, "netmask", '')
|
|
||||||
wireless.SetWirelessProperty(networkid, "gateway", '')
|
|
||||||
|
|
||||||
if entry.checkboxStaticDNS.get_active() and \
|
|
||||||
not entry.checkboxGlobalDNS.get_active():
|
|
||||||
wireless.SetWirelessProperty(networkid, 'use_static_dns', True)
|
|
||||||
wireless.SetWirelessProperty(networkid, 'use_global_dns', False)
|
|
||||||
wireless.SetWirelessProperty(networkid, 'dns1',
|
|
||||||
noneToString(entry.txtDNS1.get_text()))
|
|
||||||
wireless.SetWirelessProperty(networkid, 'dns2',
|
|
||||||
noneToString(entry.txtDNS2.get_text()))
|
|
||||||
wireless.SetWirelessProperty(networkid, 'dns3',
|
|
||||||
noneToString(entry.txtDNS3.get_text()))
|
|
||||||
elif entry.checkboxStaticDNS.get_active() and \
|
|
||||||
entry.checkboxGlobalDNS.get_active():
|
|
||||||
wireless.SetWirelessProperty(networkid, 'use_static_dns', True)
|
|
||||||
wireless.SetWirelessProperty(networkid, 'use_global_dns', True)
|
|
||||||
else:
|
|
||||||
wireless.SetWirelessProperty(networkid, 'use_static_dns', False)
|
|
||||||
wireless.SetWirelessProperty(networkid, 'use_global_dns', False)
|
|
||||||
wireless.SetWirelessProperty(networkid, 'dns1', '')
|
|
||||||
wireless.SetWirelessProperty(networkid, 'dns2', '')
|
|
||||||
wireless.SetWirelessProperty(networkid, 'dns3', '')
|
|
||||||
|
|
||||||
if entry.checkboxEncryption.get_active():
|
|
||||||
print "setting encryption info..."
|
|
||||||
encryptionInfo = entry.encryptionInfo
|
|
||||||
encrypt_methods = misc.LoadEncryptionMethods()
|
|
||||||
wireless.SetWirelessProperty(networkid, "enctype",
|
|
||||||
encrypt_methods[entry.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", "None")
|
|
||||||
|
|
||||||
config.SaveWirelessNetworkProfile(networkid)
|
|
||||||
|
|
||||||
elif type == "wired":
|
|
||||||
if entry.checkboxStaticIP.get_active():
|
if entry.checkboxStaticIP.get_active():
|
||||||
wired.SetWiredProperty("ip", noneToString(entry.txtIP.get_text()))
|
wired.SetWiredProperty("ip", noneToString(entry.txtIP.get_text()))
|
||||||
wired.SetWiredProperty("netmask", noneToString(entry.txtNetmask.get_text()))
|
wired.SetWiredProperty("netmask", noneToString(entry.txtNetmask.get_text()))
|
||||||
@@ -1437,23 +1391,76 @@ class appGui:
|
|||||||
|
|
||||||
if entry.checkboxStaticDNS.get_active() and \
|
if entry.checkboxStaticDNS.get_active() and \
|
||||||
not entry.checkboxGlobalDNS.get_active():
|
not entry.checkboxGlobalDNS.get_active():
|
||||||
wireless.SetWiredProperty('use_static_dns', True)
|
wired.SetWiredProperty('use_static_dns', True)
|
||||||
wireless.SetWiredProperty('use_global_dns', False)
|
wired.SetWiredProperty('use_global_dns', False)
|
||||||
wired.SetWiredProperty("dns1", noneToString(entry.txtDNS1.get_text()))
|
wired.SetWiredProperty("dns1", noneToString(entry.txtDNS1.get_text()))
|
||||||
wired.SetWiredProperty("dns2", noneToString(entry.txtDNS2.get_text()))
|
wired.SetWiredProperty("dns2", noneToString(entry.txtDNS2.get_text()))
|
||||||
wired.SetWiredProperty("dns3", noneToString(entry.txtDNS3.get_text()))
|
wired.SetWiredProperty("dns3", noneToString(entry.txtDNS3.get_text()))
|
||||||
elif entry.checkboxStaticDNS.get_active() and \
|
elif entry.checkboxStaticDNS.get_active() and \
|
||||||
entry.checkboxGlobalDNS.get_active():
|
entry.checkboxGlobalDNS.get_active():
|
||||||
wireless.SetWiredProperty('use_static_dns', True)
|
wired.SetWiredProperty('use_static_dns', True)
|
||||||
wireless.SetWiredProperty('use_global_dns', True)
|
wired.SetWiredProperty('use_global_dns', True)
|
||||||
else:
|
else:
|
||||||
wired.SetWiredProperty('use_static_dns', False)
|
wired.SetWiredProperty('use_static_dns', False)
|
||||||
wired.SetWiredProperty("dns1", '')
|
wired.SetWiredProperty("dns1", '')
|
||||||
wired.SetWiredProperty("dns2", '')
|
wired.SetWiredProperty("dns2", '')
|
||||||
wired.SetWiredProperty("dns3", '')
|
wired.SetWiredProperty("dns3", '')
|
||||||
|
|
||||||
config.SaveWiredNetworkProfile(entry.comboProfileNames.get_active_text())
|
config.SaveWiredNetworkProfile(entry.comboProfileNames.get_active_text())
|
||||||
return True
|
|
||||||
|
def save_wireless_settings(self, networkid, entry):
|
||||||
|
print 'networkid', networkid
|
||||||
|
wireless.SetWirelessProperty(networkid, "automatic",
|
||||||
|
noneToString(entry.checkboxAutoConnect.get_active()))
|
||||||
|
|
||||||
|
if entry.checkboxStaticIP.get_active():
|
||||||
|
wireless.SetWirelessProperty(networkid, "ip",
|
||||||
|
noneToString(entry.txtIP.get_text()))
|
||||||
|
wireless.SetWirelessProperty(networkid, "netmask",
|
||||||
|
noneToString(entry.txtNetmask.get_text()))
|
||||||
|
wireless.SetWirelessProperty(networkid, "gateway",
|
||||||
|
noneToString(entry.txtGateway.get_text()))
|
||||||
|
else:
|
||||||
|
# Blank the values
|
||||||
|
wireless.SetWirelessProperty(networkid, "ip", '')
|
||||||
|
wireless.SetWirelessProperty(networkid, "netmask", '')
|
||||||
|
wireless.SetWirelessProperty(networkid, "gateway", '')
|
||||||
|
|
||||||
|
if entry.checkboxStaticDNS.get_active() and \
|
||||||
|
not entry.checkboxGlobalDNS.get_active():
|
||||||
|
wireless.SetWirelessProperty(networkid, 'use_static_dns', True)
|
||||||
|
wireless.SetWirelessProperty(networkid, 'use_global_dns', False)
|
||||||
|
wireless.SetWirelessProperty(networkid, 'dns1',
|
||||||
|
noneToString(entry.txtDNS1.get_text()))
|
||||||
|
wireless.SetWirelessProperty(networkid, 'dns2',
|
||||||
|
noneToString(entry.txtDNS2.get_text()))
|
||||||
|
wireless.SetWirelessProperty(networkid, 'dns3',
|
||||||
|
noneToString(entry.txtDNS3.get_text()))
|
||||||
|
elif entry.checkboxStaticDNS.get_active() and \
|
||||||
|
entry.checkboxGlobalDNS.get_active():
|
||||||
|
wireless.SetWirelessProperty(networkid, 'use_static_dns', True)
|
||||||
|
wireless.SetWirelessProperty(networkid, 'use_global_dns', True)
|
||||||
|
else:
|
||||||
|
wireless.SetWirelessProperty(networkid, 'use_static_dns', False)
|
||||||
|
wireless.SetWirelessProperty(networkid, 'use_global_dns', False)
|
||||||
|
wireless.SetWirelessProperty(networkid, 'dns1', '')
|
||||||
|
wireless.SetWirelessProperty(networkid, 'dns2', '')
|
||||||
|
wireless.SetWirelessProperty(networkid, 'dns3', '')
|
||||||
|
|
||||||
|
if entry.checkboxEncryption.get_active():
|
||||||
|
print "setting encryption info..."
|
||||||
|
encryptionInfo = entry.encryptionInfo
|
||||||
|
encrypt_methods = misc.LoadEncryptionMethods()
|
||||||
|
wireless.SetWirelessProperty(networkid, "enctype",
|
||||||
|
encrypt_methods[entry.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", "None")
|
||||||
|
|
||||||
|
config.SaveWirelessNetworkProfile(networkid)
|
||||||
|
|
||||||
def edit_advanced(self, widget, event, ttype, networkid, networkentry):
|
def edit_advanced(self, widget, event, ttype, networkid, networkentry):
|
||||||
""" Display the advanced settings dialog.
|
""" Display the advanced settings dialog.
|
||||||
@@ -1472,12 +1479,12 @@ class appGui:
|
|||||||
dialog.vbox.pack_start(networkentry.expander.vboxAdvanced)
|
dialog.vbox.pack_start(networkentry.expander.vboxAdvanced)
|
||||||
dialog.show_all()
|
dialog.show_all()
|
||||||
while True:
|
while True:
|
||||||
if self.run_settings_dialog(dialog, networkid, networkentry):
|
if self.run_settings_dialog(dialog, ttype, networkid, networkentry):
|
||||||
break
|
break
|
||||||
dialog.vbox.remove(networkentry.expander.vboxAdvanced)
|
dialog.vbox.remove(networkentry.expander.vboxAdvanced)
|
||||||
dialog.destroy()
|
dialog.destroy()
|
||||||
|
|
||||||
def run_settings_dialog(self, dialog, networkid, networkentry):
|
def run_settings_dialog(self, dialog, nettype, networkid, networkentry):
|
||||||
""" Runs the settings dialog.
|
""" Runs the settings dialog.
|
||||||
|
|
||||||
Runs the settings dialog and returns True if settings are saved
|
Runs the settings dialog and returns True if settings are saved
|
||||||
@@ -1486,23 +1493,23 @@ class appGui:
|
|||||||
"""
|
"""
|
||||||
result = dialog.run()
|
result = dialog.run()
|
||||||
if result == gtk.RESPONSE_ACCEPT:
|
if result == gtk.RESPONSE_ACCEPT:
|
||||||
if self.save_settings(type, networkid, networkentry):
|
if self.save_settings(nettype, networkid, networkentry):
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def connect(self, widget, event, type, networkid, networkentry):
|
def connect(self, widget, event, nettype, networkid, networkentry):
|
||||||
""" Initiates the connection process in the daemon. """
|
""" Initiates the connection process in the daemon. """
|
||||||
cancelButton = self.wTree.get_widget("cancel_button")
|
cancelButton = self.wTree.get_widget("cancel_button")
|
||||||
cancelButton.set_sensitive(True)
|
cancelButton.set_sensitive(True)
|
||||||
|
|
||||||
if not self.save_settings(type, networkid, networkentry):
|
if not self.save_settings(nettype, networkid, networkentry):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
if type == "wireless":
|
if nettype == "wireless":
|
||||||
wireless.ConnectWireless(networkid)
|
wireless.ConnectWireless(networkid)
|
||||||
elif type == "wired":
|
elif nettype == "wired":
|
||||||
wired.ConnectWired()
|
wired.ConnectWired()
|
||||||
|
|
||||||
def exit(self, widget=None, event=None):
|
def exit(self, widget=None, event=None):
|
||||||
|
|||||||
Reference in New Issue
Block a user