diff --git a/.github/workflows/build-and-push.yml b/.github/workflows/build-and-push.yml index 7ad13c49..f6c17023 100644 --- a/.github/workflows/build-and-push.yml +++ b/.github/workflows/build-and-push.yml @@ -41,7 +41,7 @@ jobs: - name: Test with tox run: | # https://github.com/actions/setup-python/issues/225 - sudo env "PATH=$PATH" TERM='xterm-256color' tox -e py${{ matrix.python-version }} + sudo env "PATH=$PATH" tox -e py${{ matrix.python-version }} docker: name: "Build Docker image develop" diff --git a/jtop/gui/lib/chart.py b/jtop/gui/lib/chart.py index 74631e25..f5b1a667 100644 --- a/jtop/gui/lib/chart.py +++ b/jtop/gui/lib/chart.py @@ -67,12 +67,15 @@ def __init__(self, jetson, name, callback, type_value=int, line="*", color_text= if c[0] not in list_colors: list_colors[c[0]] = [] list_colors[c[0]] = [c] + list_colors[c[0]] - for idx, list_element in enumerate(list_colors.values()): - list_element = sorted(list_element, key=lambda x: x[1], reverse=True) - for idy, color_set in enumerate(list_element): - idx_name = Chart.OFFSET_COLOR_CHART + self._color_obj_counter + (len(self.color_chart) - idx - 1) * color_step + idy - second_color = self.color_chart[color_set[1]] if color_set[1] < len(self.color_chart) else curses.COLOR_BLACK - curses.init_pair(idx_name, self.color_chart[color_set[0]], second_color) + try: + for idx, list_element in enumerate(list_colors.values()): + list_element = sorted(list_element, key=lambda x: x[1], reverse=True) + for idy, color_set in enumerate(list_element): + idx_name = Chart.OFFSET_COLOR_CHART + self._color_obj_counter + (len(self.color_chart) - idx - 1) * color_step + idy + second_color = self.color_chart[color_set[1]] if color_set[1] < len(self.color_chart) else curses.COLOR_BLACK + curses.init_pair(idx_name, self.color_chart[color_set[0]], second_color) + except curses.error: + curses.use_default_colors() # Update counter colors Chart.COLOR_COUNTER += len(self._combinations) + 1 # Attach the chart for every update from jtop