Merge lp://staging/~dpaleino/wicd/pre-post-down into lp://staging/wicd/1.6

Proposed by David Paleino
Status: Merged
Merged at revision: not available
Proposed branch: lp://staging/~dpaleino/wicd/pre-post-down
Merge into: lp://staging/wicd/1.6
Diff against target: None lines
To merge this branch: bzr merge lp://staging/~dpaleino/wicd/pre-post-down
Reviewer Review Type Date Requested Status
Dan O'Reilly Approve
Review via email: mp+7505@code.staging.launchpad.net

Commit message

Provide a pre-/post-down script mechanism

To post a comment you must log in.
Revision history for this message
Dan O'Reilly (oreilldf) wrote :

Looks good.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'curses/configscript_curses.py'
2--- curses/configscript_curses.py 2009-01-31 04:48:56 +0000
3+++ curses/configscript_curses.py 2009-06-16 15:13:41 +0000
4@@ -38,7 +38,8 @@
5 language['configure_scripts'] = _("Configure Scripts")
6 language['before_script'] = _("Pre-connection Script")
7 language['after_script'] = _("Post-connection Script")
8-language['disconnect_script'] = _("Disconnection Script")
9+language['pre_disconnect_script'] = _("Pre-disconnection Script")
10+language['post_disconnect_script'] = _("Post-disconnection Script")
11
12 def main(argv):
13 global ui,frame
14@@ -62,16 +63,19 @@
15 blank = urwid.Text('')
16 pre_entry_t = ('body',language['before_script']+': ')
17 post_entry_t = ('body',language['after_script']+': ')
18- disconnect_entry_t = ('body',language['disconnect_script']+': ')
19+ pre_disconnect_entry_t = ('body',language['pre_disconnect_script']+': ')
20+ post_disconnect_entry_t = ('body',language['post_disconnect_script']+': ')
21
22- global pre_entry,post_entry,disconnect_entry
23+ global pre_entry,post_entry,pre_disconnect_entry,post_disconnect_entry
24 pre_entry = urwid.AttrWrap(urwid.Edit(pre_entry_t,
25 none_to_blank(script_info.get('pre_entry'))),'editbx','editfc' )
26 post_entry = urwid.AttrWrap(urwid.Edit(post_entry_t,
27 none_to_blank(script_info.get('post_entry'))),'editbx','editfc' )
28
29- disconnect_entry = urwid.AttrWrap(urwid.Edit(disconnect_entry_t,
30- none_to_blank(script_info.get('disconnect_entry'))),'editbx','editfc' )
31+ pre_disconnect_entry = urwid.AttrWrap(urwid.Edit(pre_disconnect_entry_t,
32+ none_to_blank(script_info.get('pre_disconnect_entry'))),'editbx','editfc' )
33+ post_disconnect_entry = urwid.AttrWrap(urwid.Edit(post_disconnect_entry_t,
34+ none_to_blank(script_info.get('post_disconnect_entry'))),'editbx','editfc' )
35
36 # The buttons
37 ok_button = urwid.AttrWrap(urwid.Button('OK',ok_callback),'body','focus')
38@@ -82,7 +86,8 @@
39 lbox = urwid.Pile([('fixed',2,urwid.Filler(pre_entry)),
40 #('fixed',urwid.Filler(blank),1),
41 ('fixed',2,urwid.Filler(post_entry)),
42- ('fixed',2,urwid.Filler(disconnect_entry)),
43+ ('fixed',2,urwid.Filler(pre_disconnect_entry)),
44+ ('fixed',2,urwid.Filler(post_disconnect_entry)),
45 #blank,blank,blank,blank,blank,
46 urwid.Filler(button_cols,'bottom')
47 ])
48@@ -92,7 +97,8 @@
49 if result == True:
50 script_info["pre_entry"] = blank_to_none(pre_entry.get_edit_text())
51 script_info["post_entry"] = blank_to_none(post_entry.get_edit_text())
52- script_info["disconnect_entry"] = blank_to_none(disconnect_entry.get_edit_text())
53+ script_info["pre_disconnect_entry"] = blank_to_none(pre_disconnect_entry.get_edit_text())
54+ script_info["post_disconnect_entry"] = blank_to_none(post_disconnect_entry.get_edit_text())
55 write_scripts(network, network_type, script_info)
56
57 OK_PRESSED = False
58
59=== modified file 'curses/wicd-curses.py'
60--- curses/wicd-curses.py 2009-06-05 02:19:33 +0000
61+++ curses/wicd-curses.py 2009-06-16 15:13:41 +0000
62@@ -263,7 +263,7 @@
63 # Translation needs to be changed to accomidate this text below.
64 """You can also configure the wireless networks by looking for the "[<ESSID>]" field in the config file.
65
66-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."""]
67+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."""]
68 dialog = TextDialog(theText,20,80)
69 dialog.run(ui,parent)
70 # This code works with many distributions, but not all of them. So, to
71
72=== modified file 'data/wicd.glade'
73--- data/wicd.glade 2009-06-13 20:07:49 +0000
74+++ data/wicd.glade 2009-06-16 15:13:41 +0000
75@@ -342,18 +342,18 @@
76 <property name="visible">True</property>
77 <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
78 <child>
79- <widget class="GtkLabel" id="disconnect_label">
80+ <widget class="GtkLabel" id="pre_disconnect_label">
81 <property name="width_request">150</property>
82 <property name="visible">True</property>
83 <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
84- <property name="label" translatable="yes">Disconnection Script:</property>
85+ <property name="label" translatable="yes">Pre-disconnection Script:</property>
86 </widget>
87 <packing>
88 <property name="position">0</property>
89 </packing>
90 </child>
91 <child>
92- <widget class="GtkEntry" id="disconnect_entry">
93+ <widget class="GtkEntry" id="pre_disconnect_entry">
94 <property name="visible">True</property>
95 <property name="can_focus">True</property>
96 <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
97@@ -370,6 +370,39 @@
98 <property name="position">3</property>
99 </packing>
100 </child>
101+ <child>
102+ <widget class="GtkHBox" id="hbox10">
103+ <property name="visible">True</property>
104+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
105+ <child>
106+ <widget class="GtkLabel" id="post_disconnect_label">
107+ <property name="width_request">150</property>
108+ <property name="visible">True</property>
109+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
110+ <property name="label" translatable="yes">Post-disconnection Script:</property>
111+ </widget>
112+ <packing>
113+ <property name="position">0</property>
114+ </packing>
115+ </child>
116+ <child>
117+ <widget class="GtkEntry" id="post_disconnect_entry">
118+ <property name="visible">True</property>
119+ <property name="can_focus">True</property>
120+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
121+ </widget>
122+ <packing>
123+ <property name="position">1</property>
124+ </packing>
125+ </child>
126+ </widget>
127+ <packing>
128+ <property name="expand">False</property>
129+ <property name="fill">False</property>
130+ <property name="padding">5</property>
131+ <property name="position">4</property>
132+ </packing>
133+ </child>
134 </widget>
135 <packing>
136 <property name="position">1</property>
137
138=== modified file 'in/man=wicd-wired-settings.conf.5.in'
139--- in/man=wicd-wired-settings.conf.5.in 2009-02-12 04:01:24 +0000
140+++ in/man=wicd-wired-settings.conf.5.in 2009-06-16 15:13:41 +0000
141@@ -33,8 +33,12 @@
142 IMPORTANT - scripts should ONLY be writable by root and located in a
143 directory that is only writable by root.
144 .TP
145-.BI "disconnectscript = " <None|arbitrary_script>
146-This defines a script to run when Wicd disconnects the interface.
147+.BI "predisconnectscript = " <None|arbitrary_script>
148+This defines a script to run before Wicd disconnects the interface.
149+The script should be a Bourne-compatible script and should be executable.
150+.TP
151+.BI "postdisconnectscript = " <None|arbitrary_script>
152+This defines a script to run after Wicd disconnects the interface.
153 The script should be a Bourne-compatible script and should be executable.
154 .br
155 IMPORTANT - scripts should ONLY be writable by root and located in a
156
157=== modified file 'in/man=wicd-wireless-settings.conf.5.in'
158--- in/man=wicd-wireless-settings.conf.5.in 2009-02-12 04:01:58 +0000
159+++ in/man=wicd-wireless-settings.conf.5.in 2009-06-16 15:13:41 +0000
160@@ -99,8 +99,11 @@
161 IMPORTANT - scripts should ONLY be writable by root and located
162 in a directory that is writable by only root.
163 .TP
164-.BI "disconnectscript = " <None|arbitrary_script>
165-This defines a script to run when Wicd disconnects the interface.
166+.BI "predisconnectscript = " <None|arbitrary_script>
167+This defines a script to run before Wicd disconnects the interface.
168+.TP
169+.BI "postdisconnectscript = " <None|arbitrary_script>
170+This defines a script to run after Wicd disconnects the interface.
171 .br
172 IMPORTANT - scripts should ONLY be writable by root and located
173 in a directory that is writable by only root.
174
175=== modified file 'in/wicd=wpath.py.in'
176--- in/wicd=wpath.py.in 2009-05-05 02:34:44 +0000
177+++ in/wicd=wpath.py.in 2009-06-16 15:13:41 +0000
178@@ -27,7 +27,8 @@
179 share = '%SHARE%'
180 etc = '%ETC%'
181 scripts = '%SCRIPTS%'
182-disconnectscripts = '%SCRIPTS%disconnect'
183+predisconnectscripts = '%SCRIPTS%predisconnect'
184+postdisconnectscripts = '%SCRIPTS%postdisconnect'
185 preconnectscripts = '%SCRIPTS%preconnect'
186 postconnectscripts = '%SCRIPTS%postconnect'
187 images = '%IMAGES%'
188
189=== modified file 'setup.py'
190--- setup.py 2009-06-04 14:24:14 +0000
191+++ setup.py 2009-06-16 15:13:41 +0000
192@@ -488,7 +488,8 @@
193 (wpath.backends, ['wicd/backends/be-external.py', 'wicd/backends/be-ioctl.py']),
194 (wpath.autostart, ['other/wicd-tray.desktop', ]),
195 (wpath.scripts, []),
196- (wpath.disconnectscripts, []),
197+ (wpath.predisconnectscripts, []),
198+ (wpath.postdisconnectscripts, []),
199 (wpath.preconnectscripts, []),
200 (wpath.postconnectscripts, []),
201 ]
202
203=== modified file 'wicd/configscript.py'
204--- wicd/configscript.py 2009-04-12 02:45:13 +0000
205+++ wicd/configscript.py 2009-06-16 15:13:41 +0000
206@@ -42,7 +42,8 @@
207 language['configure_scripts'] = _("Configure Scripts")
208 language['before_script'] = _("Pre-connection Script")
209 language['after_script'] = _("Post-connection Script")
210-language['disconnect_script'] = _("Disconnection Script")
211+language['pre_disconnect_script'] = _("Pre-disconnection Script")
212+language['post_disconnect_script'] = _("Post-disconnection Script")
213
214 dbus = dbusmanager.DBusManager()
215 dbus.connect_to_dbus()
216@@ -100,14 +101,16 @@
217 if con.has_section(network):
218 info["pre_entry"] = get_val(con, network, "beforescript")
219 info["post_entry"] = get_val(con, network, "afterscript")
220- info["disconnect_entry"] = get_val(con, network, "disconnectscript")
221+ info["pre_disconnect_entry"] = get_val(con, network, "predisconnectscript")
222+ info["post_disconnect_entry"] = get_val(con, network, "postdisconnectscript")
223 else:
224 bssid = wireless.GetWirelessProperty(int(network), "bssid")
225 con.read(wireless_conf)
226 if con.has_section(bssid):
227 info["pre_entry"] = get_val(con, bssid, "beforescript")
228 info["post_entry"] = get_val(con, bssid, "afterscript")
229- info["disconnect_entry"] = get_val(con, bssid, "disconnectscript")
230+ info["pre_disconnect_entry"] = get_val(con, bssid, "predisconnectscript")
231+ info["post_disconnect_entry"] = get_val(con, bssid, "postdisconnectscript")
232 return info
233
234 def write_scripts(network, network_type, script_info):
235@@ -120,7 +123,8 @@
236 con.add_section(network)
237 con.set(network, "beforescript", script_info["pre_entry"])
238 con.set(network, "afterscript", script_info["post_entry"])
239- con.set(network, "disconnectscript", script_info["disconnect_entry"])
240+ con.set(network, "predisconnectscript", script_info["pre_disconnect_entry"])
241+ con.set(network, "postdisconnectscript", script_info["post_disconnect_entry"])
242 con.write(open(wired_conf, "w"))
243 wired.ReloadConfig()
244 wired.ReadWiredNetworkProfile(network)
245@@ -132,7 +136,8 @@
246 con.add_section(bssid)
247 con.set(bssid, "beforescript", script_info["pre_entry"])
248 con.set(bssid, "afterscript", script_info["post_entry"])
249- con.set(bssid, "disconnectscript", script_info["disconnect_entry"])
250+ con.set(bssid, "predisconnectscript", script_info["pre_disconnect_entry"])
251+ con.set(bssid, "postdisconnectscript", script_info["post_disconnect_entry"])
252 con.write(open(wireless_conf, "w"))
253 wireless.ReloadConfig()
254 wireless.ReadWirelessNetworkProfile(int(network))
255@@ -155,25 +160,30 @@
256 dialog = wTree.get_widget("configure_script_dialog")
257 wTree.get_widget("pre_label").set_label(language['before_script'] + ":")
258 wTree.get_widget("post_label").set_label(language['after_script'] + ":")
259- wTree.get_widget("disconnect_label").set_label(language['disconnect_script']
260+ wTree.get_widget("pre_disconnect_label").set_label(language['pre_disconnect_script']
261+ + ":")
262+ wTree.get_widget("post_disconnect_label").set_label(language['post_disconnect_script']
263 + ":")
264 wTree.get_widget("window1").hide()
265
266 pre_entry = wTree.get_widget("pre_entry")
267 post_entry = wTree.get_widget("post_entry")
268- disconnect_entry = wTree.get_widget("disconnect_entry")
269+ pre_disconnect_entry = wTree.get_widget("pre_disconnect_entry")
270+ post_disconnect_entry = wTree.get_widget("post_disconnect_entry")
271
272 pre_entry.set_text(none_to_blank(script_info.get("pre_entry")))
273 post_entry.set_text(none_to_blank(script_info.get("post_entry")))
274- disconnect_entry.set_text(none_to_blank(script_info.get("disconnect_entry")))
275-
276+ pre_disconnect_entry.set_text(none_to_blank(script_info.get("pre_disconnect_entry")))
277+ post_disconnect_entry.set_text(none_to_blank(script_info.get("post_disconnect_entry")))
278+
279 dialog.show_all()
280
281 result = dialog.run()
282 if result == 1:
283 script_info["pre_entry"] = blank_to_none(pre_entry.get_text())
284 script_info["post_entry"] = blank_to_none(post_entry.get_text())
285- script_info["disconnect_entry"] = blank_to_none(disconnect_entry.get_text())
286+ script_info["pre_disconnect_entry"] = blank_to_none(pre_disconnect_entry.get_text())
287+ script_info["post_disconnect_entry"] = blank_to_none(post_disconnect_entry.get_text())
288 write_scripts(network, network_type, script_info)
289 dialog.destroy()
290
291
292=== modified file 'wicd/networking.py'
293--- wicd/networking.py 2009-06-14 18:25:06 +0000
294+++ wicd/networking.py 2009-06-16 15:13:41 +0000
295@@ -151,7 +151,8 @@
296 self.connecting_thread = None
297 self.before_script = None
298 self.after_script = None
299- self.disconnect_script = None
300+ self.pre_disconnect_script = None
301+ self.post_disconnect_script = None
302 self.driver = None
303 self.iface = None
304
305@@ -203,17 +204,23 @@
306 def Disconnect(self, *args, **kargs):
307 """ Disconnect from the network. """
308 iface = self.iface
309- misc.ExecuteScripts(wpath.disconnectscripts, self.debug)
310- if self.disconnect_script:
311- print 'Running disconnect script'
312- misc.ExecuteScript(expand_script_macros(self.disconnect_script,
313- 'disconnection', *args),
314+ misc.ExecuteScripts(wpath.predisconnectscripts, self.debug)
315+ if self.pre_disconnect_script:
316+ print 'Running pre-disconnect script'
317+ misc.ExecuteScript(expand_script_macros(self.pre_disconnect_script,
318+ 'pre-disconnection', *args),
319 self.debug)
320 iface.ReleaseDHCP()
321 iface.SetAddress('0.0.0.0')
322 iface.FlushRoutes()
323 iface.Down()
324 iface.Up()
325+ misc.ExecuteScripts(wpath.postdisconnectscripts, self.debug)
326+ if self.post_disconnect_script:
327+ print 'Running post-disconnect script'
328+ misc.ExecuteScript(expand_script_macros(self.post_disconnect_script,
329+ 'post-disconnection', *args),
330+ self.debug)
331
332 def ReleaseDHCP(self):
333 """ Release the DHCP lease for this interface. """
334@@ -273,8 +280,8 @@
335 lock = threading.Lock()
336
337 def __init__(self, network, interface_name, before_script, after_script,
338- disconnect_script, gdns1, gdns2, gdns3, gdns_dom, gsearch_dom,
339- iface, debug):
340+ pre_disconnect_script, post_disconnect_script, gdns1,
341+ gdns2, gdns3, gdns_dom, gsearch_dom, iface, debug):
342 """ Initialise the required object variables and the thread.
343
344 Keyword arguments:
345@@ -283,7 +290,8 @@
346 wired -- name of the wired interface
347 before_script -- script to run before bringing up the interface
348 after_script -- script to run after bringing up the interface
349- disconnect_script -- script to run after disconnection
350+ pre_disconnect_script -- script to run before disconnection
351+ post_disconnect_script -- script to run after disconnection
352 gdns1 -- global DNS server 1
353 gdns2 -- global DNS server 2
354 gdns3 -- global DNS server 3
355@@ -297,7 +305,8 @@
356 self.connect_result = None
357 self.before_script = before_script
358 self.after_script = after_script
359- self.disconnect_script = disconnect_script
360+ self.pre_disconnect_script = pre_disconnect_script
361+ self.post_disconnect_script = post_disconnect_script
362 self._should_die = False
363 self.abort_reason = ""
364 self.connect_result = ""
365@@ -607,7 +616,8 @@
366
367 self.connecting_thread = WirelessConnectThread(network,
368 self.wireless_interface, self.wpa_driver, self.before_script,
369- self.after_script, self.disconnect_script, self.global_dns_1,
370+ self.after_script, self.pre_disconnect_script,
371+ self.post_disconnect_script, self.global_dns_1,
372 self.global_dns_2, self.global_dns_3, self.global_dns_dom,
373 self.global_search_dom, self.wiface, debug)
374 self.connecting_thread.setDaemon(True)
375@@ -779,8 +789,9 @@
376 """
377
378 def __init__(self, network, wireless, wpa_driver, before_script,
379- after_script, disconnect_script, gdns1, gdns2, gdns3,
380- gdns_dom, gsearch_dom, wiface, debug=False):
381+ after_script, pre_disconnect_script, post_disconnect_script,
382+ gdns1, gdns2, gdns3, gdns_dom, gsearch_dom, wiface,
383+ debug=False):
384 """ Initialise the thread with network information.
385
386 Keyword arguments:
387@@ -789,14 +800,16 @@
388 wpa_driver -- type of wireless interface
389 before_script -- script to run before bringing up the interface
390 after_script -- script to run after bringing up the interface
391- disconnect_script -- script to run after disconnection
392+ pre_disconnect_script -- script to run before disconnection
393+ post_disconnect_script -- script to run after disconnection
394 gdns1 -- global DNS server 1
395 gdns2 -- global DNS server 2
396 gdns3 -- global DNS server 3
397
398 """
399 ConnectThread.__init__(self, network, wireless, before_script,
400- after_script, disconnect_script, gdns1, gdns2,
401+ after_script, pre_disconnect_script,
402+ post_disconnect_script, gdns1, gdns2,
403 gdns3, gdns_dom, gsearch_dom, wiface, debug)
404 self.wpa_driver = wpa_driver
405
406@@ -967,9 +980,10 @@
407 if not self.liface: return False
408 self.connecting_thread = WiredConnectThread(network,
409 self.wired_interface, self.before_script, self.after_script,
410- self.disconnect_script, self.global_dns_1, self.global_dns_2,
411- self.global_dns_3, self.global_dns_dom, self.global_search_dom,
412- self.liface, debug)
413+ self.pre_disconnect_script, self.post_disconnect_script,
414+ self.global_dns_1, self.global_dns_2, self.global_dns_3,
415+ self.global_dns_dom, self.global_search_dom, self.liface,
416+ debug)
417 self.connecting_thread.setDaemon(True)
418 self.connecting_thread.start()
419 return self.connecting_thread
420@@ -993,8 +1007,8 @@
421
422 """
423 def __init__(self, network, wired, before_script, after_script,
424- disconnect_script, gdns1, gdns2, gdns3, gdns_dom, gsearch_dom,
425- liface, debug=False):
426+ pre_disconnect_script, post_disconnect_script, gdns1,
427+ gdns2, gdns3, gdns_dom, gsearch_dom, liface, debug=False):
428 """ Initialise the thread with network information.
429
430 Keyword arguments:
431@@ -1003,14 +1017,16 @@
432 wired -- name of the wired interface
433 before_script -- script to run before bringing up the interface
434 after_script -- script to run after bringing up the interface
435- disconnect_script -- script to run after disconnection
436+ pre_disconnect_script -- script to run before disconnection
437+ post_disconnect_script -- script to run after disconnection
438 gdns1 -- global DNS server 1
439 gdns2 -- global DNS server 2
440 gdns3 -- global DNS server 3
441
442 """
443 ConnectThread.__init__(self, network, wired, before_script,
444- after_script, disconnect_script, gdns1, gdns2,
445+ after_script, pre_disconnect_script,
446+ post_disconnect_script, gdns1, gdns2,
447 gdns3, gdns_dom, gsearch_dom, liface, debug)
448
449 def _connect(self):
450
451=== modified file 'wicd/translations.py'
452--- wicd/translations.py 2009-06-05 08:13:38 +0000
453+++ wicd/translations.py 2009-06-16 15:13:41 +0000
454@@ -74,7 +74,8 @@
455 language['backend_alert'] = _('''Changes to your backend won't occur until the daemon is restarted.''')
456 language['about_help'] = _('''Stop a network connection in progress''')
457 language['connecting'] = _('''Connecting''')
458-language['disconnect_script'] = _('''Run disconnect script''')
459+language['pre_disconnect_script'] = _('''Run pre-disconnect script''')
460+language['post_disconnect_script'] = _('''Run post-disconnect script''')
461 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:''')
462 language['cannot_edit_scripts_3'] = _('''You can also configure the wireless networks by looking for the "[<ESSID>]" field in the config file.''')
463 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.''')
464
465=== modified file 'wicd/wicd-daemon.py'
466--- wicd/wicd-daemon.py 2009-05-24 21:11:14 +0000
467+++ wicd/wicd-daemon.py 2009-06-16 15:13:41 +0000
468@@ -1134,8 +1134,10 @@
469 # is done.
470 self.wifi.before_script = self.GetWirelessProperty(id, 'beforescript')
471 self.wifi.after_script = self.GetWirelessProperty(id, 'afterscript')
472- self.wifi.disconnect_script = self.GetWirelessProperty(id,
473- 'disconnectscript')
474+ self.wifi.pre_disconnect_script = self.GetWirelessProperty(id,
475+ 'predisconnectscript')
476+ self.wifi.post_disconnect_script = self.GetWirelessProperty(id,
477+ 'postdisconnectscript')
478 print 'Connecting to wireless network ' + self.LastScan[id]['essid']
479 self.daemon.wired_bus.wired.Disconnect()
480 self.daemon.SetForcedDisconnect(False)
481@@ -1222,12 +1224,14 @@
482
483 write_script_ent(bssid_key, "beforescript")
484 write_script_ent(bssid_key, "afterscript")
485- write_script_ent(bssid_key, "disconnectscript")
486+ write_script_ent(bssid_key, "predisconnectscript")
487+ write_script_ent(bssid_key, "postdisconnectscript")
488
489 if cur_network["use_settings_globally"]:
490 write_script_ent(essid_key, "beforescript")
491 write_script_ent(essid_key, "afterscript")
492- write_script_ent(essid_key, "disconnectscript")
493+ write_script_ent(essid_key, "predisconnectscript")
494+ write_script_ent(essid_key, "postdisconnectscript")
495
496 self.config.write()
497
498@@ -1421,7 +1425,8 @@
499 """ Connects to a wired network. """
500 self.wired.before_script = self.GetWiredProperty("beforescript")
501 self.wired.after_script = self.GetWiredProperty("afterscript")
502- self.wired.disconnect_script = self.GetWiredProperty("disconnectscript")
503+ self.wired.pre_disconnect_script = self.GetWiredProperty("predisconnectscript")
504+ self.wired.post_disconnect_script = self.GetWiredProperty("postdisconnectscript")
505 self.daemon.wireless_bus.wifi.Disconnect()
506 self.daemon.SetForcedDisconnect(False)
507 self.UnsetWiredLastUsed()
508@@ -1439,7 +1444,8 @@
509
510 for option in ["ip", "broadcast", "netmask","gateway", "search_domain",
511 "dns_domain", "dns1", "dns2", "dns3", "beforescript",
512- "afterscript", "disconnectscript"]:
513+ "afterscript", "predisconnectscript",
514+ "postdisconnectscript"]:
515 self.config.set(profilename, option, None)
516 self.config.set(profilename, "default", default)
517 self.config.write()
518@@ -1507,7 +1513,8 @@
519
520 write_script_ent(profilename, "beforescript")
521 write_script_ent(profilename, "afterscript")
522- write_script_ent(profilename, "disconnectscript")
523+ write_script_ent(profilename, "predisconnectscript")
524+ write_script_ent(profilename, "postdisconnectscript")
525 self.config.write()
526 return "100: Profile Written"
527

Subscribers

People subscribed via source and target branches

to status/vote changes: