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

Updated comments in misc.py

Updated some GUI elements
This commit is contained in:
compwiz18
2008-01-15 02:11:36 +00:00
parent 50ffd944f5
commit 03b7ead08f
4 changed files with 49 additions and 30 deletions

View File

@@ -41,10 +41,10 @@ import misc
_ = misc.get_gettext() _ = misc.get_gettext()
language = {} language = {}
language['configure_scripts'] = "Configure Scripts" language['configure_scripts'] = _("Configure Scripts")
language['before_script'] = "Pre-connection Script" language['before_script'] = _("Pre-connection Script")
language['after_script'] = "Post-connection Script" language['after_script'] = _("Post-connection Script")
language['disconnect_script'] = "Disconnection Script" language['disconnect_script'] = _("Disconnection Script")
bus = dbus.SystemBus() bus = dbus.SystemBus()
@@ -103,18 +103,22 @@ def get_script_info(network, network_type):
def write_scripts(network, network_type, script_info): def write_scripts(network, network_type, script_info):
"""Writes script info to disk and loads it into the daemon""" """Writes script info to disk and loads it into the daemon"""
con = ConfigParser.ConfigParser() con = ConfigParser.ConfigParser()
print "writing scripts, type",network_type
if network_type == "wired": if network_type == "wired":
con.read(wired_conf) con.read(wired_conf)
if con.has_section(network): if con.has_section(network):
con.add_section(network)
con.set(network, "beforescript", script_info["pre_entry"]) con.set(network, "beforescript", script_info["pre_entry"])
con.set(network, "afterscript", script_info["post_entry"]) con.set(network, "afterscript", script_info["post_entry"])
con.set(network, "disconnectscript", script_info["disconnect_entry"]) con.set(network, "disconnectscript", script_info["disconnect_entry"])
con.write(open(wired_conf, "w")) con.write(open(wired_conf, "w"))
config.ReadWiredNetworkProfile(network) config.ReadWiredNetworkProfile(network)
config.SaveWiredNetworkProfile(network)
else: else:
bssid = wireless.GetWirelessProperty(int(network), "bssid") bssid = wireless.GetWirelessProperty(int(network), "bssid")
con.read(wireless_conf) con.read(wireless_conf)
if con.has_section(bssid): if con.has_section(bssid):
con.add_section(bssid)
con.set(bssid, "beforescript", script_info["pre_entry"]) con.set(bssid, "beforescript", script_info["pre_entry"])
con.set(bssid, "afterscript", script_info["post_entry"]) con.set(bssid, "afterscript", script_info["post_entry"])
con.set(bssid, "disconnectscript", script_info["disconnect_entry"]) con.set(bssid, "disconnectscript", script_info["disconnect_entry"])
@@ -145,9 +149,9 @@ def main (argv):
post_entry = wTree.get_widget("post_entry") post_entry = wTree.get_widget("post_entry")
disconnect_entry = wTree.get_widget("disconnect_entry") disconnect_entry = wTree.get_widget("disconnect_entry")
pre_entry.set_text(none_to_blank(script_info["pre_entry"])) pre_entry.set_text(none_to_blank(script_info.get("pre_entry")))
post_entry.set_text(none_to_blank(script_info["post_entry"])) post_entry.set_text(none_to_blank(script_info.get("post_entry")))
disconnect_entry.set_text(none_to_blank(script_info["disconnect_entry"])) disconnect_entry.set_text(none_to_blank(script_info.get("disconnect_entry")))
dialog.show_all() dialog.show_all()

View File

@@ -1380,7 +1380,7 @@ class ConnectionStatus():
def usage(): def usage():
print """ print """
wicd 1.33 wicd 1.5.0
wireless (and wired) connection daemon. wireless (and wired) connection daemon.
Arguments: Arguments:

19
gui.py
View File

@@ -332,7 +332,8 @@ class PrettyNetworkEntry(gtk.HBox):
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 = LinkButton(language["connect"]) self.connectButton = gtk.Button(stock=gtk.STOCK_CONNECT)
#self.connectButton = LinkButton(language["connect"])
self.connectButton.show() self.connectButton.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(self.connectButton,fill=False,expand=False) self.tempVBox.pack_start(self.connectButton,fill=False,expand=False)
@@ -434,7 +435,21 @@ class NetworkEntry(gtk.Expander):
self.txtDNS1 = LabelEntry(language['dns'] + ' ' + language['1']) self.txtDNS1 = LabelEntry(language['dns'] + ' ' + language['1'])
self.txtDNS2 = LabelEntry(language['dns'] + ' ' + language['2']) self.txtDNS2 = LabelEntry(language['dns'] + ' ' + language['2'])
self.txtDNS3 = LabelEntry(language['dns'] + ' ' + language['3']) self.txtDNS3 = LabelEntry(language['dns'] + ' ' + language['3'])
self.scriptButton = LinkButton(language['scripts']) #self.scriptButton = LinkButton(language['scripts'])
image_hbox = gtk.HBox()
self.scriptButton = gtk.Button() #language['scripts']) #, stock=gtk.STOCK_EXECUTE)
label = gtk.Label(language['scripts'])
image = gtk.Image()
image.set_from_icon_name ('execute', 4)
image.set_padding(4, 0)
self.scriptButton.set_alignment(.5 , .5)
image.set_alignment(1, .5)
label.set_alignment(0, .5)
image_hbox.pack_start(image,fill=True, expand=True)
image_hbox.pack_start(label,fill=True, expand=True)
self.scriptButton.add(image_hbox)
#self.scriptButton.child.set_alignment(.5, .5)
#self.scriptButton.set_use_stock(True)
self.checkboxStaticIP = gtk.CheckButton(language['use_static_ip']) self.checkboxStaticIP = gtk.CheckButton(language['use_static_ip'])
self.checkboxStaticDNS = gtk.CheckButton(language['use_static_dns']) self.checkboxStaticDNS = gtk.CheckButton(language['use_static_dns'])
self.checkboxGlobalDNS = gtk.CheckButton(language['use_global_dns']) self.checkboxGlobalDNS = gtk.CheckButton(language['use_global_dns'])

12
misc.py
View File

@@ -143,7 +143,7 @@ def ParseEncryption(network):
for x in template: for x in template:
x = x.strip("\n") x = x.strip("\n")
if y > 4: if y > 4:
# blah blah replace stuff # replace values
x = x.replace("$_SCAN","0") x = x.replace("$_SCAN","0")
for t in network: for t in network:
# Don't bother if z's value is None cause it will cause errors # Don't bother if z's value is None cause it will cause errors
@@ -152,15 +152,15 @@ def ParseEncryption(network):
z = z + "\n" + x z = z + "\n" + x
y += 1 y += 1
# Write the data to the files # Write the data to the files
# then chmod them so they can't be read by evil little munchkins # then chmod them so they can't be read by normal users
fileness = open(wpath.networks + network["bssid"].replace(":", "").lower(), file = open(wpath.networks + network["bssid"].replace(":", "").lower(),
"w") "w")
os.chmod(wpath.networks + network["bssid"].replace(":", "").lower(), 0600) os.chmod(wpath.networks + network["bssid"].replace(":", "").lower(), 0600)
os.chown(wpath.networks + network["bssid"].replace(":", "").lower(), 0, 0) os.chown(wpath.networks + network["bssid"].replace(":", "").lower(), 0, 0)
# We could do this above, but we'd like to permod (permission mod) # We could do this above, but we'd like to read protect
# them before we write, so that it can't be read. # them before we write, so that it can't be read.
fileness.write(z) file.write(z)
fileness.close() file.close()
def LoadEncryptionMethods(): def LoadEncryptionMethods():
''' Load encryption methods from configuration files ''' Load encryption methods from configuration files