This commit is contained in:
Robin Müller 2022-05-23 18:33:35 +02:00
parent 623e1cc37e
commit c9f5a5652e
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
4 changed files with 42 additions and 32 deletions

View File

@ -1,5 +1,11 @@
from PyQt5.QtWidgets import (
QDialog, QDialogButtonBox, QVBoxLayout, QLabel, QGroupBox, QGridLayout, QLineEdit
QDialog,
QDialogButtonBox,
QVBoxLayout,
QLabel,
QGroupBox,
QGridLayout,
QLineEdit,
)
from PyQt5 import QtCore
@ -22,6 +28,7 @@ class Parameter:
self.widget.setPlaceholderText(self.defaultValue)
self.widget.setText("")
class ParameterDialog(QDialog):
def __init__(self):
super().__init__()
@ -59,7 +66,6 @@ class ParameterDialog(QDialog):
self.parameters[name] = parameter
def _reset(self):
for value in self.parameters.values():
value.reset()
@ -80,14 +86,13 @@ class ParameterDialog(QDialog):
super().reject()
"""Prompt the user to specify additional Parameters
:param parameterList: array of dictionaries with name and defaultValue attributes
:return: dict with all names as key and user supplied input as value string
"""
def prompt_parameters(parameterList):
gui = get_global(CoreGlobalIds.GUI)
mode = get_global(CoreGlobalIds.MODE)
@ -98,6 +103,7 @@ def prompt_parameters(parameterList):
else:
return _cli_prompt(parameterList)
def _gui_prompt(parameterList):
dialog = ParameterDialog()
for parameter in parameterList:
@ -105,10 +111,13 @@ def _gui_prompt(parameterList):
dialog.exec_()
return dialog.getParameters()
def _cli_prompt(parameterList):
result = {}
for parameter in parameterList:
userInput = input("Specify {} [{}]: ".format(parameter["name"], parameter["defaultValue"]))
userInput = input(
"Specify {} [{}]: ".format(parameter["name"], parameter["defaultValue"])
)
if userInput == "":
userInput = parameter["defaultValue"]
result[parameter["name"]] = userInput

View File

@ -18,8 +18,12 @@ class Info:
def pack_controller_commands(tc_queue: TcQueueT, op_code: str):
parameters = prompt_parameters([{"name": "Mode", "defaultValue": "2"}, {
"name": "Submode", "defaultValue": "0"}])
parameters = prompt_parameters(
[
{"name": "Mode", "defaultValue": "2"},
{"name": "Submode", "defaultValue": "0"},
]
)
mode = int(parameters["Mode"])
if mode < 0 or mode > 2:
print("Invalid Mode, defaulting to OFF")

View File

@ -1,6 +1,7 @@
from tmtccmd.config import QueueCommands
from tmtccmd.tc.definitions import TcQueueT
from tmtccmd.tc.pus_3_fsfw_hk import *
"""
from config.object_ids import (
BPX_HANDLER_ID,
@ -66,8 +67,6 @@ PROC_INFO_DICT = {
KAI.TCS_FT_ON[0]: [OpCodes.TCS_FT_ON, KAI.TCS_FT_ON[1], 120.0, 10.0],
KAI.TCS_FT_OFF[0]: [OpCodes.TCS_FT_OFF, KAI.TCS_FT_OFF[1], 120.0, 10.0],
KAI.ACS_FT[0]: [OpCodes.ACS_FT, KAI.ACS_FT[1], 120.0, 10.0],
}
@ -293,7 +292,6 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str):
tc_queue=tc_queue, proc_key=key, sid=sid, diag=False
)
# mgt 1: imtq und hk
# mgt 2.: imtq + dual side + dipole
@ -301,7 +299,6 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str):
key = KAI.MGT_FT[0]
pack_acs_command(tc_queue=tc_queue, op_code="acs-a")
sid = make_sid(oids.IMTQ_HANDLER_ID, ImtqSetIds.ENG_HK_SET)
pack_generic_hk_listening_cmds(
tc_queue=tc_queue, proc_key=key, sid=sid, diag=False
@ -315,7 +312,6 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str):
tc_queue=tc_queue, proc_key=key, sid=sid, diag=False
)
pack_acs_command(tc_queue=tc_queue, op_code="acs-off")

View File

@ -7,6 +7,7 @@ from tmtccmd.config.args import (
parse_gui_input_arguments,
)
def main():
hook_obj = tmtcc_pre_args()
arg_parser = create_default_args_parser()