def _update_status(self, status: Optional[Status]) -> Optional[Status]: if status is not None: if self._should_update_fan_speed: last_applied_fan_profile: CurrentSpeedProfile = CurrentSpeedProfile.get_or_none( channel=ChannelType.FAN.value) if last_applied_fan_profile is not None and status.fan_duty is None and status.fan_rpm is not None: _LOG.debug( "No Fan Duty reported from device, calculating based on speed profile" ) status = status.with_fan_duty( self._calculate_duty(last_applied_fan_profile.profile, status.liquid_temperature)) if self._should_update_pump_speed: last_applied_pump_profile: CurrentSpeedProfile = CurrentSpeedProfile.get_or_none( channel=ChannelType.PUMP.value) if last_applied_pump_profile is not None and status.pump_duty is None and status.pump_rpm is not None: _LOG.debug( "No Pump Duty reported from device, calculating based on speed profile" ) status = status.with_pump_duty( self._calculate_duty(last_applied_pump_profile.profile, status.liquid_temperature)) self.main_view.refresh_status(status) if status.driver_type == SettingsKraken2.supported_driver \ and not self._legacy_firmware_dialog_shown \ and status.firmware_version.startswith('2.'): self._legacy_firmware_dialog_shown = True self.main_view.show_legacy_firmware_dialog() return status
def _update_current_speed_profile(self, profile: SpeedProfile) -> None: current: CurrentSpeedProfile = CurrentSpeedProfile.get_or_none( channel=profile.channel) if current is None: CurrentSpeedProfile.create(channel=profile.channel, profile=profile) else: current.profile = profile current.save() self.main_view.set_statusbar_text('%s cooling profile applied' % profile.channel.capitalize())
def _update_status(self, status: Optional[Status]) -> None: if status is not None: if self._should_update_fan_speed: last_applied: CurrentSpeedProfile = CurrentSpeedProfile.get_or_none( channel=ChannelType.FAN.value) if last_applied is not None: status.fan_duty = self._get_fan_duty( last_applied.profile, status.liquid_temperature) self.main_view.refresh_status(status) if not self._legacy_firmware_dialog_shown and status.firmware_version.startswith( '2.'): self._legacy_firmware_dialog_shown = True self.main_view.show_legacy_firmware_dialog()
def _refresh_speed_profile(self, channel: ChannelType, init: bool = False, profile_id: Optional[int] = None) -> None: data = self._get_profile_list(channel) active = None if profile_id is not None: active = next(i for i, item in enumerate(data) if item[0] == profile_id) elif init and self._settings_interactor.get_bool( 'settings_load_last_profile'): self._should_update_fan_speed = True current: CurrentSpeedProfile = CurrentSpeedProfile.get_or_none( channel=channel.value) if current is not None: active = next(i for i, item in enumerate(data) if item[0] == current.profile.id) self._set_speed_profile(current.profile) data.append( (_ADD_NEW_PROFILE_INDEX, "<span style='italic' alpha='50%'>Add new profile...</span>")) self.main_view.refresh_profile_combobox(channel, data, active)
def _refresh_speed_profile_fixed_only( self, channel: ChannelType, init: bool = False, profile_id: Optional[int] = None) -> None: """This method will only allow fixed profiles for those models that only support fixed speeds""" data = list( filter(lambda profile_data: profile_data[1] == 'Fixed', self._get_profile_list(channel))) active = None if profile_id is not None: active = next(i for i, item in enumerate(data) if item[0] == profile_id) elif init and self._settings_interactor.get_bool( 'settings_load_last_profile'): self._should_update_fan_speed = True self._should_update_pump_speed = True current: CurrentSpeedProfile = CurrentSpeedProfile.get_or_none( channel=channel.value) if current is not None and current.profile.single_step: # make sure current is fixed only active = next(i for i, item in enumerate(data) if item[0] == current.profile.id) self._set_speed_profile(current.profile) self.main_view.refresh_profile_combobox(channel, data, active)