2626
2727import curses
2828import threading
29- import time
3029from threading import Lock
30+ import time
3131from typing import Optional
3232
3333import rclpy
@@ -54,8 +54,8 @@ def __init__(self):
5454
5555 # UI state
5656 self .input_mode = None
57- self .input_buffer = ""
58- self .status_message = ""
57+ self .input_buffer = ''
58+ self .status_message = ''
5959 self .status_timeout = 0
6060 self .show_only_monitored = False
6161
@@ -121,9 +121,9 @@ def toggle_topic_monitoring(self, topic_name: str):
121121 """Toggle monitoring for a topic."""
122122 if self .ui_adaptor :
123123 self .ui_adaptor .toggle_topic_monitoring (topic_name )
124- self .show_status (f" Toggling monitoring for { topic_name } " )
124+ self .show_status (f' Toggling monitoring for { topic_name } ' )
125125 else :
126- self .show_status (" UI adaptor not available" )
126+ self .show_status (' UI adaptor not available' )
127127
128128 def show_status (self , message : str ):
129129 """Show a status message for 3 seconds."""
@@ -233,13 +233,13 @@ def curses_main(stdscr, node):
233233 tolerance = float (parts [1 ]) if len (parts ) > 1 else 5.0
234234 success , msg = node .ui_adaptor .set_expected_frequency (
235235 topic_name , hz , tolerance )
236- status_message = f" Set frequency for { topic_name } : { hz } Hz"
236+ status_message = f' Set frequency for { topic_name } : { hz } Hz'
237237 if not success :
238- status_message = f" Error: { msg } "
238+ status_message = f' Error: { msg } '
239239 else :
240- status_message = " Invalid input format"
240+ status_message = ' Invalid input format'
241241 except ValueError :
242- status_message = " Invalid frequency values"
242+ status_message = ' Invalid frequency values'
243243 status_timeout = current_time + 3.0
244244 input_mode = None
245245 input_buffer = ''
@@ -276,7 +276,7 @@ def curses_main(stdscr, node):
276276 if 0 <= selected_row < len (node .visible_topics ):
277277 topic_name = node .visible_topics [selected_row ]
278278 node .toggle_topic_monitoring (topic_name )
279- status_message = f" Toggled monitoring for { topic_name } "
279+ status_message = f' Toggled monitoring for { topic_name } '
280280 status_timeout = current_time + 3.0
281281 elif key == ord ('f' ) or key == ord ('F' ):
282282 if 0 <= selected_row < len (node .visible_topics ):
@@ -287,16 +287,16 @@ def curses_main(stdscr, node):
287287 topic_name = node .visible_topics [selected_row ]
288288 success , msg = node .ui_adaptor .set_expected_frequency (
289289 topic_name , clear = True )
290- status_message = f" Cleared frequency for { topic_name } "
290+ status_message = f' Cleared frequency for { topic_name } '
291291 if not success :
292- status_message = f" Error: { msg } "
292+ status_message = f' Error: { msg } '
293293 status_timeout = current_time + 3.0
294294 elif key == ord ('h' ) or key == ord ('H' ):
295295 node .show_only_monitored = not node .show_only_monitored
296296 with node .topics_lock :
297297 node .update_visible_topics ()
298- mode_text = " monitored only" if node .show_only_monitored else " all topics"
299- status_message = f" Showing { mode_text } "
298+ mode_text = ' monitored only' if node .show_only_monitored else ' all topics'
299+ status_message = f' Showing { mode_text } '
300300 status_timeout = current_time + 3.0
301301
302302 # Get data safely
@@ -340,7 +340,7 @@ def curses_main(stdscr, node):
340340 # Get expected frequency
341341 expected_hz , tolerance = node .ui_adaptor .get_expected_frequency (topic_name )
342342 if expected_hz > 0 :
343- expected_freq_display = f" { expected_hz :.1f} Hz" .ljust (12 )
343+ expected_freq_display = f' { expected_hz :.1f} Hz' .ljust (12 )
344344
345345 # Color coding based on status
346346 if is_monitored :
@@ -418,7 +418,7 @@ def curses_main(stdscr, node):
418418 # Input prompt (if in input mode)
419419 if input_mode :
420420 try :
421- prompt = f" Set frequency: { input_buffer } "
421+ prompt = f' Set frequency: { input_buffer } '
422422 stdscr .addstr (height - 3 , 0 , prompt [:width - 1 ],
423423 curses .color_pair (COLOR_STATUS_MSG ))
424424 # Position cursor after the input
@@ -437,7 +437,7 @@ def curses_main(stdscr, node):
437437 status_line = ("Format: Hz [tolerance%] - Examples: '30' (30Hz±5% default) "
438438 "or '30 10' (30Hz±10%) - ESC=cancel, Enter=confirm" )
439439 else :
440- mode_text = " monitored only" if node .show_only_monitored else " all topics"
440+ mode_text = ' monitored only' if node .show_only_monitored else ' all topics'
441441 status_line = (
442442 f'Showing { start_idx + 1 } - { num_shown } of { len (visible_topics )} '
443443 f'topics ({ mode_text } ). Enter=toggle, f=set freq, c=clear freq, '
0 commit comments