1
0
mirror of https://github.com/gryf/wicd.git synced 2025-12-19 20:38:00 +01:00

Moved translations out of translations.py, re-designed l10n system a bit

This commit is contained in:
David Paleino
2011-10-18 23:33:23 +02:00
parent 278f20a264
commit 4928f9c683
15 changed files with 414 additions and 519 deletions

View File

@@ -189,28 +189,32 @@ if options.connect:
wireless.ConnectWireless(options.network)
check = lambda: wireless.CheckIfWirelessConnecting()
status = lambda: wireless.CheckWirelessConnectingStatus()[1]
message = lambda: wireless.CheckWirelessConnectingMessage()[1]
elif options.wired:
print "Connecting to wired connection on %s" % wired.DetectWiredInterface()
wired.ConnectWired()
check = lambda: wired.CheckIfWiredConnecting()
status = lambda: wired.CheckWiredConnectingStatus()
message = lambda: wired.CheckWiredConnectingMessage()
else:
check = lambda: False
status = lambda: False
message = lambda: False
# update user on what the daemon is doing
last = None
if check:
while check():
next = message()
next = status()
if next != last:
# avoid a race condition where status is updated to "done" after the
# loop check
# FIXME
if next == "done":
break
print "%s..." % next.replace("_", " ")
print message()
last = next
print "done!"
op_performed = True

View File

@@ -24,6 +24,7 @@ Also recycles a lot of configscript.py, too. :-)
# MA 02110-1301, USA.
from wicd import misc
from wicd.translations import _
import configscript
from configscript import write_scripts,get_script_info,get_val,none_to_blank,blank_to_none
@@ -32,15 +33,6 @@ import urwid.curses_display
import sys
import os
_ = misc.get_gettext()
language = {}
language['configure_scripts'] = _("Configure Scripts")
language['before_script'] = _("Pre-connection Script")
language['after_script'] = _("Post-connection Script")
language['pre_disconnect_script'] = _("Pre-disconnection Script")
language['post_disconnect_script'] = _("Post-disconnection Script")
def main(argv):
global ui,frame
if len(argv) < 2:
@@ -61,10 +53,10 @@ def main(argv):
script_info = get_script_info(network, network_type)
blank = urwid.Text('')
pre_entry_t = ('body',language['before_script']+': ')
post_entry_t = ('body',language['after_script']+': ')
pre_disconnect_entry_t = ('body',language['pre_disconnect_script']+': ')
post_disconnect_entry_t = ('body',language['post_disconnect_script']+': ')
pre_entry_t = ('body',_('Pre-connection Script')+': ')
post_entry_t = ('body',_('Post-connection Script')+': ')
pre_disconnect_entry_t = ('body',_('Pre-disconnection Script')+': ')
post_disconnect_entry_t = ('body',_('Post-disconnection Script')+': ')
global pre_entry,post_entry,pre_disconnect_entry,post_disconnect_entry
pre_entry = urwid.AttrWrap(urwid.Edit(pre_entry_t,
@@ -78,8 +70,8 @@ def main(argv):
none_to_blank(script_info.get('post_disconnect_entry'))),'editbx','editfc' )
# The buttons
ok_button = urwid.AttrWrap(urwid.Button('OK',ok_callback),'body','focus')
cancel_button = urwid.AttrWrap(urwid.Button('Cancel',cancel_callback),'body','focus')
ok_button = urwid.AttrWrap(urwid.Button(_('OK'),ok_callback),'body','focus')
cancel_button = urwid.AttrWrap(urwid.Button(_('Cancel'),cancel_callback),'body','focus')
button_cols = urwid.Columns([ok_button,cancel_button],dividechars=1)

View File

@@ -24,6 +24,8 @@ wicd-curses.
import urwid
from wicd.translations import _
# Uses code that is towards the bottom
def error(ui,parent,message):
"""Shows an error dialog (or something that resembles one)"""
@@ -522,7 +524,7 @@ class TextDialog(Dialog2):
self.frame.set_focus('footer')
class InputDialog(Dialog2):
def __init__(self, text, height, width,ok_name='OK',edit_text=''):
def __init__(self, text, height, width,ok_name=_('OK'),edit_text=''):
self.edit = urwid.Edit(wrap='clip',edit_text=edit_text)
body = urwid.ListBox([self.edit])
body = urwid.AttrWrap(body, 'editbx','editfc')
@@ -530,7 +532,7 @@ class InputDialog(Dialog2):
Dialog2.__init__(self, text, height, width, body)
self.frame.set_focus('body')
self.add_buttons([(ok_name,0),('Cancel',-1)])
self.add_buttons([(ok_name,0),(_('Cancel'),-1)])
def unhandled_key(self, size, k):
if k in ('up','page up'):

View File

@@ -46,24 +46,24 @@ class AdvancedSettingsDialog(urwid.WidgetWrap):
def __init__(self):
self.ui=None
static_ip_t = language['use_static_ip']
ip_t = ('editcp',language['ip']+': ')
netmask_t = ('editcp',language['netmask']+':')
gateway_t = ('editcp',language['gateway']+':')
static_ip_t = _('Use Static IPs')
ip_t = ('editcp',_('IP')+': ')
netmask_t = ('editcp',_('Netmask')+':')
gateway_t = ('editcp',_('Gateway')+':')
use_static_dns_t = language['use_static_dns']
use_global_dns_t = language['use_global_dns']
dns_dom_t = ('editcp',language['dns_domain']+': ')
search_dom_t = ('editcp',language['search_domain']+':')
dns1_t = ('editcp',language['dns']+ ' 1'+':'+' '*8)
dns2_t = ('editcp',language['dns']+ ' 2'+':'+' '*8)
dns3_t = ('editcp',language['dns']+ ' 3'+':'+' '*8)
use_static_dns_t = _('Use Static DNS')
use_global_dns_t = _('Use global DNS servers')
dns_dom_t = ('editcp',_('DNS domain')+': ')
search_dom_t = ('editcp',_('Search domain')+':')
dns1_t = ('editcp',_('DNS server')+ ' 1'+':'+' '*8)
dns2_t = ('editcp',_('DNS server')+ ' 2'+':'+' '*8)
dns3_t = ('editcp',_('DNS server')+ ' 3'+':'+' '*8)
use_dhcp_h_t = ("Use DHCP Hostname")
dhcp_h_t = ('editcp',"DHCP Hostname: ")
use_dhcp_h_t = _('Use DHCP Hostname')
dhcp_h_t = ('editcp',_('DHCP Hostname')+': ')
cancel_t = 'Cancel'
ok_t = 'OK'
cancel_t = _('Cancel')
ok_t = _('OK')
self.static_ip_cb = urwid.CheckBox(static_ip_t,
on_state_change=self.static_ip_toggle)
@@ -187,13 +187,13 @@ class WiredSettingsDialog(AdvancedSettingsDialog):
def __init__(self,name):
global wired, daemon
AdvancedSettingsDialog.__init__(self)
self.set_default = urwid.CheckBox(language['default_wired'])
self.set_default = urwid.CheckBox(_('Use as default profile (overwrites any previous default)'))
#self.cur_default =
# Add widgets to listbox
self._w.body.body.append(self.set_default)
self.prof_name = name
title = language['configuring_wired'].replace('$A',self.prof_name)
title = _('Configuring preferences for wired profile "$A"').replace('$A',self.prof_name)
self._w.header = urwid.Text( ('header',title),align='right' )
self.set_values()
@@ -252,9 +252,9 @@ class WirelessSettingsDialog(AdvancedSettingsDialog):
AdvancedSettingsDialog.__init__(self)
self.networkid = networkID
self.parent = parent
global_settings_t = language['global_settings']
encryption_t = language['use_encryption']
autoconnect_t = language['automatic_connect']
global_settings_t = _('Use these settings for all networks sharing this essid')
encryption_t = _('Use Encryption')
autoconnect_t = _('Automatically connect to this network')
self.global_settings_chkbox = urwid.CheckBox(global_settings_t)
self.encryption_chkbox = urwid.CheckBox(encryption_t,on_state_change=self.encryption_toggle)
@@ -269,7 +269,7 @@ class WirelessSettingsDialog(AdvancedSettingsDialog):
self.encrypt_types = misc.LoadEncryptionMethods()
self.set_values()
title = language['configuring_wireless'].replace('$A',wireless.GetWirelessProperty(networkID,'essid')).replace('$B',wireless.GetWirelessProperty(networkID,'bssid'))
title = _('Configuring preferences for wireless network "$A" ($B)').replace('$A',wireless.GetWirelessProperty(networkID,'essid')).replace('$B',wireless.GetWirelessProperty(networkID,'bssid'))
self._w.header = urwid.Text(('header',title),align='right' )
def encryption_toggle(self,chkbox,new_state,user_data=None):
@@ -354,7 +354,7 @@ class WirelessSettingsDialog(AdvancedSettingsDialog):
if entry_info[0].get_edit_text() == "" \
and entry_info[1] == 'required':
error(self.ui, self.parent,"%s (%s)" \
% (language['encrypt_info_missing'],
% (_('Required encryption information is missing.'),
entry_info[0].get_caption()[0:-2] )
)
return False
@@ -365,7 +365,7 @@ class WirelessSettingsDialog(AdvancedSettingsDialog):
elif not self.encryption_chkbox.get_state() and \
wireless.GetWirelessProperty(self.networkid, "encryption"):
# Encrypt checkbox is off, but the network needs it.
error(self.ui, self.parent, language['enable_encryption'])
error(self.ui, self.parent, _('This network requires encryption to be enabled.'))
return False
else:
self.set_net_prop("enctype", "None")
@@ -403,10 +403,7 @@ class WirelessSettingsDialog(AdvancedSettingsDialog):
for type_ in ['required', 'optional']:
fields = methods[ID][type_]
for field in fields:
if language.has_key(field[1]):
edit = MaskingEdit(('editcp',language[field[1].lower().replace(' ','_')]+': '))
else:
edit = MaskingEdit(('editcp',field[1].replace('_',' ')+': '))
edit.set_mask_mode('no_focus')
theList.append(edit)
# Add the data to any array, so that the information

View File

@@ -24,6 +24,7 @@ import urwid.curses_display
from wicd import misc
from wicd import dbusmanager
from wicd.translations import _
from curses_misc import SelText,DynWrap,DynRadioButton,ComboBox,TabColumns
daemon = None
@@ -46,13 +47,13 @@ class PrefsDialog(urwid.WidgetWrap):
#height = 20
# Stuff that goes at the top
header0_t = language["gen_settings"]
header1_t = language["ext_programs"]
header2_t = language["advanced_settings"]
header0_t = _('General Settings')
header1_t = _('External Programs')
header2_t = _('Advanced Settings')
self.header0 = urwid.AttrWrap(SelText(header0_t), 'tab active', 'focus')
self.header1 = urwid.AttrWrap(SelText(header1_t), 'body', 'focus')
self.header2 = urwid.AttrWrap(SelText(header2_t), 'body', 'focus')
title = language['preferences']
title = _('Preferences')
# Blank line
_blank = urwid.Text('')
@@ -62,63 +63,63 @@ class PrefsDialog(urwid.WidgetWrap):
####
# General Settings
net_cat_t = ('header', language['network_interfaces'])
wired_t = ('editcp', language['wired_interface']+': ')
wless_t = ('editcp', language['wireless_interface']+':')
always_show_wired_t = language['wired_always_on']
prefer_wired_t = language['always_switch_to_wired']
net_cat_t = ('header', _('Network Interfaces'))
wired_t = ('editcp', _('Wired Interface')+': ')
wless_t = ('editcp', _('Wireless Interface')+':')
always_show_wired_t = _('''Always show wired interface''')
prefer_wired_t = _('''Always switch to wired connection when available''')
global_dns_cat_t = ('header', language['global_dns_servers'])
global_dns_t = ('editcp', language['use_global_dns'])
dns_dom_t = ('editcp', ' '+language['dns_domain']+': ')
search_dom_t = ('editcp', ' '+language['search_domain']+':')
dns1_t = ('editcp', ' DNS server 1: ')
dns2_t = ('editcp', ' DNS server 2: ')
dns3_t = ('editcp', ' DNS server 3: ')
global_dns_cat_t = ('header', _('Global DNS servers'))
global_dns_t = ('editcp', _('Use global DNS servers'))
dns_dom_t = ('editcp', ' '+_('DNS domain')+': ')
search_dom_t = ('editcp', ' '+_('Search domain')+':')
dns1_t = ('editcp', ' '+_('DNS server')+' 1: ')
dns2_t = ('editcp', ' '+_('DNS server')+' 2: ')
dns3_t = ('editcp', ' '+_('DNS server')+' 3: ')
wired_auto_cat_t= ('header', language['wired_autoconnect_settings'])
wired_auto_1_t = language['use_default_profile']
wired_auto_2_t = language['show_wired_list']
wired_auto_3_t = language['use_last_used_profile']
wired_auto_cat_t= ('header', _('Wired Autoconnect Settings'))
wired_auto_1_t = _('Use default profile on wired autoconnect')
wired_auto_2_t = _('Prompt for profile on wired autoconnect')
wired_auto_3_t = _('Use last used profile on wired autoconnect')
auto_reconn_cat_t = ('header', language['automatic_reconnection'])
auto_reconn_t = language['auto_reconnect']
auto_reconn_cat_t = ('header', _('Automatic Reconnection'))
auto_reconn_t = _('Automatically reconnect on connection loss')
#### External Programs
automatic_t = language['wicd_auto_config']
automatic_t = _('Automatic (recommended)')
dhcp_header_t = ('header', language["dhcp_client"])
dhcp_header_t = ('header', _('DHCP Client'))
# Automatic
dhcp1_t = 'dhclient'
dhcp2_t = 'dhcpcd'
dhcp3_t = 'pump'
dhcp4_t = 'udhcpc'
wired_detect_header_t = ('header', language["wired_detect"])
wired_detect_header_t = ('header', _('Wired Link Detection'))
wired1_t = 'ethtool'
wired2_t = 'mii-tool'
flush_header_t = ('header', language["route_flush"])
flush_header_t = ('header', _('Route Table Flushing'))
flush1_t = 'ip'
flush2_t = 'route'
#### Advanced Settings
wpa_cat_t=('header', language['wpa_supplicant'])
wpa_cat_t=('header', _('WPA Supplicant'))
wpa_t=('editcp','Driver:')
wpa_list = []
wpa_warn_t = ('important', language['always_use_wext'])
wpa_warn_t = ('important', _('You should almost always use wext as the WPA supplicant driver'))
backend_cat_t = ('header', language['backend'])
backend_t = language['backend']+':'
backend_cat_t = ('header', _('Backend'))
backend_t = _('Backend')+':'
backend_list = []
debug_cat_t = ('header', language['debugging'])
debug_mode_t = language['use_debug_mode']
debug_cat_t = ('header', _('Debugging'))
debug_mode_t = _('Enable debug mode')
wless_cat_t = ('header', language['wireless_interface'])
use_dbm_t = language['display_type_dialog']
verify_ap_t = language['verify_ap_dialog']
wless_cat_t = ('header', _('Wireless Interface'))
use_dbm_t = _('Use dBm to measure signal strength')
verify_ap_t = _('Ping static gateways after connecting to verify association')
@@ -172,7 +173,7 @@ class PrefsDialog(urwid.WidgetWrap):
])
#### External Programs tab
automatic_t = language['wicd_auto_config']
automatic_t = _('Automatic (recommended)')
self.dhcp_header = urwid.Text(dhcp_header_t)
self.dhcp_l = []
@@ -248,7 +249,7 @@ class PrefsDialog(urwid.WidgetWrap):
self.header2 : advancedLB}
#self.load_settings()
self.tabs = TabColumns(headerList,lbList,language['preferences'])
self.tabs = TabColumns(headerList,lbList,_('Preferences'))
self.__super.__init__(self.tabs)
def load_settings(self):

View File

@@ -75,7 +75,7 @@ from os import system
CURSES_REV=wpath.curses_revision
# Fix strings in wicd-curses
from wicd.translations import language
from wicd.translations import language, _
for i in language.keys():
language[i] = language[i].decode('utf8')
@@ -91,12 +91,14 @@ def wrap_exceptions(func):
#gobject.source_remove(redraw_tag)
loop.quit()
ui.stop()
print >> sys.stderr, "\n"+language['terminated']
print >> sys.stderr, "\n"+_('Terminated by user')
#raise
except DBusException:
loop.quit()
ui.stop()
print >> sys.stderr,"\n"+language['dbus_fail']
print >> sys.stderr,"\n"+_('DBus failure! '\
'This is most likely caused by the wicd daemon stopping while wicd-curses is running. '\
'Please restart the daemon, and then restart wicd-curses.')
raise
except :
# Quit the loop
@@ -106,7 +108,7 @@ def wrap_exceptions(func):
ui.stop()
# Print out standard notification:
# This message was far too scary for humans, so it's gone now.
# print >> sys.stderr, "\n" + language['exception']
# print >> sys.stderr, "\n" + _('EXCEPTION! Please report this to the maintainer and file a bug report with the backtrace below:')
# Flush the buffer so that the notification is always above the
# backtrace
sys.stdout.flush()
@@ -129,7 +131,7 @@ def wrap_exceptions(func):
def check_for_wired(wired_ip,set_status):
""" Determine if wired is active, and if yes, set the status. """
if wired_ip and wired.CheckPluggedIn():
set_status(language['connected_to_wired'].replace('$A',wired_ip))
set_status(_('Connected to wired network (IP: $A)').replace('$A',wired_ip))
return True
else:
return False
@@ -154,7 +156,7 @@ def check_for_wireless(iwconfig, wireless_ip, set_status):
return False
strength = str(strength)
ip = str(wireless_ip)
set_status(language['connected_to_wireless'].replace
set_status(_('Connected to $A at $B (IP: $C)').replace
('$A', network).replace
('$B', daemon.FormatSignalForPrinting(strength)).replace
('$C', wireless_ip))
@@ -190,40 +192,40 @@ def about_dialog(body):
('green',"\\|| \\\\")," |+| ",('green',"// ||/ \n"),
('green'," \\\\\\")," |+| ",('green',"///")," http://wicd.net\n",
('green'," \\\\\\")," |+| ",('green',"///")," ",language["brought_to_you"],"\n",
('green'," \\\\\\")," |+| ",('green',"///")," ",_('Brought to you by:'),"\n",
('green'," \\\\\\")," |+| ",('green',"///")," Adam Blackburn\n",
" ___|+|___ Dan O'Reilly\n",
" |---------| Andrew Psaltis\n",
"-----------------------------------------------------"]
about = TextDialog(theText,16,55,header=('header','About Wicd'))
about = TextDialog(theText,16,55,header=('header',_('About Wicd')))
about.run(ui,body)
# Modeled after htop's help
def help_dialog(body):
textT = urwid.Text(('header','wicd-curses help'),'right')
textT = urwid.Text(('header',_('wicd-curses help')),'right')
textSH = urwid.Text(['This is ',('blue','wicd-curses-'+CURSES_REV),' using wicd ',unicode(daemon.Hello()),'\n'])
textH = urwid.Text([
"For more detailed help, consult the wicd-curses(8) man page.\n",
_('For more detailed help, consult the wicd-curses(8) man page.')+"\n",
('bold','->'),' and ',('bold','<-')," are the right and left arrows respectively.\n"])
text1 = urwid.Text([
('bold',' H h ?'),": Display this help dialog\n",
('bold','enter C'),": Connect to selected network\n",
('bold',' D'),": Disconnect from all networks\n",
('bold',' ESC'),": Stop a connection in progress\n",
('bold',' F5 R'),": Refresh network list\n",
('bold',' P'),": Prefrences dialog\n",
('bold',' H h ?'),": "+_('Display this help dialog')+"\n",
('bold','enter C'),": "+_('Connect to selected network')+"\n",
('bold',' D'),": "+_('Disconnect from all networks')+"\n",
('bold',' ESC'),": "+_('Stop a connection in progress')+"\n",
('bold',' F5 R'),": "+_('Refresh network list')+"\n",
('bold',' P'),": "+_('Preferences dialog')+"\n",
])
text2 = urwid.Text([
('bold',' I'),": Scan for hidden networks\n",
('bold',' S'),": Select scripts\n",
('bold',' O'),": Set up Ad-hoc network\n",
('bold',' ->'),": Configure selected network\n",
('bold',' A'),": Display 'about' dialog\n",
('bold',' F8 q Q'),": Quit wicd-curses\n",
('bold',' I'),": "+_('Scan for hidden networks')+"\n",
('bold',' S'),": "+_('Select scripts')+"\n",
('bold',' O'),": "+_('Set up Ad-hoc network')+"\n",
('bold',' ->'),": "+_('Configure selected network')+"\n",
('bold',' A'),": "+_("Display 'about' dialog")+"\n",
('bold',' F8 q Q'),": "+_('Quit wicd-curses')+"\n",
])
textF = urwid.Text('Press any key to return.')
textF = urwid.Text(_('Press any key to return.'))
# textJ = urwid.Text(('important','Nobody expects the Spanish Inquisition!'))
@@ -266,12 +268,18 @@ def run_configscript(parent,netname,nettype):
else:
profname = wireless.GetWirelessProperty( int(netname),'bssid')
theText = [
language['cannot_edit_scripts_1'].replace('$A',configfile).replace('$B',header),
_('To avoid various complications, wicd-curses does not support directly editing the scripts. '\
'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:').
replace('$A', configfile).replace('$B', header),
"\n\n["+profname+"]\n\n",
# 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", "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."""]
_('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", "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
@@ -341,7 +349,7 @@ class NetLabel(urwid.WidgetWrap):
if wireless.GetWirelessProperty(id, 'encryption'):
self.encrypt = wireless.GetWirelessProperty(id,'encryption_method')
else:
self.encrypt = language['unsecured']
self.encrypt = _('Unsecured')
self.mode = wireless.GetWirelessProperty(id, 'mode') # Master, Ad-Hoc
self.channel = wireless.GetWirelessProperty(id, 'channel')
@@ -366,7 +374,7 @@ class WiredComboBox(ComboBox):
list : the list of wired network profiles. The rest is self-explanitory.
"""
def __init__(self,list):
self.ADD_PROFILE = '---'+language["add_new_profile"]+'---'
self.ADD_PROFILE = '---'+_('Add a new profile')+'---'
self.__super.__init__(use_enter=False)
self.set_list(list)
@@ -399,7 +407,7 @@ class WiredComboBox(ComboBox):
key = ComboBox.keypress(self,size,key)
if key == ' ':
if self.get_focus()[1] == len(self.list)-1:
dialog = InputDialog(('header',language["add_new_wired_profile"]),7,30)
dialog = InputDialog(('header',_('Add a new wired profile')),7,30)
exitcode,name = dialog.run(ui,self.parent)
if exitcode == 0:
name = name.strip()
@@ -416,7 +424,7 @@ class WiredComboBox(ComboBox):
wired.ReadWiredNetworkProfile(self.get_selected_profile())
if key == 'delete':
if len(self.theList) == 1:
error(self.ui,self.parent,language["no_delete_last_profile"])
error(self.ui,self.parent,_('wicd-curses does not support deleting the last wired profile. Try renaming it ("F2")'))
return key
wired.DeleteWiredNetworkProfile(self.get_selected_profile())
# Return to the top of the list if something is deleted.
@@ -429,7 +437,7 @@ class WiredComboBox(ComboBox):
self.set_list(wired.GetWiredProfileList())
self.rebuild_combobox()
if key == 'f2':
dialog = InputDialog(('header',language["rename_wired_profile"]),7,30,
dialog = InputDialog(('header',_('Rename wired profile')),7,30,
edit_text=unicode(self.get_selected_profile()))
exitcode,name = dialog.run(ui,self.parent)
if exitcode == 0:
@@ -449,12 +457,12 @@ class WiredComboBox(ComboBox):
# Dialog2 that initiates an Ad-Hoc network connection
class AdHocDialog(Dialog2):
def __init__(self):
essid_t = language['essid']
ip_t = language['ip']
channel_t = language['channel']
key_t = " " + language['key']
use_ics_t = language['use_ics']
use_encrypt_t = language['use_wep_encryption']
essid_t = _('ESSID')
ip_t = _('IP')
channel_t = _('Channel')
key_t = " " + _('Key')
use_ics_t = _('Activate Internet Connection Sharing')
use_encrypt_t = _('Use Encryption (WEP only)')
self.essid_edit = DynEdit(essid_t)
self.ip_edit = DynEdit(ip_t)
@@ -476,9 +484,9 @@ class AdHocDialog(Dialog2):
self.use_ics_chkb,self.use_encrypt_chkb,self.key_edit]
body = urwid.ListBox(l)
header = ('header',language['create_adhoc_network'])
header = ('header', _('Create an Ad-Hoc Network'))
Dialog2.__init__(self, header, 15, 50, body)
self.add_buttons([('OK',1),('Cancel',-1)])
self.add_buttons([(_('OK'),1),(_('Cancel'),-1)])
self.frame.set_focus('body')
def encrypt_callback(self,chkbox,new_state,user_info=None):
@@ -514,16 +522,16 @@ class appGUI():
self.size = ui.get_cols_rows()
# Happy screen saying that you can't do anything because we're scanning
# for networks. :-)
self.screen_locker = urwid.Filler(urwid.Text(('important',language['scanning_stand_by']), align='center'))
self.no_wlan = urwid.Filler(urwid.Text(('important',language['no_wireless_networks_found']), align='center'))
self.TITLE = language['wicd_curses']
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.WIRED_IDX = 1
self.WLESS_IDX = 3
header = urwid.AttrWrap(urwid.Text(self.TITLE,align='right'), 'header')
self.wiredH=urwid.Filler(urwid.Text("Wired Network(s)"))
self.wiredH=urwid.Filler(urwid.Text(_('Wired Networks')))
self.list_header=urwid.AttrWrap(urwid.Text(gen_list_header()),'listbar')
self.wlessH=NSelListBox([urwid.Text("Wireless Network(s)"),self.list_header])
self.wlessH=NSelListBox([urwid.Text(_('Wireless Networks')),self.list_header])
# Init this earlier to make update_status happy
self.update_tag = None
@@ -543,17 +551,17 @@ class appGUI():
# Keymappings proposed by nanotube in #wicd
keys = [
('H' ,'Help' ,None),
('right','Config',None),
('H' ,_('Help'),None),
('right',_('Config'),None),
#(' ',' ',None),
('K' , 'RfKill',None),
('C' ,'Connect',None),
('D' ,'Disconn',None),
('R' ,'Refresh',None),
('P' ,'Prefs',None),
('I' ,'Hidden',None),
('A' ,'About',None),
('Q' ,'Quit',loop.quit)
('K' , _('RfKill'),None),
('C' ,_('Connect'),None),
('D' ,_('Disconn'),None),
('R' ,_('Refresh'),None),
('P' ,_('Prefs'),None),
('I' ,_('Hidden'),None),
('A' ,_('About'),None),
('Q' ,_('Quit'),loop.quit)
]
self.primaryCols = OptCols(keys,self.handle_keys)
@@ -590,12 +598,12 @@ class appGUI():
def init_other_optcols(self):
# The "tabbed" preferences dialog
self.prefCols = OptCols( [ ('f10','OK'),
('page up','Tab Left',),
('page down', 'Tab Right'),
('esc','Cancel') ], self.handle_keys)
self.confCols = OptCols( [ ('f10','OK'),
('esc','Cancel') ],self.handle_keys)
self.prefCols = OptCols( [ ('f10',_('OK')),
('page up',_('Tab Left'),),
('page down', _('Tab Right')),
('esc',_('Cancel')) ], self.handle_keys)
self.confCols = OptCols( [ ('f10',_('OK')),
('esc',_('Cancel')) ],self.handle_keys)
# Does what it says it does
def lock_screen(self):
@@ -617,7 +625,7 @@ class appGUI():
self.update_ui()
def raise_hidden_network_dialog(self):
dialog = InputDialog(('header',language["select_hidden_essid"]),7,30,language['scan'])
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
@@ -726,7 +734,7 @@ class appGUI():
self.set_status):
return True
else:
self.set_status(language['not_connected'])
self.set_status(_('Not connected'))
self.update_ui()
return True
@@ -739,13 +747,10 @@ class appGUI():
else:
iwconfig = ''
essid, stat = wireless.CheckWirelessConnectingMessage()
return self.set_status("%s: %s" % (essid, language[str(stat)]),
True)
return self.set_status("%s: %s" % (essid, stat), True)
if wired_connecting:
return self.set_status( language['wired_network'] +
': ' +
language[str(wired.CheckWiredConnectingMessage())],
True)
return self.set_status(_('Wired Network') +
': ' + wired.CheckWiredConnectingMessage(), True)
else:
self.conn_status=False
return False
@@ -1019,7 +1024,7 @@ def setup_dbus(force=True):
try:
dbusmanager.connect_to_dbus()
except DBusException:
print >> sys.stderr, language['cannot_connect_to_daemon']
print >> sys.stderr, _("Can't connect to the daemon, trying to start it automatically...")
bus = dbusmanager.get_bus()
dbus_ifaces = dbusmanager.get_dbus_ifaces()
daemon = dbus_ifaces['daemon']
@@ -1043,11 +1048,14 @@ if __name__ == '__main__':
parser = OptionParser(version="wicd-curses-%s (using wicd %s)" % (CURSES_REV,daemon.Hello()), prog="wicd-curses")
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')
print _('ERROR: wicd-curses was denied access to the wicd daemon: '\
'please check that your user is in the "$A" group.').\
replace('$A','\033[1;34m' + wpath.wicd_group + '\033[0m')
sys.exit(1)
else:
raise
#parser.add_option("-d", "--debug",action="store_true"
# ,dest='debug',help="enable logging of wicd-curses (currently does nothing)")
(options,args) = parser.parse_args()
main()

View File

@@ -37,13 +37,6 @@ from wicd import dbusmanager
_ = translations.get_gettext()
language = {}
language['configure_scripts'] = _("Configure Scripts")
language['before_script'] = _("Pre-connection Script")
language['after_script'] = _("Post-connection Script")
language['pre_disconnect_script'] = _("Pre-disconnection Script")
language['post_disconnect_script'] = _("Post-disconnection Script")
dbus = dbusmanager.DBusManager()
dbus.connect_to_dbus()
@@ -158,11 +151,11 @@ def main (argv):
self.wTree = gtk.Builder()
self.wTree.add_from_file(gladefile)
self.dialog = self.wTree.get_object("configure_script_dialog")
self.wTree.get_object("pre_label").set_label(language['before_script'] + ":")
self.wTree.get_object("post_label").set_label(language['after_script'] + ":")
self.wTree.get_object("pre_disconnect_label").set_label(language['pre_disconnect_script']
self.wTree.get_object("pre_label").set_label(_('Pre-connection Script') + ":")
self.wTree.get_object("post_label").set_label(_('Post-connection Script') + ":")
self.wTree.get_object("pre_disconnect_label").set_label(_('Pre-disconnection Script')
+ ":")
self.wTree.get_object("post_disconnect_label").set_label(language['post_disconnect_script']
self.wTree.get_object("post_disconnect_label").set_label(_('Post-disconnection Script')
+ ":")
self.wTree.get_object("window1").hide()

View File

@@ -36,12 +36,12 @@ from wicd import misc
from wicd import wpath
from wicd import dbusmanager
from wicd.misc import noneToString
from wicd.translations import _
import prefs
from prefs import PreferencesDialog
import netentry
from netentry import WiredNetworkEntry, WirelessNetworkEntry
from guiutil import error, LabelEntry
from wicd.translations import language
if __name__ == '__main__':
wpath.chdir(__file__)
@@ -62,8 +62,7 @@ def setup_dbus(force=True):
try:
dbusmanager.connect_to_dbus()
except DBusException:
error(None, "Could not connect to wicd's D-Bus interface. " +
"Check the wicd log for error messages.")
error(None, _("Could not connect to wicd's D-Bus interface. Check the wicd log for error messages."))
return False
else:
return False
@@ -83,7 +82,7 @@ def handle_no_dbus(from_tray=False):
DBUS_AVAIL = False
if from_tray: return False
print "Wicd daemon is shutting down!"
error(None, language['lost_dbus'], block=False)
error(None, _('The wicd daemon has shut down. The UI will not function properly until it is restarted.'), block=False)
return False
@@ -95,14 +94,14 @@ class WiredProfileChooser:
# functions and widgets it uses.
wired_net_entry = WiredNetworkEntry()
dialog = gtk.Dialog(title = language['wired_network_found'],
dialog = gtk.Dialog(title = _('Wired connection detected'),
flags = gtk.DIALOG_MODAL,
buttons = (gtk.STOCK_CONNECT, 1,
gtk.STOCK_CANCEL, 2))
dialog.set_has_separator(False)
dialog.set_size_request(400, 150)
instruct_label = gtk.Label(language['choose_wired_profile'] + ':\n')
stoppopcheckbox = gtk.CheckButton(language['stop_showing_chooser'])
instruct_label = gtk.Label(_('Select or create a wired profile to connect with') + ':\n')
stoppopcheckbox = gtk.CheckButton(_('Stop Showing Autoconnect pop-up temporarily'))
wired_net_entry.is_full_gui = False
instruct_label.set_alignment(0, 0)
@@ -185,10 +184,10 @@ class appGui(object):
# Set some strings in the GUI - they may be translated
label_instruct = self.wTree.get_object("label_instructions")
label_instruct.set_label(language['select_a_network'])
label_instruct.set_label(_('Choose from the networks below:'))
probar = self.wTree.get_object("progressbar")
probar.set_text(language['connecting'])
probar.set_text(_('Connecting'))
self.rfkill_button = self.wTree.get_object("rfkill_button")
self.all_network_list = self.wTree.get_object("network_list_vbox")
@@ -220,7 +219,7 @@ class appGui(object):
self.update_cb = None
self._wired_showing = False
self.network_list.set_sensitive(False)
label = gtk.Label("%s..." % language['scanning'])
label = gtk.Label("%s..." % _('Scanning'))
self.network_list.pack_start(label)
label.show()
self.wait_for_events(0.2)
@@ -249,27 +248,27 @@ class appGui(object):
self.refresh_clicked()
def handle_connection_results(self, results):
if results not in ['Success', 'aborted'] and self.is_visible:
if results not in ['success', 'aborted'] and self.is_visible:
error(self.window, language[results], block=False)
def create_adhoc_network(self, widget=None):
""" Shows a dialog that creates a new adhoc network. """
print "Starting the Ad-Hoc Network Creation Process..."
dialog = gtk.Dialog(title = language['create_adhoc_network'],
dialog = gtk.Dialog(title = _('Create an Ad-Hoc Network'),
flags = gtk.DIALOG_MODAL,
buttons=(gtk.STOCK_CANCEL, 2, gtk.STOCK_OK, 1))
dialog.set_has_separator(False)
dialog.set_size_request(400, -1)
self.chkbox_use_encryption = gtk.CheckButton(language['use_wep_encryption'])
self.chkbox_use_encryption = gtk.CheckButton(_('Use Encryption (WEP only)'))
self.chkbox_use_encryption.set_active(False)
ip_entry = LabelEntry(language['ip'] + ':')
essid_entry = LabelEntry(language['essid'] + ':')
channel_entry = LabelEntry(language['channel'] + ':')
self.key_entry = LabelEntry(language['key'] + ':')
ip_entry = LabelEntry(_('IP') + ':')
essid_entry = LabelEntry(_('ESSID') + ':')
channel_entry = LabelEntry(_('Channel') + ':')
self.key_entry = LabelEntry(_('Key') + ':')
self.key_entry.set_auto_hidden(True)
self.key_entry.set_sensitive(False)
chkbox_use_ics = gtk.CheckButton(language['use_ics'])
chkbox_use_ics = gtk.CheckButton( _('Activate Internet Connection Sharing'))
self.chkbox_use_encryption.connect("toggled",
self.toggle_encrypt_check)
@@ -309,10 +308,10 @@ class appGui(object):
wireless.SwitchRfKill()
if wireless.GetRfKillEnabled():
self.rfkill_button.set_stock_id(gtk.STOCK_MEDIA_PLAY)
self.rfkill_button.set_label(language['switch_on_wifi'])
self.rfkill_button.set_label(_('Switch On Wi-Fi'))
else:
self.rfkill_button.set_stock_id(gtk.STOCK_MEDIA_STOP)
self.rfkill_button.set_label(language['switch_off_wifi'])
self.rfkill_button.set_label(_('Switch Off Wi-Fi'))
def disconnect_all(self, widget=None):
""" Disconnects from any active network. """
@@ -350,11 +349,11 @@ class appGui(object):
def connect_hidden(self, widget):
""" Prompts the user for a hidden network, then scans for it. """
dialog = gtk.Dialog(title=language['hidden_network'],
dialog = gtk.Dialog(title=('Hidden Network'),
flags=gtk.DIALOG_MODAL,
buttons=(gtk.STOCK_CONNECT, 1, gtk.STOCK_CANCEL, 2))
dialog.set_has_separator(False)
lbl = gtk.Label(language['hidden_network_essid'])
lbl = gtk.Label(_('Hidden Network ESSID'))
textbox = gtk.Entry()
dialog.vbox.pack_start(lbl)
dialog.vbox.pack_start(textbox)
@@ -419,14 +418,14 @@ class appGui(object):
if self.connecting:
# Adjust our state from connecting->connected.
self._set_not_connecting_state()
self.set_status(language['connected_to_wired'].replace('$A', info[0]))
self.set_status(_('Connected to wired network (IP: $A)').replace('$A', info[0]))
return True
def set_wireless_state(self, info):
if self.connecting:
# Adjust our state from connecting->connected.
self._set_not_connecting_state()
self.set_status(language['connected_to_wireless'].replace
self.set_status(_('Connected to $A at $B (IP: $C)').replace
('$A', info[1]).replace
('$B', daemon.FormatSignalForPrinting(info[2])).replace
('$C', info[0]))
@@ -436,7 +435,7 @@ class appGui(object):
if self.connecting:
# Adjust our state from connecting->not-connected.
self._set_not_connecting_state()
self.set_status(language['not_connected'])
self.set_status(_('Not connected'))
return True
def _set_not_connecting_state(self):
@@ -468,11 +467,10 @@ class appGui(object):
gobject.idle_add(self.status_bar.remove_message, 1, self.statusID)
if info[0] == "wireless":
essid, stat = wireless.CheckWirelessConnectingMessage()
gobject.idle_add(self.set_status, "%s: %s" % (essid,
language[str(stat)]))
gobject.idle_add(self.set_status, "%s: %s" % (essid, stat))
elif info[0] == "wired":
gobject.idle_add(self.set_status, language['wired_network'] + ': ' +
language[str(wired.CheckWiredConnectingMessage())])
gobject.idle_add(self.set_status, _('Wired Network') + ': ' \
+ wired.CheckWiredConnectingMessage())
return True
def update_connect_buttons(self, state=None, x=None, force_check=False):
@@ -526,7 +524,7 @@ class appGui(object):
# Remove stuff already in there.
self._remove_items_from_vbox(self.wired_network_box)
self._remove_items_from_vbox(self.network_list)
label = gtk.Label("%s..." % language['scanning'])
label = gtk.Label("%s..." % _('Scanning'))
self.network_list.pack_start(label)
self.network_list.show_all()
if wired.CheckPluggedIn() or daemon.GetAlwaysShowWiredInterface():
@@ -599,9 +597,9 @@ class appGui(object):
else:
instruct_label.hide()
if wireless.GetKillSwitchEnabled():
label = gtk.Label(language['killswitch_enabled'] + ".")
label = gtk.Label(_('Wireless Kill Switch Enabled') + ".")
else:
label = gtk.Label(language['no_wireless_networks_found'])
label = gtk.Label(_('No wireless networks found.'))
self.network_list.pack_start(label)
label.show()
self.update_connect_buttons(force_check=True)
@@ -628,7 +626,7 @@ class appGui(object):
for lblent in req_entlist:
lblent.set_text(lblent.get_text().strip())
if not misc.IsValidIP(lblent.get_text()):
error(self.window, language['invalid_address'].
error(self.window, _('Invalid address in $A entry.').
replace('$A', lblent.label.get_label()))
return False
@@ -636,7 +634,7 @@ class appGui(object):
for lblent in opt_entlist:
lblent.set_text(lblent.get_text().strip())
if lblent.get_text() and not misc.IsValidIP(lblent.get_text()):
error(self.window, language['invalid_address'].
error(self.window, _('Invalid address in $A entry.').
replace('$A', lblent.label.get_label()))
return False
@@ -691,14 +689,14 @@ class appGui(object):
for entry_info in encryption_info.itervalues():
if entry_info[0].entry.get_text() == "" and \
entry_info[1] == 'required':
error(self.window, "%s (%s)" % (language['encrypt_info_missing'],
error(self.window, "%s (%s)" % (_('Required encryption information is missing.'),
entry_info[0].label.get_label())
)
return False
# Make sure the checkbox is checked when it should be
elif not entry.chkbox_encryption.get_active() and \
wireless.GetWirelessProperty(networkid, "encryption"):
error(self.window, language['enable_encryption'])
error(self.window, _('This network requires encryption to be enabled.'))
return False
return True
@@ -722,7 +720,7 @@ class appGui(object):
self.all_network_list.set_sensitive(False)
if self.statusID:
gobject.idle_add(self.status_bar.remove_message, 1, self.statusID)
gobject.idle_add(self.set_status, language["disconnecting_active"])
gobject.idle_add(self.set_status, _('Disconnecting active connections...'))
gobject.idle_add(self.status_area.show_all)
self.wait_for_events()
self._connect_thread_started = False

View File

@@ -32,7 +32,7 @@ import wicd.dbusmanager as dbusmanager
from wicd.misc import noneToString, stringToNone, noneToBlankString, to_bool
from guiutil import error, LabelEntry, GreyLabel, LeftAlignedLabel, string_input, ProtectedLabelEntry
from wicd.translations import language
from wicd.translations import language, _
# These get set when a NetworkEntry is instantiated.
daemon = None
@@ -55,9 +55,9 @@ class AdvancedSettingsDialog(gtk.Dialog):
"""
# if no network name was passed, just use Properties as the title
if network_name:
title = '%s - %s' % (network_name, language['properties'])
title = '%s - %s' % (network_name, _('Properties'))
else:
title = language['properties']
title = _('Properties')
gtk.Dialog.__init__(self, title=title,
flags=gtk.DIALOG_MODAL, buttons=(gtk.STOCK_CANCEL,
@@ -70,23 +70,23 @@ class AdvancedSettingsDialog(gtk.Dialog):
self.connect('show', lambda *a, **k: self.set_default_size())
# Set up the Advanced Settings Dialog.
self.txt_ip = LabelEntry(language['ip'])
self.txt_ip = LabelEntry(_('IP'))
self.txt_ip.entry.connect('focus-out-event', self.set_defaults)
self.txt_netmask = LabelEntry(language['netmask'])
self.txt_gateway = LabelEntry(language['gateway'])
self.txt_search_dom = LabelEntry(language['search_domain'])
self.txt_domain = LabelEntry(language['dns_domain'])
self.txt_dns_1 = LabelEntry(language['dns'] + ' 1')
self.txt_dns_2 = LabelEntry(language['dns'] + ' 2')
self.txt_dns_3 = LabelEntry(language['dns'] + ' 3')
self.txt_netmask = LabelEntry(_('Netmask'))
self.txt_gateway = LabelEntry(_('Gateway'))
self.txt_search_dom = LabelEntry(_('Search domain'))
self.txt_domain = LabelEntry(_('DNS domain'))
self.txt_dns_1 = LabelEntry(_('DNS server') + ' 1')
self.txt_dns_2 = LabelEntry(_('DNS server') + ' 2')
self.txt_dns_3 = LabelEntry(_('DNS server') + ' 3')
dhcp_hostname_hbox = gtk.HBox(False, 0)
self.chkbox_use_dhcp_hostname = gtk.CheckButton()
self.txt_dhcp_hostname = LabelEntry("DHCP Hostname")
dhcp_hostname_hbox.pack_start(self.chkbox_use_dhcp_hostname, fill=False, expand=False)
dhcp_hostname_hbox.pack_start(self.txt_dhcp_hostname)
self.chkbox_static_ip = gtk.CheckButton(language['use_static_ip'])
self.chkbox_static_dns = gtk.CheckButton(language['use_static_dns'])
self.chkbox_global_dns = gtk.CheckButton(language['use_global_dns'])
self.chkbox_static_ip = gtk.CheckButton(_('Use Static IPs'))
self.chkbox_static_dns = gtk.CheckButton(_('Use Static DNS'))
self.chkbox_global_dns = gtk.CheckButton(_('Use global DNS servers'))
self.hbox_dns = gtk.HBox(False, 0)
self.hbox_dns.pack_start(self.chkbox_static_dns)
self.hbox_dns.pack_start(self.chkbox_global_dns)
@@ -98,7 +98,7 @@ class AdvancedSettingsDialog(gtk.Dialog):
script_image.set_padding(4, 0)
#self.script_button.set_alignment(.5, .5)
self.script_button.set_image(script_image)
self.script_button.set_label(language['scripts'])
self.script_button.set_label(_('Scripts'))
self.button_hbox = gtk.HBox(False, 2)
self.button_hbox.pack_start(self.script_button, fill=False, expand=False)
@@ -163,7 +163,7 @@ class AdvancedSettingsDialog(gtk.Dialog):
if stringToNone(netmask.get_text()) is None: # Make sure the netmask is blank
netmask.set_text('255.255.255.0') # Fill in the most common one
elif ipAddress != "":
error(None, language['invalid_ip_address'])
error(None, _('Invalid IP address entered.'))
def reset_static_checkboxes(self):
# Enable the right stuff
@@ -229,7 +229,7 @@ class AdvancedSettingsDialog(gtk.Dialog):
""" Set the DNS entries' sensitivity based on the Global checkbox. """
global_dns_active = daemon.GetUseGlobalDNS()
if not global_dns_active and self.chkbox_global_dns.get_active():
error(None, language['global_dns_not_enabled'])
error(None, _('Global DNS has not been enabled in general preferences.'))
self.chkbox_global_dns.set_active(False)
if daemon.GetUseGlobalDNS() and self.chkbox_static_dns.get_active():
for w in [self.txt_dns_1, self.txt_dns_2, self.txt_dns_3,
@@ -282,7 +282,7 @@ class AdvancedSettingsDialog(gtk.Dialog):
class WiredSettingsDialog(AdvancedSettingsDialog):
def __init__(self, name):
""" Build the wired settings dialog. """
AdvancedSettingsDialog.__init__(self, language['wired_network'])
AdvancedSettingsDialog.__init__(self, _('Wired Network'))
self.des = self.connect("destroy", self.destroy_called)
self.script_button.connect("clicked", self.edit_scripts)
self.prof_name = name
@@ -296,10 +296,12 @@ class WiredSettingsDialog(AdvancedSettingsDialog):
profile = self.prof_name
cmdend = [os.path.join(wpath.gtk, "configscript.py"), profile, "wired"]
if os.getuid() != 0:
cmdbase = misc.get_sudo_cmd(language['scripts_need_pass'],
cmdbase = misc.get_sudo_cmd(_('You must enter your password to configure scripts'),
prog_num=daemon.GetSudoApp())
if not cmdbase:
error(None, language["no_sudo_prog"])
error(None, _('Could not find a graphical sudo program. '\
'The script editor could not be launched. '\
"You'll have to edit scripts directly your configuration file."))
return
cmdbase.extend(cmdend)
misc.LaunchAndWait(cmdbase)
@@ -350,8 +352,8 @@ class WirelessSettingsDialog(AdvancedSettingsDialog):
# Set up encryption stuff
self.networkID = networkID
self.combo_encryption = gtk.combo_box_new_text()
self.chkbox_encryption = gtk.CheckButton(language['use_encryption'])
self.chkbox_global_settings = gtk.CheckButton(language['global_settings'])
self.chkbox_encryption = gtk.CheckButton(_('Use Encryption'))
self.chkbox_global_settings = gtk.CheckButton(_('Use these settings for all networks sharing this essid'))
# Make the vbox to hold the encryption stuff.
self.vbox_encrypt_info = gtk.VBox(False, 0)
self.toggle_encryption()
@@ -402,10 +404,12 @@ class WirelessSettingsDialog(AdvancedSettingsDialog):
cmdend = [os.path.join(wpath.gtk, "configscript.py"),
str(self.networkID), "wireless"]
if os.getuid() != 0:
cmdbase = misc.get_sudo_cmd(language['scripts_need_pass'],
cmdbase = misc.get_sudo_cmd(_('You must enter your password to configure scripts'),
prog_num=daemon.GetSudoApp())
if not cmdbase:
error(None, language["no_sudo_prog"])
error(None, _('Could not find a graphical sudo program. '\
'The script editor could not be launched. '\
"You'll have to edit scripts directly your configuration file."))
return
cmdbase.extend(cmdend)
misc.LaunchAndWait(cmdbase)
@@ -478,7 +482,7 @@ class WirelessSettingsDialog(AdvancedSettingsDialog):
for entry_info in encrypt_info.itervalues():
if entry_info[0].entry.get_text() == "" and \
entry_info[1] == 'required':
error(self, "%s (%s)" % (language['encrypt_info_missing'],
error(self, "%s (%s)" % (_('Required encryption information is missing.'),
entry_info[0].label.get_label())
)
return False
@@ -489,7 +493,7 @@ class WirelessSettingsDialog(AdvancedSettingsDialog):
elif not self.chkbox_encryption.get_active() and \
wireless.GetWirelessProperty(networkid, "encryption"):
# Encrypt checkbox is off, but the network needs it.
error(self, language['enable_encryption'])
error(self, _('This network requires encryption to be enabled.'))
return False
else:
print "no encryption specified..."
@@ -531,10 +535,7 @@ class WirelessSettingsDialog(AdvancedSettingsDialog):
for type_ in ['required', 'optional']:
fields = methods[ID][type_]
for field in fields:
if language.has_key(field[1]):
field_text = language[field[1].lower().replace(' ','_')]
else:
field_text = field[1].replace('_',' ')
if field in methods[ID]['protected']:
box = ProtectedLabelEntry(field_text)
@@ -593,7 +594,7 @@ class NetworkEntry(gtk.HBox):
self.advanced_image.set_from_stock(gtk.STOCK_EDIT, 4)
self.advanced_image.set_padding(4, 0)
self.advanced_button.set_alignment(.5, .5)
self.advanced_button.set_label(language['properties'])
self.advanced_button.set_label(_('Properties'))
self.advanced_button.set_image(self.advanced_image)
self.buttons_hbox.pack_start(self.connect_hbox, False, False)
@@ -624,14 +625,14 @@ class WiredNetworkEntry(NetworkEntry):
self.connect_button.show()
self.name_label.set_use_markup(True)
self.name_label.set_label("<b>" + language['wired_network'] + "</b>")
self.name_label.set_label("<b>" + _('Wired Network') + "</b>")
self.is_full_gui = True
self.button_add = gtk.Button(stock=gtk.STOCK_ADD)
self.button_delete = gtk.Button(stock=gtk.STOCK_DELETE)
self.profile_help = gtk.Label(language['wired_network_instructions'])
self.chkbox_default_profile = gtk.CheckButton(language['default_wired'])
self.profile_help = gtk.Label(_('To connect to a wired network, you must create a network profile. To create a network profile, type a name that describes this network, and press Add.'))
self.chkbox_default_profile = gtk.CheckButton(_('Use as default profile (overwrites any previous default)'))
self.combo_profile_names = gtk.combo_box_new_text()
# Format the profile help label.
@@ -812,8 +813,8 @@ class WirelessNetworkEntry(NetworkEntry):
self.lbl_channel = GreyLabel()
print "ESSID : " + self.essid
self.chkbox_autoconnect = gtk.CheckButton(language['automatic_connect'])
self.chkbox_neverconnect = gtk.CheckButton(language['never_connect'])
self.chkbox_autoconnect = gtk.CheckButton(_('Automatically connect to this network'))
self.chkbox_neverconnect = gtk.CheckButton(_('Never connect to this network'))
self.set_signal_strength(wireless.GetWirelessProperty(networkID,
'quality'),
@@ -955,13 +956,13 @@ class WirelessNetworkEntry(NetworkEntry):
if on and ttype:
self.lbl_encryption.set_label(str(ttype))
if on and not ttype:
self.lbl_encryption.set_label(language['secured'])
self.lbl_encryption.set_label(_('Secured'))
if not on:
self.lbl_encryption.set_label(language['unsecured'])
self.lbl_encryption.set_label(_('Unsecured'))
def set_channel(self, channel):
""" Set the channel value for the WirelessNetworkEntry. """
self.lbl_channel.set_label(language['channel'] + ' ' + str(channel))
self.lbl_channel.set_label(_('Channel') + ' ' + str(channel))
def format_entry(self, networkid, label):
""" Helper method for fetching/formatting wireless properties. """
@@ -1077,13 +1078,13 @@ class WirelessInformationDialog(gtk.Dialog):
if on and ttype:
self.lbl_encryption.set_label(str(ttype))
if on and not ttype:
self.lbl_encryption.set_label(language['secured'])
self.lbl_encryption.set_label(_('Secured'))
if not on:
self.lbl_encryption.set_label(language['unsecured'])
self.lbl_encryption.set_label(_('Unsecured'))
def set_channel(self, channel):
""" Set the channel value for the WirelessNetworkEntry. """
self.lbl_channel.set_label(language['channel'] + ' ' + str(channel))
self.lbl_channel.set_label(_('Channel') + ' ' + str(channel))
def set_mode(self, mode):
""" Set the mode value for the WirelessNetworkEntry. """

View File

@@ -33,6 +33,7 @@ from wicd import misc
from wicd import wpath
from wicd import dbusmanager
from wicd.misc import checkboxTextboxToggle, noneToBlankString
from wicd.translations import _
daemon = None
wireless = None
@@ -285,18 +286,18 @@ class PreferencesDialog(object):
""" Sets up a label for the given widget name. """
widget = self.wTree.get_object(name)
# if lbl:
# widget.set_label(language[lbl])
# widget.set_label(lbl)
if widget is None:
raise ValueError('widget %s does not exist' % name)
return widget
# External Programs tab
# self.wTree.get_object("gen_settings_label").set_label(language["gen_settings"])
# self.wTree.get_object("ext_prog_label").set_label(language["ext_programs"])
# self.wTree.get_object("dhcp_client_label").set_label(language["dhcp_client"])
# self.wTree.get_object("wired_detect_label").set_label(language["wired_detect"])
# self.wTree.get_object("route_flush_label").set_label(language["route_flush"])
# self.wTree.get_object("pref_backend_label").set_label(language["backend"] + ":")
# self.wTree.get_object("gen_settings_label").set_label(_('General Settings'))
# self.wTree.get_object("ext_prog_label").set_label(_('External Programs'))
# self.wTree.get_object("dhcp_client_label").set_label(_('DHCP Client'))
# self.wTree.get_object("wired_detect_label").set_label(_('Wired Link Detection'))
# self.wTree.get_object("route_flush_label").set_label(_('Route Table Flushing'))
# self.wTree.get_object("pref_backend_label").set_label(_('Backend') + ":")
# entryWiredAutoMethod = self.wTree.get_object("pref_wired_auto_label")
# entryWiredAutoMethod.set_label('Wired Autoconnect Setting:')
@@ -305,16 +306,16 @@ class PreferencesDialog(object):
# atrlist.insert(pango.AttrWeight(pango.WEIGHT_BOLD, 0, 50))
# entryWiredAutoMethod.set_attributes(atrlist)
# self.set_label("pref_dns1_label", "%s %s" % (language['dns'], language['1']))
# self.set_label("pref_dns2_label", "%s %s" % (language['dns'], language['2']))
# self.set_label("pref_dns3_label", "%s %s" % (language['dns'], language['3']))
# self.set_label("pref_search_dom_label", "%s:" % language['search_domain'])
# self.set_label("pref_wifi_label", "%s:" % language['wireless_interface'])
# self.set_label("pref_wired_label", "%s:" % language['wired_interface'])
# self.set_label("pref_driver_label", "%s:" % language['wpa_supplicant_driver'])
# self.set_label("pref_dns1_label", "%s 1" % _('DNS server'))
# self.set_label("pref_dns2_label", "%s 2" % _('DNS server'))
# self.set_label("pref_dns3_label", "%s 3" % _('DNS server'))
# self.set_label("pref_search_dom_label", "%s:" % _('Search domain'))
# self.set_label("pref_wifi_label", "%s:" % _('Wireless Interface'))
# self.set_label("pref_wired_label", "%s:" % _('Wired Interface'))
# self.set_label("pref_driver_label", "%s:" % _('WPA Supplicant Driver'))
self.dialog = self.wTree.get_object("pref_dialog")
self.dialog.set_title(language['preferences'])
self.dialog.set_title(_('Preferences'))
if os.path.exists(os.path.join(wpath.images, "wicd.png")):
self.dialog.set_icon_from_file(os.path.join(wpath.images, "wicd.png"))
width = int(gtk.gdk.screen_width() / 2.4)
@@ -322,53 +323,52 @@ class PreferencesDialog(object):
width = 450
self.dialog.resize(width, int(gtk.gdk.screen_height() / 2))
self.wiredcheckbox = setup_label("pref_always_check",
'wired_always_on')
self.wiredcheckbox = setup_label("pref_always_check", _('''Always show wired interface'''))
self.preferwiredcheckbox = setup_label("pref_prefer_wired_check",
"prefer_wired")
self.reconnectcheckbox = setup_label("pref_auto_check",
'auto_reconnect')
_('Automatically reconnect on connection loss'))
self.showneverconnectcheckbox = setup_label("pref_show_never_connect_check",
'show_never_connect')
_('Show never connect networks'))
self.debugmodecheckbox = setup_label("pref_debug_check",
'use_debug_mode')
_('Enable debug mode'))
self.displaytypecheckbox = setup_label("pref_dbm_check",
'display_type_dialog')
_('Use dBm to measure signal strength'))
self.verifyapcheckbox = setup_label("pref_verify_ap_check",
'verify_ap_dialog')
_('Ping static gateways after connecting to verify association'))
self.usedefaultradiobutton = setup_label("pref_use_def_radio",
'use_default_profile')
_('Use default profile on wired autoconnect'))
self.showlistradiobutton = setup_label("pref_prompt_radio",
'show_wired_list')
_('Prompt for profile on wired autoconnect'))
self.lastusedradiobutton = setup_label("pref_use_last_radio",
'use_last_used_profile')
_('Use last used profile on wired autoconnect'))
self.notificationscheckbox = setup_label("pref_use_libnotify",
'display_notifications')
_('Display notifications about connection status'))
# DHCP Clients
self.dhcpautoradio = setup_label("dhcp_auto_radio", "wicd_auto_config")
self.dhcpautoradio = setup_label("dhcp_auto_radio", _('Automatic (recommended)'))
self.dhclientradio = self.wTree.get_object("dhclient_radio")
self.pumpradio = self.wTree.get_object("pump_radio")
self.dhcpcdradio = self.wTree.get_object("dhcpcd_radio")
self.udhcpcradio = self.wTree.get_object("udhcpc_radio")
# Wired Link Detection Apps
self.linkautoradio = setup_label("link_auto_radio", 'wicd_auto_config')
self.linkautoradio = setup_label("link_auto_radio", _('Automatic (recommended)'))
self.linkautoradio = setup_label("link_auto_radio")
self.ethtoolradio = setup_label("ethtool_radio")
self.miitoolradio = setup_label("miitool_radio")
# Route Flushing Apps
self.flushautoradio = setup_label("flush_auto_radio",
'wicd_auto_config')
_('Automatic (recommended)'))
self.ipflushradio = setup_label("ip_flush_radio")
self.routeflushradio = setup_label("route_flush_radio")
# Graphical Sudo Apps
self.sudoautoradio = setup_label("sudo_auto_radio", "wicd_auto_config")
self.sudoautoradio = setup_label("sudo_auto_radio", _('Automatic (recommended)'))
self.gksudoradio = setup_label("gksudo_radio")
self.kdesuradio = setup_label("kdesu_radio")
self.ktsussradio = setup_label("ktsuss_radio")

View File

@@ -64,7 +64,7 @@ from wicd import dbusmanager
import gui
from guiutil import error, can_use_notify
from wicd.translations import language
from wicd.translations import _
ICON_AVAIL = True
USE_EGG = False
@@ -91,7 +91,7 @@ def catchdbus(func):
return func(*args, **kwargs)
except DBusException, e:
if e.get_dbus_name() != None and "DBus.Error.AccessDenied" in e.get_dbus_name():
error(None, language['access_denied'].replace("$A","<b>"+wpath.wicd_group+"</b>"))
error(None, _('Unable to contact the Wicd daemon due to an access denied error from DBus. Please check that your user is in the $A group.').replace("$A","<b>"+wpath.wicd_group+"</b>"))
#raise
raise DBusException(e)
else:
@@ -208,20 +208,20 @@ class TrayIcon(object):
Updates the trayicon tooltip based on current connection status
"""
if (self.network_type == "none"):
self.tr.set_tooltip(language['not_connected'])
self.tr.set_tooltip(_('Not connected'))
elif (self.network_type == "wireless"):
self.tr.set_tooltip(language['connected_to_wireless']
self.tr.set_tooltip(_('Connected to $A at $B (IP: $C)')
.replace('$A', self.network_name)
.replace('$B', self.network_str)
.replace('$C', self.network_addr))
elif (self.network_type == "wired"):
self.tr.set_tooltip(language['connected_to_wired']
self.tr.set_tooltip(_('Connected to wired network (IP: $A)')
.replace('$A', self.network_addr))
elif (self.network_type == "killswitch"):
self.tr.set_tooltip(language['not_connected'] + "(" +
language['killswitched_enabled'] + ")")
self.tr.set_tooltip(_('Not connected') + "(" +
_('Wireless Kill Switch Enabled') + ")")
elif (self.network_type == "no_daemon"):
self.tr.set_tooltip(language['no_daemon_tooltip'])
self.tr.set_tooltip(_('Wicd daemon unreachable'))
return True
@@ -260,11 +260,11 @@ class TrayIcon(object):
self.network_addr = str(info[0])
self.network_type = "wired"
self.tr.set_from_file(os.path.join(wpath.images, "wired.png"))
# status_string = language['connected_to_wired'].replace('$A',
# status_string = _('Connected to wired network (IP: $A)').replace('$A',
#wired_ip)
# self.tr.set_tooltip(status_string)
self._show_notification(language['wired_network'],
language['connection_established'],
self._show_notification(_('Wired Network'),
_('Connection established'),
'network-wired')
self.update_tooltip()
@@ -287,14 +287,14 @@ class TrayIcon(object):
if wireless.GetWirelessProperty(cur_net_id, "encryption"):
lock = "-lock"
# status_string = (language['connected_to_wireless']
# status_string = (_('Connected to $A at $B (IP: $C)')
#.replace('$A', self.network)
# .replace('$B', sig_string)
# .replace('$C', str(wireless_ip)))
#self.tr.set_tooltip(status_string)
self.set_signal_image(int(strength), lock)
self._show_notification(self.network,
language['connection_established'],
_('Connection established'),
'network-wireless')
@@ -304,22 +304,22 @@ class TrayIcon(object):
""" Sets the icon info for a connecting state. """
wired = False
if info[0] == 'wired' and len(info) == 1:
cur_network = language['wired_network']
cur_network = _('Wired Network')
wired = True
else:
cur_network = info[1]
status_string = language['connecting'] + " to " + \
status_string = _('Connecting') + " to " + \
cur_network + "..."
self.update_tooltip()
# self.tr.set_tooltip(status_string)
self.tr.set_from_file(os.path.join(wpath.images, "no-signal.png"))
if wired:
self._show_notification(cur_network,
language['establishing_connection'],
_('Establishing connection...'),
'network-wired')
else:
self._show_notification(cur_network,
language['establishing_connection'],
_('Establishing connection...'),
'network-wireless')
@@ -328,14 +328,14 @@ class TrayIcon(object):
""" Set the icon info for the not connected state. """
self.tr.set_from_file(wpath.images + "no-signal.png")
if not DBUS_AVAIL:
status = language['no_daemon_tooltip']
status = _('Wicd daemon unreachable')
elif wireless.GetKillSwitchEnabled():
status = (language['not_connected'] + " (" +
language['killswitch_enabled'] + ")")
status = (_('Not connected') + " (" +
_('Wireless Kill Switch Enabled') + ")")
else:
status = language['not_connected']
status = _('Not connected')
# self.tr.set_tooltip(status)
self._show_notification(language['disconnected'], None, 'stop')
self._show_notification(_('Disconnected'), None, 'stop')
self.update_tooltip()
@catchdbus
@@ -495,9 +495,9 @@ class TrayIcon(object):
('Menu', None, 'Menu'),
('Connect', gtk.STOCK_CONNECT, "Connect"),
('Info', gtk.STOCK_INFO, "_Connection Info", None,
'Information about the current connection',
_('Information about the current connection'),
self.on_conn_info),
('Quit',gtk.STOCK_QUIT,'_Quit',None,'Quit wicd-tray-icon',
('Quit',gtk.STOCK_QUIT,'_Quit',None,_('Quit wicd-tray-icon'),
self.on_quit),
]
actg = gtk.ActionGroup('Actions')
@@ -535,7 +535,7 @@ class TrayIcon(object):
if DBUS_AVAIL:
self.toggle_wicd_gui()
else:
# error(None, language["daemon_unavailable"])
# error(None, _('The wicd daemon is unavailable, so your request cannot be completed'))
pass
def on_quit(self, widget=None):
@@ -598,12 +598,19 @@ class TrayIcon(object):
# Choose info for the data
if state == misc.WIRED:
text = (language['conn_info_wired']
text = (_('''$A
$B KB/s
$C KB/s''')
.replace('$A', str(info[0])) #IP
.replace('$B', str(rx)) #RX
.replace('$C', str(tx))) #TX
elif state == misc.WIRELESS:
text = (language['conn_info_wireless']
text = (_('''$A
$B
$C
$D
$E KB/s
$F KB/s''')
.replace('$A', str(info[1])) #SSID
.replace('$B', str(info[4])) #Speed
.replace('$C', str(info[0])) #IP
@@ -616,13 +623,22 @@ class TrayIcon(object):
# Choose info for the labels
self.list[0].set_text('\n' + text)
if state == misc.WIRED:
self.list[1].set_text(language['conn_info_wired_labels'])
self.list[1].set_text(_('''Wired
IP:
RX:
TX:'''))
elif state == misc.WIRELESS:
self.list[1].set_text(language['conn_info_wireless_labels'])
self.list[1].set_text(_('''Wireless
SSID:
Speed:
IP:
Strength:
RX:
TX:'''))
elif state == misc.CONNECTING:
self.list[1].set_text(language['connecting'])
self.list[1].set_text(_('Connecting'))
elif state in (misc.SUSPENDED, misc.NOT_CONNECTED):
self.list[1].set_text(language['disconnected'])
self.list[1].set_text(_('Disconnected'))
return True
@@ -776,7 +792,7 @@ class TrayIcon(object):
self._add_item_to_menu(submenu, essid, "wifi", x,
is_connecting, is_active)
else:
no_nets_item = gtk.MenuItem(language['no_wireless_networks_found'])
no_nets_item = gtk.MenuItem(_('No wireless networks found.'))
no_nets_item.set_sensitive(False)
no_nets_item.show()
submenu.append(no_nets_item)
@@ -789,7 +805,7 @@ class TrayIcon(object):
submenu = net_menuitem.get_submenu()
self._clear_menu(submenu)
loading_item = gtk.MenuItem(language['scanning'] + "...")
loading_item = gtk.MenuItem(_('Scanning') + "...")
loading_item.set_sensitive(False)
loading_item.show()
submenu.append(loading_item)
@@ -933,8 +949,7 @@ def setup_dbus(force=True):
try:
dbusmanager.connect_to_dbus()
except DBusException:
error(None, "Could not connect to wicd's D-Bus interface. " +
"Check the wicd log for error messages.")
error(None, _("Could not connect to wicd's D-Bus interface. Check the wicd log for error messages."))
return False
else:
return False
@@ -963,7 +978,7 @@ def handle_no_dbus():
DBUS_AVAIL = False
gui.handle_no_dbus(from_tray=True)
print "Wicd daemon is shutting down!"
lost_dbus_id = misc.timeout_add(5, lambda:error(None, language['lost_dbus'],
lost_dbus_id = misc.timeout_add(5, lambda:error(None, _('The wicd daemon has shut down. The UI will not function properly until it is restarted.'),
block=False))
return False

View File

@@ -33,6 +33,8 @@ from commands import getoutput
from itertools import repeat, chain, izip
from pipes import quote
from wicd.translations import _
# wicd imports
import wpath
@@ -71,6 +73,30 @@ _sudo_dict = {
KTSUSS: "ktsuss",
}
_status_dict = {
'aborted': _('Connection Cancelled'),
'association_failed': _('Connection failed: Could not contact the wireless access point.'),
'bad_pass': _('Connection Failed: Bad password'),
'configuring_interface': _('Configuring wireless interface...'),
'dhcp_failed': _('Connection Failed: Unable to Get IP Address'),
'done': _('Done connecting...'),
'failed': _('Connection Failed.'),
'flushing_routing_table': _('Flushing the routing table...'),
'generating_psk': _('Generating PSK...'),
'generating_wpa_config': _('Generating WPA configuration file...'),
'interface_down': _('Putting interface down...'),
'interface_up': _('Putting interface up...'),
'no_dhcp_offers': _('Connection Failed: No DHCP offers received.'),
'resetting_ip_address': _('Resetting IP address...'),
'running_dhcp': _('Obtaining IP address...'),
'setting_broadcast_address': _('Setting broadcast address...'),
'setting_static_dns': _('Setting static DNS servers...'),
'setting_static_ip': _('Setting static IP addresses...'),
'success': _('Connection successful.'),
'validating_authentication': _('Validating authentication...'),
'verifying_association': _('Verifying access point association...'),
}
class WicdError(Exception):
pass
@@ -167,7 +193,7 @@ def PromptToStartDaemon():
else:
msg = '--caption'
sudo_args = [sudo_prog, msg,
'Wicd needs to access your computer\'s network cards.',
_("Wicd needs to access your computer's network cards."),
daemonloc]
os.spawnvpe(os.P_WAIT, sudo_prog, sudo_args, os.environ)
return True

View File

@@ -53,6 +53,7 @@ from signal import SIGTERM
import misc
import wpath
from backend import BackendManager
from translations import _
if __name__ == '__main__':
wpath.chdir(__file__)
@@ -330,13 +331,13 @@ class ConnectThread(threading.Thread):
self.iface = iface
self.connecting_message = None
self.connecting_status = None
self.debug = debug
self.SetStatus('interface_down')
def run(self):
self.connect_result = "Failed"
self.connect_result = "failed"
try:
self._connect()
finally:
@@ -360,7 +361,7 @@ class ConnectThread(threading.Thread):
"""
self.lock.acquire()
try:
self.connecting_message = status
self.connecting_status = status
finally:
self.lock.release()
@@ -373,10 +374,10 @@ class ConnectThread(threading.Thread):
"""
self.lock.acquire()
try:
message = self.connecting_message
status = self.connecting_status
finally:
self.lock.release()
return message
return status
@abortable
def reset_ip_addresses(self, iface):
@@ -496,7 +497,7 @@ class ConnectThread(threading.Thread):
""" Sets the thread status to aborted. """
if self.abort_reason:
reason = self.abort_reason
self.connecting_message = reason
self.connecting_status = reason
self.is_aborted = True
self.connect_result = reason
self.is_connecting = False
@@ -910,7 +911,7 @@ class WirelessConnectThread(ConnectThread):
self.SetStatus('validating_authentication')
if not wiface.ValidateAuthentication(time.time()):
print "connect result is %s" % self.connect_result
if not self.connect_result or self.connect_result == 'Failed':
if not self.connect_result or self.connect_result == 'failed':
self.abort_connection('bad_pass')
# Set up gateway, IP address, and DNS servers.
@@ -932,7 +933,7 @@ class WirelessConnectThread(ConnectThread):
print 'Connecting thread exiting.'
if self.debug:
print "IP Address is: " + str(wiface.GetIP())
self.connect_result = "Success"
self.connect_result = "success"
self.is_connecting = False
@abortable
@@ -962,7 +963,7 @@ class WirelessConnectThread(ConnectThread):
iface.FlushRoutes()
if hasattr(iface, "StopWPA"):
iface.StopWPA()
self.abort_connection("association_failed")
self.abort_connection('association_failed')
else:
print 'not verifying'
@@ -1163,5 +1164,5 @@ class WiredConnectThread(ConnectThread):
if self.debug:
print "IP Address is: " + str(liface.GetIP())
self.connect_result = "Success"
self.connect_result = "success"
self.is_connecting = False

View File

@@ -55,195 +55,35 @@ def get_gettext():
_ = lang.gettext
return _
# Generated automatically on Mon, 11 Jul 2011 03:53:23 CDT
_ = get_gettext()
# language[] should contain only strings in encryption templates, which
# can't otherwise be translated, at least with the current templating
# scheme.
language = {}
language['resetting_ip_address'] = _('''Resetting IP address...''')
language['prefs_help'] = _('''Preferences dialog''')
language['no_dhcp_offers'] = _('''Connection Failed: No DHCP offers received.''')
language['more_help'] = _('''For more detailed help, consult the wicd-curses(8) man page.''')
language['bad_pass'] = _('''Connection Failed: Bad password''')
language['cannot_start_daemon'] = _('''Unable to connect to wicd daemon DBus interface. This typically means there was a problem starting the daemon. Check the wicd log for more information.''')
language['verifying_association'] = _('''Verifying access point association...''')
language['wired_always_on'] = _('''Always show wired interface''')
language['could_not_connect'] = _('''Could not connect to wicd's D-Bus interface. Check the wicd log for error messages.''')
language['path_to_pac_file'] = _('''Path to PAC File''')
language['always_switch_to_wired'] = _('''Always switch to wired connection when available''')
language['disconn_help'] = _('''Disconnect from all networks''')
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['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. 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.''')
language['scripts_need_pass'] = _('''You must enter your password to configure scripts''')
language['dns_domain'] = _('''DNS domain''')
language['aborted'] = _('''Connection Cancelled''')
language['scanning_stand_by'] = _('''Scanning networks... stand by...''')
language['password'] = _('''Password''')
language['no_daemon_tooltip'] = _('''Wicd daemon unreachable''')
language['use_static_dns'] = _('''Use Static DNS''')
language['setting_broadcast_address'] = _('''Setting broadcast address...''')
language['choose_wired_profile'] = _('''Select or create a wired profile to connect with''')
language['make_wired_profile'] = _('''To connect to a wired network, you must create a network profile. To create a network profile, type a name that describes this network, and press Add.''')
language['esc_to_cancel'] = _('''Press ESC to cancel''')
language['scanning'] = _('''Scanning''')
language['flushing_routing_table'] = _('''Flushing the routing table...''')
language['brought_to_you'] = _('''Brought to you by:''')
language['refresh_help'] = _('''Refresh network list''')
language['select_hidden_essid'] = _('''Select Hidden Network ESSID''')
language['ext_programs'] = _('''External Programs''')
language['connect'] = _('''Connect''')
language['help_help'] = _('''Display this help dialog''')
language['use_global_dns'] = _('''Use global DNS servers''')
language['enable_encryption'] = _('''This network requires encryption to be enabled.''')
language['use_last_used_profile'] = _('''Use last used profile on wired autoconnect''')
language['preferences'] = _('''Preferences''')
language['dhcp_failed'] = _('''Connection Failed: Unable to Get IP Address''')
language['setting_static_ip'] = _('''Setting static IP addresses...''')
language['connecting_to_daemon'] = _('''Connecting to daemon...''')
language['automatic_connect'] = _('''Automatically connect to this network''')
language['never_connect'] = _('Never connect to this network')
language['show_never_connect'] = _('Show never connect networks')
language['hide_never_connect'] = _('Hide never connect networks')
language['add_new_wired_profile'] = _('''Add a new wired profile''')
language['dhcp_client'] = _('''DHCP Client''')
language['display_type_dialog'] = _('''Use dBm to measure signal strength''')
language['global_settings'] = _('''Use these settings for all networks sharing this essid''')
language['config_help'] = _('''Configure Selected Network''')
language['use_debug_mode'] = _('''Enable debug mode''')
language['removing_old_connection'] = _('''Removing old connection...''')
language['no_sudo_prog'] = _('''Could not find a graphical sudo program. The script editor could not be launched. You'll have to edit scripts directly your configuration file.''')
language['wireless_networks'] = _('''Wireless Networks''')
language['configuring_wired'] = _('''Configuring preferences for wired profile "$A"''')
language['no_wireless_networks_found'] = _('''No wireless networks found.''')
language['madwifi_for_adhoc'] = _('''Check if using madwifi/atheros drivers''')
language['properties'] = _('''Properties''')
language['setting_encryption_info'] = _('''Setting encryption info''')
language['about'] = _('''About Wicd''')
language['ok'] = _('''OK''')
language['adhoc_help'] = _('''Set up Ad-hoc network''')
language['scripts_help'] = _('''Select scripts''')
language['invalid_address'] = _('''Invalid address in $A entry.''')
language['configuring_interface'] = _('''Configuring wireless interface...''')
language['generating_psk'] = _('''Generating PSK...''')
language['validating_authentication'] = _('''Validating authentication...''')
language['essid'] = _('''ESSID''')
language['anonymous_identity'] = _('''Anonymous Identity''')
language['wireless_interface'] = _('''Wireless Interface''')
language['hidden_network'] = _('''Hidden Network''')
language['key'] = _('''Key''')
language['wicd_curses'] = _('''Wicd Curses Interface''')
language['debugging'] = _('''Debugging''')
language['use_encryption'] = _('''Use Encryption''')
language['wpa_supplicant'] = _('''WPA Supplicant''')
language['global_dns_servers'] = _('''Global DNS servers''')
language['not_connected'] = _('''Not connected''')
language['done'] = _('''Done connecting...''')
language['cannot_connect_to_daemon'] = _('''Can't connect to the daemon, trying to start it automatically...''')
language['cancel'] = _('''Cancel''')
language['case_sensitive'] = _('''All controls are case sensitive''')
language['gateway'] = _('''Gateway''')
language['backend'] = _('''Backend''')
language['dbus_fail'] = _('''DBus failure! This is most likely caused by the wicd daemon stopping while wicd-curses is running. Please restart the daemon, and then restart wicd-curses.''')
language['terminated'] = _('''Terminated by user''')
language['wired_detect'] = _('''Wired Link Detection''')
language['add_new_profile'] = _('''Add a new profile''')
language['use_ics'] = _('''Activate Internet Connection Sharing''')
language['create_adhoc_network'] = _('''Create an Ad-Hoc Network''')
language['interface_up'] = _('''Putting interface up...''')
language['global_dns_not_enabled'] = _('''Global DNS has not been enabled in general preferences.''')
language['dns'] = _('''DNS''')
language['advanced_settings'] = _('''Advanced Settings''')
language['username'] = _('''Username''')
language['wicd_auto_config'] = _('''Automatic (recommended)''')
language['wired_network_found'] = _('''Wired connection detected''')
language['netmask'] = _('''Netmask''')
language['select_a_network'] = _('''Choose from the networks below:''')
language['connect_help'] = _('''Connect to selected network''')
language['no_delete_last_profile'] = _('''wicd-curses does not support deleting the last wired profile. Try renaming it ('F2')''')
language['gen_settings'] = _('''General Settings''')
language['connected_to_wireless'] = _('''Connected to $A at $B (IP: $C)''')
language['exception'] = _('''EXCEPTION! Please report this to the maintainer and file a bug report with the backtrace below:''')
language['configuring_wireless'] = _('''Configuring preferences for wireless network "$A" ($B)''')
language['generating_wpa_config'] = _('''Generating WPA configuration file...''')
language['search_domain'] = _('''Search domain''')
language['encrypt_info_missing'] = _('''Required encryption information is missing.''')
language['running_dhcp'] = _('''Obtaining IP address...''')
language['lost_dbus'] = _('''The wicd daemon has shut down. The UI will not function properly until it is restarted.''')
language['wired_network_instructions'] = _('''To connect to a wired network, you must create a network profile. To create a network profile, type a name that describes this network, and press Add.''')
language['setting_static_dns'] = _('''Setting static DNS servers...''')
language['auto_reconnect'] = _('''Automatically reconnect on connection loss''')
language['use_wep_encryption'] = _('''Use Encryption (WEP only)''')
language['wired_autoconnect_settings'] = _('''Wired Autoconnect Settings''')
language['before_script'] = _('''Run script before connect''')
language['always_use_wext'] = _('''You should almost always use wext as the WPA supplicant driver''')
language['network_interfaces'] = _('''Network Interfaces''')
language['use_default_profile'] = _('''Use default profile on wired autoconnect''')
language['scan'] = _('''Scan''')
language['ip'] = _('''IP''')
language['connected_to_wired'] = _('''Connected to wired network (IP: $A)''')
language['wpa_supplicant_driver'] = _('''WPA Supplicant Driver''')
language['access_cards'] = _('''Wicd needs to access your computer's network cards.''')
language['killswitch_enabled'] = _('''Wireless Kill Switch Enabled''')
language['hidden_network_essid'] = _('''Hidden Network ESSID''')
language['secured'] = _('''Secured''')
language['interface_down'] = _('''Putting interface down...''')
language['authentication'] = _('''Authentication''')
language['after_script'] = _('''Run script after connect''')
language['show_wired_list'] = _('''Prompt for profile on wired autoconnect''')
language['channel'] = _('''Channel''')
language['unsecured'] = _('''Unsecured''')
language['rename_wired_profile'] = _('''Rename wired profile''')
language['daemon_unavailable'] = _('''The wicd daemon is unavailable, so your request cannot be completed''')
language['stop_showing_chooser'] = _('''Stop Showing Autoconnect pop-up temporarily''')
language['scan_help'] = _('''Scan for hidden networks''')
language['use_static_ip'] = _('''Use Static IPs''')
language['raw_screen_arg'] = _('''use urwid's raw screen controller''')
language['route_flush'] = _('''Route Table Flushing''')
language['scripts'] = _('''Scripts''')
language['identity'] = _('''Identity''')
language['automatic_reconnection'] = _('''Automatic Reconnection''')
language['wired_interface'] = _('''Wired Interface''')
language['press_to_quit'] = _('''Press F8 or Q to quit.''')
language['default_wired'] = _('''Use as default profile (overwrites any previous default)''')
language['wired_network'] = _('''Wired Network''')
language['dns_server'] = _('''DNS server''')
language['notifications'] = _('''Notifications''')
language['display_notifications'] = _('''Display notifications about connection status''')
language['connection_established'] = _('''Connection established''')
language['disconnected'] = _('''Disconnected''')
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 that your user is in the $A group.''')
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''')
language['resume_script'] = _('''Resume script''')
language['suspend_script'] = _('''Suspend script''')
language['invalid_ip_address'] = _('''Invalid IP address entered.''')
language['verify_ap_dialog'] = _('''Ping static gateways after connecting to verify association''')
language['conn_info_wireless'] = _('''$A
$B
$C
$D
$E KB/s
$F KB/s''')
language['conn_info_wired'] = _('''$A
$B KB/s
$C KB/s''')
language['conn_info_wireless_labels'] = _('''Wireless
SSID:
Speed:
IP:
Strength:
RX:
TX:''')
language['conn_info_wired_labels'] = _('''Wired
IP:
RX:
TX:''')
language['switch_on_wifi'] = _('''Switch On Wi-Fi''')
language['switch_off_wifi'] = _('''Switch Off Wi-Fi''')
# FIXME: these were present in wicd 1.7.0, can't find where they are.
# Leaving here for future reference, they should be removed whenever
# possible.
#language['cannot_start_daemon'] = _('''Unable to connect to wicd daemon DBus interface. This typically means there was a problem starting the daemon. Check the wicd log for more information.''')
#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['connect'] = _('''Connect''')
# from templates, dict populated with:
# grep -R "*" encryption/templates/ | tr " " "\n" | grep "^*" | sed -e "s/*//"| sort -u | tr [A-Z] [a-z]
language['authentication'] = _('Authentication')
language['domain'] = _('Domain')
language['identity'] = _('Identity')
language['key'] = _('Key')
language['passphrase'] = _('Passphrase')
language['password'] = _('Password')
language['path_to_ca_cert'] = _('Path to CA cert')
language['path_to_client_cert'] = _('Path to client cert')
language['path_to_pac_file'] = _('Path to PAC file')
language['preshared_key'] = _('Preshared key')
language['private_key'] = _('Private key')
language['private_key_password'] = _('Private key password')
language['username'] = _('Username')

View File

@@ -57,7 +57,7 @@ from wicd import wpath
from wicd import networking
from wicd import misc
from wicd import wnettools
from wicd.misc import noneToBlankString
from wicd.misc import noneToBlankString, _status_dict
from wicd.logfile import ManagedStdio
from wicd.configmanager import ConfigManager
@@ -1176,15 +1176,24 @@ class WirelessDaemon(dbus.service.Object):
return ip
@dbus.service.method('org.wicd.daemon.wireless')
def CheckWirelessConnectingMessage(self):
""" Returns the wireless interface's status message. """
if not self.wifi.connecting_thread == None:
def CheckWirelessConnectingStatus(self):
""" Returns the wireless interface's status code. """
if self.wifi.connecting_thread:
essid = self.wifi.connecting_thread.network["essid"]
stat = self.wifi.connecting_thread.GetStatus()
return essid, stat
else:
return False
@dbus.service.method('org.wicd.daemon.wireless')
def CheckWirelessConnectingMessage(self):
""" Returns the wireless interface's status message. """
if self.wifi.connecting_thread:
essid, stat = self.CheckWirelessConnectingStatus()
return essid, _status_dict[stat]
else:
return False
@dbus.service.method('org.wicd.daemon.wireless')
def ReadWirelessNetworkProfile(self, id):
""" Reads in wireless profile as the active network """
@@ -1372,11 +1381,19 @@ class WiredDaemon(dbus.service.Object):
else:
return False
@dbus.service.method('org.wicd.daemon.wired')
def CheckWiredConnectingStatus(self):
"""Returns the wired interface's status code. '"""
if self.wired.connecting_thread:
return self.wired.connecting_thread.GetStatus()
else:
return False
@dbus.service.method('org.wicd.daemon.wired')
def CheckWiredConnectingMessage(self):
""" Returns the wired interface's status message. """
if self.wired.connecting_thread:
return self.wired.connecting_thread.GetStatus()
return _status_dict(self.CheckWiredConnectingStatus())
else:
return False