diff --git a/wicd/gui.py b/wicd/gui.py index f492b3c..4d357de 100644 --- a/wicd/gui.py +++ b/wicd/gui.py @@ -56,7 +56,7 @@ else: from dbus.mainloop.glib import DBusGMainLoop DBusGMainLoop(set_as_default=True) -proxy_obj, daemon, wireless, wired, bus = [None for x in range(0, 5)] +proxy_obj = daemon = wireless = wired = bus = None language = misc.get_language_list_gui() def setup_dbus(dbus_man=None): @@ -84,6 +84,7 @@ def setup_dbus(dbus_man=None): wired = dbus_ifaces['wired'] return True + def error(parent, message): """ Shows an error dialog """ dialog = gtk.MessageDialog(parent, gtk.DIALOG_MODAL, gtk.MESSAGE_ERROR, @@ -91,6 +92,14 @@ def error(parent, message): dialog.set_markup(message) dialog.run() dialog.destroy() + +def alert(parent, message): + """ Shows an error dialog """ + dialog = gtk.MessageDialog(parent, gtk.DIALOG_MODAL, gtk.MESSAGE_WARNING, + gtk.BUTTONS_OK) + dialog.set_markup(message) + dialog.run() + dialog.destroy() ######################################## ##### GTK EXTENSION CLASSES diff --git a/wicd/misc.py b/wicd/misc.py index 26ea78b..cfe537c 100644 --- a/wicd/misc.py +++ b/wicd/misc.py @@ -134,7 +134,7 @@ def WriteLine(my_file, text): def ExecuteScript(script): """ Execute a command and send its output to the bit bucket. """ - os.system("%s > /dev/null 2>&1" % script) + call("%s > /dev/null 2>&1" % script) def ReadFile(filename): """ read in a file and return it's contents as a string """ diff --git a/wicd/monitor.py b/wicd/monitor.py index f49a6bb..d0b009a 100755 --- a/wicd/monitor.py +++ b/wicd/monitor.py @@ -289,7 +289,14 @@ def main(): """ monitor = ConnectionStatus() - gobject.timeout_add(2500, monitor.update_connection_status) + if daemon.GetCurrentBackend() == "ioctl": + to_time = 2.5 + else: + to_time = 4 + try: + gobject.timeout_add_seconds(to_time, monitor.update_connection_status) + except: + gobject.timeout_add(to_time * 1000, monitor.update_connection_status) mainloop = gobject.MainLoop() mainloop.run() diff --git a/wicd/wicd-daemon.py b/wicd/wicd-daemon.py index 2f573bd..9cd2112 100644 --- a/wicd/wicd-daemon.py +++ b/wicd/wicd-daemon.py @@ -591,7 +591,10 @@ class WicdDaemon(dbus.service.Object): print "Attempting to autoconnect with wired interface..." self.auto_connecting = True time.sleep(1.5) - gobject.timeout_add(3000, self._monitor_wired_autoconnect) + try: + gobject.timeout_add_seconds(3, self._monitor_wired_autoconnect) + except: + gobject.timeout_add(3000, self._monitor_wired_autoconnect) return True def _monitor_wired_autoconnect(self): @@ -1025,7 +1028,7 @@ class WirelessDaemon(dbus.service.Object): def _wireless_autoconnect(self): """ Attempts to autoconnect to a wireless network. """ - print "No wired connection present, attempting to autoconnect" + \ + print "No wired connection present, attempting to autoconnect " + \ "to wireless network" if self.wifi.wireless_interface is None: print 'Autoconnect failed because wireless interface returned None'