From 18cbb52daf66cac61c71d289c899491c8a8c3d2e Mon Sep 17 00:00:00 2001 From: zachar1a Date: Tue, 6 Oct 2020 16:40:05 -0500 Subject: [PATCH] Fix #123, #121, Make into package and close all windows on exit --- GroundSystem.py | 18 ++++++++++++------ Subsystems/__init__.py | 0 Subsystems/cmdGui/CommandFiles/__init__.py | 0 Subsystems/cmdGui/__init__.py | 0 Subsystems/cmdUtil/__init__.py | 0 Subsystems/tlmGUI/__init__.py | 0 requirements.txt | 1 + setup.py | 13 +++++++++++++ 8 files changed, 26 insertions(+), 6 deletions(-) create mode 100644 Subsystems/__init__.py create mode 100644 Subsystems/cmdGui/CommandFiles/__init__.py create mode 100644 Subsystems/cmdGui/__init__.py create mode 100644 Subsystems/cmdUtil/__init__.py create mode 100644 Subsystems/tlmGUI/__init__.py create mode 100644 requirements.txt create mode 100644 setup.py diff --git a/GroundSystem.py b/GroundSystem.py index f72a52a..342a213 100644 --- a/GroundSystem.py +++ b/GroundSystem.py @@ -24,7 +24,9 @@ import shlex import subprocess import sys -from pathlib import Path +import os +import signal +import pathlib from PyQt5.QtWidgets import QApplication, QMainWindow, QMessageBox @@ -36,8 +38,8 @@ __version__ = _version - -ROOTDIR = Path(sys.argv[0]).resolve().parent +#ROOTDIR = Path(sys.argv[0]).resolve().parent +ROOTDIR = pathlib.Path(__file__).parent.absolute() # @@ -71,7 +73,7 @@ def closeEvent(self, evnt): if self.RoutingService: self.RoutingService.stop() print("Stopped routing service") - + os.kill(0, signal.SIGKILL) super().closeEvent(evnt) # Read the selected spacecraft from combo box on GUI @@ -171,9 +173,10 @@ def initRoutingService(self): # # Main + # -if __name__ == "__main__": - +def main(): + # Report Version Number upon startup print(_version_string) @@ -193,3 +196,6 @@ def initRoutingService(self): # Execute the app sys.exit(app.exec_()) + +if __name__ == "__main__": + main() diff --git a/Subsystems/__init__.py b/Subsystems/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/Subsystems/cmdGui/CommandFiles/__init__.py b/Subsystems/cmdGui/CommandFiles/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/Subsystems/cmdGui/__init__.py b/Subsystems/cmdGui/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/Subsystems/cmdUtil/__init__.py b/Subsystems/cmdUtil/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/Subsystems/tlmGUI/__init__.py b/Subsystems/tlmGUI/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..49fe098 --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +setuptools diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..f95033d --- /dev/null +++ b/setup.py @@ -0,0 +1,13 @@ +from setuptools import setup + +setup( + name='GroundSystem', + packages=['Subsystems','Subsystems.tlmGUI','Subsystems.cmdGui','Subsystems.cmdUtil'], + include_package_data=True, + version='0.0.0', + entry_points={ + 'console_scripts':[ + 'startg=GroundSystem:main' + ] + }, + )