# SPDX-FileCopyrightText: Copyright (c) 2022 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. from tkinter import StringVar from tkinter.ttk import Label, LabelFrame from ...utils.common import PAttrs, PNames from ...utils.layoutmanager import fill_parent, grid_span, padding from ...utils.subjectobserver import Observer class DiskFrame(LabelFrame, Observer): def __init__(self, master=None, **kwargs): super().__init__(master, text="Disk", **kwargs) self.create_widgets() self.manage_layout() fill_parent(self) def create_widgets(self): self.usage_v = StringVar() self.size_l = Label(self, text="Size") self.usage_l = Label(self, textvariable=self.usage_v) def manage_layout(self): self.size_l.grid(row=0, column=0, **grid_span, **padding) self.usage_l.grid(row=0, column=1, **grid_span, **padding) def update_data(self, data): self.usage_v.set(f"{data[(PNames.DISK, PAttrs.USED_SIZE)]}/" f"{data[(PNames.DISK, PAttrs.TOTAL_SIZE)]} MB")