Skip to content

Commit

Permalink
Testing Chart error
Browse files Browse the repository at this point in the history
  • Loading branch information
rbonghi committed Jul 25, 2024
1 parent 8e55b45 commit dc2d409
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions jtop/gui/jtopgui.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
# Get variables
from ..core.common import get_var
# Graphics elements
from .lib.chart import Chart
from .lib.colors import NColors
from .lib.common import check_curses, set_xterm_title
# Create logger
Expand Down Expand Up @@ -99,6 +100,9 @@ def __init__(self, stdscr, jetson, pages, init_page=0, start=True, loop=False, s
if start:
self.run(loop, seconds)

def __del__(self):
Chart.reset_color_counter()

def run(self, loop, seconds):
# In this program, we don't want keystrokes echoed to the console,
# so we run this to disable that
Expand Down
5 changes: 5 additions & 0 deletions jtop/gui/lib/chart.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,11 @@ def __init__(self, jetson, name, callback, type_value=int, line="*", color_text=
# Attach the chart for every update from jtop
jetson.attach(self.update)

@classmethod
def reset_color_counter():
Chart.COLOR_COUNTER = 0


def __del__(self):
# Remove from color counter
Chart.COLOR_COUNTER -= len(self._combinations) + 1
Expand Down

0 comments on commit dc2d409

Please sign in to comment.