mirror of
https://github.com/gryf/wicd.git
synced 2026-03-12 20:45:52 +01:00
experimental branch:
- Tray icon fixes from trunk - Handle possible failure in wpactrl - Format some docstrings
This commit is contained in:
@@ -394,7 +394,12 @@ class WirelessInterface(Interface, wnettools.BaseWirelessInterface):
|
|||||||
MAX_DISCONNECTED_TIME = 3
|
MAX_DISCONNECTED_TIME = 3
|
||||||
disconnected_time = 0
|
disconnected_time = 0
|
||||||
while (time.time() - auth_time) < MAX_TIME:
|
while (time.time() - auth_time) < MAX_TIME:
|
||||||
|
try:
|
||||||
status = wpa.request("STATUS").split("\n")
|
status = wpa.request("STATUS").split("\n")
|
||||||
|
except:
|
||||||
|
print "wpa_supplicant status query failed."
|
||||||
|
return False
|
||||||
|
|
||||||
if self.verbose:
|
if self.verbose:
|
||||||
print 'wpa_supplicant ctrl_interface status query is %s' % str(status)
|
print 'wpa_supplicant ctrl_interface status query is %s' % str(status)
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
|
||||||
#
|
#
|
||||||
# Copyright (C) 1999-2006 Keith Dart <keith@kdart.com>
|
# Copyright (C) 1999-2006 Keith Dart <keith@kdart.com>
|
||||||
# Copyright (C) 2008 Dan O'Reilly <oreilldf@gmail.com>
|
# Copyright (C) 2008 Dan O'Reilly <oreilldf@gmail.com>
|
||||||
@@ -14,6 +15,7 @@
|
|||||||
# Lesser General Public License for more details.
|
# Lesser General Public License for more details.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
Managing logfile rotation. A ManagedLog object is a file-like object that
|
Managing logfile rotation. A ManagedLog object is a file-like object that
|
||||||
rotates itself when a maximum size is reached.
|
rotates itself when a maximum size is reached.
|
||||||
|
|
||||||
@@ -30,8 +32,11 @@ class SizeError(IOError):
|
|||||||
|
|
||||||
class LogFile(file):
|
class LogFile(file):
|
||||||
"""LogFile(name, [mode="w"], [maxsize=360000])
|
"""LogFile(name, [mode="w"], [maxsize=360000])
|
||||||
Opens a new file object. After writing <maxsize> bytes a SizeError will be
|
|
||||||
raised. """
|
Opens a new file object. After writing <maxsize> bytes a SizeError
|
||||||
|
will be raised.
|
||||||
|
|
||||||
|
"""
|
||||||
def __init__(self, name, mode="a", maxsize=360000):
|
def __init__(self, name, mode="a", maxsize=360000):
|
||||||
super(LogFile, self).__init__(name, mode)
|
super(LogFile, self).__init__(name, mode)
|
||||||
self.maxsize = maxsize
|
self.maxsize = maxsize
|
||||||
@@ -79,13 +84,17 @@ class LogFile(file):
|
|||||||
return rotate(self)
|
return rotate(self)
|
||||||
|
|
||||||
def note(self, text):
|
def note(self, text):
|
||||||
"""Writes a specially formated note text to the file.The note starts
|
"""Writes a specially formated note text to the file.
|
||||||
with the string '\\n#*=' so you can easily filter them. """
|
|
||||||
|
The note starts with the string '\\n#*=' so you can easily filter them.
|
||||||
|
|
||||||
|
"""
|
||||||
self.write("\n#*===== %s =====\n" % (text,))
|
self.write("\n#*===== %s =====\n" % (text,))
|
||||||
|
|
||||||
|
|
||||||
class ManagedLog(object):
|
class ManagedLog(object):
|
||||||
"""ManagedLog(name, [maxsize=360000], [maxsave=9])
|
"""ManagedLog(name, [maxsize=360000], [maxsave=9])
|
||||||
|
|
||||||
A ManagedLog instance is a persistent log object. Write data with the
|
A ManagedLog instance is a persistent log object. Write data with the
|
||||||
write() method. The log size and rotation is handled automatically.
|
write() method. The log size and rotation is handled automatically.
|
||||||
|
|
||||||
|
|||||||
@@ -52,18 +52,15 @@ from wicd import gui
|
|||||||
from wicd import dbusmanager
|
from wicd import dbusmanager
|
||||||
|
|
||||||
ICON_AVAIL = True
|
ICON_AVAIL = True
|
||||||
|
USE_EGG = False
|
||||||
# Import egg.trayicon if we're using an older gtk version
|
# Import egg.trayicon if we're using an older gtk version
|
||||||
if not (gtk.gtk_version[0] >= 2 and gtk.gtk_version[1] >= 10):
|
if not hasattr(gtk, "StatusIcon"):
|
||||||
class Dummy(object): pass
|
|
||||||
gtk.StatusIcon = Dummy
|
|
||||||
try:
|
try:
|
||||||
import egg.trayicon
|
import egg.trayicon
|
||||||
USE_EGG = True
|
USE_EGG = True
|
||||||
except ImportError:
|
except ImportError:
|
||||||
print 'Unable to load tray icon: Missing egg.trayicon module.'
|
print 'Unable to load tray icon: Missing egg.trayicon module.'
|
||||||
ICON_AVAIL = False
|
ICON_AVAIL = False
|
||||||
else:
|
|
||||||
USE_EGG = False
|
|
||||||
|
|
||||||
misc.RenameProcess("wicd-client")
|
misc.RenameProcess("wicd-client")
|
||||||
|
|
||||||
@@ -534,6 +531,7 @@ class TrayIcon(object):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
if USE_EGG:
|
||||||
class EggTrayIconGUI(TrayIconGUI):
|
class EggTrayIconGUI(TrayIconGUI):
|
||||||
""" Tray Icon for gtk < 2.10.
|
""" Tray Icon for gtk < 2.10.
|
||||||
|
|
||||||
@@ -586,6 +584,7 @@ class TrayIcon(object):
|
|||||||
self.tooltip.set_tip(self.eb, val)
|
self.tooltip.set_tip(self.eb, val)
|
||||||
|
|
||||||
|
|
||||||
|
if hasattr(gtk, "StatusIcon"):
|
||||||
class StatusTrayIconGUI(gtk.StatusIcon, TrayIconGUI):
|
class StatusTrayIconGUI(gtk.StatusIcon, TrayIconGUI):
|
||||||
""" Class for creating the wicd tray icon on gtk > 2.10.
|
""" Class for creating the wicd tray icon on gtk > 2.10.
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user