Skip to content

Commit

Permalink
add APID to setup args
Browse files Browse the repository at this point in the history
  • Loading branch information
robamu committed Apr 6, 2022
1 parent ddf2738 commit ea87dae
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
3 changes: 3 additions & 0 deletions src/tmtccmd/config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ def __init__(
self,
hook_obj: TmTcHookBase,
use_gui: bool,
apid: int,
cli_args: Optional[argparse.Namespace],
json_cfg_path: Optional[str] = None,
reduced_printout: bool = False,
Expand All @@ -49,6 +50,8 @@ def __init__(
self.ansi_colors = use_ansi_colors
self.cli_args = cli_args
self.json_cfg_path = json_cfg_path
self.tc_apid = apid
self.tm_apid = apid
if json_cfg_path is None:
self.json_cfg_path = default_json_path()

Expand Down
15 changes: 6 additions & 9 deletions src/tmtccmd/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,6 @@ def run(
def __assign_tmtc_commander_hooks(hook_object: TmTcHookBase):
if hook_object is None:
raise ValueError

# Check whether all required hook functions have bee implemented properly, Python
# does not enforce this.
if hook_object.add_globals_pre_args_parsing is None:
LOGGER.error(
"Passed hook base object handle is invalid. Abstract functions have to be implemented!"
)
raise ValueError
# Insert hook object handle into global dictionary so it can be used by the TMTC commander
update_global(CoreGlobalIds.TMTC_HOOK, hook_object)
# Set core object IDs
Expand All @@ -143,9 +135,14 @@ def init_printout(use_gui: bool, ansi_colors: bool = True):
def __handle_cli_args_and_globals(setup_args: SetupArgs):
from typing import cast
from tmtccmd.core.globals_manager import get_global
from tmtccmd.config.globals import set_default_globals_pre_args_parsing

LOGGER.info("Setting up pre-globals..")
setup_args.hook_obj.add_globals_pre_args_parsing(False)
set_default_globals_pre_args_parsing(
setup_args.use_gui,
tc_apid=setup_args.tc_apid,
tm_apid=setup_args.tm_apid
)
LOGGER.info("Setting up post-globals..")
pass_cli_args(setup_args=setup_args)

Expand Down

0 comments on commit ea87dae

Please sign in to comment.