1
0
mirror of https://github.com/gryf/wicd.git synced 2025-12-26 16:32:34 +01:00

Fixed the width of the connection summary window. Uses tables now. All

information updated every couple of seconds.
This commit is contained in:
Kevin Woo
2009-05-03 04:30:57 -04:00
parent 76d5bc935a
commit 0d4c924790
2 changed files with 47 additions and 24 deletions

View File

@@ -85,8 +85,10 @@ language['tray_connected_to_wireless'] = _('Wireless Network\n$A at $B\nSpeed: $
language['connected_to_wired'] = _('Connected to wired network (IP: $A)')
language['tray_connected_to_wired'] = _('Wired Network\nIP: $A')
language['not_connected'] = _('Not connected')
language['conn_info_wired'] = _('Wired\nIP:\t\t$A\nRX:\t\t$B KB/s\nTX:\t\t$C KB/s\n\n\n')
language['conn_info_wireless'] = _('Wireless\nSSID:\t$A\nSpeed\t$B\nIP:\t\t$C\nStrength:\t$D\nRX:\t\t$E KB/s\nTX:\t\t$F KB/s')
language['conn_info_wired_labels'] = _('Wired\nIP:\nRX:\nTX:\n\n\n')
language['conn_info_wireless_labels'] = _('Wireless\nSSID:\nSpeed:\nIP:\nStrength:\nRX:\nTX:')
language['conn_info_wired'] = _('\n$A\n$B KB/s\n$C KB/s\n\n\n')
language['conn_info_wireless'] = _('\n$A\n$B\n$C\n$D\n$E KB/s\n$F KB/s')
language['no_wireless_networks_found'] = _('No wireless networks found.')
language['killswitch_enabled'] = _('Wireless Kill Switch Enabled')
language['key'] = _('Key')

View File

@@ -451,52 +451,73 @@ class TrayIcon(object):
""" Opens the Connection Information Dialog """
window = gtk.Dialog("Wicd Connection Info", None, 0, (gtk.STOCK_OK, gtk.RESPONSE_CLOSE))
msg = gtk.Label()
msg.show()
# Create labels
self.label = gtk.Label()
self.data = gtk.Label()
self.label.show()
self.data.show()
self.list = []
self.list.append(self.data)
self.list.append(self.label)
# Setup table
table = gtk.Table(1,2)
table.set_col_spacings(12)
table.attach(self.label, 0, 1, 0, 1)
table.attach(self.data, 1, 2, 0 ,1)
# Setup Window
content = window.get_content_area()
content.pack_start(table, True, True, 0)
content.show_all()
# Start updates
self.cont = 'Go'
gobject.timeout_add(5000, self.update_conn_info_win, msg)
self.update_conn_info_win(msg)
gobject.timeout_add(5000, self.update_conn_info_win, self.list)
self.update_conn_info_win(self.list)
# Setup Window
content = window.get_content_area()
content.pack_start(msg, True, True, 0)
content.visible = True
window.run()
# Destroy window and stop updates
window.destroy()
self.cont = 'Stop'
def update_conn_info_win(self, msg):
def update_conn_info_win(self, list):
""" Updates the information in the connection summary window """
if (self.cont == "Stop"):
return False
[state, info] = daemon.GetConnectionStatus()
[rx, tx] = self.get_current_bandwidth()
# Choose info for the data
if state == misc.WIRED:
text = (language['conn_info_wired']
.replace('$A', str(info[0]))
.replace('$B', str(rx))
.replace('$C', str(tx)))
.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']
.replace('$A', info[1])
.replace('$B', info[4])
.replace('$C', str(info[0]))
.replace('$A', str(info[1])) #SSID
.replace('$B', str(info[4])) #Speed
.replace('$C', str(info[0])) #IP
.replace('$D', daemon.FormatSignalForPrinting(str(info[2])))
.replace('$E', str(rx))
.replace('$F', str(tx)))
elif state == misc.CONNECTING:
text = (language['connecting'])
elif state in (misc.SUSPENDED, misc.NOT_CONNECTED):
text = (language['not_connected'])
else:
text = ''
msg.set_text(text)
# Choose info for the labels
self.list[0].set_text(text)
if state == misc.WIRED:
self.list[1].set_text(language['conn_info_wired_labels'])
elif state == misc.WIRELESS:
self.list[1].set_text(language['conn_info_wireless_labels'])
elif state == misc.CONNECTING:
self.list[1].set_text(language['connecting'])
elif state in (misc.SUSPENDED, misc.NOT_CONNECTED):
self.list[1].set_text(language['not_connected'])
return True
def get_current_bandwidth(self):