Round temp and cpu values
This commit is contained in:
		
							parent
							
								
									26eb6ea44b
								
							
						
					
					
						commit
						d54a743380
					
				| @ -20,8 +20,8 @@ TEMP_COLOR    = RED | |||||||
| CPU_COLOR     = BLUE | CPU_COLOR     = BLUE | ||||||
| NETWORK_COLOR = PINK | NETWORK_COLOR = PINK | ||||||
| 
 | 
 | ||||||
| MIN_TEMP = 40 | MIN_TEMP = 45 | ||||||
| MAX_TEMP = 80 | MAX_TEMP = 85 | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| class SystemStatus: | class SystemStatus: | ||||||
| @ -106,10 +106,10 @@ class SystemStatus: | |||||||
|         adjusted = max(0, temp - MIN_TEMP) |         adjusted = max(0, temp - MIN_TEMP) | ||||||
|         percent = min(1, adjusted / (MAX_TEMP - MIN_TEMP)) |         percent = min(1, adjusted / (MAX_TEMP - MIN_TEMP)) | ||||||
| 
 | 
 | ||||||
|         return int(self.height * percent) |         return round(self.height * percent) | ||||||
| 
 | 
 | ||||||
|     def getCpuValue(self): |     def getCpuValue(self): | ||||||
|         return int(self.height * (psutil.cpu_percent() / 100)) |         return round(self.height * (psutil.cpu_percent() / 100)) | ||||||
| 
 | 
 | ||||||
|     def getNetworkValue(self): |     def getNetworkValue(self): | ||||||
|         connections = psutil.net_connections(kind='inet') |         connections = psutil.net_connections(kind='inet') | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user