#!/usr/bin/python3

import pygame.font

class Display_Load:
    def __init__(self, game):
        """initilizes the display load"""
        
        #settings up screen
        self.screen = game.screen
        self.screen_rect = self.screen.get_rect()
        self.sailor_moon_rect = game.sailor_moon.rect
        self.ahegao_rect = game.ahegao.rect
        self.sailor_mars_rect = game.sailor_mars.rect
        self.sailor_venus_rect = game.sailor_venus.rect
        self.sailor_mercury_rect = game.sailor_mercury.rect
        self.sailor_jupitor_rect = game.sailor_jupitor.rect

        #font settings
        #self.font_teal = (26, 126, 176)
        self.font_teal = (105, 185, 209)
        self.font_red = (255, 0 , 0)
        self.font_orange = (255, 165, 0)
        self.font_green = (25, 138, 21)
        self.font_cool_purple = (157, 250, 224)
        self.font_small = pygame.font.SysFont(None, 20)
        self.font_med = pygame.font.SysFont(None, 26)
        self.font_large = pygame.font.SysFont(None, 32)

        self.prep_msg(game.load)


    def warning_message(self, game):
        '''if your lookings at this, yes i know i could make a group or a loop to do this cleaner, but im hung over as fuck and dont wanna do all that right now'''
        message_for_feminazis1 = self.font_small.render('WARNING: if you are white knight faggot and are offended by the idea of pixels that look like', True, self.font_red)
        message_for_feminazis2 = self.font_small.render('females being "objectified" then instead of emailing me, condsider protestings ONLYFANS as', True, self.font_red)
        message_for_feminazis3 = self.font_small.render('these are made up characters', True, self.font_red)
        message_for_feminazis_rect1 = message_for_feminazis1.get_rect()
        message_for_feminazis_rect2 = message_for_feminazis2.get_rect()
        message_for_feminazis_rect3 = message_for_feminazis3.get_rect()
        message_for_feminazis_rect1.midtop = game.settings.andex_rect.midbottom
        message_for_feminazis_rect2.midtop = message_for_feminazis_rect1.midbottom
        message_for_feminazis_rect3.midtop = message_for_feminazis_rect2.midbottom
        self.screen.blit(message_for_feminazis1, message_for_feminazis_rect1)
        self.screen.blit(message_for_feminazis2, message_for_feminazis_rect2)
        self.screen.blit(message_for_feminazis3, message_for_feminazis_rect3)

    def prep_msg(self, game):
        #images
        game.processor_load = str(game.processor_load)
        game.processor_freq = str(game.processor_freq)
        game.processor_temp = str(game.processor_temp)
        game.memory = str(game.memory)
        self.read = str(game.read_difference)
        self.write = str(game.write_difference)
        
        self.cpu_percent_image = self.font_med.render(f'cpu %: {game.processor_load}', True, self.font_red)
        self.cpu_freq_image = self.font_small.render(f'cpu freq: {game.processor_freq}', True, self.font_cool_purple)
        self.cpu_temp_image = self.font_med.render(f'cpu temp: {game.processor_temp}', True, self.font_cool_purple)
        self.memory_image = self.font_med.render(f'memory %: {game.memory}', True, self.font_orange)
        self.disk_read_image = self.font_med.render(f'read: {self.read}MB', True, self.font_teal)
        self.disk_write_image = self.font_med.render(f'write: {self.write}MB', True, self.font_green)

        #rects
        self.cpu_percent_rect = self.cpu_percent_image.get_rect()
        self.cpu_freq_rect = self.cpu_freq_image.get_rect()
        self.cpu_temp_rect = self.cpu_temp_image.get_rect()
        self.memory_rect = self.memory_image.get_rect()
        self.disk_read_rect = self.disk_read_image.get_rect()
        self.disk_write_rect = self.disk_write_image.get_rect()

        #position
        self.cpu_temp_rect.midbottom = self.sailor_moon_rect.midtop
        self.cpu_freq_rect.midtop = self.ahegao_rect.midbottom
        self.cpu_percent_rect.midbottom = self.sailor_mars_rect.midtop
        self.disk_read_rect.midbottom = self.sailor_mercury_rect.midtop
        self.disk_write_rect.midbottom = self.sailor_jupitor_rect.midtop
        self.disk_write_rect.y += 5
        self.memory_rect.midbottom = self.sailor_venus_rect.midtop

    def show_loads(self):
        self.screen.blit(self.cpu_temp_image, self.cpu_temp_rect)
        self.screen.blit(self.cpu_freq_image, self.cpu_freq_rect)
        self.screen.blit(self.cpu_percent_image, self.cpu_percent_rect)
        self.screen.blit(self.disk_read_image, self.disk_read_rect)
        self.screen.blit(self.disk_write_image, self.disk_write_rect)
        self.screen.blit(self.memory_image, self.memory_rect)

class Display_Cpu_Temp_Text:
    def __init__(self, game):
        self.screen = game.screen
        self.screen_rect = self.screen.get_rect()

        #self.font_blue = (0, 0, 112)
        #self.font_light_green = (137, 240, 44)
        self.font_pink = (250, 87, 196)
        self.font_purple = (112, 42, 250)
        #self.font_red = (255, 0 , 0)
        self.font_orange = (255, 165, 0)
        #self.font_light_green = (82, 217, 143)
        self.font_light_green = (25, 247, 99)
        self.font_small = pygame.font.SysFont(None, 20)
        self.font_med = pygame.font.SysFont(None, 24)
        self.font_large = pygame.font.SysFont(None, 32)


        self.moon_wand_rect = game.moon_wand.rect

    def prep_text(self, game):
        game.processor_temp = str(game.processor_temp)
        first_process = str(f'name: {game.listOfRunningProcess[:5][0]["name"]}, pid: {game.listOfRunningProcess[:5][0]["pid"]}, cpu usage{game.listOfRunningProcess[:5][0]["cpu"]}')
        secound_process = str(f'name: {game.listOfRunningProcess[:5][1]["name"]}, pid: {game.listOfRunningProcess[:5][1]["pid"]}, cpu usage{game.listOfRunningProcess[:5][1]["cpu"]}')
        third_process = str(f'name: {game.listOfRunningProcess[:5][2]["name"]}, pid: {game.listOfRunningProcess[:5][2]["pid"]}, cpu usage{game.listOfRunningProcess[:5][2]["cpu"]}')
        fourth_process = str(f'name: {game.listOfRunningProcess[:5][3]["name"]}, pid: {game.listOfRunningProcess[:5][3]["pid"]}, cpu usage{game.listOfRunningProcess[:5][3]["cpu"]}')
        fith_process = str(f'name: {game.listOfRunningProcess[:5][4]["name"]}, pid: {game.listOfRunningProcess[:5][4]["pid"]}, cpu usage{game.listOfRunningProcess[:5][4]["cpu"]}')


        #images
        self.cpu_temp_image = self.font_large.render(f'cpu temp: {game.processor_temp}C', True, self.font_pink)
        self.press_e_image = self.font_large.render('Press "e" to Exit', True, self.font_purple)
        self.first_process_image = self.font_small.render(first_process, True, self.font_light_green)
        self.secound_process_image = self.font_small.render(secound_process, True, self.font_light_green)
        self.third_process_image = self.font_small.render(third_process, True, self.font_light_green)
        self.fourth_process_image = self.font_small.render(fourth_process, True, self.font_light_green)
        self.fith_process_image = self.font_small.render(fith_process, True, self.font_light_green)

        #rect
        self.cpu_temp_rect = self.cpu_temp_image.get_rect()
        self.cpu_temp_rect.center = self.moon_wand_rect.center
        self.press_e_rect = self.press_e_image.get_rect()
        self.press_e_rect.midbottom = self.screen_rect.midbottom
        self.press_e_rect.y -= 10
        self.first_process_rect = self.first_process_image.get_rect()
        self.first_process_rect.midleft = self.screen_rect.midleft
        self.first_process_rect.y =  250
        self.secound_process_rect = self.secound_process_image.get_rect()
        self.secound_process_rect.midtop = self.first_process_rect.midbottom
        self.secound_process_rect.x = 5
        self.third_process_rect = self.third_process_image.get_rect()
        self.third_process_rect.midtop = self.secound_process_rect.midbottom
        self.third_process_rect.x = 10
        self.fourth_process_rect = self.fourth_process_image.get_rect()
        self.fourth_process_rect.midtop = self.third_process_rect.midbottom
        self.fourth_process_rect.x = 15
        self.fith_process_rect = self.fith_process_image.get_rect()
        self.fith_process_rect.midtop = self.fourth_process_rect.midbottom
        self.fith_process_rect.x = 20

    def update_cpu_temp(self, game):
        game.processor_temp = str(game.processor_temp)
        self.cpu_temp_image = self.font_large.render(f'cpu temp: {game.processor_temp}C', True, self.font_pink)
 
    def update_text(self, game):
        first_process = str(f'name: {game.listOfRunningProcess[:5][0]["name"]}, pid: {game.listOfRunningProcess[:5][0]["pid"]}, cpu usage{game.listOfRunningProcess[:5][0]["cpu"]}')
        self.first_process_image = self.font_small.render(first_process, True, self.font_light_green)
        secound_process = str(f'name: {game.listOfRunningProcess[:5][1]["name"]}, pid: {game.listOfRunningProcess[:5][1]["pid"]}, cpu usage{game.listOfRunningProcess[:5][1]["cpu"]}')
        self.secound_process_image = self.font_small.render(secound_process, True, self.font_light_green)
        third_process = str(f'name: {game.listOfRunningProcess[:5][2]["name"]}, pid: {game.listOfRunningProcess[:5][2]["pid"]}, cpu usage{game.listOfRunningProcess[:5][2]["cpu"]}')
        self.third_process_image = self.font_small.render(third_process, True, self.font_light_green)
        fourth_process = str(f'name: {game.listOfRunningProcess[:5][3]["name"]}, pid: {game.listOfRunningProcess[:5][3]["pid"]}, cpu usage{game.listOfRunningProcess[:5][3]["cpu"]}')
        self.fourth_process_image = self.font_small.render(fourth_process, True, self.font_light_green)
        fith_process = str(f'name: {game.listOfRunningProcess[:5][4]["name"]}, pid: {game.listOfRunningProcess[:5][4]["pid"]}, cpu usage{game.listOfRunningProcess[:5][4]["cpu"]}')
        self.fith_process_image = self.font_small.render(fith_process, True, self.font_light_green)

    def show_text(self):
        self.screen.blit(self.press_e_image, self.press_e_rect)
        self.screen.blit(self.cpu_temp_image, self.cpu_temp_rect)
        self.screen.blit(self.first_process_image, self.first_process_rect)
        self.screen.blit(self.secound_process_image, self.secound_process_rect)
        self.screen.blit(self.third_process_image, self.third_process_rect)
        self.screen.blit(self.fourth_process_image, self.fourth_process_rect)
        self.screen.blit(self.fith_process_image, self.fith_process_rect)

class Display_Cpu_Load_Text:
    def __init__(self, game):
        self.screen = game.screen
        self.screen_rect = self.screen.get_rect()

        self.font_pink = (250, 87, 196)
        self.font_purple = (112, 42, 250)
        self.font_orange = (255, 165, 0)
        self.font_light_green = (25, 247, 99)
        self.font_small = pygame.font.SysFont(None, 20)
        self.font_med = pygame.font.SysFont(None, 24)
        self.font_large = pygame.font.SysFont(None, 32)


        self.mars_gauge_rect = game.mars_gauge.rect

    def prep_text(self, game):
        game.processor_load = str(game.processor_load)
        first_process = str(f'name: {game.listOfRunningProcess[:5][0]["name"]}, pid: {game.listOfRunningProcess[:5][0]["pid"]}, cpu usage{game.listOfRunningProcess[:5][0]["cpu"]}')
        secound_process = str(f'name: {game.listOfRunningProcess[:5][1]["name"]}, pid: {game.listOfRunningProcess[:5][1]["pid"]}, cpu usage{game.listOfRunningProcess[:5][1]["cpu"]}')
        third_process = str(f'name: {game.listOfRunningProcess[:5][2]["name"]}, pid: {game.listOfRunningProcess[:5][2]["pid"]}, cpu usage{game.listOfRunningProcess[:5][2]["cpu"]}')
        fourth_process = str(f'name: {game.listOfRunningProcess[:5][3]["name"]}, pid: {game.listOfRunningProcess[:5][3]["pid"]}, cpu usage{game.listOfRunningProcess[:5][3]["cpu"]}')
        fith_process = str(f'name: {game.listOfRunningProcess[:5][4]["name"]}, pid: {game.listOfRunningProcess[:5][4]["pid"]}, cpu usage{game.listOfRunningProcess[:5][4]["cpu"]}')


        #images
        self.cpu_load_image = self.font_large.render(f'cpu load: {game.processor_load}%', True, self.font_pink)
        self.press_e_image = self.font_large.render('Press "e" to Exit', True, self.font_purple)
        self.first_process_image = self.font_small.render(first_process, True, self.font_light_green)
        self.secound_process_image = self.font_small.render(secound_process, True, self.font_light_green)
        self.third_process_image = self.font_small.render(third_process, True, self.font_light_green)
        self.fourth_process_image = self.font_small.render(fourth_process, True, self.font_light_green)
        self.fith_process_image = self.font_small.render(fith_process, True, self.font_light_green)

        #rect
        self.cpu_load_rect = self.cpu_load_image.get_rect()
        self.cpu_load_rect.center = self.mars_gauge_rect.center
        self.press_e_rect = self.press_e_image.get_rect()
        self.press_e_rect.midbottom = self.screen_rect.midbottom
        self.press_e_rect.y -= 10
        self.first_process_rect = self.first_process_image.get_rect()
        self.first_process_rect.midleft = self.screen_rect.midleft
        self.first_process_rect.y =  250
        self.secound_process_rect = self.secound_process_image.get_rect()
        self.secound_process_rect.midtop = self.first_process_rect.midbottom
        self.secound_process_rect.x = 5
        self.third_process_rect = self.third_process_image.get_rect()
        self.third_process_rect.midtop = self.secound_process_rect.midbottom
        self.third_process_rect.x = 10
        self.fourth_process_rect = self.fourth_process_image.get_rect()
        self.fourth_process_rect.midtop = self.third_process_rect.midbottom
        self.fourth_process_rect.x = 15
        self.fith_process_rect = self.fith_process_image.get_rect()
        self.fith_process_rect.midtop = self.fourth_process_rect.midbottom
        self.fith_process_rect.x = 20

    def update_cpu_temp(self, game):
        game.processor_load = str(game.processor_load)
        self.cpu_load_image = self.font_large.render(f'cpu load: {game.processor_load}%', True, self.font_pink)
 
    def update_text(self, game):
        first_process = str(f'name: {game.listOfRunningProcess[:5][0]["name"]}, pid: {game.listOfRunningProcess[:5][0]["pid"]}, cpu usage{game.listOfRunningProcess[:5][0]["cpu"]}')
        self.first_process_image = self.font_small.render(first_process, True, self.font_light_green)
        secound_process = str(f'name: {game.listOfRunningProcess[:5][1]["name"]}, pid: {game.listOfRunningProcess[:5][1]["pid"]}, cpu usage{game.listOfRunningProcess[:5][1]["cpu"]}')
        self.secound_process_image = self.font_small.render(secound_process, True, self.font_light_green)
        third_process = str(f'name: {game.listOfRunningProcess[:5][2]["name"]}, pid: {game.listOfRunningProcess[:5][2]["pid"]}, cpu usage{game.listOfRunningProcess[:5][2]["cpu"]}')
        self.third_process_image = self.font_small.render(third_process, True, self.font_light_green)
        fourth_process = str(f'name: {game.listOfRunningProcess[:5][3]["name"]}, pid: {game.listOfRunningProcess[:5][3]["pid"]}, cpu usage{game.listOfRunningProcess[:5][3]["cpu"]}')
        self.fourth_process_image = self.font_small.render(fourth_process, True, self.font_light_green)
        fith_process = str(f'name: {game.listOfRunningProcess[:5][4]["name"]}, pid: {game.listOfRunningProcess[:5][4]["pid"]}, cpu usage{game.listOfRunningProcess[:5][4]["cpu"]}')
        self.fith_process_image = self.font_small.render(fith_process, True, self.font_light_green)

    def show_text(self):
        self.screen.blit(self.press_e_image, self.press_e_rect)
        self.screen.blit(self.cpu_load_image, self.cpu_load_rect)
        self.screen.blit(self.first_process_image, self.first_process_rect)
        self.screen.blit(self.secound_process_image, self.secound_process_rect)
        self.screen.blit(self.third_process_image, self.third_process_rect)
        self.screen.blit(self.fourth_process_image, self.fourth_process_rect)
        self.screen.blit(self.fith_process_image, self.fith_process_rect)

class Display_Memory_Text:
    def __init__(self, game):
        self.screen = game.screen
        self.screen_rect = self.screen.get_rect()

        self.font_pink = (250, 87, 196)
        self.font_purple = (112, 42, 250)
        self.font_orange = (255, 165, 0)
        self.font_light_green = (25, 247, 99)
        self.font_small = pygame.font.SysFont(None, 20)
        self.font_med = pygame.font.SysFont(None, 24)
        self.font_large = pygame.font.SysFont(None, 32)


        self.venus_gauge_rect = game.venus_gauge.rect

    def prep_text(self, game):
        game.memory = str(game.memory)
        first_process = str(f'name: {game.list_of_running_memory_process[:5][0]["name"]}, pid: {game.list_of_running_memory_process[:5][0]["pid"]}, memory{game.list_of_running_memory_process[:5][0]["vms"]}')
        secound_process = str(f'name: {game.list_of_running_memory_process[:5][1]["name"]}, pid: {game.list_of_running_memory_process[:5][1]["pid"]}, memory{game.list_of_running_memory_process[:5][1]["vms"]}')
        third_process = str(f'name: {game.list_of_running_memory_process[:5][2]["name"]}, pid: {game.list_of_running_memory_process[:5][2]["pid"]}, memory{game.list_of_running_memory_process[:5][2]["vms"]}')
        fourth_process = str(f'name: {game.list_of_running_memory_process[:5][3]["name"]}, pid: {game.list_of_running_memory_process[:5][3]["pid"]}, memory{game.list_of_running_memory_process[:5][3]["vms"]}')
        fith_process = str(f'name: {game.list_of_running_memory_process[:5][4]["name"]}, pid: {game.list_of_running_memory_process[:5][4]["pid"]}, memory{game.list_of_running_memory_process[:5][4]["vms"]}')


        #images
        self.cpu_load_image = self.font_large.render(f'memory: {game.memory}%', True, self.font_pink)
        self.press_e_image = self.font_large.render('Press "e" to Exit', True, self.font_purple)
        self.first_process_image = self.font_small.render(first_process, True, self.font_light_green)
        self.secound_process_image = self.font_small.render(secound_process, True, self.font_light_green)
        self.third_process_image = self.font_small.render(third_process, True, self.font_light_green)
        self.fourth_process_image = self.font_small.render(fourth_process, True, self.font_light_green)
        self.fith_process_image = self.font_small.render(fith_process, True, self.font_light_green)

        #rect
        self.cpu_load_rect = self.cpu_load_image.get_rect()
        self.cpu_load_rect.center = self.venus_gauge_rect.center
        self.press_e_rect = self.press_e_image.get_rect()
        self.press_e_rect.midbottom = self.screen_rect.midbottom
        self.press_e_rect.y -= 10
        self.first_process_rect = self.first_process_image.get_rect()
        self.first_process_rect.midleft = self.screen_rect.midleft
        self.first_process_rect.y =  250
        self.secound_process_rect = self.secound_process_image.get_rect()
        self.secound_process_rect.midtop = self.first_process_rect.midbottom
        self.secound_process_rect.x = 5
        self.third_process_rect = self.third_process_image.get_rect()
        self.third_process_rect.midtop = self.secound_process_rect.midbottom
        self.third_process_rect.x = 10
        self.fourth_process_rect = self.fourth_process_image.get_rect()
        self.fourth_process_rect.midtop = self.third_process_rect.midbottom
        self.fourth_process_rect.x = 15
        self.fith_process_rect = self.fith_process_image.get_rect()
        self.fith_process_rect.midtop = self.fourth_process_rect.midbottom
        self.fith_process_rect.x = 20

    def update_memory(self, game):
        game.memory = str(game.memory)
        self.cpu_load_image = self.font_large.render(f'memory: {game.memory}%', True, self.font_pink)
 
    def update_text(self, game):
        first_process = str(f'name: {game.list_of_running_memory_process[:5][0]["name"]}, pid: {game.list_of_running_memory_process[:5][0]["pid"]}, memory{game.list_of_running_memory_process[:5][0]["vms"]}')
        self.first_process_image = self.font_small.render(first_process, True, self.font_light_green)
        secound_process = str(f'name: {game.list_of_running_memory_process[:5][1]["name"]}, pid: {game.list_of_running_memory_process[:5][1]["pid"]}, memory{game.list_of_running_memory_process[:5][1]["vms"]}')
        self.secound_process_image = self.font_small.render(secound_process, True, self.font_light_green)
        third_process = str(f'name: {game.list_of_running_memory_process[:5][2]["name"]}, pid: {game.list_of_running_memory_process[:5][2]["pid"]}, memory{game.list_of_running_memory_process[:5][2]["vms"]}')
        self.third_process_image = self.font_small.render(third_process, True, self.font_light_green)
        fourth_process = str(f'name: {game.list_of_running_memory_process[:5][3]["name"]}, pid: {game.list_of_running_memory_process[:5][3]["pid"]}, memory{game.list_of_running_memory_process[:5][3]["vms"]}')
        self.fourth_process_image = self.font_small.render(fourth_process, True, self.font_light_green)
        fith_process = str(f'name: {game.list_of_running_memory_process[:5][4]["name"]}, pid: {game.list_of_running_memory_process[:5][4]["pid"]}, memory{game.list_of_running_memory_process[:5][4]["vms"]}')
        self.fith_process_image = self.font_small.render(fith_process, True, self.font_light_green)

    def show_text(self):
        self.screen.blit(self.press_e_image, self.press_e_rect)
        self.screen.blit(self.cpu_load_image, self.cpu_load_rect)
        self.screen.blit(self.first_process_image, self.first_process_rect)
        self.screen.blit(self.secound_process_image, self.secound_process_rect)
        self.screen.blit(self.third_process_image, self.third_process_rect)
        self.screen.blit(self.fourth_process_image, self.fourth_process_rect)
        self.screen.blit(self.fith_process_image, self.fith_process_rect)

class Display_Disk_Text:
    def __init__(self, game):
        self.screen = game.screen
        self.screen_rect = self.screen.get_rect()

        self.font_pink = (250, 87, 196)
        self.font_purple = (112, 42, 250)
        self.font_orange = (255, 165, 0)
        self.font_light_green = (25, 247, 99)
        self.font_small = pygame.font.SysFont(None, 20)
        self.font_med = pygame.font.SysFont(None, 24)
        self.font_large = pygame.font.SysFont(None, 32)

    def prep_text(self, game):
        space = game.space
        total = str(f'total: {int(((space[0] / 1000000) / 1000))}GB')
        used = str(f'used: {int(((space[1] / 1000000) / 1000))}GB')
        free = str(f'free: {int(((space[2] / 1000000) / 1000))}GB')
        percent = str(f'percent: {space[3]}')

        #images
        self.disk_total_image = self.font_large.render(total, True, self.font_pink)
        self.disk_used_image = self.font_large.render(used, True, self.font_pink)
        self.disk_free_image = self.font_large.render(free, True, self.font_pink)

        #rect
        self.disk_total_rect = self.disk_total_image.get_rect()
        self.disk_total_rect.midtop = self.screen_rect.midtop
        self.disk_used_rect = self.disk_used_image.get_rect()
        self.disk_used_rect.midtop = self.disk_total_rect.midbottom
        self.disk_free_rect = self.disk_free_image.get_rect()
        self.disk_free_rect.midtop = self.disk_used_rect.midbottom


    def show_text(self):
        self.screen.blit(self.disk_total_image, self.disk_total_rect)
        self.screen.blit(self.disk_used_image, self.disk_used_rect)
        self.screen.blit(self.disk_free_image, self.disk_free_rect)
