jtop/gui/pcontrol.py
def draw(self, key, mouse):
        """ Control board, check status jetson_clocks and change NVP model """
        # Screen size
        height, width, first = self.size_page()
        # Position information
        start_y = first + 1
        start_x = 1
        # Status jetson_clocks
        # Write status jetson_clocks
        jc_status_name = self.jetson.jetson_clocks.status
        # Show service status
        if self.jetson.jetson_clocks.is_config:
            self.service_start.draw(start_y + 3, start_x, key, mouse)
        # Field service
        jetson_clocks_string = "jetson_clocks"
        self.stdscr.addstr(start_y + 4, start_x + 5, jetson_clocks_string, curses.A_UNDERLINE)
        # Read status jetson_clocks
        if jc_status_name == "running":
            color = (curses.A_BOLD | curses.color_pair(2))  # Running (Bold)
        elif jc_status_name == "inactive":
            color = curses.A_NORMAL       # Normal (Grey)
        elif "ing" in jc_status_name:
            color = curses.color_pair(3)  # Warning (Yellow)
        else:
            color = curses.color_pair(1)  # Error (Red)
        # Status jetson_clocks
        self.stdscr.addstr(
            start_y + 4, start_x + len(jetson_clocks_string) + 6,
            jc_status_name.capitalize(),
            color)
        # button start/stop jetson clocks
        self.service_enable.draw(start_y + 6, start_x, key, mouse)
        # Read status jetson_clocks
        jetson_clocks_boot_string = "boot"
        self.stdscr.addstr(start_y + 7, start_x + 5, jetson_clocks_boot_string, curses.A_UNDERLINE)
        boot = self.jetson.jetson_clocks.boot
        self.stdscr.addstr(
            start_y + 7, start_x + len(jetson_clocks_boot_string) + 6,
            "Enable" if boot else "Disable",
            curses.A_BOLD if boot else curses.A_NORMAL)
        # Build NVP model list
        nvpmodel = self.jetson.nvpmodel
        if nvpmodel is not None:
            nvp_id = nvpmodel.id
            self.stdscr.addstr(start_y + 10, start_x, "NVP model", curses.A_BOLD)
            # Draw keys to decrease nvpmodel
            if nvp_id != 0:
                self.nvp_decrease.draw(start_y + 9, start_x + 10, key, mouse)
            # Draw selected number
            self.stdscr.addstr(start_y + 10, start_x + 16, str(nvp_id), curses.A_NORMAL)
            # Status NVP model service
            if nvpmodel.is_running:
                self.stdscr.addch(start_y + 10, start_x + 25, curses.ACS_DIAMOND, curses.color_pair(2) | curses.A_BOLD)
            # Draw keys to increase nvpmodel
            if nvp_id != len(self.jetson.nvpmodel.modes) - 1:
                self.nvp_increase.draw(start_y + 9, start_x + 18, key, mouse)
            # Write list of available modes
            self.nvp_list.draw(
                start_y + 12, start_x, width // 2 - start_x, key, mouse,
                lstatus=nvpmodel.status,
                select=nvp_id)
        # Evaluate size chart
        size_x = [start_x + width // 2 + 1, width - start_x - 1]
        size_y = [start_y + 3, height - 3]
        # Add label
        label = ''
        if self.jetson.fan:
            # Read status control fan
            ctrl_stat = "Auto=" + ("Enable" if self.jetson.fan.auto else "Disable")
            # Add label
            if self.jetson.fan.speed is not None:
                label = "{current: >3.0f}% of {target: >3.0f}% {ctrl}".format(current=self.jetson.fan.measure, target=self.jetson.fan.speed, ctrl=ctrl_stat)
            else:
                label = "{current: >3.0f}% {ctrl}".format(current=self.jetson.fan.measure, ctrl=ctrl_stat)
            if self.jetson.fan.speed is not None:
                # Fan label
                self.stdscr.addstr(start_y, start_x, "Fan", curses.A_NORMAL)
                self.stdscr.addstr(start_y + 1, start_x, "Speed", curses.A_BOLD)
                # Draw keys to decrease fan speed
                self.fan_status_decrease.draw(start_y, start_x + 6, key, mouse)
                # Draw selected number
                speed_str = "{speed: >3.0f}%".format(speed=self.jetson.fan.speed)
                self.stdscr.addstr(start_y + 1, start_x + 12, speed_str, curses.A_NORMAL)
                # Draw keys to increase fan speed
                self.fan_status_increase.draw(start_y, start_x + 17, key, mouse)
            if self.jetson.fan.auto is not None:
                # Write list of available modes
                self.stdscr.addstr(start_y, start_x + 24, "Fan", curses.A_NORMAL)
                self.stdscr.addstr(start_y + 1, start_x + 24, "Mode", curses.A_BOLD)
                # Get ID from fan mode
                fan_mode = self.jetson.fan.mode
                fan_id = self.jetson.fan.configs.index(fan_mode)
                self.fan_list.draw(start_y, start_x + 30, width, key, mouse, select=fan_id)
        # Draw the GPU chart
        self.chart_fan.draw(self.stdscr, size_x, size_y, label=label)
 Control board, check status jetson_clocks and change NVP model 
Control board, check status jetson_clocks and change NVP model
Control board check status jetson_clocks and change NVP model
def draw(self, key, mouse):
        height, width, first = self.size_page()
        start_y = first + 1
        start_x = 1
        jc_status_name = self.jetson.jetson_clocks.status
        if self.jetson.jetson_clocks.is_config:
            self.service_start.draw(start_y + 3, start_x, key, mouse)
        jetson_clocks_string = "jetson_clocks"
        self.stdscr.addstr(start_y + 4, start_x + 5, jetson_clocks_string, curses.A_UNDERLINE)
        if jc_status_name == "running":
            color = (curses.A_BOLD | curses.color_pair(2))  
        elif jc_status_name == "inactive":
            color = curses.A_NORMAL       
        elif "ing" in jc_status_name:
            color = curses.color_pair(3)  
        else:
            color = curses.color_pair(1)  
        self.stdscr.addstr(
            start_y + 4, start_x + len(jetson_clocks_string) + 6,
            jc_status_name.capitalize(),
            color)
        self.service_enable.draw(start_y + 6, start_x, key, mouse)
        jetson_clocks_boot_string = "boot"
        self.stdscr.addstr(start_y + 7, start_x + 5, jetson_clocks_boot_string, curses.A_UNDERLINE)
        boot = self.jetson.jetson_clocks.boot
        self.stdscr.addstr(
            start_y + 7, start_x + len(jetson_clocks_boot_string) + 6,
            "Enable" if boot else "Disable",
            curses.A_BOLD if boot else curses.A_NORMAL)
        nvpmodel = self.jetson.nvpmodel
        if nvpmodel is not None:
            nvp_id = nvpmodel.id
            self.stdscr.addstr(start_y + 10, start_x, "NVP model", curses.A_BOLD)
            if nvp_id != 0:
                self.nvp_decrease.draw(start_y + 9, start_x + 10, key, mouse)
            self.stdscr.addstr(start_y + 10, start_x + 16, str(nvp_id), curses.A_NORMAL)
            if nvpmodel.is_running:
                self.stdscr.addch(start_y + 10, start_x + 25, curses.ACS_DIAMOND, curses.color_pair(2) | curses.A_BOLD)
            if nvp_id != len(self.jetson.nvpmodel.modes) - 1:
                self.nvp_increase.draw(start_y + 9, start_x + 18, key, mouse)
            self.nvp_list.draw(
                start_y + 12, start_x, width // 2 - start_x, key, mouse,
                lstatus=nvpmodel.status,
                select=nvp_id)
        size_x = [start_x + width // 2 + 1, width - start_x - 1]
        size_y = [start_y + 3, height - 3]
        label = ''
        if self.jetson.fan:
            ctrl_stat = "Auto=" + ("Enable" if self.jetson.fan.auto else "Disable")
            if self.jetson.fan.speed is not None:
                label = "{current: >3.0f}% of {target: >3.0f}% {ctrl}".format(current=self.jetson.fan.measure, target=self.jetson.fan.speed, ctrl=ctrl_stat)
            else:
                label = "{current: >3.0f}% {ctrl}".format(current=self.jetson.fan.measure, ctrl=ctrl_stat)
            if self.jetson.fan.speed is not None:
                self.stdscr.addstr(start_y, start_x, "Fan", curses.A_NORMAL)
                self.stdscr.addstr(start_y + 1, start_x, "Speed", curses.A_BOLD)
                self.fan_status_decrease.draw(start_y, start_x + 6, key, mouse)
                speed_str = "{speed: >3.0f}%".format(speed=self.jetson.fan.speed)
                self.stdscr.addstr(start_y + 1, start_x + 12, speed_str, curses.A_NORMAL)
                self.fan_status_increase.draw(start_y, start_x + 17, key, mouse)
            if self.jetson.fan.auto is not None:
                self.stdscr.addstr(start_y, start_x + 24, "Fan", curses.A_NORMAL)
                self.stdscr.addstr(start_y + 1, start_x + 24, "Mode", curses.A_BOLD)
                fan_mode = self.jetson.fan.mode
                fan_id = self.jetson.fan.configs.index(fan_mode)
                self.fan_list.draw(start_y, start_x + 30, width, key, mouse, select=fan_id)
        self.chart_fan.draw(self.stdscr, size_x, size_y, label=label)
def draw ( self , key , mouse ) : height , width , first = self . size_page ( ) start_y = first + 1 start_x = 1 jc_status_name = self . jetson . jetson_clocks . status if self . jetson . jetson_clocks . is_config : self . service_start . draw ( start_y + 3 , start_x , key , mouse ) jetson_clocks_string = "jetson_clocks" self . stdscr . addstr ( start_y + 4 , start_x + 5 , jetson_clocks_string , curses . A_UNDERLINE ) if jc_status_name == "running" : color = ( curses . A_BOLD | curses . color_pair ( 2 ) ) elif jc_status_name == "inactive" : color = curses . A_NORMAL elif "ing" in jc_status_name : color = curses . color_pair ( 3 ) else : color = curses . color_pair ( 1 ) self . stdscr . addstr ( start_y + 4 , start_x + len ( jetson_clocks_string ) + 6 , jc_status_name . capitalize ( ) , color ) self . service_enable . draw ( start_y + 6 , start_x , key , mouse ) jetson_clocks_boot_string = "boot" self . stdscr . addstr ( start_y + 7 , start_x + 5 , jetson_clocks_boot_string , curses . A_UNDERLINE ) boot = self . jetson . jetson_clocks . boot self . stdscr . addstr ( start_y + 7 , start_x + len ( jetson_clocks_boot_string ) + 6 , "Enable" if boot else "Disable" , curses . A_BOLD if boot else curses . A_NORMAL ) nvpmodel = self . jetson . nvpmodel if nvpmodel is not None : nvp_id = nvpmodel . id self . stdscr . addstr ( start_y + 10 , start_x , "NVP model" , curses . A_BOLD ) if nvp_id != 0 : self . nvp_decrease . draw ( start_y + 9 , start_x + 10 , key , mouse ) self . stdscr . addstr ( start_y + 10 , start_x + 16 , str ( nvp_id ) , curses . A_NORMAL ) if nvpmodel . is_running : self . stdscr . addch ( start_y + 10 , start_x + 25 , curses . ACS_DIAMOND , curses . color_pair ( 2 ) | curses . A_BOLD ) if nvp_id != len ( self . jetson . nvpmodel . modes ) - 1 : self . nvp_increase . draw ( start_y + 9 , start_x + 18 , key , mouse ) self . nvp_list . draw ( start_y + 12 , start_x , width // 2 - start_x , key , mouse , lstatus = nvpmodel . status , select = nvp_id ) size_x = [ start_x + width // 2 + 1 , width - start_x - 1 ] size_y = [ start_y + 3 , height - 3 ] label = '' if self . jetson . fan : ctrl_stat = "Auto=" + ( "Enable" if self . jetson . fan . auto else "Disable" ) if self . jetson . fan . speed is not None : label = "{current: >3.0f}% of {target: >3.0f}% {ctrl}" . format ( current = self . jetson . fan . measure , target = self . jetson . fan . speed , ctrl = ctrl_stat ) else : label = "{current: >3.0f}% {ctrl}" . format ( current = self . jetson . fan . measure , ctrl = ctrl_stat ) if self . jetson . fan . speed is not None : self . stdscr . addstr ( start_y , start_x , "Fan" , curses . A_NORMAL ) self . stdscr . addstr ( start_y + 1 , start_x , "Speed" , curses . A_BOLD ) self . fan_status_decrease . draw ( start_y , start_x + 6 , key , mouse ) speed_str = "{speed: >3.0f}%" . format ( speed = self . jetson . fan . speed ) self . stdscr . addstr ( start_y + 1 , start_x + 12 , speed_str , curses . A_NORMAL ) self . fan_status_increase . draw ( start_y , start_x + 17 , key , mouse ) if self . jetson . fan . auto is not None : self . stdscr . addstr ( start_y , start_x + 24 , "Fan" , curses . A_NORMAL ) self . stdscr . addstr ( start_y + 1 , start_x + 24 , "Mode" , curses . A_BOLD ) fan_mode = self . jetson . fan . mode fan_id = self . jetson . fan . configs . index ( fan_mode ) self . fan_list . draw ( start_y , start_x + 30 , width , key , mouse , select = fan_id ) self . chart_fan . draw ( self . stdscr , size_x , size_y , label = label )
Control board, check status jetson_clocks and change NVP model
Control board check status jetson_clocks and change NVP model
""" Control board, check status jetson_clocks and change NVP model """ # Screen size # Position information # Status jetson_clocks # Write status jetson_clocks # Show service status # Field service # Read status jetson_clocks # Running (Bold) # Normal (Grey) # Warning (Yellow) # Error (Red) # Status jetson_clocks # button start/stop jetson clocks # Read status jetson_clocks # Build NVP model list # Draw keys to decrease nvpmodel # Draw selected number # Status NVP model service # Draw keys to increase nvpmodel # Write list of available modes # Evaluate size chart # Add label # Read status control fan # Add label # Fan label # Draw keys to decrease fan speed # Draw selected number # Draw keys to increase fan speed # Write list of available modes # Get ID from fan mode # Draw the GPU chart
self
key
mouse