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

Merge r463 of mainline 1.6.

This commit is contained in:
Andrew Psaltis
2009-10-31 17:55:04 -04:00
11 changed files with 103 additions and 102 deletions

View File

@@ -65,8 +65,11 @@ class DynWrap(urwid.AttrWrap):
def __init__(self,w,sensitive=True,attrs=('editbx','editnfc'),focus_attr='editfc'):
self._attrs=attrs
self._sensitive = sensitive
cur_attr = attrs[0] if sensitive else attrs[1]
if sensitive:
cur_attr = attrs[0]
else:
cur_attr = attrs[1]
self.__super.__init__(w,cur_attr,focus_attr)
@@ -211,24 +214,27 @@ class TabColumns(urwid.WidgetWrap):
return True
def keypress(self,size,key):
if key == "meta [" or key == "meta ]":
# If the key is page up or page down, move focus to the tabs and call
# left or right on the tabs.
if key == "page up" or key == "page down":
self._w.get_body().set_focus(0)
newK = 'left' if key[-1] == '[' else 'right'
if key == "page up":
newK = 'left'
else:
newK = 'right'
self.keypress(size,newK)
self._w.get_body().set_focus(1)
else:
key = self._w.keypress(size,key)
wid = self.pile.get_focus().get_body()
if wid == self.columns:
# lw = self.listbox.body
# lw.pop(1)
self.active_tab.set_attr('body')
self.columns.get_focus().set_attr('tab active')
self.active_tab = self.columns.get_focus()
self.gen_pile(self.tab_map[self.active_tab])
return key
# self.listbox.body = lw
def mouse_event(self,size,event,button,x,y,focus):
wid = self.pile.get_focus().get_body()
if wid == self.columns:
@@ -564,26 +570,11 @@ class OptCols(urwid.WidgetWrap):
# callbacks map the text contents to its assigned callback.
self.callbacks = []
for cmd in tuples:
splitcmd = cmd[0].split()
key = ''
for part in splitcmd:
if part == 'ctrl':
key+='Ctrl+'
elif part == 'meta':
# If anyone has a problem with this, they can bother me
# about it.
key+='Alt+'
else:
if part == 'left':
key += '<-'
elif part == 'right':
key += '->'
elif part == 'esc':
key += 'ESC'
elif part == 'enter':
key += 'Enter'
else:
key += part
key = reduce(lambda s,(f,t):s.replace(f,t), [ \
('ctrl ', 'Ctrl+'), ('meta ', 'Alt+'), \
('left', '<-'), ('right', '->'), \
('page up', 'Page Up'), ('page down', 'Page Down'), \
('esc', 'ESC'), ('enter', 'Enter'), ('f10','F10')], cmd[0])
if debug:
callback = self.debugClick

View File

@@ -292,9 +292,7 @@ class PrefsDialog(urwid.WidgetWrap):
### Advanced settings
# wpa_supplicant janx
self.wpadrivers = ["wext", "hostap", "madwifi", "atmel",
"ndiswrapper", "ipw"]
self.wpadrivers = wireless.GetWpaSupplicantDrivers(self.wpadrivers)
self.wpadrivers = wireless.GetWpaSupplicantDrivers()
self.wpadrivers.append("ralink_legacy")
# Same as above with the dbus.String
self.thedrivers = [unicode(w) for w in self.wpadrivers]

View File

@@ -3,8 +3,8 @@
""" wicd-curses. (curses/urwid-based) console interface to wicd
Provides the a console UI for wicd, so that people with broken X servers can
at least get a network connection. Or those who don't like using X. ;-)
Provides a console UI for wicd, so that people with broken X servers can
at least get a network connection. Or those who don't like using X and/or GTK.
"""
@@ -254,9 +254,14 @@ def help_dialog(body):
def run_configscript(parent,netname,nettype):
configfile = wpath.etc+netname+'-settings.conf'
header = 'profile' if nettype == 'wired' else 'BSSID'
profname = netname if nettype == 'wired' else wireless.GetWirelessProperty(
int(netname),'bssid')
if nettype != 'wired':
header = 'profile'
else:
header ='BSSID'
if nettype == 'wired':
profname = nettype
else:
profname = wireless.GetWirelessProperty( int(netname),'bssid')
theText = [
language['cannot_edit_scripts_1'].replace('$A',configfile).replace('$B',header),
"\n\n["+profname+"]\n\n",
@@ -329,7 +334,12 @@ class NetLabel(urwid.WidgetWrap):
str(wireless.GetWirelessProperty(id, strenstr)))
self.essid = wireless.GetWirelessProperty(id, 'essid')
self.bssid = wireless.GetWirelessProperty(id, 'bssid')
self.encrypt = wireless.GetWirelessProperty(id,'encryption_method') if wireless.GetWirelessProperty(id, 'encryption') else language['unsecured']
if wireless.GetWirelessProperty(id, 'encryption'):
self.encrypt = wireless.GetWirelessProperty(id,'encryption_method')
else:
self.encrypt = language['unsecured']
self.mode = wireless.GetWirelessProperty(id, 'mode') # Master, Ad-Hoc
self.channel = wireless.GetWirelessProperty(id, 'channel')
theString = ' %-*s %25s %9s %17s %6s %4s' % (gap,
@@ -400,7 +410,6 @@ class WiredComboBox(ComboBox):
self.rebuild_combobox()
self.set_focus(prev_focus)
else:
print "updating..."
wired.ReadWiredNetworkProfile(self.get_selected_profile())
if key == 'delete':
if len(self.theList) == 1:
@@ -583,11 +592,11 @@ class appGUI():
def init_other_optcols(self):
# The "tabbed" preferences dialog
self.prefCols = OptCols( [ ('meta enter','OK'),
('meta [','Tab Left',),
('meta ]','Tab Right'),
self.prefCols = OptCols( [ ('f10','OK'),
('page up','Tab Left',),
('page down', 'Tab Right'),
('esc','Cancel') ], self.handle_keys)
self.confCols = OptCols( [ ('meta enter','OK'),
self.confCols = OptCols( [ ('f10','OK'),
('esc','Cancel') ],self.handle_keys)
# Does what it says it does
@@ -768,6 +777,7 @@ class appGUI():
self.tcount+=1
toAppend=self.twirl[self.tcount % 4]
self.status_label.set_text(text+' '+toAppend)
self.update_ui()
return True
# Make sure the screen is still working by providing a pretty counter.
@@ -776,6 +786,7 @@ class appGUI():
#@wrap_exceptions
def update_time(self):
self.time_label.set_text(strftime('%H:%M:%S'))
self.update_ui()
return True
# Yeah, I'm copying code. Anything wrong with that?
@@ -902,7 +913,7 @@ class appGUI():
if k == 'esc' or k == 'q' or k == 'Q':
self.restore_primary()
break
if k == 'meta enter':
if k == 'f10':
self.diag.save_settings()
self.restore_primary()
break
@@ -911,17 +922,16 @@ class appGUI():
continue
def call_update_ui(self,source,cb_condition):
self.update_ui(from_key=True)
self.update_ui(True)
return True
# Redraw the screen
@wrap_exceptions
def update_ui(self,from_key=True,from_alarm=False):
#self.update_status()
canvas = self.frame.render( (self.size),True )
def update_ui(self,from_key=False):
if not ui._started:
return False
canvas = self.frame.render( (self.size),True )
# Update the screen
ui.draw_screen((self.size),canvas)
# Get the input data
@@ -932,24 +942,12 @@ class appGUI():
# Resolve any "alarms" in the waiting
if self.update_tag != None:
gobject.source_remove(self.update_tag)
if max_wait == None:
max_wait = 25
else:
max_wait *= 100
max_wait = int(max_wait)
self.update_tag = gobject.timeout_add(max_wait, \
self.update_ui,False,True)
#print keys
#if keys == []:
# return True
self.handle_keys(keys)
# If we came from the "alarm", die.
if from_alarm:
return False
return True
if from_key:
max_wait = 20
self.update_tag = gobject.timeout_add(max_wait, \
self.update_ui,True)
self.handle_keys(keys)
return False
def connect(self, nettype, networkid, networkentry=None):
""" Initiates the connection process in the daemon. """