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

* Fixed indentation errors and syntax errors

* Fixed wicd.py so it starts properly
* Hid the status bar in gui.py when it is displayed via the tray icon
This commit is contained in:
compwiz18
2007-12-17 15:20:02 +00:00
parent 6d708846d9
commit dee28b818c
4 changed files with 34 additions and 13 deletions

View File

@@ -528,12 +528,13 @@ class ConnectionWizard(dbus.service.Object):
def GetWirelessProperty(self,networkid,property):
''' Retrieves wireless property from the network specified '''
value = self.LastScan[networkid].get(property)
if self.debug_mode == 1:
print 'returned wireless network',networkid,'property',property,'of value',value
try:
value = value.encode('utf-8')
except:
pass
if self.debug_mode == 1:
#return type instead of value for security
print 'returned wireless network',networkid,'property',property,'of type',type(value)
return value
#end function GetWirelessProperty
@@ -583,7 +584,7 @@ class ConnectionWizard(dbus.service.Object):
def GetCurrentDBMStrength(self):
''' Returns the current dbm signal strength '''
try:
dbm_strength = int(self.wifi.GetDBMStrength())
dbm_strength = int(self.wifi.GetDBMStrength())
except:
dbm_strength = 0
return dbm_strength
@@ -659,7 +660,7 @@ class ConnectionWizard(dbus.service.Object):
''' Returns the IP that the wireless interface has '''
ip = self.wifi.GetIP()
if self.debug_mode == 1:
print 'returning wireless ip',ip
print 'returning wireless ip',ip
return ip
#end function GetWirelessIP
@@ -690,7 +691,7 @@ class ConnectionWizard(dbus.service.Object):
'''returns the wired interface\'s ip address'''
ip = self.wired.GetIP()
if self.debug_mode == 1:
print 'returning wired ip',ip
print 'returning wired ip',ip
return ip
#end function GetWiredIP
@@ -702,11 +703,11 @@ class ConnectionWizard(dbus.service.Object):
#status, if it doesn't exist, we aren't connecting
status = self.wired.connecting_thread.is_connecting
if self.debug_mode == 1:
print 'wired connecting',status
print 'wired connecting',status
return status
else:
if self.debug_mode == 1:
print 'wired connecting',False
print 'wired connecting',False
return False
#end function CheckIfWiredConnecting
@@ -771,7 +772,7 @@ class ConnectionWizard(dbus.service.Object):
if self.WiredNetwork:
self.WiredNetwork[property] = misc.Noneify(value)
if self.debug_mode == 1:
print 'set',property,'to',misc.Noneify(value)
print 'set',property,'to',misc.Noneify(value)
return True
else:
print 'WiredNetwork does not exist'
@@ -783,7 +784,7 @@ class ConnectionWizard(dbus.service.Object):
if self.WiredNetwork:
value = self.WiredNetwork.get(property)
if self.debug_mode == 1:
print 'returned',property,'with value of',value,'to client...'
print 'returned',property,'with value of',value,'to client...'
return value
else:
print 'WiredNetwork does not exist'

View File

@@ -139,7 +139,7 @@
<property name="border_width">4</property>
<child>
<widget class="GtkProgressBar" id="progressbar">
<property name="visible">True</property>
<property name="visible">False</property>
<property name="tooltip" translatable="yes">Connecting...</property>
<property name="activity_mode">True</property>
<property name="text" translatable="yes">Connecting...</property>

20
gui.py
View File

@@ -103,7 +103,7 @@ _ = lang.gettext
#but it works and makes it easy for me :)
##########
# translations are done at
# http://wicd.sourceforge.net/wiki/doku.php?id=translations
# http://wicd.net/translator
# please translate if you can!
##########
language = {}
@@ -896,7 +896,8 @@ class appGui:
self.windowname = "gtkbench"
self.wTree = gtk.glade.XML(gladefile)
dic = { "on_vpn_connection" : self.on_vpn_connection,
dic = { # "on_vpn_connection" : self.on_vpn_connection,
# I don't see a function that matches this...
"refresh_clicked" : self.refresh_networks,
"quit_clicked" : self.exit,
"disconnect_clicked" : self.disconnect_wireless,
@@ -914,7 +915,11 @@ class appGui:
# I don't know how to translate a menu entry.
# More specifically, I don't know how to set a menu entry's text
# self.wTree.get_widget("connect_button").modify_text(language['_network'])
self.wTree.get_widget("progressbar").set_text(language['connecting'])
probar = self.wTree.get_widget("progressbar")
probar.set_text(language['connecting'])
# self.entry.set_visibility(False)
# probar.set_visiblity(False)
self.window = self.wTree.get_widget("window1")
self.network_list = self.wTree.get_widget("network_list_vbox")
@@ -922,6 +927,8 @@ class appGui:
self.status_bar = self.wTree.get_widget("statusbar")
self.refresh_networks(fresh=False)
self.status_area.hide_all()
self.statusID = None
self.vpn_connection_pipe = None
@@ -1343,4 +1350,11 @@ class appGui:
def show_win(self):
self.window.show_all()
# hide the status bar, as it might be confusing if it
# pops up randomly :)
self.status_area.hide_all()
self.is_visible = True
if __name__ == '__main__':
app = appGui()
gtk.main()

View File

@@ -100,6 +100,7 @@ language['connecting'] = _('Connecting...')
class TrayIcon():
def __init__(self, use_tray):
print 'Use tray:',use_tray
if USE_EGG:
self.tr = self.DapperTrayIconGUI(use_tray)
else:
@@ -146,6 +147,7 @@ class TrayIcon():
# Check for a wireless connection
elif cur_iface == wifi_iface:
cur_net_id = wireless.GetCurrentNetworkID()
lock = ''
if wireless.GetWirelessProperty(cur_net_id, "encryption"):
lock = "-lock"
strength = wireless.GetPrintableSignalStrength()
@@ -353,6 +355,7 @@ def main(argv):
argv -- The arguments passed to the script.
"""
print 'Loading...'
use_tray = True
try:
@@ -373,6 +376,8 @@ def main(argv):
#sys.stderr = log
#sys.stdout = log
print 'Done initalizing, starting...'
# Set up the tray icon GUI and backend
tray_icon = TrayIcon(use_tray)
@@ -392,5 +397,6 @@ def main(argv):
mainloop.run()
print 'Here.'
if __name__ == '__main__':
main(sys.argv)