Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions resources/LoggingBar.qml
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@ Rectangle {
SwiftComboBox {
id: sbpLoggingFormat

currentIndex: 0
Layout.preferredWidth: Constants.loggingBar.sbpLoggingButtonWidth
Layout.preferredHeight: loggingBarRowLayout.preferredButtonHeight
enabled: !sbpLoggingButton.checked
Expand Down Expand Up @@ -287,11 +286,14 @@ Rectangle {
repeat: true
onTriggered: {
logging_bar_model.fill_data(loggingBarData);
sbpLoggingButton.checked = loggingBarData.sbp_logging;
csvLoggingButton.checked = loggingBarData.csv_logging;
if (sbpLoggingFormat.currentIndex == -1) {
sbpLoggingFormat.currentIndex = loggingBarData.sbp_logging_format_index;
sbpLoggingButton.checked = loggingBarData.sbp_logging;
csvLoggingButton.checked = loggingBarData.csv_logging;
}
if (loggingBarData.recording_filename)
recordingFilenameText.editText = loggingBarData.recording_filename;
let recording = sbpLoggingButton.checked || csvLoggingButton.checked;
let recording = loggingBarData.sbp_logging;
if (mockTime) {
mockRecordingTime += interval;
recordingTime.text = loggingDurationFormat(mockRecordingTime / 1000);
Expand Down
1 change: 1 addition & 0 deletions swiftnav_console/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ class Keys(str, Enum):
PREVIOUS_FOLDERS = "PREVIOUS_FOLDERS"
SBP_LOGGING = "SBP_LOGGING"
SBP_LOGGING_FORMAT = "SBP_LOGGING_FORMAT"
SBP_LOGGING_FORMAT_INDEX = "SBP_LOGGING_FORMAT_INDEX"
CSV_LOGGING = "CSV_LOGGING"
SBP_LOGGING_LABELS = "SBP_LOGGING_LABELS"
LOG_LEVEL_LABELS = "LOG_LEVEL_LABELS"
Expand Down
14 changes: 13 additions & 1 deletion swiftnav_console/logging_bar.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ def logging_bar_update() -> Dict[str, Any]:
Keys.CSV_LOGGING: False,
Keys.SBP_LOGGING: False,
Keys.SBP_LOGGING_FORMAT: SbpLogging.SBP_JSON,
Keys.SBP_LOGGING_FORMAT_INDEX: 0,
Keys.SBP_LOGGING_LABELS: [SbpLogging.SBP_JSON, SbpLogging.SBP],
}

Expand Down Expand Up @@ -70,11 +71,12 @@ def __len__(self) -> int:


@QmlElement
class LoggingBarData(QObject): # pylint: disable=too-many-instance-attributes
class LoggingBarData(QObject): # pylint: disable=too-many-instance-attributes, too-many-public-methods
_instance: "LoggingBarData"
_csv_logging: bool = False
_sbp_logging: bool = False
_sbp_logging_format: str = SbpLogging.SBP_JSON
_sbp_logging_format_index: int = 0
_sbp_logging_labels: QStringListModel = SwiftStringListModel()
_previous_folders: QStringListModel = SwiftStringListModel()
_recording_duration_sec: int = 0
Expand All @@ -97,6 +99,7 @@ def __init__(self):

@classmethod
def post_data_update(cls, update_data: Dict[str, Any]) -> None:
update_data[Keys.SBP_LOGGING_FORMAT_INDEX] = update_data[Keys.SBP_LOGGING_LABELS].index(update_data[Keys.SBP_LOGGING_FORMAT])
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it might be better to have this posted in capnproto but we construct the string model here so will just leave it here...

LOGGING_BAR[0] = update_data
cls._instance._data_updated.emit() # pylint: disable=protected-access

Expand Down Expand Up @@ -148,6 +151,14 @@ def set_sbp_logging_format(self, sbp_logging_format: str) -> None:

sbp_logging_format = Property(str, get_sbp_logging_format, set_sbp_logging_format)

def get_sbp_logging_format_index(self) -> int:
return self._sbp_logging_format_index

def set_sbp_logging_format_index(self, sbp_logging_format_index: int) -> None:
self._sbp_logging_format_index = sbp_logging_format_index

sbp_logging_format_index = Property(int, get_sbp_logging_format_index, set_sbp_logging_format_index)

# sbp_logging_labels property
def get_sbp_logging_labels(self) -> QObject:
return self._sbp_logging_labels
Expand Down Expand Up @@ -203,6 +214,7 @@ def fill_data(self, cp: LoggingBarData) -> LoggingBarData: # pylint:disable=no-
cp.set_csv_logging(cp.logging_bar[Keys.CSV_LOGGING])
cp.set_sbp_logging(cp.logging_bar[Keys.SBP_LOGGING])
cp.set_sbp_logging_format(cp.logging_bar[Keys.SBP_LOGGING_FORMAT])
cp.set_sbp_logging_format_index(cp.logging_bar[Keys.SBP_LOGGING_FORMAT_INDEX])
cp.set_sbp_logging_labels(cp.logging_bar[Keys.SBP_LOGGING_LABELS])
cp.set_previous_folders(cp.logging_bar[Keys.PREVIOUS_FOLDERS])
cp.set_recording_size(cp.logging_bar_recording[Keys.RECORDING_SIZE])
Expand Down