mirror of
https://github.com/gryf/wicd.git
synced 2025-12-20 21:08:06 +01:00
curses/wicd-curses.py: Fixed a problem where any use of the wired network combo box would prevent connecting to wired networks.
Added some semblance of a "working" indicator while connecting, a simple |,/,-,\,|,/,...
This commit is contained in:
@@ -349,15 +349,25 @@ class appGUI():
|
|||||||
self.set_status(language['not_connected'])
|
self.set_status(language['not_connected'])
|
||||||
return True
|
return True
|
||||||
|
|
||||||
# Set the status text, called by the update_status method
|
|
||||||
# from_idle : a check to see if we are being called directly from the
|
# Cheap little indicator stating that we are actually connecting
|
||||||
# mainloop
|
twirl = ['|','/','-','\\']
|
||||||
def set_status(self,text,from_idle=False):
|
def set_status(self,text,from_idle=False):
|
||||||
|
# Set the status text, usually called by the update_status method
|
||||||
|
# from_idle : a check to see if we are being called directly from the
|
||||||
|
# mainloop
|
||||||
# If we are being called as the result of trying to connect to
|
# If we are being called as the result of trying to connect to
|
||||||
# something, return False immediately.
|
# something, and we aren't connecting to something, return False
|
||||||
|
# immediately.
|
||||||
if from_idle and not self.connecting:
|
if from_idle and not self.connecting:
|
||||||
return False
|
return False
|
||||||
self.footer2 = urwid.AttrWrap(urwid.Text(text),'important')
|
toAppend = ''
|
||||||
|
# If we are connecting and being called from the idle function, spin
|
||||||
|
# the wheel.
|
||||||
|
if from_idle and self.connecting:
|
||||||
|
# This is probably the wrong way to do this, but ir works for now.
|
||||||
|
toAppend=self.twirl[self.incr % 4]
|
||||||
|
self.footer2 = urwid.AttrWrap(urwid.Text(text+' '+toAppend),'important')
|
||||||
self.frame.set_footer(urwid.BoxAdapter(
|
self.frame.set_footer(urwid.BoxAdapter(
|
||||||
urwid.ListBox([self.footer1,self.footer2]),2))
|
urwid.ListBox([self.footer1,self.footer2]),2))
|
||||||
return True
|
return True
|
||||||
@@ -433,11 +443,13 @@ class appGUI():
|
|||||||
self.frame.keypress( self.size, k )
|
self.frame.keypress( self.size, k )
|
||||||
|
|
||||||
if " " in keys:
|
if " " in keys:
|
||||||
# I can't really tell if this works ^_^.
|
self.set_status('space pressed on wiredCB!')
|
||||||
if self.thePile.get_focus() == self.wiredCB:
|
|
||||||
wid,pos = self.wiredCB.get_body().get_selected()
|
wid,pos = self.wiredCB.get_body().get_selected()
|
||||||
text,attr = wid.get_text()
|
text,attr = wid.get_text()
|
||||||
wired.ReadWiredNetworkProfile(text)
|
wired.ReadWiredNetworkProfile(text)
|
||||||
|
# Make sure our internal reference to the combobox matches the
|
||||||
|
# one found in the pile.
|
||||||
|
self.wiredCB = self.thePile.get_focus()
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@@ -449,12 +461,13 @@ class appGUI():
|
|||||||
# Apparently, connect() doesn't care about the networkid
|
# Apparently, connect() doesn't care about the networkid
|
||||||
self.connect(self,'wired',0)
|
self.connect(self,'wired',0)
|
||||||
#return "Wired network %i" % pos
|
#return "Wired network %i" % pos
|
||||||
if wid is self.wlessLB:
|
elif wid is self.wlessLB:
|
||||||
#self.footer1 = urwid.Text("Wireless!")
|
#self.footer1 = urwid.Text("Wireless!")
|
||||||
wid2,pos = self.wlessLB.get_focus()
|
wid2,pos = self.wlessLB.get_focus()
|
||||||
self.connect(self,'wireless',pos)
|
self.connect(self,'wireless',pos)
|
||||||
else:
|
else:
|
||||||
return "Failure!"
|
self.set_status("call_connect() failed! This is definitely a bug!")
|
||||||
|
#return "Failure!"
|
||||||
|
|
||||||
def connect(self, event, nettype, networkid):
|
def connect(self, event, nettype, networkid):
|
||||||
""" Initiates the connection process in the daemon. """
|
""" Initiates the connection process in the daemon. """
|
||||||
|
|||||||
Reference in New Issue
Block a user