mirror of
https://github.com/gryf/wicd.git
synced 2025-12-19 12:28:08 +01:00
Implement --status/-i in wicd-cli, to show current connection status.
This commit is contained in:
@@ -20,6 +20,7 @@ import dbus
|
|||||||
import dbus.service
|
import dbus.service
|
||||||
import sys
|
import sys
|
||||||
from wicd import misc
|
from wicd import misc
|
||||||
|
from wicd.translations import _
|
||||||
|
|
||||||
misc.RenameProcess('wicd-cli')
|
misc.RenameProcess('wicd-cli')
|
||||||
|
|
||||||
@@ -61,19 +62,55 @@ parser.add_option('--network-details', '-d', default=False, action='store_true')
|
|||||||
parser.add_option('--disconnect', '-x', default=False, action='store_true')
|
parser.add_option('--disconnect', '-x', default=False, action='store_true')
|
||||||
parser.add_option('--connect', '-c', default=False, action='store_true')
|
parser.add_option('--connect', '-c', default=False, action='store_true')
|
||||||
parser.add_option('--list-encryption-types', '-e', default=False, action='store_true')
|
parser.add_option('--list-encryption-types', '-e', default=False, action='store_true')
|
||||||
# short options for these two aren't great.
|
# short options for these aren't great.
|
||||||
parser.add_option('--wireless', '-y', default=False, action='store_true')
|
parser.add_option('--wireless', '-y', default=False, action='store_true')
|
||||||
parser.add_option('--wired', '-z', default=False, action='store_true')
|
parser.add_option('--wired', '-z', default=False, action='store_true')
|
||||||
parser.add_option('--load-profile', '-o', default=False, action='store_true')
|
parser.add_option('--load-profile', '-o', default=False, action='store_true')
|
||||||
|
parser.add_option('--status', '-i', default=False, action='store_true') # -i(nfo)
|
||||||
|
|
||||||
options, arguments = parser.parse_args()
|
options, arguments = parser.parse_args()
|
||||||
|
|
||||||
op_performed = False
|
op_performed = False
|
||||||
|
|
||||||
if not (options.wireless or options.wired):
|
if not (options.wireless or options.wired) and not options.status:
|
||||||
print "Please use --wireless or --wired to specify " + \
|
print "Please use --wireless or --wired to specify " + \
|
||||||
"the type of connection to operate on."
|
"the type of connection to operate on."
|
||||||
|
|
||||||
|
if options.status:
|
||||||
|
status, info = daemon.GetConnectionStatus()
|
||||||
|
if status in (misc.WIRED, misc.WIRELESS):
|
||||||
|
connected = True
|
||||||
|
status_msg = _('Connected')
|
||||||
|
if status == misc.WIRED:
|
||||||
|
conn_type = _('Wired')
|
||||||
|
else:
|
||||||
|
conn_type = _('Wireless')
|
||||||
|
else:
|
||||||
|
connected = False
|
||||||
|
status_msg = misc._const_status_dict[status]
|
||||||
|
|
||||||
|
print _('Connection status') + ': ' + status_msg
|
||||||
|
if connected:
|
||||||
|
print _('Connection type') + ': ' + conn_type
|
||||||
|
if status == misc.WIRELESS:
|
||||||
|
print _('Connected to $A at $B (IP: $C)') \
|
||||||
|
.replace('$A', info[1]) \
|
||||||
|
.replace('$B', info[2]) \
|
||||||
|
.replace('$C', info[0])
|
||||||
|
print _('Network ID: $A') \
|
||||||
|
.replace('$A', info[3])
|
||||||
|
else:
|
||||||
|
print _('Connected to wired network (IP: $A)') \
|
||||||
|
.replace('$A', info[0])
|
||||||
|
else:
|
||||||
|
if status == misc.CONNECTING:
|
||||||
|
if info[0] == 'wired':
|
||||||
|
print _('Connecting to wired network.')
|
||||||
|
elif info[0] == 'wireless':
|
||||||
|
print _('Connecting to wireless network "$A".') \
|
||||||
|
.replace('$A', info[1])
|
||||||
|
op_performed = True
|
||||||
|
|
||||||
# functions
|
# functions
|
||||||
def is_valid_wireless_network_id(network_id):
|
def is_valid_wireless_network_id(network_id):
|
||||||
if not (network_id >= 0 \
|
if not (network_id >= 0 \
|
||||||
|
|||||||
103
po/wicd.pot
103
po/wicd.pot
@@ -8,7 +8,7 @@ msgid ""
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: PACKAGE VERSION\n"
|
"Project-Id-Version: PACKAGE VERSION\n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: 2012-05-06 21:25+0200\n"
|
"POT-Creation-Date: 2012-09-26 17:26+0200\n"
|
||||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
@@ -140,7 +140,7 @@ msgstr ""
|
|||||||
msgid "Configuring preferences for wireless network \"$A\" ($B)"
|
msgid "Configuring preferences for wireless network \"$A\" ($B)"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: wicd/misc.py:82
|
#: wicd/misc.py:89
|
||||||
msgid "Configuring wireless interface..."
|
msgid "Configuring wireless interface..."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
@@ -152,10 +152,30 @@ msgstr ""
|
|||||||
msgid "Connect to selected network"
|
msgid "Connect to selected network"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: cli/wicd-cli.py:83
|
||||||
|
msgid "Connected"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: cli/wicd-cli.py:96
|
||||||
|
msgid "Connected to \"$A\" ($B)."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#: curses/wicd-curses.py:158 gtk/gui.py:490 gtk/wicd-client.py:215
|
#: curses/wicd-curses.py:158 gtk/gui.py:490 gtk/wicd-client.py:215
|
||||||
msgid "Connected to $A at $B (IP: $C)"
|
msgid "Connected to $A at $B (IP: $C)"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: cli/wicd-cli.py:102
|
||||||
|
msgid "Connected to $A."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: wicd/misc.py:53
|
||||||
|
msgid "Connected to a wired network"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: wicd/misc.py:52
|
||||||
|
msgid "Connected to a wireless network"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#: curses/wicd-curses.py:133 gtk/gui.py:483 gtk/wicd-client.py:220
|
#: curses/wicd-curses.py:133 gtk/gui.py:483 gtk/wicd-client.py:220
|
||||||
msgid "Connected to wired network (IP: $A)"
|
msgid "Connected to wired network (IP: $A)"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@@ -164,23 +184,31 @@ msgstr ""
|
|||||||
msgid "Connecting"
|
msgid "Connecting"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: wicd/misc.py:79
|
#: cli/wicd-cli.py:107
|
||||||
|
msgid "Connecting to wired network."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: cli/wicd-cli.py:109
|
||||||
|
msgid "Connecting to wireless network \"$A\"."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: wicd/misc.py:86
|
||||||
msgid "Connection Cancelled"
|
msgid "Connection Cancelled"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: wicd/misc.py:85
|
#: wicd/misc.py:92
|
||||||
msgid "Connection Failed."
|
msgid "Connection Failed."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: wicd/misc.py:81
|
#: wicd/misc.py:88
|
||||||
msgid "Connection Failed: Bad password"
|
msgid "Connection Failed: Bad password"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: wicd/misc.py:91
|
#: wicd/misc.py:98
|
||||||
msgid "Connection Failed: No DHCP offers received."
|
msgid "Connection Failed: No DHCP offers received."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: wicd/misc.py:83
|
#: wicd/misc.py:90
|
||||||
msgid "Connection Failed: Unable to Get IP Address"
|
msgid "Connection Failed: Unable to Get IP Address"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
@@ -188,14 +216,30 @@ msgstr ""
|
|||||||
msgid "Connection established"
|
msgid "Connection established"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: wicd/misc.py:80
|
#: wicd/misc.py:87
|
||||||
msgid "Connection failed: Could not contact the wireless access point."
|
msgid "Connection failed: Could not contact the wireless access point."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: wicd/misc.py:97
|
#: wicd/misc.py:51
|
||||||
|
msgid "Connection in progress"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: cli/wicd-cli.py:92
|
||||||
|
msgid "Connection status"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: wicd/misc.py:104
|
||||||
msgid "Connection successful."
|
msgid "Connection successful."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: wicd/misc.py:54
|
||||||
|
msgid "Connection suspended"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: cli/wicd-cli.py:94
|
||||||
|
msgid "Connection type"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#: gtk/gui.py:65 gtk/wicd-client.py:955
|
#: gtk/gui.py:65 gtk/wicd-client.py:955
|
||||||
msgid ""
|
msgid ""
|
||||||
"Could not connect to wicd's D-Bus interface. Check the wicd log for error "
|
"Could not connect to wicd's D-Bus interface. Check the wicd log for error "
|
||||||
@@ -274,7 +318,7 @@ msgstr ""
|
|||||||
msgid "Domain"
|
msgid "Domain"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: wicd/misc.py:84
|
#: wicd/misc.py:91
|
||||||
msgid "Done connecting..."
|
msgid "Done connecting..."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
@@ -300,7 +344,7 @@ msgstr ""
|
|||||||
msgid "External Programs"
|
msgid "External Programs"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: wicd/misc.py:86
|
#: wicd/misc.py:93
|
||||||
msgid "Flushing the routing table..."
|
msgid "Flushing the routing table..."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
@@ -316,11 +360,11 @@ msgstr ""
|
|||||||
msgid "General Settings"
|
msgid "General Settings"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: wicd/misc.py:87
|
#: wicd/misc.py:94
|
||||||
msgid "Generating PSK..."
|
msgid "Generating PSK..."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: wicd/misc.py:88
|
#: wicd/misc.py:95
|
||||||
msgid "Generating WPA configuration file..."
|
msgid "Generating WPA configuration file..."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
@@ -385,6 +429,10 @@ msgstr ""
|
|||||||
msgid "Netmask"
|
msgid "Netmask"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: cli/wicd-cli.py:99
|
||||||
|
msgid "Network ID: $A"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#: curses/prefs_curses.py:66
|
#: curses/prefs_curses.py:66
|
||||||
msgid "Network Interfaces"
|
msgid "Network Interfaces"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@@ -399,6 +447,7 @@ msgstr ""
|
|||||||
|
|
||||||
#: curses/wicd-curses.py:786 gtk/gui.py:500 gtk/wicd-client.py:213
|
#: curses/wicd-curses.py:786 gtk/gui.py:500 gtk/wicd-client.py:213
|
||||||
#: gtk/wicd-client.py:223 gtk/wicd-client.py:335 gtk/wicd-client.py:338
|
#: gtk/wicd-client.py:223 gtk/wicd-client.py:335 gtk/wicd-client.py:338
|
||||||
|
#: wicd/misc.py:50
|
||||||
msgid "Not connected"
|
msgid "Not connected"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
@@ -409,7 +458,7 @@ msgstr ""
|
|||||||
msgid "OK"
|
msgid "OK"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: wicd/misc.py:93
|
#: wicd/misc.py:100
|
||||||
msgid "Obtaining IP address..."
|
msgid "Obtaining IP address..."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
@@ -503,11 +552,11 @@ msgstr ""
|
|||||||
msgid "Properties"
|
msgid "Properties"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: wicd/misc.py:89
|
#: wicd/misc.py:96
|
||||||
msgid "Putting interface down..."
|
msgid "Putting interface down..."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: wicd/misc.py:90
|
#: wicd/misc.py:97
|
||||||
msgid "Putting interface up..."
|
msgid "Putting interface up..."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
@@ -548,7 +597,7 @@ msgstr ""
|
|||||||
msgid "Required encryption information is missing."
|
msgid "Required encryption information is missing."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: wicd/misc.py:92
|
#: wicd/misc.py:99
|
||||||
msgid "Resetting IP address..."
|
msgid "Resetting IP address..."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
@@ -604,15 +653,15 @@ msgstr ""
|
|||||||
msgid "Set up Ad-hoc network"
|
msgid "Set up Ad-hoc network"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: wicd/misc.py:94
|
#: wicd/misc.py:101
|
||||||
msgid "Setting broadcast address..."
|
msgid "Setting broadcast address..."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: wicd/misc.py:95
|
#: wicd/misc.py:102
|
||||||
msgid "Setting static DNS servers..."
|
msgid "Setting static DNS servers..."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: wicd/misc.py:96
|
#: wicd/misc.py:103
|
||||||
msgid "Setting static IP addresses..."
|
msgid "Setting static IP addresses..."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
@@ -733,11 +782,11 @@ msgstr ""
|
|||||||
msgid "Username"
|
msgid "Username"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: wicd/misc.py:98
|
#: wicd/misc.py:105
|
||||||
msgid "Validating authentication..."
|
msgid "Validating authentication..."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: wicd/misc.py:99
|
#: wicd/misc.py:106
|
||||||
msgid "Verifying access point association..."
|
msgid "Verifying access point association..."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
@@ -753,10 +802,14 @@ msgstr ""
|
|||||||
msgid "Wicd daemon unreachable"
|
msgid "Wicd daemon unreachable"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: wicd/misc.py:209
|
#: wicd/misc.py:216
|
||||||
msgid "Wicd needs to access your computer's network cards."
|
msgid "Wicd needs to access your computer's network cards."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: cli/wicd-cli.py:85
|
||||||
|
msgid "Wired"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#: gtk/wicd-client.py:628
|
#: gtk/wicd-client.py:628
|
||||||
msgid ""
|
msgid ""
|
||||||
"Wired\n"
|
"Wired\n"
|
||||||
@@ -790,6 +843,10 @@ msgstr ""
|
|||||||
msgid "Wired connection detected"
|
msgid "Wired connection detected"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: cli/wicd-cli.py:87
|
||||||
|
msgid "Wireless"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#: gtk/wicd-client.py:633
|
#: gtk/wicd-client.py:633
|
||||||
msgid ""
|
msgid ""
|
||||||
"Wireless\n"
|
"Wireless\n"
|
||||||
|
|||||||
@@ -46,6 +46,13 @@ CONNECTING = 1
|
|||||||
WIRELESS = 2
|
WIRELESS = 2
|
||||||
WIRED = 3
|
WIRED = 3
|
||||||
SUSPENDED = 4
|
SUSPENDED = 4
|
||||||
|
_const_status_dict = {
|
||||||
|
NOT_CONNECTED: _('Not connected'),
|
||||||
|
CONNECTING: _('Connection in progress'),
|
||||||
|
WIRELESS: _('Connected to a wireless network'),
|
||||||
|
WIRED: _('Connected to a wired network'),
|
||||||
|
SUSPENDED: _('Connection suspended'),
|
||||||
|
}
|
||||||
|
|
||||||
# Automatic app selection constant
|
# Automatic app selection constant
|
||||||
AUTO = 0
|
AUTO = 0
|
||||||
|
|||||||
Reference in New Issue
Block a user