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

curses/configscript_curses.py:

Added translations
  Removed the redundant run() function in WirelessSettingsDialog
curses/wicd-curses.py:
  Added translations, some still missing.
wicd/misc.py:
  Added some translations that are not in the database, but are in the translator
This commit is contained in:
Andrew Psaltis
2009-01-31 01:33:11 -05:00
parent 0d669c4e84
commit a89e45f0c8
4 changed files with 31 additions and 64 deletions

View File

@@ -215,7 +215,8 @@ class WiredSettingsDialog(AdvancedSettingsDialog):
self._w.body.body.append(self.button_cols) self._w.body.body.append(self.button_cols)
self.prof_name = name self.prof_name = name
self._w.header = urwid.Text( ('header',">Configuring preferences for wired profile \"%s\"" % self.prof_name),align='right' ) title = ">"+language['configuring_wired'].replace('$A',self.prof_name)
self._w.header = urwid.Text( ('header',title),align='right' )
self.set_values() self.set_values()
def set_net_prop(self,option,value): def set_net_prop(self,option,value):
@@ -277,8 +278,8 @@ class WirelessSettingsDialog(AdvancedSettingsDialog):
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. title = ">"+language['configuring_wireless'].replace('$A',wireless.GetWirelessProperty(networkID,'essid')).replace('$B',wireless.GetWirelessProperty(networkID,'bssid'))
self._w.header = urwid.Text(('header',">Configuring preferences for wireless network \"%s\"" % wireless.GetWirelessProperty(networkID,'essid')),align='right' ) self._w.header = urwid.Text(('header',title),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)
@@ -412,37 +413,6 @@ class WirelessSettingsDialog(AdvancedSettingsDialog):
self._w.body.body.insert(self._w.body.body.__len__()-1,self.pile_encrypt) self._w.body.body.insert(self._w.body.body.__len__()-1,self.pile_encrypt)
#self._w.body.body.append(self.pile_encrypt) #self._w.body.body.append(self.pile_encrypt)
def run(self,ui,dim,display): def prerun(self,ui,dim,display):
self.ui = ui
self.parent = display
width,height = ui.get_cols_rows()
self.overlay = urwid.Overlay(self, display, ('fixed left', 0),width
, ('fixed top',1), height-3)
self.encryption_combo.build_combobox(self.overlay,ui,14) self.encryption_combo.build_combobox(self.overlay,ui,14)
self.change_encrypt_method() self.change_encrypt_method()
#self._w.body.body.append(self.pile_encrypt)
keys = True
while True:
if keys:
ui.draw_screen(dim, self.overlay.render(dim, True))
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:
dim = ui.get_cols_rows()
if "esc" in keys or 'Q' in keys:
return False
if "meta enter" in keys or self.OK_PRESSED:
self.OK_PRESSED = False
if self.save_settings(self.networkID):
return True
if self.CANCEL_PRESSED:
return False

View File

@@ -68,6 +68,8 @@ from optparse import OptionParser
CURSES_REVNO=wpath.curses_revision CURSES_REVNO=wpath.curses_revision
language = misc.get_language_list_gui() language = misc.get_language_list_gui()
# We need 'Connecting' without the '...'
language['connecting']=misc.get_language_list_tray()['connecting']
######################################## ########################################
##### SUPPORT CLASSES ##### SUPPORT CLASSES
@@ -87,7 +89,7 @@ class wrap_exceptions:
gobject.source_remove(redraw_tag) gobject.source_remove(redraw_tag)
loop.quit() loop.quit()
ui.stop() ui.stop()
print "\nTerminated by user." print "\n"+language['terminated']
#raise #raise
except DBusException: except DBusException:
gobject.source_remove(redraw_tag) gobject.source_remove(redraw_tag)
@@ -95,12 +97,7 @@ class wrap_exceptions:
loop.quit() loop.quit()
# Zap the screen # Zap the screen
ui.stop() ui.stop()
print "" print "\n"+language['dbus_fail']
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 then restart wicd-curses."
raise 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
@@ -113,10 +110,7 @@ class wrap_exceptions:
# Zap the screen # Zap the screen
ui.stop() ui.stop()
# Print out standard notification: # Print out standard notification:
print "\n" + language['exception']
print "\nEXCEPTION!"
print "Please report this to the maintainer and/or file a bug report with the backtrace below:"
print redraw_tag
# Flush the buffer so that the notification is always above the # Flush the buffer so that the notification is always above the
# backtrace # backtrace
sys.stdout.flush() sys.stdout.flush()
@@ -230,7 +224,7 @@ def about_dialog(body):
('green',"\\|| \\\\")," |+| ",('green',"// ||/ \n"), ('green',"\\|| \\\\")," |+| ",('green',"// ||/ \n"),
('green'," \\\\\\")," |+| ",('green',"///")," http://wicd.net\n", ('green'," \\\\\\")," |+| ",('green',"///")," http://wicd.net\n",
('green'," \\\\\\")," |+| ",('green',"///")," Brought to you by:\n", ('green'," \\\\\\")," |+| ",('green',"///")," ",language["brought_to_you"],"\n",
('green'," \\\\\\")," |+| ",('green',"///")," Adam Blackburn (wicd)\n", ('green'," \\\\\\")," |+| ",('green',"///")," Adam Blackburn (wicd)\n",
" ___|+|___ Dan O'Reilly (wicd)\n", " ___|+|___ Dan O'Reilly (wicd)\n",
" |---------| Andrew Psaltis (this ui)\n", " |---------| Andrew Psaltis (this ui)\n",
@@ -262,13 +256,12 @@ def run_configscript(parent,netname,nettype):
profname = netname if nettype == 'wired' else wireless.GetWirelessProperty( profname = netname if nettype == 'wired' else wireless.GetWirelessProperty(
int(netname),'bssid') int(netname),'bssid')
theText = [ theText = [
"""To avoid various complications, wicd-curses does not support editing the scripts directly. However, you can edit them manually. First, (as root)", open the "%s" config file, and look for the section labeled by the %s in question. For example, this network is: language['cannot_edit_scripts_1'].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.
[%s] 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."""]
You can also configure the wireless networks by looking for the "[<ESSID>]" field in the config file.
Once there, you can adjust (or add) the "beforescript", "afterscript", and "disconnectscript" variables as needed, to change the preconnect, postconnect, and disconnect scripts respectively. Note that you will be specifying the full path to the scripts - not the actual script contents. You will need to add/edit the script contents separately. Refer to the wicd manual page for more information.""" % (configfile,header,profname)]
dialog = TextDialog(theText,20,80) dialog = TextDialog(theText,20,80)
dialog.run(ui,parent) dialog.run(ui,parent)
# This code works with many distributions, but not all of them. So, to # This code works with many distributions, but not all of them. So, to
@@ -349,7 +342,7 @@ class WiredComboBox(ComboBox):
list : the list of wired network profiles. The rest is self-explanitory. list : the list of wired network profiles. The rest is self-explanitory.
""" """
def __init__(self,list): def __init__(self,list):
self.ADD_PROFILE = '---Add a new profile---' self.ADD_PROFILE = '---'+language["add_new_profile"]+'---'
self.__super.__init__(use_enter=False) self.__super.__init__(use_enter=False)
self.set_list(list) self.set_list(list)
#self.set_focus(self.theList.index(wired.GetDefaultProfile())) #self.set_focus(self.theList.index(wired.GetDefaultProfile()))
@@ -390,7 +383,7 @@ class WiredComboBox(ComboBox):
prev_focus = self.get_focus()[1] prev_focus = self.get_focus()[1]
key = self.__super.keypress(size,key) key = self.__super.keypress(size,key)
if self.get_focus()[1] == len(self.list)-1: if self.get_focus()[1] == len(self.list)-1:
dialog = InputDialog(('header',"Add a new wired profile"),7,30) dialog = InputDialog(('header',language["add_new_wired_profile"]),7,30)
exitcode,name = dialog.run(ui,self.parent) exitcode,name = dialog.run(ui,self.parent)
if exitcode == 0: if exitcode == 0:
@@ -402,7 +395,7 @@ class WiredComboBox(ComboBox):
wired.ReadWiredNetworkProfile(self.get_selected_profile()) wired.ReadWiredNetworkProfile(self.get_selected_profile())
if key == 'delete': if key == 'delete':
if len(self.theList) == 1: if len(self.theList) == 1:
error(self.ui,self.parent,"Cannot delete the last wired profile. Try renaming it ('F2')") error(self.ui,self.parent,language["no_delete_last_profile"])
return key return key
wired.DeleteWiredNetworkProfile(self.get_selected_profile()) wired.DeleteWiredNetworkProfile(self.get_selected_profile())
# Return to the top of the list if something is deleted. # Return to the top of the list if something is deleted.
@@ -415,7 +408,7 @@ class WiredComboBox(ComboBox):
self.set_list(wired.GetWiredProfileList()) self.set_list(wired.GetWiredProfileList())
self.rebuild_combobox() self.rebuild_combobox()
if key == 'f2': if key == 'f2':
dialog = InputDialog(('header',"Rename wired profile"),7,30, dialog = InputDialog(('header',language["rename_wired_profile"]),7,30,
edit_text=unicode(self.get_selected_profile())) edit_text=unicode(self.get_selected_profile()))
exitcode,name = dialog.run(ui,self.parent) exitcode,name = dialog.run(ui,self.parent)
if exitcode == 0: if exitcode == 0:
@@ -505,7 +498,7 @@ class appGUI():
# Will need a translation sooner or later # Will need a translation sooner or later
self.screen_locker = urwid.Filler(urwid.Text(('important',language['scanning_stand_by']), align='center')) 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.no_wlan = urwid.Filler(urwid.Text(('important',language['no_wireless_networks_found']), align='center'))
self.TITLE = 'Wicd Curses Interface' self.TITLE = language['wicd_curses']
self.WIRED_IDX = 1 self.WIRED_IDX = 1
self.WLESS_IDX = 3 self.WLESS_IDX = 3
@@ -573,7 +566,7 @@ class appGUI():
self.update_ui() self.update_ui()
def raise_hidden_network_dialog(self): def raise_hidden_network_dialog(self):
dialog = InputDialog(('header','Select Hidden Network ESSID'),7,30,'Scan') dialog = InputDialog(('header',language["select_hidden_essid"]),7,30,language['scan'])
exitcode,hidden = dialog.run(ui,self.frame) exitcode,hidden = dialog.run(ui,self.frame)
if exitcode != -1: if exitcode != -1:
# That dialog will sit there for a while if I don't get rid of it # That dialog will sit there for a while if I don't get rid of it
@@ -736,8 +729,8 @@ class appGUI():
#if self.special != None: #if self.special != None:
# theText += self.special # theText += self.special
if self.connecting: if self.connecting:
theText += "-- Connecting -- Press ESC to cancel " theText += "-- "+language['connecting']+' -- '+language["esc_to_cancel"]
quit_note = "-- Press F8 or Q to quit." quit_note = language["press_to_quit"]
self.footer1 = urwid.Text(str(self.incr) + theText+quit_note,wrap='clip') self.footer1 = urwid.Text(str(self.incr) + theText+quit_note,wrap='clip')
self.incr+=1 self.incr+=1
return True return True
@@ -944,8 +937,7 @@ def setup_dbus(force=True):
except DBusException: except DBusException:
# I may need to be a little more verbose here. # I may need to be a little more verbose here.
# Suggestions as to what should go here, please? # Suggestions as to what should go here, please?
print "Can't connect to the daemon. Are you sure it is running?" print language['cannot_connect_to_daemon']
print "Please check the wicd log for error messages."
#raise #raise
# return False # <- Will need soon. # return False # <- Will need soon.
bus = dbusmanager.get_bus() bus = dbusmanager.get_bus()

View File

@@ -27,7 +27,7 @@ import subprocess
# VERSIONNUMBER # VERSIONNUMBER
VERSION_NUM = '1.6.0' VERSION_NUM = '1.6.0'
REVISION_NUM = 'unknown' REVISION_NUM = 'unknown'
CURSES_REVNO = 'r260' CURSES_REVNO = 'r266'
try: try:
if not os.path.exists('vcsinfo.py'): if not os.path.exists('vcsinfo.py'):

View File

@@ -567,6 +567,11 @@ def get_language_list_gui():
language["esc_to_cancel"] = _("Press ESC to cancel") language["esc_to_cancel"] = _("Press ESC to cancel")
language["press_to_quit"] = _("Press F8 or Q to quit.") language["press_to_quit"] = _("Press F8 or Q to quit.")
language['terminated'] = _("Terminated by user")
language['wicd_curses'] = _("Wicd Curses Interface")
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.")
return language return language
def get_language_list_tray(): def get_language_list_tray():