Exemplo n.º 1
0
    def initialise(self, configure):
        logging.info("Initialising application")
        self.monitor = monitor.FileMonitor(self)
        self.configManager = cm.get_config_manager(self)
        self.service = service.Service(self)
        self.serviceDisabled = False

        # Initialise user code dir
        if self.configManager.userCodeDir is not None:
            sys.path.append(self.configManager.userCodeDir)

        try:
            self.service.start()
        except Exception as e:
            logging.exception("Error starting interface: " + str(e))
            self.serviceDisabled = True
            self.show_error_dialog(_("Error starting interface. Keyboard monitoring will be disabled.\n" +
                                    "Check your system/configuration."), str(e))

        self.notifier = get_notifier(self)
        self.configWindow = None
        self.monitor.start()

        dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
        self.dbusService = common.AppService(self)

        if configure: self.show_configure()
Exemplo n.º 2
0
    def update_service(self, service_id, service_info, ip_info):
        """Update a service associated with this peer.

        @param service_id: string peerd service ID.
        @param service_info: dictionary of string,string items comprising
                the metadata for the service.
        @param ip_info: an instance of IpInfo defined in service.py.

        """
        if service_id in self.services:
            self.services[service_id].update(service_info, ip_info)
        else:
            self._services_counter += 1
            service_path = '%s/services/%d' % (self._path,
                                               self._services_counter)
            self.services[service_id] = service.Service(
                    self._bus, service_path, self.uuid, service_id,
                    service_info, ip_info, self._object_manager)
        logging.info('service=%s has info %r.', service_id, service_info)
        self._update_last_seen()
        self.on_property_changed(peerd_dbus_helper.PEER_PROPERTY_LAST_SEEN)