1
0
mirror of https://github.com/gryf/wicd.git synced 2026-01-04 21:04:15 +01:00

Merged NaCl's latest revision (used bzr merge --weave as it handled the

conflicts much better) (and no, I'm not even sure *why* there were
conflicts).
This commit is contained in:
Robby Workman
2009-01-12 00:21:09 -06:00
11 changed files with 502 additions and 225 deletions

View File

@@ -2,30 +2,34 @@ This is a curses-based client for wicd. It is designed to imitate wicd-client
as much as can be done with a console-based interface. It is written using the as much as can be done with a console-based interface. It is written using the
Urwid (http://excess.org/urwid) toolkit, and thus requires it. Urwid (http://excess.org/urwid) toolkit, and thus requires it.
That's all there is to it, really. It installs unless you disable when you That's all there is to it, really. It installs unless you disable it when you
call setup.py call setup.py.
Right now, it lists current available networks, and whether you are connected Right now, it lists current available networks, and whether you are connected
to anything or not, all of which is updated in real time. It will actually to anything or not, all of which is updated in real time. Other features
connect you to networks now. Global preferences are now configurable from the include the ability to connect to networks, global preferences controls, and
console. Per-network settings is a work in progress. per-network settings for wireless networks.
All features that I plan on implementing (that are not mentioned above) are
listed the TODO file in this same directory. If you want any other features,
ask me. I try to be on the #wicd Freenode IRC channel most of the time.
Controls: Controls:
F5 : refresh wireless networks F5 : refresh wireless networks
F8 or Q: quit F8 or Q: quit
D : disconnect from active network D : disconnect from all active networks
ESC : if connecting to a network, stop doing so ESC : if connecting to a network, stop doing so
ENTER : Attempt connection to selected network ENTER : Attempt connection to selected network
P : Display preferences dialog P : Display preferences dialog
C : Display network configuration for selected network C : Display network configuration for selected network (only works for
wireless at the moment)
A : Display "About" dialog A : Display "About" dialog
I : Raise up the "Scan for hidden networks" dialog
IN DIALOGS: IN DIALOGS (Meta usually is "Alt"):
ESC or Q: Quit dialog without saving information (if present) ESC or Q: Quit dialog without saving information (if present)
Meta+Left/Right: Change tabs Left/Right Meta+Left/Right: Change tabs Left/Right (if tabs present)
Meta+Enter : Quit dialog and save information Meta+Enter : Quit dialog and save information
~NaCl ~NaCl

View File

@@ -1,17 +1,9 @@
Things to do (in no particular order): Things to do (in no particular order):
* Make a network config dialog for both wireless and wired interfaces * Make a network config dialog for wired interfaces
* Make an about dialog
* Implement a keyhandler function for the overall frame * Implement a keyhandler function for the overall frame
* Make keystrokes customizable * Make keystrokes customizable
* Make color schemes customizable * Make color schemes customizable
* Integrate this with the my local copy of the experimental branch * Implement a "make an ad-hoc network" dialog
* Give some indication of activity during the connection process * Implement a "help" dialog
* Make a man page for the UI. * Perform a mass code cleanup
Oh, and most importantly:
* Tell people how they can quit the app in the app (F8 or Q, until I do all of
that stuff) :-)
Anything else? That's all I can think of now.

View File

@@ -261,7 +261,7 @@ class ComboBox(urwid.WidgetWrap):
#def get_size(self): #def get_size(self):
def __init__(self,label='',list=[],attrs=('body','editnfc'),focus_attr='focus',use_enter=True,show_first=0): def __init__(self,label='',list=[],attrs=('body','editnfc'),focus_attr='focus',use_enter=True,focus=0,callback=None,user_args=None):
""" """
label : bit of text that preceeds the combobox. If it is "", then label : bit of text that preceeds the combobox. If it is "", then
ignore it ignore it
@@ -269,13 +269,16 @@ class ComboBox(urwid.WidgetWrap):
body : parent widget body : parent widget
ui : the screen ui : the screen
row : where this object is to be found onscreen row : where this object is to be found onscreen
show_first: index of the element in the list to pick first focus : index of the element in the list to pick first
callback : function that takes (combobox,sel_index,user_args=None)
user_args : user_args in the callback
""" """
self.label = urwid.Text(label) self.label = urwid.Text(label)
self.attrs = attrs self.attrs = attrs
self.focus_attr = focus_attr self.focus_attr = focus_attr
self.list = list self.list = list
str,trash = self.label.get_text() str,trash = self.label.get_text()
self.overlay = None self.overlay = None
@@ -290,26 +293,27 @@ class ComboBox(urwid.WidgetWrap):
# We need this to pick our keypresses # We need this to pick our keypresses
self.use_enter = use_enter self.use_enter = use_enter
# The Focus
# Set the focus at the beginning to 0 self.focus = focus
self.show_first = show_first # The callback and friends
self.callback = callback
self.user_args = user_args
def set_list(self,list): def set_list(self,list):
self.list = list self.list = list
def set_show_first(self,show_first): def set_focus(self,index):
self.show_first = show_first self.focus = index
def build_combobox(self,body,ui,row): def build_combobox(self,body,ui,row):
str,trash = self.label.get_text() str,trash = self.label.get_text()
self.cbox = DynWrap(SelText([self.list[self.show_first]+' vvv']),attrs=self.attrs,focus_attr=self.focus_attr) self.cbox = DynWrap(SelText([self.list[self.focus]+' vvv']),attrs=self.attrs,focus_attr=self.focus_attr)
if str != '': if str != '':
w = urwid.Columns([('fixed',len(str),self.label),self.cbox],dividechars=1) w = urwid.Columns([('fixed',len(str),self.label),self.cbox],dividechars=1)
self.overlay = self.ComboSpace(self.list,body,ui,self.show_first, self.overlay = self.ComboSpace(self.list,body,ui,self.focus,
pos=(len(str)+1,row)) pos=(len(str)+1,row))
else: else:
w = urwid.Columns([self.cbox]) w = urwid.Columns([self.cbox])
self.overlay = self.ComboSpace(self.list,body,ui,self.show_first, self.overlay = self.ComboSpace(self.list,body,ui,self.focus,
pos=(0,row)) pos=(0,row))
self.set_w(w) self.set_w(w)
@@ -328,89 +332,142 @@ class ComboBox(urwid.WidgetWrap):
retval = self.overlay.show(self.ui,self.body) retval = self.overlay.show(self.ui,self.body)
if retval != None: if retval != None:
self.cbox.set_w(SelText(retval+' vvv')) self.cbox.set_w(SelText(retval+' vvv'))
if self.callback != None:
self.callback(self,self.overlay._listbox.get_focus()[1],self.user_args)
return self._w.keypress(size,key) return self._w.keypress(size,key)
# Most obvious thing ever. :-)
def selectable(self): def selectable(self):
return self.cbox.selectable() return self.cbox.selectable()
# Return the index of the selected element def get_focus(self):
def get_selected(self): if self.overlay:
wid,pos = self.overlay._listbox.get_focus() return self.overlay._listbox.get_focus()
return (wid,pos) else:
return None,self.focus
def get_sensitive(self): def get_sensitive(self):
return self.cbox.get_sensitive() return self.cbox.get_sensitive()
def set_sensitive(self,state): def set_sensitive(self,state):
self.cbox.set_sensitive(state) self.cbox.set_sensitive(state)
# Almost completely ripped from rbreu_filechooser.py: # This is a h4x3d copy of some of the code in Ian Ward's dialog.py example.
# http://excess.org/urwid/browser/contrib/trunk/rbreu_menus.py class DialogExit(Exception):
class Dialog(urwid.WidgetWrap): pass
"""
Creates a BoxWidget that displays a message
Attributes: class Dialog2(urwid.WidgetWrap):
def __init__(self, text, height,width, body=None ):
b_pressed -- Contains the label of the last button pressed or None if no self.width = int(width)
button has been pressed. if width <= 0:
edit_text -- After a button is pressed, this contains the text the user self.width = ('relative', 80)
has entered in the edit field self.height = int(height)
""" if height <= 0:
self.height = ('relative', 80)
self.body = body
if body is None:
# fill space with nothing
body = urwid.Filler(urwid.Divider(),'top')
b_pressed = None self.frame = urwid.Frame( body, focus_part='footer')
edit_text = None if text is not None:
self.frame.header = urwid.Pile( [urwid.Text(text),
_blank = urwid.Text("") urwid.Divider()] )
_edit_widget = None w = self.frame
_mode = None self.view = w
def __init__(self, msg, buttons, attr, width, height, body, ):
"""
msg -- content of the message widget, one of:
plain string -- string is displayed
(attr, markup2) -- markup2 is given attribute attr
[markupA, markupB, ... ] -- list items joined together
buttons -- a list of strings with the button labels
attr -- a tuple (background, button, active_button) of attributes
width -- width of the message widget
height -- height of the message widget
body -- widget displayed beneath the message widget
"""
# Text widget containing the message:
msg_widget = urwid.Padding(urwid.Text(msg), 'center', width - 4)
# GridFlow widget containing all the buttons:
button_widgets = []
for button in buttons:
button_widgets.append(urwid.AttrWrap(
urwid.Button(button, self._action), attr[1], attr[2]))
button_grid = urwid.GridFlow(button_widgets, 12, 2, 1, 'center')
# Combine message widget and button widget:
widget_list = [msg_widget, self._blank, button_grid]
self._combined = urwid.AttrWrap(urwid.Filler(
urwid.Pile(widget_list, 2)), attr[0])
# This was the real thing I added to this class
self._linebox = urwid.LineBox(self._combined)
# Place the dialog widget on top of body:
# Width and height are increased to accomidate the linebox
overlay = urwid.Overlay(self._linebox, body, 'center', width+2,
'middle', height+2)
urwid.WidgetWrap.__init__(self, overlay) # pad area around listbox
#w = urwid.Padding(w, ('fixed left',2), ('fixed right',2))
#w = urwid.Filler(w, ('fixed top',1), ('fixed bottom',1))
#w = urwid.AttrWrap(w, 'body')
# buttons: tuple of name,exitcode
def add_buttons(self, buttons):
l = []
for name, exitcode in buttons:
b = urwid.Button( name, self.button_press )
b.exitcode = exitcode
b = urwid.AttrWrap( b, 'body','focus' )
l.append( b )
self.buttons = urwid.GridFlow(l, 10, 3, 1, 'center')
self.frame.footer = urwid.Pile( [ urwid.Divider(),
self.buttons ], focus_item = 1)
def button_press(self, button):
raise DialogExit(button.exitcode)
def run(self,ui,parent):
ui.set_mouse_tracking()
size = ui.get_cols_rows()
overlay = urwid.Overlay(urwid.LineBox(self.view), parent, 'center', self.width,
'middle', self.height)
try:
while True:
canvas = overlay.render( size, focus=True )
ui.draw_screen( size, canvas )
keys = None
while not keys:
keys = ui.get_input()
for k in keys:
if urwid.is_mouse_event(k):
event, button, col, row = k
overlay.mouse_event( size,
event, button, col, row,
focus=True)
if k == 'window resize':
size = ui.get_cols_rows()
k = self.view.keypress( size, k )
if k == 'esc':
raise DialogExit(-1)
if k:
self.unhandled_key( size, k)
except DialogExit, e:
return self.on_exit( e.args[0] )
def on_exit(self, exitcode):
return exitcode, ""
def unhandled_key(self, size, key):
pass
class TextDialog(Dialog2):
def __init__(self, text, height, width, header=None):
l = []
# read the whole file (being slow, not lazy this time)
#for line in open(file).readlines():
# l.append( urwid.Text( line.rstrip() ))
l = [urwid.Text(text)]
body = urwid.ListBox(l)
body = urwid.AttrWrap(body, 'body')
Dialog2.__init__(self, header, height+2, width+2, body)
self.add_buttons([('OK',1)])
def _action(self, button): def unhandled_key(self, size, k):
""" if k in ('up','page up','down','page down'):
Function called when a button is pressed. self.frame.set_focus('body')
Should not be called manually. self.view.keypress( size, k )
""" self.frame.set_focus('footer')
self.b_pressed = button.get_label() class InputDialog(Dialog2):
if self._edit_widget: def __init__(self, text, height, width,ok_name='OK'):
self.edit_text = self._edit_widget.get_edit_text() self.edit = urwid.Edit(wrap='clip')
body = urwid.ListBox([self.edit])
body = urwid.AttrWrap(body, 'editbx','editfc')
Dialog2.__init__(self, text, height, width, body)
self.frame.set_focus('body')
self.add_buttons([(ok_name,0),('Cancel',-1)])
def unhandled_key(self, size, k):
if k in ('up','page up'):
self.frame.set_focus('body')
if k in ('down','page down'):
self.frame.set_focus('footer')
if k == 'enter':
# pass enter to the "ok" button
self.frame.set_focus('footer')
self.view.keypress( size, k )
def on_exit(self, exitcode):
return exitcode, self.edit.get_edit_text()

View File

@@ -22,7 +22,7 @@
# MA 02110-1301, USA. # MA 02110-1301, USA.
import urwid import urwid
from curses_misc import Dialog,DynWrap,MaskingEdit,ComboBox from curses_misc import TextDialog,DynWrap,MaskingEdit,ComboBox
import wicd.misc as misc import wicd.misc as misc
from wicd.misc import noneToString, stringToNone, noneToBlankString, to_bool from wicd.misc import noneToString, stringToNone, noneToBlankString, to_bool
@@ -31,23 +31,9 @@ def error(ui,parent,message):
# /\ # /\
# /!!\ # /!!\
# /____\ # /____\
dialog = Dialog(message,[OK],('body','body','focus'),40,6) dialog = TextDialog(message,40,6,('important',"ERROR"))
return dialog.run(ui,parent)
keys = True
dim = ui.get_cols_rows()
while True:
if keys:
ui.draw_screen(dim, about.render(dim, True))
keys = ui.get_input()
if "window resize" in keys:
dim = ui.get_cols_rows()
if "esc" in keys:
return False
for k in keys:
dialog.keypress(dim, k)
if dialog.b_pressed == 'OK':
return False
language = misc.get_language_list_gui() language = misc.get_language_list_gui()
@@ -61,10 +47,13 @@ def dbus_init(dbus_ifaces):
wired = dbus_ifaces['wired'] wired = dbus_ifaces['wired']
wireless = dbus_ifaces['wireless'] wireless = dbus_ifaces['wireless']
# Both the wired and the wireless NetEntries some of the same fields. # Both the wired and the wireless settings preferences dialogs use some of the
# This will be used to produce the individual network settings # same fields.
class NetEntryBase(urwid.WidgetWrap): # This will be used to produce the individual network settings dialogs way far below
class AdvancedSettingsDialog(urwid.WidgetWrap):
def __init__(self): def __init__(self):
self.ui=None
static_ip_t = language['use_static_ip'] static_ip_t = language['use_static_ip']
ip_t = ('editcp',language['ip']+': ') ip_t = ('editcp',language['ip']+': ')
netmask_t = ('editcp',language['netmask']+':') netmask_t = ('editcp',language['netmask']+':')
@@ -78,7 +67,7 @@ class NetEntryBase(urwid.WidgetWrap):
dns2_t = ('editcp',language['dns']+ ' ' + language['2']+':'+' '*8) dns2_t = ('editcp',language['dns']+ ' ' + language['2']+':'+' '*8)
dns3_t = ('editcp',language['dns']+ ' ' + language['3']+':'+' '*8) dns3_t = ('editcp',language['dns']+ ' ' + language['3']+':'+' '*8)
cancel_t = 'cancel' cancel_t = 'Cancel'
ok_t = 'OK' ok_t = 'OK'
self.static_ip_cb = urwid.CheckBox(static_ip_t, self.static_ip_cb = urwid.CheckBox(static_ip_t,
@@ -102,6 +91,12 @@ class NetEntryBase(urwid.WidgetWrap):
_blank = urwid.Text('') _blank = urwid.Text('')
# Buttons. These need to be added to the list in superclasses.
self.OK_PRESSED= False
self.CANCEL_PRESSED = False
self.ok_button = urwid.AttrWrap(urwid.Button('OK',self.ok_callback),'body','focus')
self.cancel_button = urwid.AttrWrap(urwid.Button('Cancel',self.cancel_callback),'body','focus')
self.button_cols = urwid.Columns([self.ok_button,self.cancel_button])
walker = urwid.SimpleListWalker([self.static_ip_cb, walker = urwid.SimpleListWalker([self.static_ip_cb,
self.ip_edit, self.ip_edit,
@@ -113,11 +108,20 @@ class NetEntryBase(urwid.WidgetWrap):
self.dns1,self.dns2,self.dns3 self.dns1,self.dns2,self.dns3
]) ])
self._listbox = urwid.ListBox(walker) self._listbox = urwid.ListBox(walker)
#self._frame = urwid.Frame(self._listbox) #self._frame = urwid.Frame(self._listbox)
self._frame = urwid.Frame(self._listbox) self._frame = urwid.Frame(self._listbox)
self.__super.__init__(self._frame) self.__super.__init__(self._frame)
# Button callbacks
def ok_callback(self,button_object,user_data=None):
self.OK_PRESSED = True
def cancel_callback(self,button_object,user_data=None):
self.CANCEL_PRESSED = True
def static_ip_set_state(self,checkb,new_state,user_data=None): def static_ip_set_state(self,checkb,new_state,user_data=None):
for w in [ self.ip_edit,self.netmask_edit,self.gateway_edit ]: for w in [ self.ip_edit,self.netmask_edit,self.gateway_edit ]:
w.set_sensitive(new_state) w.set_sensitive(new_state)
@@ -139,7 +143,7 @@ class NetEntryBase(urwid.WidgetWrap):
# Code totally yanked from netentry.py # Code totally yanked from netentry.py
def save_settings(self): def save_settings(self):
""" Save settings common to wired and wireless settings dialogs. """ """ Save settings common to wired and wireless settings dialogs. """
if self.chkbox_static_ip.get_active(): if self.static_ip_cb.get_state():
self.set_net_prop("ip", noneToString(self.ip_edit.get_edit_text())) self.set_net_prop("ip", noneToString(self.ip_edit.get_edit_text()))
self.set_net_prop("netmask", noneToString(self.netmask_edit.get_edit_text())) self.set_net_prop("netmask", noneToString(self.netmask_edit.get_edit_text()))
self.set_net_prop("gateway", noneToString(self.gateway_edit.get_edit_text())) self.set_net_prop("gateway", noneToString(self.gateway_edit.get_edit_text()))
@@ -148,17 +152,17 @@ class NetEntryBase(urwid.WidgetWrap):
self.set_net_prop("netmask", '') self.set_net_prop("netmask", '')
self.set_net_prop("gateway", '') self.set_net_prop("gateway", '')
if self.chkbox_static_dns.get_active() and \ if self.static_dns_cb.get_state() and \
not self.chkbox_global_dns.get_active(): not self.global_dns_cb.get_state():
self.set_net_prop('use_static_dns', True) self.set_net_prop('use_static_dns', True)
self.set_net_prop('use_global_dns', False) self.set_net_prop('use_global_dns', False)
self.set_net_prop('dns_domain', noneToString(self.txt_domain.get_text())) self.set_net_prop('dns_domain', noneToString(self.dns_dom_edit.get_text()))
self.set_net_prop("search_domain", noneToString(self.txt_search_dom.get_text())) self.set_net_prop("search_domain", noneToString(self.search_dom_edit.get_text()))
self.set_net_prop("dns1", noneToString(self.dns_1.get_text())) self.set_net_prop("dns1", noneToString(self.dns1.get_text()))
self.set_net_prop("dns2", noneToString(self.dns_2.get_text())) self.set_net_prop("dns2", noneToString(self.dns2.get_text()))
self.set_net_prop("dns3", noneToString(self.dns_3.get_text())) self.set_net_prop("dns3", noneToString(self.dns3.get_text()))
elif self.chkbox_static_dns.get_active() and \ elif self.static_dns_cb.get_state() and \
self.chkbox_global_dns.get_active(): self.global_dns_cb.get_state():
self.set_net_prop('use_static_dns', True) self.set_net_prop('use_static_dns', True)
self.set_net_prop('use_global_dns', True) self.set_net_prop('use_global_dns', True)
else: else:
@@ -198,24 +202,35 @@ class NetEntryBase(urwid.WidgetWrap):
######################################## ########################################
class WirelessNetEntry(NetEntryBase): class WirelessSettingsDialog(AdvancedSettingsDialog):
def __init__(self,networkID): def __init__(self,networkID):
NetEntryBase.__init__(self) global wireless, daemon
AdvancedSettingsDialog.__init__(self)
self.networkID = networkID self.networkID = networkID
global_settings_t = language['global_settings'] global_settings_t = language['global_settings']
encryption_t = language['use_encryption'] encryption_t = language['use_encryption']
self.global_settings_chkbox = urwid.CheckBox(global_settings_t) self.global_settings_chkbox = urwid.CheckBox(global_settings_t)
self.encryption_chkbox = urwid.CheckBox(encryption_t,on_state_change=self.encryption_toggle) self.encryption_chkbox = urwid.CheckBox(encryption_t,on_state_change=self.encryption_toggle)
self.encryption_combo = ComboBox() self.encryption_combo = ComboBox(callback=self.combo_on_change)
self.pile_encrypt = None
# _w is a Frame, _w.body is a ListBox, _w.body.body is the ListWalker :-)
self._w.body.body.append(self.global_settings_chkbox) self._w.body.body.append(self.global_settings_chkbox)
self._w.body.body.append(self.encryption_chkbox) self._w.body.body.append(self.encryption_chkbox)
self._w.body.body.append(self.encryption_combo) self._w.body.body.append(self.encryption_combo)
self._w.body.body.append(self.button_cols)
self.encrypt_types = misc.LoadEncryptionMethods() self.encrypt_types = misc.LoadEncryptionMethods()
self.set_values() self.set_values()
# Set the frame title so that people will always know what we're dealing with.
self._w.header = urwid.Text(('header',">Configuring preferences for wireless network \"%s\"" % wireless.GetWirelessProperty(networkID,'essid')),align='right' )
def encryption_toggle(self,chkbox,new_state,user_data=None): def encryption_toggle(self,chkbox,new_state,user_data=None):
self.encryption_combo.set_sensitive(new_state) self.encryption_combo.set_sensitive(new_state)
self.pile_encrypt.set_sensitive(new_state)
def combo_on_change(self,combobox,new_index,user_data=None):
self.change_encrypt_method()
def set_values(self): def set_values(self):
""" Set the various network settings to the right values. """ """ Set the various network settings to the right values. """
@@ -238,9 +253,9 @@ class WirelessNetEntry(NetEntryBase):
#self.reset_static_checkboxes() #self.reset_static_checkboxes()
self.encryption_chkbox.set_state(bool(wireless.GetWirelessProperty(networkID, self.encryption_chkbox.set_state(bool(wireless.GetWirelessProperty(networkID,
'encryption'))) 'encryption')),do_callback=False)
self.global_settings_chkbox.set_state(bool(wireless.GetWirelessProperty(networkID, self.global_settings_chkbox.set_state(bool(wireless.GetWirelessProperty(networkID
'use_settings_globally'))) ,'use_settings_globally')))
activeID = -1 # Set the menu to this item when we are done activeID = -1 # Set the menu to this item when we are done
user_enctype = wireless.GetWirelessProperty(networkID, "enctype") user_enctype = wireless.GetWirelessProperty(networkID, "enctype")
@@ -248,14 +263,19 @@ class WirelessNetEntry(NetEntryBase):
if enc_type[1] == user_enctype: if enc_type[1] == user_enctype:
activeID = x activeID = x
#self.combo_encryption.set_active(activeID) self.encryption_combo.set_focus(activeID)
#if activeID != -1: if activeID != -1:
# self.chkbox_encryption.set_active(True) self.encryption_chkbox.set_state(True,do_callback=False)
# self.combo_encryption.set_sensitive(True) self.encryption_combo.set_sensitive(True)
# self.vbox_encrypt_info.set_sensitive(True) #self.lbox_encrypt_info.set_sensitive(True)
#else: else:
# self.combo_encryption.set_active(0) self.encryption_combo.set_focus(0)
#self.change_encrypt_method() # Throw the encryption stuff into a list
list = []
for x, enc_type in enumerate(self.encrypt_types):
list.append(enc_type[0])
self.encryption_combo.set_list(list)
self.change_encrypt_method()
def set_net_prop(self, option, value): def set_net_prop(self, option, value):
""" Sets the given option to the given value for this network. """ """ Sets the given option to the given value for this network. """
@@ -265,31 +285,108 @@ class WirelessNetEntry(NetEntryBase):
""" Helper method for fetching/formatting wireless properties. """ """ Helper method for fetching/formatting wireless properties. """
return noneToBlankString(wireless.GetWirelessProperty(networkid, label)) return noneToBlankString(wireless.GetWirelessProperty(networkid, label))
# Ripped from netentry.py
def save_settings(self, networkid):
# Check encryption info
if self.encryption_chkbox.get_state():
#print "setting encryption info..."
encryption_info = self.encryption_info
encrypt_methods = misc.LoadEncryptionMethods()
self.set_net_prop("enctype",
encrypt_methods[self.encryption_combo.get_focus()[1] ][1])
for x in encryption_info:
if encryption_info[x].get_edit_text() == "":
error(self.ui, self.overlay,language['encrypt_info_missing'])
return False
self.set_net_prop(x, noneToString(encryption_info[x].
get_edit_text()))
elif not self.encryption_chkbox.get_state() and \
wireless.GetWirelessProperty(networkid, "encryption"):
error(self.ui, self.overlay, 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.global_settings_chkbox.get_state():
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
# More or less ripped from netentry.py
def change_encrypt_method(self):
#self.lbox_encrypt = urwid.ListBox()
wid,ID = self.encryption_combo.get_focus()
methods = misc.LoadEncryptionMethods()
self.encryption_info = {}
if self._w.body.body.__contains__(self.pile_encrypt):
self._w.body.body.pop(self._w.body.body.__len__()-2)
# If nothing is selected, select the first entry.
if ID == -1:
self.encryption_combo.set_active(0)
ID = 0
opts = methods[ID][2]
theList = []
for x in opts:
edit = None
if language.has_key(opts[x][0]):
edit = MaskingEdit(('editcp',language[opts[x][0].lower().replace(' ','_')]+': '),mask_mode='on_focus')
else:
edit = MaskingEdit(('editcp',opts[x][0].replace('_',' ')+': '),mask_mode='on_focus')
theList.append(edit)
# Add the data to any array, so that the information
# can be easily accessed by giving the name of the wanted
# data.
self.encryption_info[opts[x][1]] = edit
edit.set_edit_text(noneToBlankString(
wireless.GetWirelessProperty(self.networkID, opts[x][1])))
self.pile_encrypt = DynWrap(urwid.Pile(theList),attrs=('editbx','editnfc'))
self._w.body.body.insert(self._w.body.body.__len__()-1,self.pile_encrypt)
#self._w.body.body.append(self.pile_encrypt)
def run(self,ui,dim,display): def run(self,ui,dim,display):
self.ui = ui
self.parent = display
width,height = ui.get_cols_rows() width,height = ui.get_cols_rows()
list = [] self.overlay = urwid.Overlay(self, display, ('fixed left', 0),width
for x, enc_type in enumerate(self.encrypt_types):
list.append(enc_type[0])
self.encryption_combo.set_list(list)
overlay = urwid.Overlay(self, display, ('fixed left', 0),width
, ('fixed top',1), height-3) , ('fixed top',1), height-3)
self.encryption_combo.build_combobox(overlay,ui,14) self.encryption_combo.build_combobox(self.overlay,ui,14)
#self.change_encrypt_method()
#self._w.body.body.append(self.pile_encrypt)
keys = True keys = True
while True: while True:
if keys: if keys:
ui.draw_screen(dim, overlay.render(dim, True)) ui.draw_screen(dim, self.overlay.render(dim, True))
keys = ui.get_input() keys = ui.get_input()
for k in keys:
#Send key to underlying widget:
if urwid.is_mouse_event(k):
event, button, col, row = k
self.overlay.mouse_event( dim,
event, button, col, row,
focus=True)
self.overlay.keypress(dim, k)
if "window resize" in keys: if "window resize" in keys:
dim = ui.get_cols_rows() dim = ui.get_cols_rows()
if "esc" in keys or 'Q' in keys: if "esc" in keys or 'Q' in keys:
return False return False
for k in keys: if "meta enter" in keys or self.OK_PRESSED:
#Send key to underlying widget: self.OK_PRESSED = False
overlay.keypress(dim, k) if self.save_settings(self.networkID):
# Check if buttons are pressed. return True
#if self.CANCEL_PRESSED: if self.CANCEL_PRESSED:
# return False return False
#if self.OK_PRESSED or 'meta enter' in keys:
# return True

View File

@@ -109,6 +109,7 @@ class PrefsDialog(urwid.WidgetWrap):
backend_cat_t = ('header',language['backend']) backend_cat_t = ('header',language['backend'])
backend_t = language['backend']+':' backend_t = language['backend']+':'
backend_list = ['spam','double spam','triple spam','quadruple spam'] backend_list = ['spam','double spam','triple spam','quadruple spam']
backend_warn_t = ('important','Changes to the backend (probably) requires a daemon restart')
debug_cat_t = ('header','Debugging') debug_cat_t = ('header','Debugging')
debug_mode_t = language['use_debug_mode'] debug_mode_t = language['use_debug_mode']
@@ -207,6 +208,7 @@ class PrefsDialog(urwid.WidgetWrap):
self.backend_cat = urwid.Text(backend_cat_t) self.backend_cat = urwid.Text(backend_cat_t)
self.backend_cbox = ComboBox(backend_t) self.backend_cbox = ComboBox(backend_t)
self.backend_warn = urwid.Text(backend_warn_t)
self.debug_cat = urwid.Text(debug_cat_t) self.debug_cat = urwid.Text(debug_cat_t)
self.debug_mode_checkb = urwid.CheckBox(debug_mode_t) self.debug_mode_checkb = urwid.CheckBox(debug_mode_t)
@@ -218,7 +220,7 @@ class PrefsDialog(urwid.WidgetWrap):
advancedLB = urwid.ListBox([self.wpa_cat, advancedLB = urwid.ListBox([self.wpa_cat,
self.wpa_cbox,self.wpa_warn,_blank, self.wpa_cbox,self.wpa_warn,_blank,
self.backend_cat, self.backend_cat,
self.backend_cbox,_blank, self.backend_cbox,self.backend_warn,_blank,
self.debug_cat, self.debug_cat,
self.debug_mode_checkb, _blank, self.debug_mode_checkb, _blank,
self.wless_cat, self.wless_cat,
@@ -315,7 +317,7 @@ class PrefsDialog(urwid.WidgetWrap):
# Pick where to begin first: # Pick where to begin first:
def_driver = daemon.GetWPADriver() def_driver = daemon.GetWPADriver()
try: try:
self.wpa_cbox.set_show_first(self.wpadrivers.index(def_driver)) self.wpa_cbox.set_focus(self.wpadrivers.index(def_driver))
except ValueError: except ValueError:
pass # It defaults to 0 anyway pass # It defaults to 0 anyway
@@ -326,9 +328,9 @@ class PrefsDialog(urwid.WidgetWrap):
self.backend_cbox.set_list(self.thebackends) self.backend_cbox.set_list(self.thebackends)
cur_backend = daemon.GetSavedBackend() cur_backend = daemon.GetSavedBackend()
try: try:
self.backend_cbox.set_show_first(self.thebackends.index(cur_backend)) self.backend_cbox.set_focus(self.thebackends.index(cur_backend))
except ValueError: except ValueError:
self.backend_cbox.set_show_first(0) self.backend_cbox.set_focus(0)
# Two last checkboxes # Two last checkboxes
self.debug_mode_checkb.set_state(daemon.GetDebugMode()) self.debug_mode_checkb.set_state(daemon.GetDebugMode())
@@ -343,7 +345,7 @@ class PrefsDialog(urwid.WidgetWrap):
self.search_dom.get_edit_text()) self.search_dom.get_edit_text())
daemon.SetWirelessInterface(self.wless_edit.get_edit_text()) daemon.SetWirelessInterface(self.wless_edit.get_edit_text())
daemon.SetWiredInterface(self.wired_edit.get_edit_text()) daemon.SetWiredInterface(self.wired_edit.get_edit_text())
daemon.SetWPADriver(self.wpadrivers[self.wpa_cbox.get_selected()[1]]) daemon.SetWPADriver(self.wpadrivers[self.wpa_cbox.get_focus()[1]])
daemon.SetAlwaysShowWiredInterface(self.always_show_wired_checkb.get_state()) daemon.SetAlwaysShowWiredInterface(self.always_show_wired_checkb.get_state())
daemon.SetAutoReconnect(self.auto_reconn_checkb.get_state()) daemon.SetAutoReconnect(self.auto_reconn_checkb.get_state())
daemon.SetDebugMode(self.debug_mode_checkb.get_state()) daemon.SetDebugMode(self.debug_mode_checkb.get_state())
@@ -355,7 +357,7 @@ class PrefsDialog(urwid.WidgetWrap):
else: else:
daemon.SetWiredAutoConnectMethod(1) daemon.SetWiredAutoConnectMethod(1)
daemon.SetBackend(self.backends[self.backend_cbox.get_selected()[1]]) daemon.SetBackend(self.backends[self.backend_cbox.get_focus()[1]])
# External Programs Tab # External Programs Tab
if self.dhcp0.get_state(): if self.dhcp0.get_state():
@@ -423,6 +425,11 @@ class PrefsDialog(urwid.WidgetWrap):
return False return False
for k in keys: for k in keys:
#Send key to underlying widget: #Send key to underlying widget:
if urwid.is_mouse_event(k):
event, button, col, row = k
overlay.mouse_event( dim,
event, button, col, row,
focus=True)
overlay.keypress(dim, k) overlay.keypress(dim, k)
# Check if buttons are pressed. # Check if buttons are pressed.
if self.CANCEL_PRESSED: if self.CANCEL_PRESSED:

View File

@@ -53,10 +53,10 @@ import sys
from time import sleep from time import sleep
# Curses UIs for other stuff # Curses UIs for other stuff
from curses_misc import SelText,ComboBox,Dialog from curses_misc import SelText,ComboBox,TextDialog,InputDialog
from prefs_curses import PrefsDialog from prefs_curses import PrefsDialog
import netentry_curses import netentry_curses
from netentry_curses import WirelessNetEntry from netentry_curses import WirelessSettingsDialog, error
language = misc.get_language_list_gui() language = misc.get_language_list_gui()
@@ -80,6 +80,19 @@ class wrap_exceptions:
ui.stop() ui.stop()
print "\nTerminated by user." print "\nTerminated by user."
raise raise
except DBusException:
gobject.source_remove(redraw_tag)
# Quit the loop
loop.quit()
# Zap the screen
ui.stop()
print ""
print "DBus failiure!"
print "This is most likely caused by the wicd daemon stopping"
print "while wicd-curses is running."
print ""
print "Please restart the daemon, and restart wicd-curses."
raise
except : except :
# If the UI isn't inactive (redraw_tag wouldn't normally be # If the UI isn't inactive (redraw_tag wouldn't normally be
# set), then don't try to stop it, just gracefully die. # set), then don't try to stop it, just gracefully die.
@@ -212,23 +225,8 @@ def about_dialog(body):
" ___|+|___ Dan O'Reilly (wicd)\n", " ___|+|___ Dan O'Reilly (wicd)\n",
" |---------| Andrew Psaltis (this ui)\n", " |---------| Andrew Psaltis (this ui)\n",
"---------------------------------------------------"] "---------------------------------------------------"]
about = Dialog(theText,['OK'],('body','body','focus'),55,14,body) about = TextDialog(theText,55,14)
about.run(ui,body)
keys = True
dim = ui.get_cols_rows()
while True:
if keys:
ui.draw_screen(dim, about.render(dim, True))
keys = ui.get_input()
if "window resize" in keys:
dim = ui.get_cols_rows()
if "esc" in keys:
return False
for k in keys:
about.keypress(dim, k)
if about.b_pressed == 'OK':
return False
######################################## ########################################
##### URWID SUPPORT CLASSES ##### URWID SUPPORT CLASSES
@@ -303,7 +301,7 @@ class WiredComboBox(ComboBox):
wiredL.append(theString) wiredL.append(theString)
id+=1 id+=1
self.__super.__init__(list=wiredL,use_enter=False) self.__super.__init__(list=wiredL,use_enter=False)
self.set_show_first(theList.index(wired.GetDefaultWiredProfile())) self.set_focus(theList.index(wired.GetDefaultWiredProfile()))
def keypress(self,size,key): def keypress(self,size,key):
self.__super.keypress(size,key) self.__super.keypress(size,key)
@@ -335,6 +333,7 @@ class appGUI():
# for networks. :-) # for networks. :-)
# Will need a translation sooner or later # Will need a translation sooner or later
self.screen_locker = urwid.Filler(urwid.Text(('important',"Scanning networks... stand by..."), align='center')) self.screen_locker = urwid.Filler(urwid.Text(('important',"Scanning networks... stand by..."), align='center'))
self.no_wlan = urwid.Filler(urwid.Text(('important',"No wireless networks found."), align='center'))
self.TITLE = 'Wicd Curses Interface' self.TITLE = 'Wicd Curses Interface'
#wrap1 = urwid.AttrWrap(txt, 'black') #wrap1 = urwid.AttrWrap(txt, 'black')
@@ -344,8 +343,10 @@ class appGUI():
self.wiredH=urwid.Filler(urwid.Text("Wired Network(s)")) self.wiredH=urwid.Filler(urwid.Text("Wired Network(s)"))
self.wlessH=urwid.Filler(urwid.Text("Wireless Network(s)")) self.wlessH=urwid.Filler(urwid.Text("Wireless Network(s)"))
#if wireless.GetNumberOfNetworks() == 0:
# wireless.Scan()
wiredL,wlessL = gen_network_list() wiredL,wlessL = gen_network_list()
self.wiredCB = urwid.Filler(ComboBox(list=wiredL)) self.wiredCB = urwid.Filler(ComboBox(list=wiredL,use_enter=False))
self.wlessLB = urwid.ListBox(wlessL) self.wlessLB = urwid.ListBox(wlessL)
# Stuff I used to simulate large lists # Stuff I used to simulate large lists
#spam = SelText('spam') #spam = SelText('spam')
@@ -383,6 +384,8 @@ class appGUI():
self.screen_locked = False self.screen_locked = False
#self.always_show_wired = daemon.GetAlwaysShowWiredInterface() #self.always_show_wired = daemon.GetAlwaysShowWiredInterface()
self.focusloc = (1,0)
self.pref = None self.pref = None
self.update_status() self.update_status()
@@ -395,18 +398,46 @@ class appGUI():
self.screen_locked = True self.screen_locked = True
def unlock_screen(self): def unlock_screen(self):
self.update_netlist(force_check=True)
self.frame.set_body(self.thePile) self.frame.set_body(self.thePile)
self.screen_locked = False self.screen_locked = False
# I'm hoping that this will get rid of Adam's problem with the ListBox not # I'm hoping that this will get rid of Adam's problem with the ListBox not
# redisplaying itself immediately upon completion. # redisplaying itself immediately upon completion.
self.update_netlist(force_check=True)
self.update_ui() self.update_ui()
def raise_hidden_network_dialog(self):
dialog = InputDialog(('header','Select Hidden Network ESSID'),7,30,'Scan')
exitcode,hidden = dialog.run(ui,self.frame)
if exitcode != -1:
# That dialog will sit there for a while if I don't get rid of it
self.update_ui()
wireless.SetHiddenNetworkESSID(misc.noneToString(hidden))
wireless.Scan()
wireless.SetHiddenNetworkESSID("")
def update_focusloc(self):
# Location of last known focus is remapped to current location.
# This might need to be cleaned up later.
if self.thePile.get_focus() is self.wiredCB:
wlessorwired = 1
else :
wlessorwired = 3
if self.thePile.get_focus() == self.no_wlan:
where = 0
elif self.thePile.get_focus() == self.wiredCB:
where = self.thePile.get_focus().get_body().get_focus()[1]
else:
where = self.thePile.get_focus().get_focus()[1]
self.focusloc = (wlessorwired,where)
# Be clunky until I get to a later stage of development. # Be clunky until I get to a later stage of development.
# Update the list of networks. Usually called by DBus. # Update the list of networks. Usually called by DBus.
# TODO: Preserve current focus when updating the list. # TODO: Preserve current focus when updating the list.
@wrap_exceptions() @wrap_exceptions()
def update_netlist(self,state=None, x=None, force_check=False): def update_netlist(self,state=None, x=None, force_check=False):
self.update_focusloc()
""" Updates the overall network list.""" """ Updates the overall network list."""
if not state: if not state:
state, x = daemon.GetConnectionStatus() state, x = daemon.GetConnectionStatus()
@@ -416,17 +447,28 @@ class appGUI():
# use_enter=False)) # use_enter=False))
self.wiredCB.get_body().set_list(wiredL) self.wiredCB.get_body().set_list(wiredL)
self.wiredCB.get_body().build_combobox(self.frame,ui,3) self.wiredCB.get_body().build_combobox(self.frame,ui,3)
self.wlessLB.body = urwid.SimpleListWalker(wlessL) if len(wlessL) != 0:
self.wlessLB.body = urwid.SimpleListWalker(wlessL)
else:
self.wlessLB.body = urwid.SimpleListWalker([self.no_wlan])
if daemon.GetAlwaysShowWiredInterface() or wired.CheckPluggedIn(): if daemon.GetAlwaysShowWiredInterface() or wired.CheckPluggedIn():
#if daemon.GetAlwaysShowWiredInterface(): #if daemon.GetAlwaysShowWiredInterface():
self.thePile = urwid.Pile([('fixed',1,self.wiredH), self.thePile = urwid.Pile([('fixed',1,self.wiredH),
('fixed',1,self.wiredCB), ('fixed',1,self.wiredCB),
('fixed',1,self.wlessH), ('fixed',1,self.wlessH),
self.wlessLB] ) self.wlessLB] )
#self.focusloc = (self.thePile.get_focus(),
# self.thePile.get_focus().get_focus()[1])
self.thePile.set_focus(self.focusloc[0])
if self.focusloc[0] == 1:
self.thePile.get_focus().get_body().set_focus(self.focusloc[1])
else:
self.thePile.get_focus().set_focus(self.focusloc[1])
else: else:
self.thePile = urwid.Pile([('fixed',1,self.wlessH),self.wlessLB] ) self.thePile = urwid.Pile([('fixed',1,self.wlessH),self.wlessLB] )
self.frame.body = self.thePile self.frame.body = self.thePile
if self.focusloc[0] == self.wlessLB:
self.wlessLB.set_focus(self.focusloc[1])
#self.always_show_wired = not self.always_show_wired #self.always_show_wired = not self.always_show_wired
self.prev_state = state self.prev_state = state
@@ -503,27 +545,29 @@ class appGUI():
def idle_incr(self): def idle_incr(self):
theText = "" theText = ""
if self.connecting: if self.connecting:
theText = "-- Connecting -- Press ESC to cancel" theText = "-- Connecting -- Press ESC to cancel "
self.footer1 = urwid.Text(str(self.incr) + ' '+theText) quit_note = "-- Press F8 or Q to quit."
self.footer1 = urwid.Text(str(self.incr) + ' '+theText+quit_note)
self.incr+=1 self.incr+=1
return True return True
# Yeah, I'm copying code. Anything wrong with that? # Yeah, I'm copying code. Anything wrong with that?
#@wrap_exceptions() #@wrap_exceptions()
def dbus_scan_finished(self): def dbus_scan_finished(self):
# I'm pretty sure that I'll need this later. # I'm pretty sure that I'll need this later.
#if not self.connecting: #if not self.connecting:
#self.refresh_networks(fresh=False) # gobject.idle_add(self.refresh_networks, None, False, None)
self.unlock_screen() self.unlock_screen()
# I'm hoping that this will resolve Adam's problem with the screen lock # I'm hoping that this will resolve Adam's problem with the screen lock
# remaining onscreen until a key is pressed. It goes away perfectly well # remaining onscreen until a key is pressed. It goes away perfectly well
# here. # here.
self.update_ui() self.update_ui()
# Same, same, same, same, same, same # Same, same, same, same, same, same
#@wrap_exceptions() #@wrap_exceptions()
def dbus_scan_started(self): def dbus_scan_started(self):
self.lock_screen() self.lock_screen()
self.update_ui()
# Redraw the screen # Redraw the screen
@wrap_exceptions() @wrap_exceptions()
@@ -553,7 +597,7 @@ class appGUI():
# references to self.frame lying around. ^_^ # references to self.frame lying around. ^_^
if "enter" in keys: if "enter" in keys:
focus = self.thePile.get_focus() focus = self.thePile.get_focus()
if focus == self.wiredCB: if focus is self.wiredCB:
self.connect("wired",0) self.connect("wired",0)
else: else:
# wless list only other option # wless list only other option
@@ -575,30 +619,35 @@ class appGUI():
self.update_ui() self.update_ui()
if "A" in keys: if "A" in keys:
about_dialog(self.frame) about_dialog(self.frame)
if "C" in keys:
focus = self.thePile.get_focus()
if focus == self.wiredCB:
pass
else:
# wireless list only other option
wid,pos = self.thePile.get_focus().get_focus()
WirelessSettingsDialog(pos).run(ui,self.size,self.frame)
#self.netentry = NetEntryBase(dbusmanager.get_dbus_ifaces())
#self.netentry.run(ui,self.size,self.frame)
if "I" in keys:
self.raise_hidden_network_dialog()
for k in keys: for k in keys:
if urwid.is_mouse_event(k):
event, button, col, row = k
self.frame.mouse_event( self.size,
event, button, col, row,
focus=True)
if k == "window resize": if k == "window resize":
self.size = ui.get_cols_rows() self.size = ui.get_cols_rows()
continue continue
self.frame.keypress( self.size, k ) self.frame.keypress( self.size, k )
if "C" in keys:
focus = self.thePile.get_focus()
if focus == self.wiredCB:
pass
#self.connect("wired",0)
else:
# wless list only other option
wid,pos = self.thePile.get_focus().get_focus()
WirelessNetEntry(pos).run(ui,self.size,self.frame)
#self.connect("wireless",pos)
#self.netentry = NetEntryBase(dbusmanager.get_dbus_ifaces())
#self.netentry.run(ui,self.size,self.frame)
if " " in keys: if " " in keys:
focus = self.thePile.get_focus() focus = self.thePile.get_focus()
if focus == self.wiredCB: if focus == self.wiredCB:
#self.set_status('space pressed on wiredCB!') #self.set_status('space pressed on wiredCB!')
wid,pos = self.wiredCB.get_body().get_selected() wid,pos = self.wiredCB.get_body().get_focus()
text,attr = wid.get_text() text,attr = wid.get_text()
wired.ReadWiredNetworkProfile(text) wired.ReadWiredNetworkProfile(text)
# Make sure our internal reference to the combobox matches the # Make sure our internal reference to the combobox matches the
@@ -630,14 +679,14 @@ def main():
misc.RenameProcess('wicd-curses') misc.RenameProcess('wicd-curses')
ui = urwid.curses_display.Screen() ui = urwid.curses_display.Screen()
# Color scheme. # Default Color scheme.
# Other potential color schemes can be found at: # Other potential color schemes can be found at:
# http://excess.org/urwid/wiki/RecommendedPalette # http://excess.org/urwid/wiki/RecommendedPalette
# Note: the current palette below is optimized for the linux console. # Note: the current palette below is optimized for the linux console.
# For example, this looks particularly bad on a default-colored XTerm. # For example, this looks particularly bad on a default-colored XTerm.
# NB: To find current terminal background use variable COLORFGBG # NB: To find current terminal background use variable COLORFGBG
ui.register_palette([ ui.register_palette([
('body','light gray','default'), ('body','default','default'),
('focus','dark magenta','light gray'), ('focus','dark magenta','light gray'),
('header','light blue','default'), ('header','light blue','default'),
('important','light red','default'), ('important','light red','default'),
@@ -659,6 +708,7 @@ def main():
def run(): def run():
global loop,redraw_tag global loop,redraw_tag
ui.set_mouse_tracking()
redraw_tag = -1 redraw_tag = -1
app = appGUI() app = appGUI()

View File

@@ -33,17 +33,25 @@ Refresh the network list
.TP .TP
.BR P .BR P
Bring up the preferences controller Bring up the preferences controller
.TP
.BR I
Bring up hidden network scanning dialog
.PP .PP
The following is a work in progress and might not be fully functional as of yet. The following is a work in progress and might not be fully functional as of yet.
.TP .TP
.BR C .BR C
Bring up network configuration controller for the selected network Bring up network configuration controller for the selected network
.PP .PP
The following is not implemented yet: The following are not implemented yet:
.TP .TP
.BR S .BR S
Bring up the script selector for the selected network (requires superuser privileges) Bring up the script selector for the selected network (requires superuser privileges)
.TP
.BR R
Bring up script selector "dialog."
.TP
.BR H
Bring up a rather simplistic help dialog. Of course, it mentions this man page first. :-)
.SH "FILES" .SH "FILES"
These are not used yet. These are not used yet.
.TP .TP

View File

@@ -0,0 +1,14 @@
If you are reading this, you are probably wondering why your Wicd configuration
files are not here. What follows is a summary of the folders that wicd uses.
For a more detailed (and complete) description what is in each directory, consult the
man pages for wicd(8) and wicd-curses(8).
~/.wicd
User-dependent configuration files, only used by wicd-curses
%ETC%
Global configuration files
%NETWORKS%
Individual network configurations

View File

@@ -1,2 +1,47 @@
#!/bin/bash #!/bin/bash
BOLD=`tput bold`
BLUE=`tput setaf 4`
NC=`tput sgr0`
# check_firstrun()
if [ ! -d ~/.wicd ]; then
mkdir ~/.wicd
fi
# Make sure the user knows WHEREAREMYFILES ;-)
if [ -e %DOCDIR%WHEREAREMYFILES ] && [ ! -L ~/.wicd/WHEREAREMYFILES ]; then
ln -s %DOCDIR%WHEREAREMYFILES ~/.wicd/WHEREAREMYFILES
fi
if [ "$DISPLAY" = "" ] && [ -x "%BIN%wicd-curses" ]; then
if [ ! -f ~/.wicd/CLIENT_CURSES_WARNING ]; then
echo "NOTICE: We see that you don't have an X server active on this console."
echo "We will now be starting ${BOLD}${BLUE}wicd-curses${NC}. If you desire"
echo "more information about what is happening here, please read:"
echo
echo "man wicd-client"
echo "-or-"
echo "man wicd-curses"
echo
echo "We apologize for any inconvenience. This message will not be displayed again."
echo "Please press enter to continue..."
read junk
cat >>~/.wicd/CLIENT_CURSES_WARNING<<EOF
This file is what wicd-client looks for so that it doesn't try to tell you that
it is trying to launch the curses client so that it doesn't surprise non-
technical users.
Please keep this file. If you remove it, then wicd-client will bark at
you if you try to launch wicd-client on a screen that is not running X.
Or, you could just run "touch ~/.wicd/CLIENT_CURSES_WARNING", and the same
objective will be met.
Have a nice day.
~The Wicd Developers
EOF
#touch ~/.wicd/CLIENT_CURSES_WARNING
fi
exec %BIN%wicd-curses
fi
exec python -O %LIB%wicd-client.py $@ exec python -O %LIB%wicd-client.py $@

View File

@@ -3,6 +3,8 @@
wicd-client \- manual page for wicd-client wicd-client \- manual page for wicd-client
.SH DESCRIPTION .SH DESCRIPTION
wireless (and wired) connection daemon front\-end. wireless (and wired) connection daemon front\-end.
If wicd-curses(8) is instaled, and you attempt to run wicd-client without an active X server on the current terminal, wicd-client will attempt to run wicd-curses(8) instead. It will warn you the first time this happens.
.SS "Arguments:" .SS "Arguments:"
.TP .TP
\fB\-n\fR \fB\-\-no\-tray\fR \fB\-n\fR \fB\-\-no\-tray\fR

View File

@@ -1,3 +1,4 @@
#!/usr/bin/env python
# #
# Copyright (C) 2007 - 2008 Adam Blackburn # Copyright (C) 2007 - 2008 Adam Blackburn
# Copyright (C) 2007 - 2008 Dan O'Reilly # Copyright (C) 2007 - 2008 Dan O'Reilly
@@ -410,13 +411,13 @@ try:
data.append(( wpath.lib, ['curses/netentry_curses.py'])) data.append(( wpath.lib, ['curses/netentry_curses.py']))
data.append(( wpath.bin, ['scripts/wicd-curses'])) data.append(( wpath.bin, ['scripts/wicd-curses']))
if not wpath.no_install_man: if not wpath.no_install_man:
data.append(( wpath.mandir + 'man8', ['man/wicd-curses.8'])) data.append(( wpath.mandir + 'man8/', ['man/wicd-curses.8']))
piddir = os.path.dirname(wpath.pidfile) piddir = os.path.dirname(wpath.pidfile)
if not piddir.endswith('/'): if not piddir.endswith('/'):
piddir += '/' piddir += '/'
data.append (( piddir, [] )) data.append (( piddir, [] ))
if not wpath.no_install_docs: if not wpath.no_install_docs:
data.append(( wpath.docdir, [ 'INSTALL', 'LICENSE', 'AUTHORS', 'README', 'CHANGES' ])) data.append(( wpath.docdir, [ 'INSTALL', 'LICENSE', 'AUTHORS', 'README', 'CHANGES','other/WHEREAREMYFILES' ]))
if not wpath.no_install_kde: if not wpath.no_install_kde:
data.append(( wpath.kdedir, [ 'other/wicd-tray.desktop' ])) data.append(( wpath.kdedir, [ 'other/wicd-tray.desktop' ]))
if not wpath.no_install_init: if not wpath.no_install_init: