mirror of
https://github.com/gryf/wicd.git
synced 2026-01-08 14:54:15 +01:00
- Make the GUI behave better when a disconnect button is pushed.
- Move some of the libnotify logic to guiutil.py and add support for displaying some error messages in a libnotify pop-up. - Apply some patches provided by sunseraph. Tweak to the channel regex and checking for a valid AP bssid when monitoring a wireless connection. Set essid, bssid, and channel in separate calls to iwconfig. - Add caching for ifconfig and iwconfig results in wnettools.py. That way we're not needlessly calling the same command a bunch of times in a short period of time (2 seconds). This removes the need for us to pass around iwconfig/ifconfig output elsewhere, though I've left it in for now. - Remove unneeded BackendManager instance from networking.py - Fix last used wired networking autoconnection method
This commit is contained in:
@@ -17,11 +17,39 @@
|
||||
#
|
||||
|
||||
import gtk
|
||||
import os.path
|
||||
|
||||
import wpath
|
||||
|
||||
HAS_NOTIFY = True
|
||||
try:
|
||||
import pynotify
|
||||
if not pynotify.init("Wicd"):
|
||||
print 'Could not initalize pynotify'
|
||||
HAS_NOTIFY = False
|
||||
except ImportError:
|
||||
print "Importing pynotify failed, notifications disabled."
|
||||
HAS_NOTIFY = False
|
||||
|
||||
print "Has notifications support", HAS_NOTIFY
|
||||
|
||||
if wpath.no_use_notifications:
|
||||
print 'Notifications disabled during setup.py configure'
|
||||
|
||||
def can_use_notify():
|
||||
use_notify = os.path.exists(os.path.join(os.path.expanduser('~/.wicd'),
|
||||
'USE_NOTIFICATIONS')
|
||||
)
|
||||
return use_notify and HAS_NOTIFY and not wpath.no_use_notifications
|
||||
|
||||
def error(parent, message, block=True):
|
||||
""" Shows an error dialog. """
|
||||
def delete_event(dialog, id):
|
||||
dialog.destroy()
|
||||
if can_use_notify() and not block:
|
||||
notification = pynotify.Notification("ERROR", message, "error")
|
||||
notification.show()
|
||||
return
|
||||
dialog = gtk.MessageDialog(parent, gtk.DIALOG_MODAL, gtk.MESSAGE_ERROR,
|
||||
gtk.BUTTONS_OK)
|
||||
dialog.set_markup(message)
|
||||
|
||||
Reference in New Issue
Block a user