mirror of
https://github.com/gryf/wicd.git
synced 2025-12-19 20:38:00 +01:00
Merged from rworkman's frankencurses branch.
Includes features from experimental-rworkman Curses client installs now. :-) Includes r237 of experimental (1.6)
This commit is contained in:
0
curses/prefs_curses.py
Normal file → Executable file
0
curses/prefs_curses.py
Normal file → Executable file
0
encryption/templates/peap-tkip
Executable file → Normal file
0
encryption/templates/peap-tkip
Executable file → Normal file
Binary file not shown.
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.5 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.6 KiB |
@@ -2,20 +2,29 @@
|
||||
|
||||
# pm-utils hook to handle suspend/resume properly for wicd
|
||||
|
||||
. "${PM_FUNCTIONS}" || . "${FUNCTIONS}"
|
||||
if [ -r "${PM_FUNCTIONS}" ]; then
|
||||
. "${PM_FUNCTIONS}"
|
||||
elif [ -r "${FUNCTIONS}" ]; then
|
||||
. "${FUNCTIONS}"
|
||||
else
|
||||
# pm-utils version is too old, or something else is wrong
|
||||
exit $NA
|
||||
fi
|
||||
|
||||
RETVAL=0 # Set this to 0 initially
|
||||
|
||||
wicd_suspend()
|
||||
{
|
||||
# Put wifi interface down
|
||||
%LIB%suspend.py 2>/dev/null
|
||||
return $NA
|
||||
%LIB%suspend.py 1>/dev/null 2>/dev/null
|
||||
RETVAL=$?
|
||||
}
|
||||
|
||||
wicd_resume()
|
||||
{
|
||||
# Bring wifi interface back up
|
||||
%LIB%autoconnect.py 2>/dev/null
|
||||
return $NA
|
||||
%LIB%autoconnect.py 1>/dev/null 2>/dev/null
|
||||
RETVAL=$?
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
@@ -29,3 +38,32 @@ case "$1" in
|
||||
;;
|
||||
esac
|
||||
|
||||
# We can't return a nonzero exit code (aside from $NA, $DX, and $NX) to
|
||||
# to pm-utils or the entire sleep operation will be inhibited, so...
|
||||
# No matter what we do, the log prefix and message will conflict a bit.
|
||||
case "$RETVAL" in
|
||||
0)
|
||||
exit $RETVAL
|
||||
;;
|
||||
1)
|
||||
# Probably the daemon isn't running if this happens
|
||||
echo "Unable to connect to wicd daemon - is it running?"
|
||||
exit $DX
|
||||
;;
|
||||
2)
|
||||
# This will occur if the daemon encounters an error
|
||||
echo "Wicd daemon was unable to suspend the network."
|
||||
exit $DX
|
||||
;;
|
||||
3)
|
||||
# Will only be returned by autoconnect.py
|
||||
# This should never happen, but just in case...
|
||||
echo "Wicd daemon failed to autoconnect on resume."
|
||||
exit $DX
|
||||
;;
|
||||
*)
|
||||
echo "Unknown exit code."
|
||||
exit $NA
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
12
other/wicd.conf → in/other=wicd.conf.in
Executable file → Normal file
12
other/wicd.conf → in/other=wicd.conf.in
Executable file → Normal file
@@ -2,6 +2,7 @@
|
||||
<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
|
||||
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
|
||||
<busconfig>
|
||||
|
||||
<policy user="root">
|
||||
<allow own="org.wicd.daemon"/>
|
||||
<allow send_destination="org.wicd.daemon"/>
|
||||
@@ -13,6 +14,7 @@
|
||||
<allow send_destination="org.wicd.daemon.config"/>
|
||||
<allow send_interface="org.wicd.daemon.config"/>
|
||||
</policy>
|
||||
|
||||
<policy at_console="true">
|
||||
<allow send_destination="org.wicd.daemon"/>
|
||||
<allow send_interface="org.wicd.daemon"/>
|
||||
@@ -22,8 +24,18 @@
|
||||
<allow send_interface="org.wicd.daemon.wired"/>
|
||||
<allow send_destination="org.wicd.daemon.config"/>
|
||||
<allow send_interface="org.wicd.daemon.config"/>
|
||||
<allow send_interface="org.freedesktop.DBus.Introspectable"/>
|
||||
</policy>
|
||||
|
||||
<policy context="default">
|
||||
<deny own="org.wicd.daemon"/>
|
||||
</policy>
|
||||
|
||||
<!-- This Unix group will have permission to use Wicd's gui -->
|
||||
<policy group="%WICDGROUP%">
|
||||
<allow send_interface="org.freedesktop.DBus.Introspectable"/>
|
||||
<allow send_destination="org.wicd.daemon"/>
|
||||
<allow send_interface="org.wicd.daemon"/>
|
||||
</policy>
|
||||
|
||||
</busconfig>
|
||||
2
in/scripts=wicd-curses.in
Executable file
2
in/scripts=wicd-curses.in
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/bin/bash
|
||||
exec python -O %LIB%wicd-curses.py $@
|
||||
@@ -55,6 +55,7 @@ pidfile = '%PIDFILE%'
|
||||
initfile = '%INITFILE%'
|
||||
# stores only the file name, i.e. wicd
|
||||
initfilename = '%INITFILENAME%'
|
||||
wicd_group = '%WICDGROUP%'
|
||||
|
||||
# BOOLEANS
|
||||
no_install_pmutils = %NO_INSTALL_PMUTILS%
|
||||
@@ -63,6 +64,7 @@ no_install_man = %NO_INSTALL_MAN%
|
||||
no_install_kde = %NO_INSTALL_KDE%
|
||||
no_install_acpi = %NO_INSTALL_ACPI%
|
||||
no_install_docs = %NO_INSTALL_DOCS%
|
||||
no_install_ncurses = %NO_INSTALL_NCURSES%
|
||||
|
||||
def chdir(file):
|
||||
"""Change directory to the location of the specified file.
|
||||
|
||||
81
setup.py
81
setup.py
@@ -20,6 +20,7 @@ from distutils.extension import Extension
|
||||
import os
|
||||
import shutil
|
||||
import sys
|
||||
import subprocess
|
||||
|
||||
# Be sure to keep this updated!
|
||||
# VERSIONNUMBER
|
||||
@@ -41,21 +42,9 @@ except Exception, e:
|
||||
class configure(Command):
|
||||
description = "configure the paths that Wicd will be installed to"
|
||||
|
||||
# lib = '/usr/share/wicd/'
|
||||
# etc = '/etc/wicd/'
|
||||
# images = '/usr/share/pixmaps/wicd/'
|
||||
# encryption = etc + 'encryption/templates/'
|
||||
# bin = current
|
||||
# networks = '/var/lib/wicd/configurations/'
|
||||
# log = '/var/log/wicd/'
|
||||
#
|
||||
# python = '/usr/bin/python'
|
||||
|
||||
user_options = [
|
||||
# these first bunch are DIRECTORIES.
|
||||
# they need to end a slash ("/")
|
||||
# which will automatically be tacked on
|
||||
# in the finalize_options method
|
||||
# The first bunch is DIRECTORIES - they need to end with a slash ("/"),
|
||||
# which will automatically be tacked on in the finalize_options method
|
||||
('lib=', None, 'set the lib directory'),
|
||||
('share=', None, 'set the share directory'),
|
||||
('etc=', None, 'set the etc directory'),
|
||||
@@ -72,7 +61,6 @@ class configure(Command):
|
||||
('dbus=', None, 'set the directory the dbus config file is stored in'),
|
||||
('desktop=', None, 'set the directory the .desktop file is stored in'),
|
||||
('icons=', None, "set the base directory for the .desktop file's icons"),
|
||||
# ('pixmaps=', None, 'directory for images'),
|
||||
('translations=', None, 'set the directory translations are stored in'),
|
||||
('autostart=', None, 'set the directory that will be autostarted on desktop login'),
|
||||
('init=', None, 'set the directory for the init file'),
|
||||
@@ -80,23 +68,24 @@ class configure(Command):
|
||||
('mandir=', None, 'set the directory for the man pages'),
|
||||
('kdedir=', None, 'set the kde autostart directory'),
|
||||
|
||||
# anything after here is a FILE.
|
||||
# in other words, a slash ("/") will not automatically
|
||||
# be added to the end of the path.
|
||||
# do NOT remove the python= entry as it signals the beginning
|
||||
# of the file section.
|
||||
# Anything after this is a FILE; in other words, a slash ("/") will
|
||||
# not automatically be added to the end of the path.
|
||||
# Do NOT remove the python= entry, as it signals the beginning of
|
||||
# the file section.
|
||||
('python=', None, 'set the path to the Python executable'),
|
||||
('pidfile=', None, 'set the pid file'),
|
||||
('initfile=', None, 'set the init file to use'),
|
||||
('initfilename=', None, "set the name of the init file (don't use)"),
|
||||
('wicdgroup=', None, "set the name of the group used for wicd"),
|
||||
|
||||
# switches
|
||||
# Configure switches
|
||||
('no-install-init', None, "do not install the init file"),
|
||||
('no-install-man', None, 'do not install the man file'),
|
||||
('no-install-kde', None, 'do not install the kde autostart file'),
|
||||
('no-install-acpi', None, 'do not install the suspend.d and resume.d acpi scripts'),
|
||||
('no-install-pmutils', None, 'do not install the pm-utils hooks'),
|
||||
('no-install-docs', None, 'do not install the auxiliary documentation')
|
||||
('no-install-docs', None, 'do not install the auxiliary documentation'),
|
||||
('no-install-ncurses', None, 'do not install the ncurses client')
|
||||
]
|
||||
|
||||
|
||||
@@ -129,9 +118,9 @@ class configure(Command):
|
||||
self.no_install_acpi = False
|
||||
self.no_install_pmutils = False
|
||||
self.no_install_docs = False
|
||||
self.no_install_ncurses = False
|
||||
|
||||
# figure out what the default init file
|
||||
# location should be on several different distros
|
||||
# Determine the default init file location on several different distros
|
||||
|
||||
self.distro_detect_failed = False
|
||||
|
||||
@@ -173,9 +162,46 @@ class configure(Command):
|
||||
'If you have specified --init and --initfile, configure will continue. ' + \
|
||||
'Please report this warning, along with the name of your ' + \
|
||||
'distribution, to the wicd developers.'
|
||||
|
||||
# Try to get the pm-utils sleep hooks directory from pkg-config and
|
||||
# the kde prefix from kde-config
|
||||
# Don't run these in a shell because it's not needed and because shell
|
||||
# swallows the OSError we would get if {pkg,kde}-config do not exist
|
||||
# If we don't get anything from *-config, or it didn't run properly,
|
||||
# or the path is not a proper absolute path, raise an error
|
||||
try:
|
||||
pmtemp = subprocess.Popen(["pkg-config","--variable=pm_sleephooks","pm-utils"], stdout=subprocess.PIPE)
|
||||
returncode = pmtemp.wait() # let it finish, and get the exit code
|
||||
pmutils_candidate = pmtemp.stdout.readline().strip() # read stdout
|
||||
if len(pmutils_candidate) == 0 or returncode != 0 or not os.path.isabs(pmutils_candidate):
|
||||
raise ValueError
|
||||
else:
|
||||
self.pmutils = pmutils_candidate
|
||||
except (OSError, ValueError):
|
||||
pass # use our default
|
||||
|
||||
try:
|
||||
kdetemp = subprocess.Popen(["kde-config","--prefix"], stdout=subprocess.PIPE)
|
||||
returncode = kdetemp.wait() # let it finish, and get the exit code
|
||||
kdedir_candidate = kdetemp.stdout.readline().strip() # read stdout
|
||||
if len(kdedir_candidate) == 0 or returncode != 0 or not os.path.isabs(kdedir_candidate):
|
||||
raise ValueError
|
||||
else:
|
||||
self.kdedir = kdedir_candidate + '/share/autostart'
|
||||
except (OSError, ValueError):
|
||||
# If kde-config isn't present or returns an error, then we can
|
||||
# assume that kde isn't installed on the user's system
|
||||
self.no_install_kde = True
|
||||
# If it turns out that the assumption above is wrong, then we'll
|
||||
# do this instead:
|
||||
#pass # use our default
|
||||
|
||||
|
||||
self.python = '/usr/bin/python'
|
||||
self.pidfile = '/var/run/wicd/wicd.pid'
|
||||
self.initfilename = os.path.basename(self.initfile)
|
||||
self.wicdgroup = 'users'
|
||||
|
||||
|
||||
def finalize_options(self):
|
||||
if self.distro_detect_failed == True:
|
||||
@@ -368,12 +394,17 @@ try:
|
||||
(wpath.backends, ['wicd/backends/be-external.py', 'wicd/backends/be-ioctl.py']),
|
||||
(wpath.autostart, ['other/wicd-tray.desktop', ]),
|
||||
]
|
||||
if not wpath.no_install_ncurses:
|
||||
data.append(( wpath.lib, ['curses/curses_misc.py']))
|
||||
data.append(( wpath.lib, ['curses/prefs_curses.py']))
|
||||
data.append(( wpath.lib, ['curses/wicd-curses.py']))
|
||||
data.append(( wpath.bin, ['scripts/wicd-curses']))
|
||||
piddir = os.path.dirname(wpath.pidfile)
|
||||
if not piddir.endswith('/'):
|
||||
piddir += '/'
|
||||
data.append (( piddir, [] ))
|
||||
if not wpath.no_install_docs:
|
||||
data.append(( wpath.docdir, [ 'INSTALL', 'LICENSE', 'AUTHORS', 'README' ]))
|
||||
data.append(( wpath.docdir, [ 'INSTALL', 'LICENSE', 'AUTHORS', 'README', 'CHANGES' ]))
|
||||
if not wpath.no_install_kde:
|
||||
data.append(( wpath.kdedir, [ 'other/wicd-tray.desktop' ]))
|
||||
if not wpath.no_install_init:
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
#
|
||||
# Copyright (C) 2007 Adam Blackburn
|
||||
# Copyright (C) 2007 Dan O'Reilly
|
||||
# Copyright (C) 2007 - 2008 Adam Blackburn
|
||||
# Copyright (C) 2007 - 2008 Dan O'Reilly
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License Version 2 as
|
||||
@@ -21,22 +21,37 @@ import dbus
|
||||
import time
|
||||
import gobject
|
||||
import sys
|
||||
from dbus.mainloop.glib import DBusGMainLoop
|
||||
|
||||
DBusGMainLoop(set_as_default=True)
|
||||
bus = dbus.SystemBus()
|
||||
proxy_obj = bus.get_object('org.wicd.daemon', '/org/wicd/daemon')
|
||||
daemon = dbus.Interface(proxy_obj, 'org.wicd.daemon')
|
||||
loop = gobject.MainLoop()
|
||||
if getattr(dbus, 'version', (0, 0, 0)) < (0, 80, 0):
|
||||
import dbus.glib
|
||||
else:
|
||||
from dbus.mainloop.glib import DBusGMainLoop
|
||||
DBusGMainLoop(set_as_default=True)
|
||||
|
||||
try:
|
||||
bus = dbus.SystemBus()
|
||||
proxy_obj = bus.get_object('org.wicd.daemon', '/org/wicd/daemon')
|
||||
daemon = dbus.Interface(proxy_obj, 'org.wicd.daemon')
|
||||
except Exception, e:
|
||||
print>>sys.stderr, "Exception caught: %s" % str(e)
|
||||
print>>sys.stderr, 'Could not connect to daemon.'
|
||||
sys.exit(1)
|
||||
|
||||
def handler(*args):
|
||||
loop.quit()
|
||||
|
||||
print daemon.Hello()
|
||||
time.sleep(3)
|
||||
daemon.SetSuspend(False)
|
||||
if not daemon.CheckIfConnecting():
|
||||
daemon.SetForcedDisconnect(False)
|
||||
daemon.AutoConnect(True, reply_handler=handler, error_handler=handler)
|
||||
def error_handler(*args):
|
||||
print>>sys.stderr, 'Async error autoconnecting.'
|
||||
sys.exit(3)
|
||||
|
||||
if __name__ == '__main__':
|
||||
try:
|
||||
time.sleep(3)
|
||||
daemon.SetSuspend(False)
|
||||
if not daemon.CheckIfConnecting():
|
||||
daemon.SetForcedDisconnect(False)
|
||||
daemon.AutoConnect(True, reply_handler=handler, error_handler=handler)
|
||||
except Exception, e:
|
||||
print>>sys.stderr, "Exception caught: %s" % str(e)
|
||||
print>>sys.stderr, 'Error autoconnecting.'
|
||||
sys.exit(2)
|
||||
|
||||
84
wicd/gui.py
84
wicd/gui.py
@@ -579,8 +579,8 @@ class appGui(object):
|
||||
|
||||
"""
|
||||
if fresh:
|
||||
# Even if it is None, it can still be passed.
|
||||
wireless.SetHiddenNetworkESSID(noneToString(hidden))
|
||||
if hidden:
|
||||
wireless.SetHiddenNetworkESSID(noneToString(hidden))
|
||||
self.refresh_clicked()
|
||||
return
|
||||
print "refreshing..."
|
||||
@@ -665,90 +665,14 @@ class appGui(object):
|
||||
|
||||
# Now save the settings.
|
||||
if nettype == "wireless":
|
||||
if not self.save_wireless_settings(networkid, entry, networkentry):
|
||||
if not networkentry.save_wireless_settings(networkid):
|
||||
return False
|
||||
|
||||
elif nettype == "wired":
|
||||
if not self.save_wired_settings(entry):
|
||||
if not networkentry.save_wired_settings():
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
def _save_gen_settings(self, entry):
|
||||
""" Save settings common to wired and wireless settings dialogs. """
|
||||
if entry.chkbox_static_ip.get_active():
|
||||
entry.set_net_prop("ip", noneToString(entry.txt_ip.get_text()))
|
||||
entry.set_net_prop("netmask", noneToString(entry.txt_netmask.get_text()))
|
||||
entry.set_net_prop("gateway", noneToString(entry.txt_gateway.get_text()))
|
||||
else:
|
||||
entry.set_net_prop("ip", '')
|
||||
entry.set_net_prop("netmask", '')
|
||||
entry.set_net_prop("gateway", '')
|
||||
|
||||
if entry.chkbox_static_dns.get_active() and \
|
||||
not entry.chkbox_global_dns.get_active():
|
||||
entry.set_net_prop('use_static_dns', True)
|
||||
entry.set_net_prop('use_global_dns', False)
|
||||
entry.set_net_prop('dns_domain', noneToString(entry.txt_domain.get_text()))
|
||||
entry.set_net_prop("search_domain", noneToString(entry.txt_search_dom.get_text()))
|
||||
entry.set_net_prop("dns1", noneToString(entry.txt_dns_1.get_text()))
|
||||
entry.set_net_prop("dns2", noneToString(entry.txt_dns_2.get_text()))
|
||||
entry.set_net_prop("dns3", noneToString(entry.txt_dns_3.get_text()))
|
||||
elif entry.chkbox_static_dns.get_active() and \
|
||||
entry.chkbox_global_dns.get_active():
|
||||
entry.set_net_prop('use_static_dns', True)
|
||||
entry.set_net_prop('use_global_dns', True)
|
||||
else:
|
||||
entry.set_net_prop('use_static_dns', False)
|
||||
entry.set_net_prop('use_global_dns', False)
|
||||
entry.set_net_prop('dns_domain', '')
|
||||
entry.set_net_prop("search_domain", '')
|
||||
entry.set_net_prop("dns1", '')
|
||||
entry.set_net_prop("dns2", '')
|
||||
entry.set_net_prop("dns3", '')
|
||||
|
||||
def save_wired_settings(self, entry):
|
||||
""" Save wired network settings. """
|
||||
self._save_gen_settings(entry)
|
||||
wired.SaveWiredNetworkProfile(entry.prof_name)
|
||||
return True
|
||||
|
||||
def save_wireless_settings(self, networkid, entry, netent):
|
||||
""" Save wireless network settings. """
|
||||
# Check encryption info
|
||||
if entry.chkbox_encryption.get_active():
|
||||
print "setting encryption info..."
|
||||
encryption_info = entry.encryption_info
|
||||
encrypt_methods = misc.LoadEncryptionMethods()
|
||||
entry.set_net_prop("enctype",
|
||||
encrypt_methods[entry.combo_encryption.get_active()][1])
|
||||
for x in encryption_info:
|
||||
if encryption_info[x].get_text() == "":
|
||||
error(self.window, language['encrypt_info_missing'])
|
||||
return False
|
||||
entry.set_net_prop(x, noneToString(encryption_info[x].
|
||||
get_text()))
|
||||
elif not entry.chkbox_encryption.get_active() and \
|
||||
wireless.GetWirelessProperty(networkid, "encryption"):
|
||||
error(self.window, language['enable_encryption'])
|
||||
return False
|
||||
else:
|
||||
print 'encryption is ' + str(wireless.GetWirelessProperty(networkid,
|
||||
"encryption"))
|
||||
print "no encryption specified..."
|
||||
entry.set_net_prop("enctype", "None")
|
||||
self._save_gen_settings(entry)
|
||||
entry.set_net_prop("automatic",
|
||||
noneToString(netent.chkbox_autoconnect.get_active()))
|
||||
|
||||
if entry.chkbox_global_settings.get_active():
|
||||
entry.set_net_prop('use_settings_globally', True)
|
||||
else:
|
||||
entry.set_net_prop('use_settings_globally', False)
|
||||
wireless.RemoveGlobalEssidEntry(networkid)
|
||||
|
||||
wireless.SaveWirelessNetworkProfile(networkid)
|
||||
return True
|
||||
|
||||
def edit_advanced(self, widget, event, ttype, networkid, networkentry):
|
||||
""" Display the advanced settings dialog.
|
||||
|
||||
@@ -237,6 +237,39 @@ class AdvancedSettingsDialog(gtk.Dialog):
|
||||
super(AdvancedSettingsDialog, self).destroy()
|
||||
self.destroy()
|
||||
del self
|
||||
|
||||
def save_settings(self):
|
||||
""" Save settings common to wired and wireless settings dialogs. """
|
||||
if self.chkbox_static_ip.get_active():
|
||||
self.set_net_prop("ip", noneToString(self.txt_ip.get_text()))
|
||||
self.set_net_prop("netmask", noneToString(self.txt_netmask.get_text()))
|
||||
self.set_net_prop("gateway", noneToString(self.txt_gateway.get_text()))
|
||||
else:
|
||||
self.set_net_prop("ip", '')
|
||||
self.set_net_prop("netmask", '')
|
||||
self.set_net_prop("gateway", '')
|
||||
|
||||
if self.chkbox_static_dns.get_active() and \
|
||||
not self.chkbox_global_dns.get_active():
|
||||
self.set_net_prop('use_static_dns', True)
|
||||
self.set_net_prop('use_global_dns', False)
|
||||
self.set_net_prop('dns_domain', noneToString(self.txt_domain.get_text()))
|
||||
self.set_net_prop("search_domain", noneToString(self.txt_search_dom.get_text()))
|
||||
self.set_net_prop("dns1", noneToString(self.txt_dns_1.get_text()))
|
||||
self.set_net_prop("dns2", noneToString(self.txt_dns_2.get_text()))
|
||||
self.set_net_prop("dns3", noneToString(self.txt_dns_3.get_text()))
|
||||
elif self.chkbox_static_dns.get_active() and \
|
||||
self.chkbox_global_dns.get_active():
|
||||
self.set_net_prop('use_static_dns', True)
|
||||
self.set_net_prop('use_global_dns', True)
|
||||
else:
|
||||
self.set_net_prop('use_static_dns', False)
|
||||
self.set_net_prop('use_global_dns', False)
|
||||
self.set_net_prop('dns_domain', '')
|
||||
self.set_net_prop("search_domain", '')
|
||||
self.set_net_prop("dns1", '')
|
||||
self.set_net_prop("dns2", '')
|
||||
self.set_net_prop("dns3", '')
|
||||
|
||||
|
||||
class WiredSettingsDialog(AdvancedSettingsDialog):
|
||||
@@ -263,6 +296,11 @@ class WiredSettingsDialog(AdvancedSettingsDialog):
|
||||
self.txt_search_dom.set_text(self.format_entry("search_domain"))
|
||||
self.chkbox_global_dns.set_active(bool(wired.GetWiredProperty("use_global_dns")))
|
||||
self.reset_static_checkboxes()
|
||||
|
||||
def save_settings(self):
|
||||
AdvancedSettingsDialog.save_settings(self)
|
||||
wired.SaveWiredNetworkProfile(self.prof_name)
|
||||
return True
|
||||
|
||||
def format_entry(self, label):
|
||||
""" Helper method to fetch and format wired properties. """
|
||||
@@ -353,7 +391,6 @@ class WirelessSettingsDialog(AdvancedSettingsDialog):
|
||||
self.chkbox_global_settings.set_active(bool(wireless.GetWirelessProperty(networkID,
|
||||
'use_settings_globally')))
|
||||
|
||||
|
||||
activeID = -1 # Set the menu to this item when we are done
|
||||
user_enctype = wireless.GetWirelessProperty(networkID, "enctype")
|
||||
for x, enc_type in enumerate(self.encrypt_types):
|
||||
@@ -368,6 +405,40 @@ class WirelessSettingsDialog(AdvancedSettingsDialog):
|
||||
else:
|
||||
self.combo_encryption.set_active(0)
|
||||
self.change_encrypt_method()
|
||||
|
||||
def save_settings(self, networkid):
|
||||
# Check encryption info
|
||||
if self.chkbox_encryption.get_active():
|
||||
print "setting encryption info..."
|
||||
encryption_info = self.encryption_info
|
||||
encrypt_methods = misc.LoadEncryptionMethods()
|
||||
self.set_net_prop("enctype",
|
||||
encrypt_methods[self.combo_encryption.get_active()][1])
|
||||
for x in encryption_info:
|
||||
if encryption_info[x].get_text() == "":
|
||||
error(self, language['encrypt_info_missing'])
|
||||
return False
|
||||
self.set_net_prop(x, noneToString(encryption_info[x].
|
||||
get_text()))
|
||||
elif not self.chkbox_encryption.get_active() and \
|
||||
wireless.GetWirelessProperty(networkid, "encryption"):
|
||||
error(self, language['enable_encryption'])
|
||||
return False
|
||||
else:
|
||||
print 'encryption is ' + str(wireless.GetWirelessProperty(networkid,
|
||||
"encryption"))
|
||||
print "no encryption specified..."
|
||||
self.set_net_prop("enctype", "None")
|
||||
AdvancedSettingsDialog.save_settings(self)
|
||||
|
||||
if self.chkbox_global_settings.get_active():
|
||||
self.set_net_prop('use_settings_globally', True)
|
||||
else:
|
||||
self.set_net_prop('use_settings_globally', False)
|
||||
wireless.RemoveGlobalEssidEntry(networkid)
|
||||
|
||||
wireless.SaveWirelessNetworkProfile(networkid)
|
||||
return True
|
||||
|
||||
def format_entry(self, networkid, label):
|
||||
""" Helper method for fetching/formatting wireless properties. """
|
||||
@@ -575,6 +646,10 @@ class WiredNetworkEntry(NetworkEntry):
|
||||
self.destroy()
|
||||
del self
|
||||
|
||||
def save_wired_settings(self):
|
||||
""" Save wired network settings. """
|
||||
return self.advanced_dialog.save_settings()
|
||||
|
||||
def edit_scripts(self, widget=None, event=None):
|
||||
""" Launch the script editting dialog. """
|
||||
profile = self.combo_profile_names.get_active_text()
|
||||
@@ -756,6 +831,10 @@ class WirelessNetworkEntry(NetworkEntry):
|
||||
""" Escapes special characters so they're displayed correctly. """
|
||||
return val.replace("&", "&").replace("<", "<").\
|
||||
replace(">",">").replace("'", "'").replace('"', """)
|
||||
|
||||
def save_wireless_settings(self, networkid):
|
||||
""" Save wireless network settings. """
|
||||
return self.advanced_dialog.save_settings(networkid)
|
||||
|
||||
def destroy_called(self, *args):
|
||||
""" Clean up everything. """
|
||||
|
||||
@@ -411,12 +411,7 @@ class ConnectThread(threading.Thread):
|
||||
BACKEND.StopDHCP()
|
||||
|
||||
def connect_aborted(self, reason):
|
||||
""" Sets the thread status to aborted in a thread-safe way.
|
||||
|
||||
Sets the status to aborted, and also delays returning for
|
||||
a few seconds to make sure the message is readable
|
||||
|
||||
"""
|
||||
""" Sets the thread status to aborted. """
|
||||
if self.abort_reason:
|
||||
reason = self.abort_reason
|
||||
self.connecting_message = reason
|
||||
|
||||
@@ -8,8 +8,8 @@ Used for when a laptop enters hibernation/suspension.
|
||||
"""
|
||||
|
||||
#
|
||||
# Copyright (C) 2007 Adam Blackburn
|
||||
# Copyright (C) 2007 Dan O'Reilly
|
||||
# Copyright (C) 2007 - 2008 Adam Blackburn
|
||||
# Copyright (C) 2007 - 2008 Dan O'Reilly
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License Version 2 as
|
||||
@@ -26,13 +26,17 @@ Used for when a laptop enters hibernation/suspension.
|
||||
|
||||
import dbus
|
||||
import dbus.service
|
||||
import sys
|
||||
|
||||
try:
|
||||
bus = dbus.SystemBus()
|
||||
proxy_obj = bus.get_object('org.wicd.daemon', '/org/wicd/daemon')
|
||||
daemon = dbus.Interface(proxy_obj, 'org.wicd.daemon')
|
||||
except Exception, e:
|
||||
print "Exception caught: %s" % str(e)
|
||||
print>>sys.stderr, "Exception caught: %s" % str(e)
|
||||
print>>sys.stderr, 'Could not connect to daemon.'
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
@@ -41,5 +45,7 @@ if __name__ == '__main__':
|
||||
daemon.SetForcedDisconnect(False)
|
||||
daemon.SetSuspend(True)
|
||||
except Exception, e:
|
||||
print "Exception caught: %s" % str(e)
|
||||
|
||||
print>>sys.stderr, "Exception caught: %s" % str(e)
|
||||
print>>sys.stderr, 'Error setting suspend.'
|
||||
sys.exit(2)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user