Skip to content

Commit

Permalink
Text chart color
Browse files Browse the repository at this point in the history
  • Loading branch information
rbonghi committed Jun 28, 2023
1 parent 0615a5d commit 14a626e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-and-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
15 changes: 9 additions & 6 deletions jtop/gui/lib/chart.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 14a626e

Please sign in to comment.