diff --git a/sysmonitor_common/sensors.py b/sysmonitor_common/sensors.py index 80f9490..03169d9 100755 --- a/sysmonitor_common/sensors.py +++ b/sysmonitor_common/sensors.py @@ -370,7 +370,7 @@ class NvGPUSensor(BaseSensor): def get_value(self, sensor): if sensor == 'nvgpu': - return "{:02.0f}%".format(self._fetch_gpu()) + return "{:.0f}%".format(self._fetch_gpu()) def _fetch_gpu(self): try: @@ -388,7 +388,7 @@ class AmdGpuSensor(BaseSensor): def get_value(self, sensor): if sensor == 'amdgpu': - return "{:02.0f}%".format(self._fetch_gpu()) + return "{:.0f}%".format(self._fetch_gpu()) def _fetch_gpu(self): result = subprocess.check_output(['cat', '/sys/class/drm/card0/device/gpu_busy_percent']) @@ -401,7 +401,7 @@ class AmdGpu1Sensor(BaseSensor): def get_value(self, sensor): if sensor == 'amdgpu': - return "{:02.0f}%".format(self._fetch_gpu()) + return "{:.0f}%".format(self._fetch_gpu()) def _fetch_gpu(self): result = subprocess.check_output(['cat', '/sys/class/drm/card1/device/gpu_busy_percent']) @@ -473,10 +473,10 @@ def check(self, sensor): def get_value(self, sensor): if sensor == 'cpu': - return "{:02.0f}%".format(self._fetch_cpu()) + return "{:.0f}%".format(self._fetch_cpu()) elif CPUSensor.cpus.match(sensor): cpus = self._fetch_cpu(percpu=True) - return "{:02.0f}%".format(cpus[int(sensor[3:])]) + return "{:.0f}%".format(cpus[int(sensor[3:])]) return None @@ -498,7 +498,7 @@ class MemSensor(BaseSensor): desc = _('Physical memory in use.') def get_value(self, sensor_data): - return '{:02.0f}%'.format(self._fetch_mem()) + return '{:.0f}%'.format(self._fetch_mem()) def _fetch_mem(self): """It gets the total memory info and return the used in percent.""" @@ -670,7 +670,7 @@ def check(self, sensor): def get_value(self, sensor): if BatSensor.bat.match(sensor): bat_id = int(sensor[3:]) if len(sensor) > 3 else 0 - return '{:02.0f}%'.format(self._fetch_bat(bat_id)) + return '{:.0f}%'.format(self._fetch_bat(bat_id)) return None @@ -728,7 +728,7 @@ class SwapSensor(BaseSensor): desc = _("Average swap usage") def get_value(self, sensor): - return '{:02.0f}%'.format(self._fetch_swap()) + return '{:.0f}%'.format(self._fetch_swap()) def _fetch_swap(self): """Return the swap usage in percent""" @@ -845,9 +845,9 @@ def get_value(self, sensor): # degrees symbol is unicode U+00B0 if self.fahrenheit: - return "{:02.0f}\u00B0F".format(self._fetch_cputemp()) + return "{:.0f}\u00B0F".format(self._fetch_cputemp()) else: - return "{:02.0f}\u00B0C".format(self._fetch_cputemp()) + return "{:.0f}\u00B0C".format(self._fetch_cputemp()) def _fetch_cputemp(self): # http://www.mjmwired.net/kernel/Documentation/hwmon/sysfs-interface