def test_fan_factory(self): for clazz in FanModel.inheritors(): if clazz.model is None: continue fan = FanModel.factory({ 'model': clazz.model, 'points': [[50, 50]], # curve 'speed': 50, # locked_speed 'target': 50, # temp_target 'multiplier': 10 }) fan.main() self.assertIsInstance(fan, FanModel)
def __init__(self): LOGGER.info('initializing thermaltake rgb daemon') LOGGER.debug('loading config') self.config = Config() LOGGER.debug('creating fan manager') fan_model = FanModel.factory(self.config.fan_manager) self.fan_manager = FanManager(fan_model) LOGGER.debug('creating lighting manager') self.lighting_manager = LightingEffect.factory( self.config.lighting_manager) self.attached_devices = {} self.controllers = {} LOGGER.debug('configuring controllers') for controller in self.config.controllers: self.controllers[ controller['unit']] = ThermaltakeController.factory( controller['type'], controller.get('unit')) for id, model in controller['devices'].items(): LOGGER.debug(' configuring devices for controller %s: %s', controller['type'], controller.get('unit')) dev = ThermaltakeDevice.factory( model, self.controllers[controller['unit']], id) self.controllers[controller['unit']].attach_device(id, dev) self.register_attached_device(controller['unit'], id, dev) self._continue = False
def set_fan_controller(self, *args): if len(args) > 0: if args[0] in ('locked_speed', 'temp_target'): fc = FanModel.factory(*args) self.daemon.fan_manager.set_model(fc) return "success" return "argument 0 must be in [locked_speed|temp_target]"
def __init__(self): self.config = Config() fan_model = FanModel.factory(self.config.fan_manager) self.fan_manager = FanManager(fan_model) self.lighting_manager = LightingEffect.factory(self.config.lighting_manager) self.dbus_service = ThermaltakeDbusService(self) self.attached_devices = {} self.controllers = {} for controller in self.config.controllers: self.controllers[controller['unit']] = controller_factory(controller['type'], controller['unit']) for id, model in controller['devices'].items(): dev = ThermaltakeDevice.factory(model, self.controllers[controller['unit']], id) self.controllers[controller['unit']].attach_device(id, dev) self.register_attached_device(controller['unit'], id, dev) self._thread = Thread(target=self._main_loop) self._continue = False