# SPDX-FileCopyrightText: Copyright (c) 2022-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: LicenseRef-NvidiaProprietary # # NVIDIA CORPORATION, its affiliates and licensors retain all intellectual # property and proprietary rights in and to this material, related # documentation and any modifications thereto. Any use, reproduction, # disclosure or distribution of this material and related documentation # without an express license agreement from NVIDIA CORPORATION or # its affiliates is strictly prohibited. """Entry point of the Jetson Power GUI application.""" import os import sys JETSON_POWER_GUI_ROOT = os.path.dirname( os.path.dirname( os.path.abspath(__file__))) sys.path.insert(0, JETSON_POWER_GUI_ROOT) from tkinter import PhotoImage, font as tkFont from tkinter import Tk from tkinter.ttk import Notebook from jetsonpowergui.mainscreen import MainScreen from jetsonpowergui.thermalpowermonitor import ThermalPowerMonitor from jetsonpowergui.utils.common import update_period from jetsonpowergui.utils.datacenter import data_center from jetsonpowergui.utils.layoutmanager import RESOLUTION_RELATED_SIZES def update_power_data(window, period): """Ask the data center to update the power data periodically.""" data_center.update_data() window.after(period, update_power_data, window, period) def main(): # Create root window with default theme window = Tk(className="Jetson Power GUI") # Note: the logo is taken from: # l4t/prebuilts/bmp_blob/NVIDIA_Trademark_License_Addendum_SW.pdf nvlogo_path = "/usr/share/jetsonpowergui/logo/nv_logo.png" window.iconphoto(True, PhotoImage(file=nvlogo_path)) window.title("Jetson Power GUI") # Modify default font size to fit the resolution default_font = tkFont.nametofont("TkDefaultFont") default_font.configure(size=RESOLUTION_RELATED_SIZES["font_size"]) # Create tabs tab_control = Notebook(window) # Main Screen Tab main_screen_tab = MainScreen(tab_control) tab_control.add(main_screen_tab, text="Main") # Thermal and Power Monitor Tab thermal_power_monitor_tab = ThermalPowerMonitor(tab_control) tab_control.add(thermal_power_monitor_tab, text="Thermal / Power Monitor") # Manage layout of tabs tab_control.pack(expand=True, fill="both") # Set min size to tkinter internal calculated size window.update() window.minsize(window.winfo_width(), window.winfo_height()) # Update power data periodically update_power_data(window, update_period) # Start the application window.mainloop() if __name__ == "__main__": main()