From 42d65d9cbef205eb35efeeeb8d79aef0a5eeab82 Mon Sep 17 00:00:00 2001 From: Jasper-Harvey0 Date: Thu, 22 Jan 2026 11:41:21 +1100 Subject: [PATCH] Fix imports and string styling --- src/fixate/core/config_util.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/fixate/core/config_util.py b/src/fixate/core/config_util.py index d30f822d..6e6f4815 100644 --- a/src/fixate/core/config_util.py +++ b/src/fixate/core/config_util.py @@ -5,10 +5,11 @@ import copy from shutil import copy2 from pathlib import Path -from cmd2.ansi import style, Fg from fixate.drivers.pps.bk_178x import BK178X from pyvisa.errors import VisaIOError import fixate.config +from cmd2.string_utils import stylize +from cmd2.colors import Color """ fxconfig is a configuration utility that helps find connected instruments and add them to fixate's driver @@ -66,8 +67,6 @@ class FxConfigError(Exception): class FxConfigCmd(cmd2.Cmd): - prompt = "fx>" - def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.config_file_path = None @@ -78,6 +77,8 @@ def __init__(self, *args, **kwargs): self.complete_save = self.path_complete self.complete_open = self.path_complete + self.prompt = "fx>" + def postloop(self): """Print a new line so the shell prompt get printed on its own line after we exit""" self.poutput("") @@ -303,13 +304,13 @@ def _print_config_dict(self, config_dict): self.poutput("SERIAL || " + com_port + " || " + str(parameters)) def _test_print_error(self, name, msg): - self.poutput(style("ERROR: ", fg=Fg.RED), end="") - self.poutput(style(str(name), fg=Fg.CYAN), end="") + self.poutput(stylize("ERROR: ", style=f"bold {Color.RED}"), end="") + self.poutput(stylize(str(name), style=Color.CYAN), end="") self.poutput(f" - {msg}") def _test_print_ok(self, name, msg): - self.poutput(style("OK: ", fg=Fg.GREEN), end="") - self.poutput(style(str(name), fg=Fg.CYAN), end="") + self.poutput(stylize("OK: ", style=f"bold {Color.GREEN}"), end="") + self.poutput(stylize(str(name), style=Color.CYAN), end="") self.poutput(f" - {msg}") def _test_config_dict(self, config_dict):