#!/usr/bin/python3

import subprocess
import re
import threading

from window import GPU_Load_Display
from load import Load


class GPU_Head:
    def __init__(self):

        self.run = True
        self.gpu_load_display = GPU_Load_Display(self.run)
        self.load = Load()

    def get_load(self):
        while self.run == True:
            self.load.update_gpu()
            self.load.update_cpu()
            self.gpu_load_display.load_update(self.load.current_temp, self.load.utilization, self.load.processor_temp)
            #self.gpu_load_display.display_text.prep_message(self.load.current_temp, self.load.processor_temp)
            self.run = self.gpu_load_display.stop_thread()


    def launch_window(self):
        self.gpu_load_display.window_loop()



gpu_head = GPU_Head()
load_thread = threading.Thread(target = gpu_head.get_load, name = 'load')
display_thread = threading.Thread(target = gpu_head.launch_window, name = 'display')
load_thread.start()
display_thread.start()
#load_thread.join()
#display_thread.join()
