diff --git a/SOURCEbadge.png b/SOURCEbadge.png new file mode 100644 index 0000000000000000000000000000000000000000..d02b2745e8a8fec61abdf300d4caf0bef2d19453 Binary files /dev/null and b/SOURCEbadge.png differ diff --git a/core/tmtc_client_core.py b/core/tmtc_client_core.py index 08b93b1296755014784b019de34c275ae927ead7..f8f216490ee6e8a3fdf932ba1ba0d784c119ba88 100755 --- a/core/tmtc_client_core.py +++ b/core/tmtc_client_core.py @@ -25,7 +25,11 @@ limitations under the License. @manual Run this file with the -h flag to display options. """ +import sys from multiprocessing import Process + +from PyQt5.QtWidgets import QApplication + from tmtc_core.utility.obsw_logger import set_tmtc_logger, get_logger from config.obsw_config import set_globals @@ -61,8 +65,11 @@ def run_tmtc_client(use_gui: bool): tmtc_handler.initialize() tmtc_handler.perform_operation() else: + app = QApplication(["TMTC Commander"]) tmtc_gui = TmTcFrontend() tmtc_gui.start_ui() + + sys.exit(app.exec_()) # tmtc_handler_task = TmTcHandler.prepare_tmtc_handler_start() # tmtc_frontend = TmTcFrontend() # tmtc_frontend_task = tmtc_frontend.prepare_start(tmtc_frontend) diff --git a/core/tmtc_frontend.py b/core/tmtc_frontend.py index 9a5908a2cc24732126de974caf32f2df8df9480c..fb9d88cc1b8e2fe36f57203d26855951aa8ba2a4 100644 --- a/core/tmtc_frontend.py +++ b/core/tmtc_frontend.py @@ -10,6 +10,8 @@ from multiprocessing import Process from PyQt5.QtWidgets import * +from PyQt5.QtGui import QPixmap, QIcon +import sys from core.tmtc_backend import TmTcHandler from tmtc_core.tc.obsw_pus_tc_base import PusTelecommand from tmtc_core.utility.obsw_logger import get_logger @@ -23,7 +25,8 @@ LOGGER = get_logger() TODO: Make it look nicer. Add SOURCE or KSat logo. """ -class TmTcFrontend: + +class TmTcFrontend(QMainWindow): # TODO: this list should probably be inside an enum in the obsw_config.py serviceList = [ 2, 3, 5, 8, 9, 17, 20, 200, "Dummy", "GPS0", "GPS1" ] # , "Error"] @@ -40,6 +43,7 @@ class TmTcFrontend: is_busy: bool def __init__(self): + super(TmTcFrontend, self).__init__() self.tmtc_handler = TmTcHandler() # TODO: Perform initialization on button press with specified ComIF # Also, when changing ComIF, ensure that old ComIF is closed (e.g. with printout) @@ -113,11 +117,18 @@ class TmTcFrontend: self.single_command_button.setEnabled(state) def start_ui(self): - app = QApplication([]) - win = QWidget() + win = QWidget(self) + self.setCentralWidget(win) grid = QGridLayout() + self.setWindowTitle("TMTC Commander") + label = QLabel(self) + pixmap = QPixmap("SOURCEbadge.png") # QPixmap is the class, easy to put pic on screen + label.setGeometry(720, 15, 110, 110) + label.setPixmap(pixmap) + self.setWindowIcon(QIcon("SOURCEbadge.png")); + label.setScaledContents(True) row = 0 grid.addWidget(QLabel("Configuration:"), row, 0, 1, 2) row += 1 @@ -284,14 +295,13 @@ class TmTcFrontend: row += 1 win.setLayout(grid) - win.resize(900, 800) - win.show() + self.resize(900, 800) + self.show() # resize table columns to fill the window width #for i in range(0, 5): # self.commandTable.setColumnWidth(i, int(self.commandTable.width() / 5) - 3) - app.exec_() class SingleCommandTable(QTableWidget): def __init__(self):