@@ -41,6 +41,7 @@ def logging_bar_update() -> Dict[str, Any]:
4141 Keys .CSV_LOGGING : False ,
4242 Keys .SBP_LOGGING : False ,
4343 Keys .SBP_LOGGING_FORMAT : SbpLogging .SBP_JSON ,
44+ Keys .SBP_LOGGING_FORMAT_INDEX : 0 ,
4445 Keys .SBP_LOGGING_LABELS : [SbpLogging .SBP_JSON , SbpLogging .SBP ],
4546 }
4647
@@ -70,11 +71,12 @@ def __len__(self) -> int:
7071
7172
7273@QmlElement
73- class LoggingBarData (QObject ): # pylint: disable=too-many-instance-attributes
74+ class LoggingBarData (QObject ): # pylint: disable=too-many-instance-attributes, too-many-public-methods
7475 _instance : "LoggingBarData"
7576 _csv_logging : bool = False
7677 _sbp_logging : bool = False
7778 _sbp_logging_format : str = SbpLogging .SBP_JSON
79+ _sbp_logging_format_index : int = 0
7880 _sbp_logging_labels : QStringListModel = SwiftStringListModel ()
7981 _previous_folders : QStringListModel = SwiftStringListModel ()
8082 _recording_duration_sec : int = 0
@@ -97,6 +99,7 @@ def __init__(self):
9799
98100 @classmethod
99101 def post_data_update (cls , update_data : Dict [str , Any ]) -> None :
102+ update_data [Keys .SBP_LOGGING_FORMAT_INDEX ] = update_data [Keys .SBP_LOGGING_LABELS ].index (update_data [Keys .SBP_LOGGING_FORMAT ])
100103 LOGGING_BAR [0 ] = update_data
101104 cls ._instance ._data_updated .emit () # pylint: disable=protected-access
102105
@@ -148,6 +151,14 @@ def set_sbp_logging_format(self, sbp_logging_format: str) -> None:
148151
149152 sbp_logging_format = Property (str , get_sbp_logging_format , set_sbp_logging_format )
150153
154+ def get_sbp_logging_format_index (self ) -> int :
155+ return self ._sbp_logging_format_index
156+
157+ def set_sbp_logging_format_index (self , sbp_logging_format_index : int ) -> None :
158+ self ._sbp_logging_format_index = sbp_logging_format_index
159+
160+ sbp_logging_format_index = Property (int , get_sbp_logging_format_index , set_sbp_logging_format_index )
161+
151162 # sbp_logging_labels property
152163 def get_sbp_logging_labels (self ) -> QObject :
153164 return self ._sbp_logging_labels
@@ -203,6 +214,7 @@ def fill_data(self, cp: LoggingBarData) -> LoggingBarData: # pylint:disable=no-
203214 cp .set_csv_logging (cp .logging_bar [Keys .CSV_LOGGING ])
204215 cp .set_sbp_logging (cp .logging_bar [Keys .SBP_LOGGING ])
205216 cp .set_sbp_logging_format (cp .logging_bar [Keys .SBP_LOGGING_FORMAT ])
217+ cp .set_sbp_logging_format_index (cp .logging_bar [Keys .SBP_LOGGING_FORMAT_INDEX ])
206218 cp .set_sbp_logging_labels (cp .logging_bar [Keys .SBP_LOGGING_LABELS ])
207219 cp .set_previous_folders (cp .logging_bar [Keys .PREVIOUS_FOLDERS ])
208220 cp .set_recording_size (cp .logging_bar_recording [Keys .RECORDING_SIZE ])
0 commit comments