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

Merged r426 of mainline 1.6.

This commit is contained in:
Andrew Psaltis
2009-06-21 14:07:22 -04:00
16 changed files with 481 additions and 79 deletions

279
CHANGES
View File

@@ -1,4 +1,283 @@
------------------------------------------------------------
revno: 425
committer: Andrew Psaltis <ampsaltis@gmail.com>
branch nick: 1.6
timestamp: Sat 2009-06-20 23:46:38 -0400
message:
Fix the log file chmodding (os.chmod() can't accept a string, apparently).
------------------------------------------------------------
revno: 424
committer: Adam Blackburn <compwiz18@gmail.com>
branch nick: 1.6
timestamp: Sat 2009-06-20 21:59:45 -0500
message:
updated translations.py
------------------------------------------------------------
revno: 423
committer: Adam Blackburn <compwiz18@gmail.com>
branch nick: 1.6
timestamp: Sat 2009-06-20 21:44:32 -0500
message:
merged lp:~nacl/wicd/1.6-access-denied to display an error message if access to the daemon via DBus is denied
------------------------------------------------------------
revno: 417.2.6
committer: Andrew Psaltis <ampsaltis@gmail.com>
branch nick: 1.6-access-denied
timestamp: Sat 2009-06-20 21:41:17 -0400
message:
Restore python 2.5 compatibility in both clients.
------------------------------------------------------------
revno: 417.2.5
committer: Andrew Psaltis <ampsaltis@gmail.com>
branch nick: 1.6-access-denied
timestamp: Fri 2009-06-19 23:03:42 -0400
message:
Made the wicd-curses "access denied" string translatable, and updated wicd-curses.py to use it.
------------------------------------------------------------
revno: 417.2.4
committer: Andrew Psaltis <ampsaltis@gmail.com>
branch nick: 1.6-access-denied
timestamp: Fri 2009-06-19 20:07:10 -0400
message:
Use the ANSI escape sequences to print colors instead of fetching them using tput(1) in wicd-curses.
------------------------------------------------------------
revno: 417.2.3
committer: Andrew Psaltis <ampsaltis@gmail.com>
branch nick: 1.6-access-denied
timestamp: Fri 2009-06-19 18:59:30 -0400
message:
Fixed wicd-client to actually show the error dialog, by checking e.get_dbus_name() instead of just e.
------------------------------------------------------------
revno: 417.2.2
committer: Andrew Psaltis <ampsaltis@gmail.com>
branch nick: 1.6-access-denied
timestamp: Fri 2009-06-19 18:48:39 -0400
message:
Updated wicd-curses to use DBusException.get_dbus_name() instead of the exception arguments.
------------------------------------------------------------
revno: 417.2.1
committer: Andrew Psaltis <ampsaltis@gmail.com>
branch nick: 1.6-access-denied
timestamp: Fri 2009-06-19 17:29:25 -0400
message:
Made wicd-curses.py spit out an error if a dbus access denied error appears on startup.
------------------------------------------------------------
revno: 422
committer: Adam Blackburn <compwiz18@gmail.com>
branch nick: 1.6
timestamp: Sat 2009-06-20 19:25:10 -0500
message:
merged lp:~adamblackburn/wicd/1.6-return-101-if-no-strength to allow cards that don't report signal strength to work with Wicd's default settings
------------------------------------------------------------
revno: 418.1.2
committer: Adam Blackburn <compwiz18@gmail.com>
branch nick: 1.6
timestamp: Sat 2009-06-20 14:40:30 -0500
message:
update FormatSignalForPrinting to return ??% instead of 101%
------------------------------------------------------------
revno: 418.1.1
committer: Adam Blackburn <compwiz18@gmail.com>
branch nick: 1.6
timestamp: Sat 2009-06-20 13:42:21 -0500
message:
return 101 as the signal strength if altstrenth_pattern fails to find the strength
------------------------------------------------------------
revno: 421
committer: Adam Blackburn <compwiz18@gmail.com>
branch nick: 1.6
timestamp: Sat 2009-06-20 19:24:07 -0500
message:
merged lp:~dpaleino/wicd/pre-post-down to allow having pre/post disconnection scripts
------------------------------------------------------------
revno: 415.2.1
committer: David Paleino <d.paleino@gmail.com>
branch nick: wicd
timestamp: Tue 2009-06-16 17:13:41 +0200
message:
Provide a pre-/post-down script mechanism
WICD currently only provides pre-/post-connection scripts, and
only one disconnection script, that is run before actually
disconnecting. This provides pre-/post-disconnection scripts,
thus increasing configuration flexibility.
------------------------------------------------------------
revno: 420
committer: Adam Blackburn <compwiz18@gmail.com>
branch nick: 1.6
timestamp: Sat 2009-06-20 19:22:36 -0500
message:
merged lp:~adamblackburn/wicd/loggroup to allow passing the preferred log group and permissions to setup.py configure -- thanks to David Paleino
------------------------------------------------------------
revno: 412.3.6
committer: Adam Blackburn <compwiz18@gmail.com>
branch nick: loggroup
timestamp: Fri 2009-06-19 22:08:32 -0500
message:
seperated chmod and chown try/excepts
------------------------------------------------------------
revno: 412.3.5
committer: Adam Blackburn <compwiz18@gmail.com>
branch nick: loggroup
timestamp: Tue 2009-06-16 23:57:02 +0800
message:
added forgotten underscores
------------------------------------------------------------
revno: 412.3.4
committer: Adam Blackburn <compwiz18@gmail.com>
branch nick: loggroup
timestamp: Tue 2009-06-16 23:22:40 +0800
message:
removed wicd-daemon.py from .bzrignore
------------------------------------------------------------
revno: 412.3.3
committer: Adam Blackburn <compwiz18@gmail.com>
branch nick: loggroup
timestamp: Tue 2009-06-16 23:15:05 +0800
message:
merge 1.6 r415
------------------------------------------------------------
revno: 412.3.2
committer: Adam Blackburn <compwiz18@gmail.com>
branch nick: loggroup
timestamp: Tue 2009-06-16 23:08:52 +0800
message:
moved wicd-daemon.py back to wicd/ and changed wpath replacement values to use the wpath module
------------------------------------------------------------
revno: 412.3.1
committer: David Paleino <d.paleino@gmail.com>
branch nick: wicd
timestamp: Sat 2009-06-13 22:59:03 +0200
message:
Support --loggroup and --logperms arguments to setup.py
------------------------------------------------------------
revno: 419
committer: Adam Blackburn <compwiz18@gmail.com>
branch nick: 1.6
timestamp: Sat 2009-06-20 19:20:42 -0500
message:
merged lp:~adamblackburn/wicd/1.6-cancel-edit-settings to allow canceling the edit settings dialog that appears when attempting to connect to an encrypted network without entering the encryption details
------------------------------------------------------------
revno: 417.1.2
committer: Adam Blackburn <compwiz18@gmail.com>
branch nick: 1.6
timestamp: Sat 2009-06-20 07:58:15 -0500
message:
fix crash resulting from encryption info missing when connecting
------------------------------------------------------------
revno: 417.1.1
committer: Adam Blackburn <compwiz18@gmail.com>
branch nick: 1.6
timestamp: Thu 2009-06-18 15:16:29 +0800
message:
allow user to cancel preferences dialog if they chose not to connect after clicking connect and showing the preferences dialog
------------------------------------------------------------
revno: 418
committer: Adam Blackburn <compwiz18@gmail.com>
branch nick: 1.6
timestamp: Sat 2009-06-20 10:33:23 -0500
message:
merged David Paleino's Debian init script that includes a status command
------------------------------------------------------------
revno: 415.1.1
committer: David Paleino <d.paleino@gmail.com>
branch nick: wicd
timestamp: Tue 2009-06-16 17:56:21 +0200
message:
Add "status" to /etc/init.d/wicd (Debian/Ubuntu)
------------------------------------------------------------
revno: 417
committer: Adam Blackburn <compwiz18@gmail.com>
branch nick: 1.6
timestamp: Thu 2009-06-18 14:56:25 +0800
message:
fixed crash that occured when clicking to connect to a secured network but without entering the security information
------------------------------------------------------------
revno: 416
committer: Adam Blackburn <compwiz18@gmail.com>
branch nick: 1.6
timestamp: Tue 2009-06-16 23:36:58 +0800
message:
fix a small typo in misc.py -- thanks to David Paleino
------------------------------------------------------------
revno: 415
committer: Adam Blackburn <compwiz18@gmail.com>
branch nick: 1.6
timestamp: Tue 2009-06-16 07:44:27 +0800
message:
disable automatically disconnecting when Automatically reconnect is False
------------------------------------------------------------
revno: 414
committer: Dan O'Reilly <oreilldf@gmail.com>
branch nick: trunk
timestamp: Sun 2009-06-14 14:27:21 -0400
message:
Merge.
------------------------------------------------------------
revno: 412.2.1
committer: Adam Blackburn <compwiz18@gmail.com>
branch nick: 1.6
timestamp: Sun 2009-06-14 12:27:36 +0800
message:
merged David's Debian patches branch
------------------------------------------------------------
revno: 412.1.3
committer: David Paleino <d.paleino@gmail.com>
branch nick: wicd
timestamp: Sat 2009-06-13 22:07:49 +0200
message:
Support udhcpc, this is needed to smoothly run on the OpenMoko FreeRunner.
Thanks to Luca Capello <gismo@debian.org> for porting the patch to 1.5.9, and
to "madmo" from the linked forum for making the patch.
Patch originally taken from http://wicd.net/punbb/viewtopic.php?id=132
Patch ported to 1.6.0 code by David Paleino <d.paleino@gmail.com>.
------------------------------------------------------------
revno: 412.1.2
committer: David Paleino <d.paleino@gmail.com>
branch nick: wicd
timestamp: Sat 2009-06-13 22:06:08 +0200
message:
Update manpage with an appropriate WHATIS entry
------------------------------------------------------------
revno: 412.1.1
committer: David Paleino <d.paleino@gmail.com>
branch nick: wicd
timestamp: Sat 2009-06-13 22:05:10 +0200
message:
Remove deprecated Encoding field
------------------------------------------------------------
revno: 413
committer: Dan O'Reilly <oreilldf@gmail.com>
branch nick: trunk
timestamp: Sun 2009-06-14 14:25:06 -0400
message:
Convert strings being prints out by dhclients to utf-8 before trying to log them.
When iwscan displays two entries for a hidden network, only display the one with the essid included.
------------------------------------------------------------
revno: 412
committer: Adam Blackburn <compwiz18@gmail.com>
branch nick: wicd
timestamp: Tue 2009-06-09 13:25:02 +0800
message:
display the ESSID/Wired Network in the title of the settings dialog
------------------------------------------------------------
revno: 411
committer: Adam Blackburn <compwiz18@gmail.com>
branch nick: 1.6
timestamp: Fri 2009-06-05 16:13:38 +0800
message:
Updated translations.py
------------------------------------------------------------
revno: 410
committer: Adam Blackburn <compwiz18@gmail.com>
branch nick: 1.6
timestamp: Fri 2009-06-05 15:20:58 +0800
message:
updated CHANGES
------------------------------------------------------------
revno: 409
committer: Adam Blackburn <compwiz18@gmail.com>
branch nick: 1.6

View File

@@ -38,7 +38,8 @@ language = {}
language['configure_scripts'] = _("Configure Scripts")
language['before_script'] = _("Pre-connection Script")
language['after_script'] = _("Post-connection Script")
language['disconnect_script'] = _("Disconnection Script")
language['pre_disconnect_script'] = _("Pre-disconnection Script")
language['post_disconnect_script'] = _("Post-disconnection Script")
def main(argv):
global ui,frame
@@ -62,16 +63,19 @@ def main(argv):
blank = urwid.Text('')
pre_entry_t = ('body',language['before_script']+': ')
post_entry_t = ('body',language['after_script']+': ')
disconnect_entry_t = ('body',language['disconnect_script']+': ')
pre_disconnect_entry_t = ('body',language['pre_disconnect_script']+': ')
post_disconnect_entry_t = ('body',language['post_disconnect_script']+': ')
global pre_entry,post_entry,disconnect_entry
global pre_entry,post_entry,pre_disconnect_entry,post_disconnect_entry
pre_entry = urwid.AttrWrap(urwid.Edit(pre_entry_t,
none_to_blank(script_info.get('pre_entry'))),'editbx','editfc' )
post_entry = urwid.AttrWrap(urwid.Edit(post_entry_t,
none_to_blank(script_info.get('post_entry'))),'editbx','editfc' )
disconnect_entry = urwid.AttrWrap(urwid.Edit(disconnect_entry_t,
none_to_blank(script_info.get('disconnect_entry'))),'editbx','editfc' )
pre_disconnect_entry = urwid.AttrWrap(urwid.Edit(pre_disconnect_entry_t,
none_to_blank(script_info.get('pre_disconnect_entry'))),'editbx','editfc' )
post_disconnect_entry = urwid.AttrWrap(urwid.Edit(post_disconnect_entry_t,
none_to_blank(script_info.get('post_disconnect_entry'))),'editbx','editfc' )
# The buttons
ok_button = urwid.AttrWrap(urwid.Button('OK',ok_callback),'body','focus')
@@ -82,7 +86,8 @@ def main(argv):
lbox = urwid.Pile([('fixed',2,urwid.Filler(pre_entry)),
#('fixed',urwid.Filler(blank),1),
('fixed',2,urwid.Filler(post_entry)),
('fixed',2,urwid.Filler(disconnect_entry)),
('fixed',2,urwid.Filler(pre_disconnect_entry)),
('fixed',2,urwid.Filler(post_disconnect_entry)),
#blank,blank,blank,blank,blank,
urwid.Filler(button_cols,'bottom')
])
@@ -92,7 +97,8 @@ def main(argv):
if result == True:
script_info["pre_entry"] = blank_to_none(pre_entry.get_edit_text())
script_info["post_entry"] = blank_to_none(post_entry.get_edit_text())
script_info["disconnect_entry"] = blank_to_none(disconnect_entry.get_edit_text())
script_info["pre_disconnect_entry"] = blank_to_none(pre_disconnect_entry.get_edit_text())
script_info["post_disconnect_entry"] = blank_to_none(post_disconnect_entry.get_edit_text())
write_scripts(network, network_type, script_info)
OK_PRESSED = False

View File

@@ -38,7 +38,6 @@ at least get a network connection. Or those who don't like using X. ;-)
import warnings
warnings.filterwarnings("ignore","The popen2 module is deprecated. Use the subprocess module.")
# UI stuff
# This library is the only reason why I wrote this program.
import urwid
# DBus communication stuff
@@ -64,6 +63,7 @@ import netentry_curses
from netentry_curses import WirelessSettingsDialog, WiredSettingsDialog,AdvancedSettingsDialog
from optparse import OptionParser
from os import system
# Stuff about getting the script configurer running
#from grp import getgrgid
@@ -72,7 +72,7 @@ from optparse import OptionParser
#import logging
#import logging.handler
CURSES_REVNO=wpath.curses_revision
CURSES_REV=wpath.curses_revision
# Fix strings in wicd-curses
from wicd.translations import language
@@ -263,7 +263,7 @@ def run_configscript(parent,netname,nettype):
# Translation needs to be changed to accomidate this text below.
"""You can also configure the wireless networks by looking for the "[<ESSID>]" field in the config file.
Once there, you can adjust (or add) the "beforescript", "afterscript", and "disconnectscript" variables as needed, to change the preconnect, postconnect, and disconnect scripts respectively. Note that you will be specifying the full path to the scripts - not the actual script contents. You will need to add/edit the script contents separately. Refer to the wicd manual page for more information."""]
Once there, you can adjust (or add) the "beforescript", "afterscript", "predisconnectscript" and "postdisconnectscript" variables as needed, to change the preconnect, postconnect, predisconnect and postdisconnect scripts respectively. Note that you will be specifying the full path to the scripts - not the actual script contents. You will need to add/edit the script contents separately. Refer to the wicd manual page for more information."""]
dialog = TextDialog(theText,20,80)
dialog.run(ui,parent)
# This code works with many distributions, but not all of them. So, to
@@ -1047,7 +1047,14 @@ setup_dbus()
##### MAIN ENTRY POINT
########################################
if __name__ == '__main__':
parser = OptionParser(version="wicd-curses-%s (using wicd %s)" % (CURSES_REVNO,daemon.Hello()))
try:
parser = OptionParser(version="wicd-curses-%s (using wicd %s)" % (CURSES_REV,daemon.Hello()))
except Exception, e:
if "DBus.Error.AccessDenied" in e.get_dbus_name():
print language['access_denied_wc'].replace('$A','\033[1;34m'+wpath.wicd_group+'\033[0m')
sys.exit(1)
else:
raise
parser.set_defaults(screen='raw',debug=False)
parser.add_option("-r", "--raw-screen",action="store_const",const='raw'
,dest='screen',help="use urwid's raw screen controller (default)")

View File

@@ -342,18 +342,18 @@
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<child>
<widget class="GtkLabel" id="disconnect_label">
<widget class="GtkLabel" id="pre_disconnect_label">
<property name="width_request">150</property>
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">Disconnection Script:</property>
<property name="label" translatable="yes">Pre-disconnection Script:</property>
</widget>
<packing>
<property name="position">0</property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="disconnect_entry">
<widget class="GtkEntry" id="pre_disconnect_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
@@ -370,6 +370,39 @@
<property name="position">3</property>
</packing>
</child>
<child>
<widget class="GtkHBox" id="hbox10">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<child>
<widget class="GtkLabel" id="post_disconnect_label">
<property name="width_request">150</property>
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">Post-disconnection Script:</property>
</widget>
<packing>
<property name="position">0</property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="post_disconnect_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
</widget>
<packing>
<property name="position">1</property>
</packing>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="padding">5</property>
<property name="position">4</property>
</packing>
</child>
</widget>
<packing>
<property name="position">1</property>

View File

@@ -153,9 +153,12 @@ case "$1" in
;;
esac
;;
status)
status_of_proc -p $PIDFILE $DAEMON $NAME
;;
*)
#echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload|status}" >&2
exit 3
;;
esac

View File

@@ -33,8 +33,12 @@ The script should be a Bourne-compatible script and should be executable.
IMPORTANT - scripts should ONLY be writable by root and located in a
directory that is only writable by root.
.TP
.BI "disconnectscript = " <None|arbitrary_script>
This defines a script to run when Wicd disconnects the interface.
.BI "predisconnectscript = " <None|arbitrary_script>
This defines a script to run before Wicd disconnects the interface.
The script should be a Bourne-compatible script and should be executable.
.TP
.BI "postdisconnectscript = " <None|arbitrary_script>
This defines a script to run after Wicd disconnects the interface.
The script should be a Bourne-compatible script and should be executable.
.br
IMPORTANT - scripts should ONLY be writable by root and located in a

View File

@@ -99,8 +99,11 @@ This defines a script to run after Wicd brings up the connection.
IMPORTANT - scripts should ONLY be writable by root and located
in a directory that is writable by only root.
.TP
.BI "disconnectscript = " <None|arbitrary_script>
This defines a script to run when Wicd disconnects the interface.
.BI "predisconnectscript = " <None|arbitrary_script>
This defines a script to run before Wicd disconnects the interface.
.TP
.BI "postdisconnectscript = " <None|arbitrary_script>
This defines a script to run after Wicd disconnects the interface.
.br
IMPORTANT - scripts should ONLY be writable by root and located
in a directory that is writable by only root.

View File

@@ -27,7 +27,8 @@ lib = '%LIB%'
share = '%SHARE%'
etc = '%ETC%'
scripts = '%SCRIPTS%'
disconnectscripts = '%SCRIPTS%disconnect'
predisconnectscripts = '%SCRIPTS%predisconnect'
postdisconnectscripts = '%SCRIPTS%postdisconnect'
preconnectscripts = '%SCRIPTS%preconnect'
postconnectscripts = '%SCRIPTS%postconnect'
images = '%IMAGES%'
@@ -62,6 +63,8 @@ initfile = '%INITFILE%'
# stores only the file name, i.e. wicd
initfilename = '%INITFILENAME%'
wicd_group = '%WICDGROUP%'
log_group = '%LOGGROUP%'
log_perms = '%LOGPERMS%'
# BOOLEANS
no_install_pmutils = %NO_INSTALL_PMUTILS%

View File

@@ -26,7 +26,7 @@ import subprocess
# Be sure to keep this updated!
# VERSIONNUMBER
VERSION_NUM = '1.6.0'
VERSION_NUM = '1.6.1'
# REVISION_NUM is automatically updated
REVISION_NUM = 'unknown'
CURSES_REVNO = 'uimod'
@@ -242,6 +242,8 @@ class configure(Command):
self.no_install_acpi = True
elif self.distro in ['debian']:
self.wicdgroup = "netdev"
self.loggroup = "adm"
self.logperms = "0640"
self.init = '/etc/init.d/'
self.initfile = 'init/debian/wicd'
elif self.distro in ['arch']:
@@ -488,7 +490,8 @@ try:
(wpath.backends, ['wicd/backends/be-external.py', 'wicd/backends/be-ioctl.py']),
(wpath.autostart, ['other/wicd-tray.desktop', ]),
(wpath.scripts, []),
(wpath.disconnectscripts, []),
(wpath.predisconnectscripts, []),
(wpath.postdisconnectscripts, []),
(wpath.preconnectscripts, []),
(wpath.postconnectscripts, []),
]

View File

@@ -42,7 +42,8 @@ language = {}
language['configure_scripts'] = _("Configure Scripts")
language['before_script'] = _("Pre-connection Script")
language['after_script'] = _("Post-connection Script")
language['disconnect_script'] = _("Disconnection Script")
language['pre_disconnect_script'] = _("Pre-disconnection Script")
language['post_disconnect_script'] = _("Post-disconnection Script")
dbus = dbusmanager.DBusManager()
dbus.connect_to_dbus()
@@ -100,14 +101,16 @@ def get_script_info(network, network_type):
if con.has_section(network):
info["pre_entry"] = get_val(con, network, "beforescript")
info["post_entry"] = get_val(con, network, "afterscript")
info["disconnect_entry"] = get_val(con, network, "disconnectscript")
info["pre_disconnect_entry"] = get_val(con, network, "predisconnectscript")
info["post_disconnect_entry"] = get_val(con, network, "postdisconnectscript")
else:
bssid = wireless.GetWirelessProperty(int(network), "bssid")
con.read(wireless_conf)
if con.has_section(bssid):
info["pre_entry"] = get_val(con, bssid, "beforescript")
info["post_entry"] = get_val(con, bssid, "afterscript")
info["disconnect_entry"] = get_val(con, bssid, "disconnectscript")
info["pre_disconnect_entry"] = get_val(con, bssid, "predisconnectscript")
info["post_disconnect_entry"] = get_val(con, bssid, "postdisconnectscript")
return info
def write_scripts(network, network_type, script_info):
@@ -120,7 +123,8 @@ def write_scripts(network, network_type, script_info):
con.add_section(network)
con.set(network, "beforescript", script_info["pre_entry"])
con.set(network, "afterscript", script_info["post_entry"])
con.set(network, "disconnectscript", script_info["disconnect_entry"])
con.set(network, "predisconnectscript", script_info["pre_disconnect_entry"])
con.set(network, "postdisconnectscript", script_info["post_disconnect_entry"])
con.write(open(wired_conf, "w"))
wired.ReloadConfig()
wired.ReadWiredNetworkProfile(network)
@@ -132,7 +136,8 @@ def write_scripts(network, network_type, script_info):
con.add_section(bssid)
con.set(bssid, "beforescript", script_info["pre_entry"])
con.set(bssid, "afterscript", script_info["post_entry"])
con.set(bssid, "disconnectscript", script_info["disconnect_entry"])
con.set(bssid, "predisconnectscript", script_info["pre_disconnect_entry"])
con.set(bssid, "postdisconnectscript", script_info["post_disconnect_entry"])
con.write(open(wireless_conf, "w"))
wireless.ReloadConfig()
wireless.ReadWirelessNetworkProfile(int(network))
@@ -155,25 +160,30 @@ def main (argv):
dialog = wTree.get_widget("configure_script_dialog")
wTree.get_widget("pre_label").set_label(language['before_script'] + ":")
wTree.get_widget("post_label").set_label(language['after_script'] + ":")
wTree.get_widget("disconnect_label").set_label(language['disconnect_script']
wTree.get_widget("pre_disconnect_label").set_label(language['pre_disconnect_script']
+ ":")
wTree.get_widget("post_disconnect_label").set_label(language['post_disconnect_script']
+ ":")
wTree.get_widget("window1").hide()
pre_entry = wTree.get_widget("pre_entry")
post_entry = wTree.get_widget("post_entry")
disconnect_entry = wTree.get_widget("disconnect_entry")
pre_disconnect_entry = wTree.get_widget("pre_disconnect_entry")
post_disconnect_entry = wTree.get_widget("post_disconnect_entry")
pre_entry.set_text(none_to_blank(script_info.get("pre_entry")))
post_entry.set_text(none_to_blank(script_info.get("post_entry")))
disconnect_entry.set_text(none_to_blank(script_info.get("disconnect_entry")))
pre_disconnect_entry.set_text(none_to_blank(script_info.get("pre_disconnect_entry")))
post_disconnect_entry.set_text(none_to_blank(script_info.get("post_disconnect_entry")))
dialog.show_all()
result = dialog.run()
if result == 1:
script_info["pre_entry"] = blank_to_none(pre_entry.get_text())
script_info["post_entry"] = blank_to_none(post_entry.get_text())
script_info["disconnect_entry"] = blank_to_none(disconnect_entry.get_text())
script_info["pre_disconnect_entry"] = blank_to_none(pre_disconnect_entry.get_text())
script_info["post_disconnect_entry"] = blank_to_none(post_disconnect_entry.get_text())
write_scripts(network, network_type, script_info)
dialog.destroy()

View File

@@ -642,7 +642,7 @@ class appGui(object):
for entry_info in encryption_info.itervalues():
if entry_info[0].entry.get_text() == "" and \
entry_info[1] == 'required':
error(self, "%s (%s)" % (language['encrypt_info_missing'],
error(self.window, "%s (%s)" % (language['encrypt_info_missing'],
entry_info[0].label.get_label())
)
return False
@@ -666,24 +666,28 @@ class appGui(object):
""" Initiates the connection process in the daemon. """
def handler(*args):
self._connect_thread_started = True
cancel_button = self.wTree.get_widget("cancel_button")
cancel_button.set_sensitive(True)
self.network_list.set_sensitive(False)
if self.statusID:
gobject.idle_add(self.status_bar.remove, 1, self.statusID)
gobject.idle_add(self.set_status, language["disconnecting_active"])
gobject.idle_add(self.status_area.show_all)
self.wait_for_events()
self._connect_thread_started = False
def setup_interface_for_connection():
cancel_button = self.wTree.get_widget("cancel_button")
cancel_button.set_sensitive(True)
self.network_list.set_sensitive(False)
if self.statusID:
gobject.idle_add(self.status_bar.remove, 1, self.statusID)
gobject.idle_add(self.set_status, language["disconnecting_active"])
gobject.idle_add(self.status_area.show_all)
self.wait_for_events()
self._connect_thread_started = False
if nettype == "wireless":
if not self.check_encryption_valid(networkid,
networkentry.advanced_dialog):
self.edit_advanced(None, nettype, networkid, networkentry)
return False
setup_interface_for_connection()
wireless.ConnectWireless(networkid, reply_handler=handler,
error_handler=handler)
elif nettype == "wired":
setup_interface_for_connection()
wired.ConnectWired(reply_handler=handler, error_handler=handler)
gobject.source_remove(self.update_cb)

View File

@@ -151,7 +151,8 @@ class Controller(object):
self.connecting_thread = None
self.before_script = None
self.after_script = None
self.disconnect_script = None
self.pre_disconnect_script = None
self.post_disconnect_script = None
self.driver = None
self.iface = None
@@ -203,17 +204,23 @@ class Controller(object):
def Disconnect(self, *args, **kargs):
""" Disconnect from the network. """
iface = self.iface
misc.ExecuteScripts(wpath.disconnectscripts, self.debug)
if self.disconnect_script:
print 'Running disconnect script'
misc.ExecuteScript(expand_script_macros(self.disconnect_script,
'disconnection', *args),
misc.ExecuteScripts(wpath.predisconnectscripts, self.debug)
if self.pre_disconnect_script:
print 'Running pre-disconnect script'
misc.ExecuteScript(expand_script_macros(self.pre_disconnect_script,
'pre-disconnection', *args),
self.debug)
iface.ReleaseDHCP()
iface.SetAddress('0.0.0.0')
iface.FlushRoutes()
iface.Down()
iface.Up()
misc.ExecuteScripts(wpath.postdisconnectscripts, self.debug)
if self.post_disconnect_script:
print 'Running post-disconnect script'
misc.ExecuteScript(expand_script_macros(self.post_disconnect_script,
'post-disconnection', *args),
self.debug)
def ReleaseDHCP(self):
""" Release the DHCP lease for this interface. """
@@ -273,8 +280,8 @@ class ConnectThread(threading.Thread):
lock = threading.Lock()
def __init__(self, network, interface_name, before_script, after_script,
disconnect_script, gdns1, gdns2, gdns3, gdns_dom, gsearch_dom,
iface, debug):
pre_disconnect_script, post_disconnect_script, gdns1,
gdns2, gdns3, gdns_dom, gsearch_dom, iface, debug):
""" Initialise the required object variables and the thread.
Keyword arguments:
@@ -283,7 +290,8 @@ class ConnectThread(threading.Thread):
wired -- name of the wired interface
before_script -- script to run before bringing up the interface
after_script -- script to run after bringing up the interface
disconnect_script -- script to run after disconnection
pre_disconnect_script -- script to run before disconnection
post_disconnect_script -- script to run after disconnection
gdns1 -- global DNS server 1
gdns2 -- global DNS server 2
gdns3 -- global DNS server 3
@@ -297,7 +305,8 @@ class ConnectThread(threading.Thread):
self.connect_result = None
self.before_script = before_script
self.after_script = after_script
self.disconnect_script = disconnect_script
self.pre_disconnect_script = pre_disconnect_script
self.post_disconnect_script = post_disconnect_script
self._should_die = False
self.abort_reason = ""
self.connect_result = ""
@@ -607,7 +616,8 @@ class Wireless(Controller):
self.connecting_thread = WirelessConnectThread(network,
self.wireless_interface, self.wpa_driver, self.before_script,
self.after_script, self.disconnect_script, self.global_dns_1,
self.after_script, self.pre_disconnect_script,
self.post_disconnect_script, self.global_dns_1,
self.global_dns_2, self.global_dns_3, self.global_dns_dom,
self.global_search_dom, self.wiface, debug)
self.connecting_thread.setDaemon(True)
@@ -779,8 +789,9 @@ class WirelessConnectThread(ConnectThread):
"""
def __init__(self, network, wireless, wpa_driver, before_script,
after_script, disconnect_script, gdns1, gdns2, gdns3,
gdns_dom, gsearch_dom, wiface, debug=False):
after_script, pre_disconnect_script, post_disconnect_script,
gdns1, gdns2, gdns3, gdns_dom, gsearch_dom, wiface,
debug=False):
""" Initialise the thread with network information.
Keyword arguments:
@@ -789,14 +800,16 @@ class WirelessConnectThread(ConnectThread):
wpa_driver -- type of wireless interface
before_script -- script to run before bringing up the interface
after_script -- script to run after bringing up the interface
disconnect_script -- script to run after disconnection
pre_disconnect_script -- script to run before disconnection
post_disconnect_script -- script to run after disconnection
gdns1 -- global DNS server 1
gdns2 -- global DNS server 2
gdns3 -- global DNS server 3
"""
ConnectThread.__init__(self, network, wireless, before_script,
after_script, disconnect_script, gdns1, gdns2,
after_script, pre_disconnect_script,
post_disconnect_script, gdns1, gdns2,
gdns3, gdns_dom, gsearch_dom, wiface, debug)
self.wpa_driver = wpa_driver
@@ -967,9 +980,10 @@ class Wired(Controller):
if not self.liface: return False
self.connecting_thread = WiredConnectThread(network,
self.wired_interface, self.before_script, self.after_script,
self.disconnect_script, self.global_dns_1, self.global_dns_2,
self.global_dns_3, self.global_dns_dom, self.global_search_dom,
self.liface, debug)
self.pre_disconnect_script, self.post_disconnect_script,
self.global_dns_1, self.global_dns_2, self.global_dns_3,
self.global_dns_dom, self.global_search_dom, self.liface,
debug)
self.connecting_thread.setDaemon(True)
self.connecting_thread.start()
return self.connecting_thread
@@ -993,8 +1007,8 @@ class WiredConnectThread(ConnectThread):
"""
def __init__(self, network, wired, before_script, after_script,
disconnect_script, gdns1, gdns2, gdns3, gdns_dom, gsearch_dom,
liface, debug=False):
pre_disconnect_script, post_disconnect_script, gdns1,
gdns2, gdns3, gdns_dom, gsearch_dom, liface, debug=False):
""" Initialise the thread with network information.
Keyword arguments:
@@ -1003,14 +1017,16 @@ class WiredConnectThread(ConnectThread):
wired -- name of the wired interface
before_script -- script to run before bringing up the interface
after_script -- script to run after bringing up the interface
disconnect_script -- script to run after disconnection
pre_disconnect_script -- script to run before disconnection
post_disconnect_script -- script to run after disconnection
gdns1 -- global DNS server 1
gdns2 -- global DNS server 2
gdns3 -- global DNS server 3
"""
ConnectThread.__init__(self, network, wired, before_script,
after_script, disconnect_script, gdns1, gdns2,
after_script, pre_disconnect_script,
post_disconnect_script, gdns1, gdns2,
gdns3, gdns_dom, gsearch_dom, liface, debug)
def _connect(self):

View File

@@ -55,7 +55,7 @@ def get_gettext():
_ = lang.gettext
return _
# Generated automatically on Fri, 05 Jun 2009 03:13:27 CDT
# Generated automatically on Sat, 20 Jun 2009 21:58:21 CDT
_ = get_gettext()
language = {}
language['resetting_ip_address'] = _('''Resetting IP address...''')
@@ -74,7 +74,7 @@ language['wired_networks'] = _('''Wired Networks''')
language['backend_alert'] = _('''Changes to your backend won't occur until the daemon is restarted.''')
language['about_help'] = _('''Stop a network connection in progress''')
language['connecting'] = _('''Connecting''')
language['disconnect_script'] = _('''Run disconnect script''')
language['pre_disconnect_script'] = _('''Run pre-disconnect script''')
language['cannot_edit_scripts_1'] = _('''To avoid various complications, wicd-curses does not support directly editing the scripts directly. However, you can edit them manually. First, (as root)", open the "$A" config file, and look for the section labeled by the $B in question. In this case, this is:''')
language['cannot_edit_scripts_3'] = _('''You can also configure the wireless networks by looking for the "[<ESSID>]" field in the config file.''')
language['cannot_edit_scripts_2'] = _('''Once there, you can adjust (or add) the "beforescript", "afterscript", and "disconnectscript" variables as needed, to change the preconnect, postconnect, and disconnect scripts respectively. Note that you will be specifying the full path to the scripts - not the actual script contents. You will need to add/edit the script contents separately. Refer to the wicd manual page for more information.''')
@@ -216,3 +216,5 @@ language['establishing_connection'] = _('''Establishing connection...''')
language['association_failed'] = _('''Connection failed: Could not contact the wireless access point.''')
language['access_denied'] = _('''Unable to contact the Wicd daemon due to an access denied error from DBus. Please check your DBus configuration.''')
language['disconnecting_active'] = _('''Disconnecting active connections...''')
language['access_denied_wc'] = _('''ERROR: wicd-curses was denied access to the wicd daemon: please check that your user is in the "$A" group.''')
language['post_disconnect_script'] = _('''Run post-disconnect script''')

View File

@@ -87,8 +87,9 @@ def catchdbus(func):
try:
return func(*args, **kwargs)
except DBusException, e:
if "DBus.Error.AccessDenied" in e:
if e.get_dbus_name() != None and "DBus.Error.AccessDenied" in e.get_dbus_name():
error(None, language['access_denied'])
#raise
raise DBusException(e)
else:
print "warning: ignoring exception %s" % e

View File

@@ -309,7 +309,13 @@ class WicdDaemon(dbus.service.Object):
if self.GetSignalDisplayType() == 1:
return (signal + " dBm")
else:
return (signal + "%")
try:
if int(signal) == 101:
return '??%'
else:
return (signal + "%")
except ValueError:
return (signal + "%")
@dbus.service.method('org.wicd.daemon')
def SetSuspend(self, val):
@@ -1134,8 +1140,10 @@ class WirelessDaemon(dbus.service.Object):
# is done.
self.wifi.before_script = self.GetWirelessProperty(id, 'beforescript')
self.wifi.after_script = self.GetWirelessProperty(id, 'afterscript')
self.wifi.disconnect_script = self.GetWirelessProperty(id,
'disconnectscript')
self.wifi.pre_disconnect_script = self.GetWirelessProperty(id,
'predisconnectscript')
self.wifi.post_disconnect_script = self.GetWirelessProperty(id,
'postdisconnectscript')
print 'Connecting to wireless network ' + self.LastScan[id]['essid']
self.daemon.wired_bus.wired.Disconnect()
self.daemon.SetForcedDisconnect(False)
@@ -1222,12 +1230,14 @@ class WirelessDaemon(dbus.service.Object):
write_script_ent(bssid_key, "beforescript")
write_script_ent(bssid_key, "afterscript")
write_script_ent(bssid_key, "disconnectscript")
write_script_ent(bssid_key, "predisconnectscript")
write_script_ent(bssid_key, "postdisconnectscript")
if cur_network["use_settings_globally"]:
write_script_ent(essid_key, "beforescript")
write_script_ent(essid_key, "afterscript")
write_script_ent(essid_key, "disconnectscript")
write_script_ent(essid_key, "predisconnectscript")
write_script_ent(essid_key, "postdisconnectscript")
self.config.write()
@@ -1421,7 +1431,8 @@ class WiredDaemon(dbus.service.Object):
""" Connects to a wired network. """
self.wired.before_script = self.GetWiredProperty("beforescript")
self.wired.after_script = self.GetWiredProperty("afterscript")
self.wired.disconnect_script = self.GetWiredProperty("disconnectscript")
self.wired.pre_disconnect_script = self.GetWiredProperty("predisconnectscript")
self.wired.post_disconnect_script = self.GetWiredProperty("postdisconnectscript")
self.daemon.wireless_bus.wifi.Disconnect()
self.daemon.SetForcedDisconnect(False)
self.UnsetWiredLastUsed()
@@ -1439,7 +1450,8 @@ class WiredDaemon(dbus.service.Object):
for option in ["ip", "broadcast", "netmask","gateway", "search_domain",
"dns_domain", "dns1", "dns2", "dns3", "beforescript",
"afterscript", "disconnectscript"]:
"afterscript", "predisconnectscript",
"postdisconnectscript"]:
self.config.set(profilename, option, None)
self.config.set(profilename, "default", default)
self.config.write()
@@ -1507,7 +1519,8 @@ class WiredDaemon(dbus.service.Object):
write_script_ent(profilename, "beforescript")
write_script_ent(profilename, "afterscript")
write_script_ent(profilename, "disconnectscript")
write_script_ent(profilename, "predisconnectscript")
write_script_ent(profilename, "postdisconnectscript")
self.config.write()
return "100: Profile Written"
@@ -1671,9 +1684,17 @@ def main(argv):
output = ManagedStdio(logpath)
if os.path.exists(logpath):
try:
os.chmod(logpath, 0600)
os.chmod(logpath, int(wpath.log_perms,8))
except:
print 'unable to chmod log file to 0600'
print 'unable to chmod log file to %s' % wpath.log_perms
try:
if wpath.log_group:
import grp
group = grp.getgrnam(wpath.log_group)
os.chown(logpath, 0, group[2])
except:
print 'unable to chown log file to %s' % group[2]
if redirect_stdout: sys.stdout = output
if redirect_stderr: sys.stderr = output

View File

@@ -1366,7 +1366,14 @@ class BaseWirelessInterface(BaseInterface):
(strength, max_strength) = (None, None)
if strength in ['', None]:
[(strength, max_strength)] = altstrength_pattern.findall(output)
try:
[(strength, max_strength)] = altstrength_pattern.findall(output)
except ValueError:
# if the pattern was unable to match anything
# we'll return 101, which will allow us to stay
# connected even though we don't know the strength
# it also allows us to tell if
return 101
if strength not in ['', None] and max_strength:
return (100 * int(strength) // int(max_strength))
elif strength not in ["", None]: