Beispiel #1
0
        def process_device_added():
            properties = self.get_devices_properties()
            cached_id = None

            for device in DeviceProfileCache.get_cached_devices():
                if device in properties:
                    cached_id = device.cached_id

            for plugin in PluginManager.get_plugins(IDBusDevicePlugin):
                if plugin in properties:
                    try:
                        plugin.setup(properties)
                        if cached_id:
                            plugin.cached_id = cached_id
                        if (plugin.udi in self.udi_device):
                            continue
                        self.udi_device[str(plugin.udi)] = plugin
                        d = DeviceResolver.identify_device(plugin)

                        def select_and_configure(name):
                            try:
                                plugin = \
                                  PluginManager.get_plugin_by_remote_name(name)
                                plugin.setup(properties)
                                self.udi_device[str(plugin.udi)] = plugin
                                self.device_list.append(plugin)
                                self.view.device_added(plugin)
                            except Exception, e:
                                print e

                        d.addCallback(select_and_configure)
                    except Exception, e:
                        pass
        def process_device_added():
            properties = self.get_devices_properties()
            cached_id = None

            for device in DeviceProfileCache.get_cached_devices():
                if device in properties:
                    cached_id = device.cached_id

            for plugin in PluginManager.get_plugins(IDBusDevicePlugin):
                if plugin in properties:
                    try:
                        plugin.setup(properties)
                        if cached_id:
                            plugin.cached_id = cached_id
                        if (plugin.udi in self.udi_device):
                            continue
                        self.udi_device[str(plugin.udi)] = plugin
                        d = DeviceResolver.identify_device(plugin)
                        def select_and_configure(name):
                            try:
                                plugin = \
                                  PluginManager.get_plugin_by_remote_name(name)
                                plugin.setup(properties)
                                self.udi_device[str(plugin.udi)] = plugin
                                self.device_list.append(plugin)
                                self.view.device_added(plugin)
                            except Exception, e:
                                print e
                        d.addCallback(select_and_configure)
                    except Exception, e:
                        pass
        def _ask_user_for_device(devices, callback, splash):
            cached_devices = DeviceProfileCache.get_cached_devices()

            for cached_device in list(cached_devices):
                if isinstance(cached_device, DBusDevicePlugin) \
                        and not cached_device in devices:
                    cached_devices.remove(cached_device)
                    
            all_devices = cached_devices + [device for device in devices
                                            if device not in cached_devices]
            controller = DeviceSelectionController(Model(),
                                                all_devices, callback, splash)
            view = DeviceSelectionView(controller)
            view.show()
        def _ask_user_for_device(devices, callback, splash):
            cached_devices = DeviceProfileCache.get_cached_devices()

            for cached_device in list(cached_devices):
                if isinstance(cached_device, DBusDevicePlugin) \
                        and not cached_device in devices:
                    cached_devices.remove(cached_device)

            all_devices = cached_devices + [
                device for device in devices if device not in cached_devices
            ]
            controller = DeviceSelectionController(Model(), all_devices,
                                                   callback, splash)
            view = DeviceSelectionView(controller)
            view.show()