Example #1
0
def mainLoop(env):
    global loop

    log = logging.getLogger(__name__)

    try:
        # connect to dbus and setup loop
        dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
        get_system_bus()

        # Instanciate dbus objects
        PluginRegistry(component="dbus.module")

        # Enter main loop
        loop = gobject.MainLoop()
        loop.run()

    except Exception as detail:
        log.critical("unexpected error in mainLoop")
        log.exception(detail)
        log.debug(traceback.format_exc())

    finally:
        shutdown()
Example #2
0
    def __init__(self):
        self.scripts = {}

        # Connect to D-Bus service
        conn = get_system_bus()
        self.conn = conn
        dbus.service.Object.__init__(self, conn, '/org/clacks/shell')

        # Initialize paths and logging
        self.log = logging.getLogger(__name__)
        self.env = Environment.getInstance()
        self.script_path = self.env.config.get("dbus.script-path", "/etc/clacks/shell.d").strip("'\"")

        # Start notifier for file changes in /etc/clacks/shell.d
        try:
            ShellDNotifier(self.script_path, self.__notifier_callback)

            # Intitially load all signatures
            self.__notifier_callback()
        except Exception:
            self.log.error("failed to start monitoring of '%s'" % (self.script_path))
Example #3
0
 def __init__(self):
     conn = get_system_bus()
     dbus.service.Object.__init__(self, conn, '/org/clacks/wol')
     self.env = Environment.getInstance()
Example #4
0
 def __init__(self):
     conn = get_system_bus()
     dbus.service.Object.__init__(self, conn, '/org/clacks/service')
     self.env = Environment.getInstance()
     self.svc_command = self.env.config.get("dbus.service-command", default="/usr/sbin/service")
     self.log = logging.getLogger(__name__)