Skip to content

Commit 1f4964f

Browse files
committed
Use hide unmonitored again
Signed-off-by: Blake McHale <[email protected]>
1 parent 1890bc3 commit 1f4964f

File tree

3 files changed

+24
-24
lines changed

3 files changed

+24
-24
lines changed

greenwave_monitor/greenwave_monitor/ncurses_frontend.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
class GreenwaveNcursesFrontend(Node):
4242
"""Ncurses frontend for Greenwave Monitor."""
4343

44-
def __init__(self, show_only_monitored: bool = False):
44+
def __init__(self, hide_unmonitored: bool = False):
4545
"""Initialize the ncurses frontend node."""
4646
super().__init__('greenwave_ncurses_frontend')
4747

@@ -60,7 +60,7 @@ def __init__(self, show_only_monitored: bool = False):
6060
self.input_buffer = ''
6161
self.status_message = ''
6262
self.status_timeout = 0
63-
self.show_only_monitored = show_only_monitored
63+
self.hide_unmonitored = hide_unmonitored
6464

6565
# Initialize UI adaptor
6666
self.ui_adaptor = GreenwaveUiAdaptor(self)
@@ -99,7 +99,7 @@ def update_visible_topics(self):
9999
"""Update the visible topics list based on current filters."""
100100
all_topic_names = list(self.all_topics)
101101

102-
if self.show_only_monitored and self.ui_adaptor:
102+
if self.hide_unmonitored and self.ui_adaptor:
103103
# Filter to only show topics that have diagnostic data (are being monitored)
104104
filtered_topics = []
105105
for topic_name in all_topic_names:
@@ -290,10 +290,10 @@ def curses_main(stdscr, node):
290290
status_message = f'Error: {msg}'
291291
status_timeout = current_time + 3.0
292292
elif key == ord('h') or key == ord('H'):
293-
node.show_only_monitored = not node.show_only_monitored
293+
node.hide_unmonitored = not node.hide_unmonitored
294294
with node.topics_lock:
295295
node.update_visible_topics()
296-
mode_text = 'monitored only' if node.show_only_monitored else 'all topics'
296+
mode_text = 'monitored only' if node.hide_unmonitored else 'all topics'
297297
status_message = f'Showing {mode_text}'
298298
status_timeout = current_time + 3.0
299299

@@ -435,7 +435,7 @@ def curses_main(stdscr, node):
435435
status_line = ("Format: Hz [tolerance%] - Examples: '30' (30Hz±5% default) "
436436
"or '30 10' (30Hz±10%) - ESC=cancel, Enter=confirm")
437437
else:
438-
if node.show_only_monitored:
438+
if node.hide_unmonitored:
439439
mode_text = 'monitored only'
440440
mode_help_text = 'show unmonitored'
441441
else:
@@ -460,9 +460,9 @@ def parse_args(args=None):
460460
description='Ncurses-based frontend for Greenwave Monitor'
461461
)
462462
parser.add_argument(
463-
'--show-only-monitored',
463+
'--hide-unmonitored',
464464
action='store_true',
465-
help='Show only monitored topics on initialization'
465+
help='Hide unmonitored topics on initialization'
466466
)
467467
return parser.parse_known_args(args)
468468

@@ -471,7 +471,7 @@ def main(args=None):
471471
"""Entry point for the ncurses frontend application."""
472472
parsed_args, ros_args = parse_args(args)
473473
rclpy.init(args=ros_args)
474-
node = GreenwaveNcursesFrontend(show_only_monitored=parsed_args.show_only_monitored)
474+
node = GreenwaveNcursesFrontend(hide_unmonitored=parsed_args.hide_unmonitored)
475475
thread = None
476476

477477
def signal_handler(signum, frame):

greenwave_monitor/scripts/ncurses_dashboard

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
# Parse command line arguments
2424
DEMO_MODE=false
2525
LOG_DIR=""
26-
SHOW_ONLY_MONITORED=false
26+
HIDE_UNMONITORED=false
2727
MONITOR_ARGS=()
2828

2929
show_help() {
@@ -34,7 +34,7 @@ show_help() {
3434
echo "OPTIONS:"
3535
echo " --demo, --test Launch demo publisher nodes for testing"
3636
echo " --log-dir DIR Enable logging to specified directory"
37-
echo " --show-only-monitored Show only monitored topics on initialization"
37+
echo " --hide-unmonitored Hide unmonitored topics on initialization"
3838
echo " --help, -h Show this help message"
3939
echo ""
4040
echo "MONITOR_ARGS are passed directly to the greenwave_monitor node"
@@ -58,8 +58,8 @@ while [[ $# -gt 0 ]]; do
5858
LOG_DIR="$2"
5959
shift 2
6060
;;
61-
--show-only-monitored)
62-
SHOW_ONLY_MONITORED=true
61+
--hide-unmonitored)
62+
HIDE_UNMONITORED=true
6363
shift
6464
;;
6565
--help|-h)
@@ -123,8 +123,8 @@ echo "Starting ncurses TUI..."
123123
echo "Controls: a=Add Topic, r=Remove, f=Set Frequency, c=Clear Freq, q=Quit"
124124
# NOTE: add proper argument parsing to the ncurses frontend if more than one argument is added here
125125
FRONTEND_ARGS=()
126-
if [ "$SHOW_ONLY_MONITORED" = "true" ]; then
127-
FRONTEND_ARGS+=("--show-only-monitored")
126+
if [ "$HIDE_UNMONITORED" = "true" ]; then
127+
FRONTEND_ARGS+=("--hide-unmonitored")
128128
fi
129129
python3 -m greenwave_monitor.ncurses_frontend "${FRONTEND_ARGS[@]}"
130130

greenwave_monitor/test/test_ncurses_frontend_argparse.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,22 +25,22 @@
2525
class TestParseArgs:
2626
"""Test argument parsing for ncurses frontend."""
2727

28-
def test_default_show_only_monitored_false(self):
29-
"""Test that show_only_monitored defaults to False."""
28+
def test_default_hide_unmonitored_false(self):
29+
"""Test that hide_unmonitored defaults to False."""
3030
parsed_args, _ = parse_args([])
31-
assert parsed_args.show_only_monitored is False
31+
assert parsed_args.hide_unmonitored is False
3232

33-
def test_show_only_monitored_long_flag(self):
34-
"""Test --show-only-monitored flag enables show_only_monitored."""
35-
parsed_args, _ = parse_args(['--show-only-monitored'])
36-
assert parsed_args.show_only_monitored is True
33+
def test_hide_unmonitored_long_flag(self):
34+
"""Test --hide-unmonitored flag enables hide_unmonitored."""
35+
parsed_args, _ = parse_args(['--hide-unmonitored'])
36+
assert parsed_args.hide_unmonitored is True
3737

3838
def test_ros_args_passthrough(self):
3939
"""Test that ROS arguments are passed through."""
4040
parsed_args, ros_args = parse_args(
41-
['--show-only-monitored', '--ros-args', '-r', '__node:=my_node']
41+
['--hide-unmonitored', '--ros-args', '-r', '__node:=my_node']
4242
)
43-
assert parsed_args.show_only_monitored is True
43+
assert parsed_args.hide_unmonitored is True
4444
assert '--ros-args' in ros_args
4545
assert '-r' in ros_args
4646
assert '__node:=my_node' in ros_args

0 commit comments

Comments
 (0)