From a1bc01022dacbfff924d74f8e650dc21466251ef Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" <robin.mueller.m@gmail.com> Date: Sat, 7 Mar 2020 15:36:31 +0100 Subject: [PATCH] gui enabled now --- .../OBSW_TmTcClient_Test.xml | 24 +++++++++++++++++++ OBSW_TmTcClient.py | 10 ++++++-- config/OBSW_Config.py | 3 +-- config/__init__.py | 0 gui/OBSW_TmtcGUI.py | 14 ++++++++--- sendreceive/__init__.py | 0 tc/__init__.py | 0 tm/__init__.py | 0 utility/__init__.py | 0 9 files changed, 44 insertions(+), 7 deletions(-) create mode 100644 .idea/runConfigurations/OBSW_TmTcClient_Test.xml create mode 100644 config/__init__.py create mode 100644 sendreceive/__init__.py create mode 100644 tc/__init__.py create mode 100644 tm/__init__.py create mode 100644 utility/__init__.py diff --git a/.idea/runConfigurations/OBSW_TmTcClient_Test.xml b/.idea/runConfigurations/OBSW_TmTcClient_Test.xml new file mode 100644 index 0000000..7524486 --- /dev/null +++ b/.idea/runConfigurations/OBSW_TmTcClient_Test.xml @@ -0,0 +1,24 @@ +<component name="ProjectRunConfigurationManager"> + <configuration default="false" name="OBSW_TmTcClient Test" type="PythonConfigurationType" factoryName="Python"> + <module name="tmtc" /> + <option name="INTERPRETER_OPTIONS" value="" /> + <option name="PARENT_ENVS" value="true" /> + <envs> + <env name="PYTHONUNBUFFERED" value="1" /> + </envs> + <option name="SDK_HOME" value="" /> + <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" /> + <option name="IS_MODULE_SDK" value="true" /> + <option name="ADD_CONTENT_ROOTS" value="true" /> + <option name="ADD_SOURCE_ROOTS" value="true" /> + <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" /> + <option name="SCRIPT_NAME" value="$PROJECT_DIR$/OBSW_TmTcClient.py" /> + <option name="PARAMETERS" value="-h" /> + <option name="SHOW_COMMAND_LINE" value="false" /> + <option name="EMULATE_TERMINAL" value="false" /> + <option name="MODULE_MODE" value="false" /> + <option name="REDIRECT_INPUT" value="false" /> + <option name="INPUT_FILE" value="" /> + <method v="2" /> + </configuration> +</component> \ No newline at end of file diff --git a/OBSW_TmTcClient.py b/OBSW_TmTcClient.py index 69305d4..116dbe6 100644 --- a/OBSW_TmTcClient.py +++ b/OBSW_TmTcClient.py @@ -69,14 +69,20 @@ from utility.OBSW_ArgParser import parseInputArguments from utility.OBSW_TmTcPrinter import TmtcPrinter from comIF.OBSW_Ethernet_ComIF import EthernetComIF from comIF.OBSW_Serial_ComIF import SerialComIF +from gui.OBSW_TmtcGUI import TmtcGUI def main(): args = parseInputArguments() setGlobals(args) tmtcPrinter = TmtcPrinter(g.displayMode, g.printToFile, True) - communicationInterface = setCommunicationInterface(tmtcPrinter) - atexit.register(communicationInterface.keyboardInterruptHandler) + communicationInterface = 0 + if g.modeId == "GUIMode": + GUI = TmtcGUI() + GUI.open() + else: + communicationInterface = setCommunicationInterface(tmtcPrinter) + atexit.register(communicationInterface.keyboardInterruptHandler) if g.modeId == "ListenerMode": Receiver = CommandSenderReceiver(communicationInterface, tmtcPrinter, g.tmTimeout, g.tcSendTimeoutFactor, g.printToFile) diff --git a/config/OBSW_Config.py b/config/OBSW_Config.py index 6608e59..45a312a 100644 --- a/config/OBSW_Config.py +++ b/config/OBSW_Config.py @@ -69,8 +69,7 @@ def setGlobals(args): global recAddress, sendAddress, scriptMode, modeId, service, displayMode, comIF, comPort, serialTimeout global tmTimeout, tcSendTimeoutFactor, sockSend, sockReceive, printToFile, printHkData, printRawTmData if args.mode == 0: - print("GUI mode not implemented yet. Try other modes") - exit() + print("GUI mode not implemented yet !") if args.shortDisplayMode: displayMode = "short" else: diff --git a/config/__init__.py b/config/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/gui/OBSW_TmtcGUI.py b/gui/OBSW_TmtcGUI.py index a64eca3..23c13e8 100644 --- a/gui/OBSW_TmtcGUI.py +++ b/gui/OBSW_TmtcGUI.py @@ -15,6 +15,7 @@ """ from tkinter import * + # A first simple version has drop down menus to chose all necessary options # which are normally handled by the args parser. # when pressing save, all chosen values get passed to the globals file (OBSW_Config) @@ -22,6 +23,13 @@ from tkinter import * # A third button to perform a keyboard interrupt should be implemented # include a really nice source badge and make it large ! # plan this on paper first... -window = Tk() -window.title("Hallo Welt") -window.mainloop() +class TmtcGUI: + def __init__(self): + self.window = Tk() + + def open(self): + self.window.title("Hallo Welt") + self.window.mainloop() + + def close(self): + self.window.quit() diff --git a/sendreceive/__init__.py b/sendreceive/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tc/__init__.py b/tc/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tm/__init__.py b/tm/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/utility/__init__.py b/utility/__init__.py new file mode 100644 index 0000000..e69de29 -- GitLab