mirror of
https://github.com/gryf/wicd.git
synced 2025-12-19 12:28:08 +01:00
Merged main experimental branch
Fixed kde autostart directory setting
This commit is contained in:
2
setup.py
2
setup.py
@@ -186,7 +186,7 @@ class configure(Command):
|
|||||||
if len(kdedir_candidate) == 0 or returncode != 0 or not os.path.isabs(kdedir_candidate):
|
if len(kdedir_candidate) == 0 or returncode != 0 or not os.path.isabs(kdedir_candidate):
|
||||||
raise ValueError
|
raise ValueError
|
||||||
else:
|
else:
|
||||||
self.kdedir = kdedir_candidate
|
self.kdedir = kdedir_candidate + '/share/autostart'
|
||||||
except (OSError, ValueError):
|
except (OSError, ValueError):
|
||||||
pass # use our default
|
pass # use our default
|
||||||
|
|
||||||
|
|||||||
@@ -20,25 +20,23 @@
|
|||||||
import dbus
|
import dbus
|
||||||
import time
|
import time
|
||||||
import gobject
|
import gobject
|
||||||
|
import sys
|
||||||
from dbus.mainloop.glib import DBusGMainLoop
|
from dbus.mainloop.glib import DBusGMainLoop
|
||||||
|
|
||||||
DBusGMainLoop(set_as_default=True)
|
DBusGMainLoop(set_as_default=True)
|
||||||
bus = dbus.SystemBus()
|
bus = dbus.SystemBus()
|
||||||
proxy_obj = bus.get_object('org.wicd.daemon', '/org/wicd/daemon')
|
proxy_obj = bus.get_object('org.wicd.daemon', '/org/wicd/daemon')
|
||||||
daemon = dbus.Interface(proxy_obj, 'org.wicd.daemon')
|
daemon = dbus.Interface(proxy_obj, 'org.wicd.daemon')
|
||||||
|
loop = gobject.MainLoop()
|
||||||
|
|
||||||
def reply_handle():
|
|
||||||
loop.quit()
|
def handler(*args):
|
||||||
def error_handle(e):
|
|
||||||
loop.quit()
|
loop.quit()
|
||||||
|
|
||||||
print daemon.Hello()
|
print daemon.Hello()
|
||||||
time.sleep(3)
|
time.sleep(3)
|
||||||
daemon.SetSuspend(False)
|
daemon.SetSuspend(False)
|
||||||
if not daemon.CheckIfConnecting():
|
if not daemon.CheckIfConnecting():
|
||||||
print daemon.AutoConnect(True, reply_handler=reply_handle,
|
|
||||||
error_handler=error_handle)
|
|
||||||
daemon.SetForcedDisconnect(False)
|
daemon.SetForcedDisconnect(False)
|
||||||
|
daemon.AutoConnect(True, reply_handler=handler, error_handler=handler)
|
||||||
|
|
||||||
loop = gobject.MainLoop()
|
|
||||||
loop.run()
|
|
||||||
|
|||||||
@@ -24,15 +24,15 @@ reusable for other purposes as well.
|
|||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#
|
#
|
||||||
|
|
||||||
from ConfigParser import ConfigParser
|
from ConfigParser import RawConfigParser
|
||||||
|
|
||||||
from wicd.misc import stringToNone
|
from wicd.misc import stringToNone
|
||||||
|
|
||||||
|
|
||||||
class ConfigManager(ConfigParser):
|
class ConfigManager(RawConfigParser):
|
||||||
""" A class that can be used to manage a given configuration file. """
|
""" A class that can be used to manage a given configuration file. """
|
||||||
def __init__(self, path):
|
def __init__(self, path):
|
||||||
ConfigParser.__init__(self)
|
RawConfigParser.__init__(self)
|
||||||
self.config_file = path
|
self.config_file = path
|
||||||
self.read(path)
|
self.read(path)
|
||||||
|
|
||||||
@@ -58,7 +58,7 @@ class ConfigManager(ConfigParser):
|
|||||||
if not self.has_section(section):
|
if not self.has_section(section):
|
||||||
self.add_section(section)
|
self.add_section(section)
|
||||||
|
|
||||||
ConfigParser.set(self, section, str(option), str(value))
|
RawConfigParser.set(self, section, str(option), str(value))
|
||||||
if save:
|
if save:
|
||||||
self.write()
|
self.write()
|
||||||
|
|
||||||
@@ -66,7 +66,7 @@ class ConfigManager(ConfigParser):
|
|||||||
""" Calls the set_option method. """
|
""" Calls the set_option method. """
|
||||||
self.set_option(*args, **kargs)
|
self.set_option(*args, **kargs)
|
||||||
|
|
||||||
def get_option(self, section, option, default=None):
|
def get_option(self, section, option, default="__None__"):
|
||||||
""" Wrapper around ConfigParser.get.
|
""" Wrapper around ConfigParser.get.
|
||||||
|
|
||||||
Automatically adds any missing sections, adds the ability
|
Automatically adds any missing sections, adds the ability
|
||||||
@@ -78,14 +78,17 @@ class ConfigManager(ConfigParser):
|
|||||||
self.add_section(section)
|
self.add_section(section)
|
||||||
|
|
||||||
if self.has_option(section, option):
|
if self.has_option(section, option):
|
||||||
ret = ConfigParser.get(self, section, option)
|
ret = RawConfigParser.get(self, section, option)
|
||||||
if default:
|
if default:
|
||||||
print ''.join(['found ', option, ' in configuration ', ret])
|
print ''.join(['found ', option, ' in configuration ', ret])
|
||||||
else:
|
else:
|
||||||
print ''.join(['did not find ', option,
|
if default != "__None__":
|
||||||
|
print ''.join(['did not find ', option,
|
||||||
' in configuration, setting default ', str(default)])
|
' in configuration, setting default ', str(default)])
|
||||||
self.set(section, option, str(default), save=True)
|
self.set(section, option, str(default), save=True)
|
||||||
ret = default
|
ret = default
|
||||||
|
else:
|
||||||
|
ret = None
|
||||||
|
|
||||||
# Try to intelligently handle the type of the return value.
|
# Try to intelligently handle the type of the return value.
|
||||||
try:
|
try:
|
||||||
@@ -101,7 +104,7 @@ class ConfigManager(ConfigParser):
|
|||||||
def write(self):
|
def write(self):
|
||||||
""" Writes the loaded config file to disk. """
|
""" Writes the loaded config file to disk. """
|
||||||
configfile = open(self.config_file, 'w')
|
configfile = open(self.config_file, 'w')
|
||||||
ConfigParser.write(self, configfile)
|
RawConfigParser.write(self, configfile)
|
||||||
configfile.close()
|
configfile.close()
|
||||||
|
|
||||||
def remove_section(self,section):
|
def remove_section(self,section):
|
||||||
@@ -112,7 +115,7 @@ class ConfigManager(ConfigParser):
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
if self.has_section(section):
|
if self.has_section(section):
|
||||||
ConfigParser.remove_section(self, section)
|
RawConfigParser.remove_section(self, section)
|
||||||
|
|
||||||
def reload(self):
|
def reload(self):
|
||||||
self.read(self.config_file)
|
self.read(self.config_file)
|
||||||
|
|||||||
Reference in New Issue
Block a user