44"""
55
66import sys
7- from PyQt5 .QtWidgets import QApplication , QWidget
87
9- title = "EPS Battery Estimator"
8+ from PyQt5 .QtSensors import QMagnetometer
9+ from PyQt5 .QtWidgets import QApplication , QWidget , QButtonGroup , QGroupBox , QVBoxLayout , QPushButton , QHBoxLayout
10+
11+ title = "Cubesat EPS solver"
1012
1113class ApplicationWindow (QWidget ):
1214 def __init__ (self ):
@@ -17,10 +19,54 @@ def initialize_ui(self):
1719 """
1820 initialize the window and display its contents on to the screen
1921 """
20- self .setGeometry (100 ,100 ,400 ,300 )
22+
23+ self .setGeometry (700 , 100 , 1100 , 600 )
2124 self .setWindowTitle (title )
25+
26+
27+ # main layout
28+ main_layout = QHBoxLayout ()
29+ self .setLayout (main_layout )
30+
31+ # create side panel for sub-system selection
32+ side_panel = self .create_side_tree_panel ()
33+ main_layout .addWidget (side_panel )
34+
35+
2236 self .show ()
2337
38+ def create_side_tree_panel (self ):
39+ """
40+ create subsystems tree on the left side panel
41+ """
42+
43+ # Side tree view for subsystems select
44+ subsystems_groupbox = QGroupBox ("Subsystems" )
45+ subsystems_layout = QVBoxLayout ()
46+ subsystems_groupbox .setLayout (subsystems_layout )
47+
48+ # create side buttons and add them to the groupbox layout
49+ obc_sys_select_btn = QPushButton ("Onboard Computer" )
50+ comms_sys_select_btn = QPushButton ("Communication System" )
51+ adcu_sys_select_btn = QPushButton ("Attitude Determination and Control" )
52+ eps_sys_select_btn = QPushButton ("Electrical Power Supply" )
53+ magnetorquer_sys_select_btn = QPushButton ("Magnetorquer" )
54+ add_sys_select_btn = QPushButton ("+ Add new" )
55+
56+ # add buttons to the layout
57+ subsystems_layout .addWidget (obc_sys_select_btn )
58+ subsystems_layout .addWidget (comms_sys_select_btn )
59+ subsystems_layout .addWidget (adcu_sys_select_btn )
60+ subsystems_layout .addWidget (eps_sys_select_btn )
61+ subsystems_layout .addWidget (magnetorquer_sys_select_btn )
62+ subsystems_layout .addWidget (add_sys_select_btn )
63+
64+ # append buttons to button group
65+ sub_sys_button_group = QButtonGroup (subsystems_groupbox )
66+ sub_sys_button_group .addButton (obc_sys_select_btn )
67+ sub_sys_button_group .addButton (comms_sys_select_btn )
68+
69+ return subsystems_groupbox
2470
2571# run
2672if __name__ == '__main__' :
0 commit comments