def get_data_update_graphics(self, data_request=None, data=None, time_scheduler=None): data.list_cpu_temp.append(data_request.cpu.temp_package.value) data.list_cpu_load.append(data_request.cpu.load.value) data.list_gpu_temp.append(data_request.gpu.temp_core.value) data.list_gpu_load.append(data_request.gpu.load.value) data.time.append(time_scheduler) if data.time[-1] > get_config()['max_time']: del data.time[-1] data.list_cpu_temp.pop(0) data.list_cpu_load.pop(0) data.list_gpu_temp.pop(0) data.list_gpu_load.pop(0) data_graphic = [] line_1 = data.time, data.list_cpu_temp line_2 = data.time, data.list_cpu_load line_3 = data.time, data.list_gpu_temp line_4 = data.time, data.list_gpu_load data_graphic.append(line_1) data_graphic.append(line_2) data_graphic.append(line_3) data_graphic.append(line_4) return data_graphic
def __init__(self, name=None): self.env = get_config() self.fig = plt.Figure(facecolor='black', figsize=(4, 2.15), dpi=110) self.fig.text(0.05, 0.9, name, fontdict=font_label) self.text_temp = self.fig.text(0.5, 0.9, 'Temp: ', fontdict=font_temp) self.text_load = self.fig.text(0.2, 0.9, 'Load: ', fontdict=font_load) self.ax1 = self.fig.add_subplot(111) self.ax1.patch.set_facecolor('black') self.ax1.spines['left'].set_color('white') self.ax1.spines['bottom'].set_color('white') self.ax1.tick_params(axis='x', colors='white') self.ax1.tick_params(axis='y', colors='white') line_temp, = self.ax1.plot([], [], lw=1, color='red') line_load, = self.ax1.plot([], [], lw=1, color='deepskyblue') self.lines = [line_temp, line_load] self.ax1.set_ylim(0, 110) self.ax1.set_xlim(0, self.env['max_time'])
import logger from config.environment import get_config import urllib.request as request from model.fan import Fan from models.cpu import CPU from models.fan import Fans from models.gpu import GPU from models.mother_board import MotherBoard from models.pump import Pump, Pumps from models.ram import RAM from models.storage import Storage from models.thread import Thread env = get_config() class ReciverService: def __init__(self): url = 'http://' + env['server']['host'] + ':' + env[ 'open_hardware_monitor']['port'] + '/data.json' self.data = self.get_ohm_json(url) self.cpu = CPU(self.data) self.gpu = GPU(self.data) string_mother_board = list( filter( lambda element: element['ImageURL'] in 'images_icon/nvidia.png' or element['ImageURL'] in 'images_icon/mainboard.png', self.data['Children'][0]['Children']))[0]['Children'][0] self.fans = Fans(string_mother_board)