Skip to content

Commit 6a6c575

Browse files
Merge branch 'main' of github.com:swift-nav/console_pp into john-michaelburke/copy-table
2 parents 56948e2 + 04376c2 commit 6a6c575

File tree

15 files changed

+94
-56
lines changed

15 files changed

+94
-56
lines changed

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Makefile.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -879,11 +879,13 @@ cd console_backend/tests && python ../../utils/bench_runner.py --frontend_mem --
879879
'''
880880

881881
[tasks.newline-terminator]
882+
env = { EXCLUSION_PATTERNS = [".png", "docs", "resources/images"] }
882883
private = true
883884
script_runner = "python"
884885
script_extension = "py"
885886
script = '''
886887
import os
888+
import re
887889
import sys
888890
import subprocess
889891
def raises_exc(func):
@@ -900,6 +902,9 @@ try_open_text = lambda fn: lambda: (open(fn, "ta"), open(fn, "tr").read(4096))
900902
valid_file = lambda fn: os.path.getsize(fn) > 0 and not raises_exc(try_open_text(fn))
901903
no_trailing_lf = lambda fn: valid_file(fn) and not has_newline(fn)
902904
all_files = subprocess.check_output(["git", "ls-files"]).decode('utf8').splitlines()
905+
exclusion_substrings = os.environ.get("EXCLUSION_PATTERNS")
906+
exclusion_substrings = exclusion_substrings.split(";")
907+
all_files = [x for x in all_files if not any([re.match(".*"+y, x) for y in exclusion_substrings])]
903908
no_newline = list(map(append_newline, filter(no_trailing_lf, all_files)))
904909
footer = "*********************************************\n"
905910
err = "ERROR: " if dry_run else "Fixing "

console_backend/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ minreq = { version = "2.4.2", features = ["https"] }
4242
regex = { version = "1.5.4" }
4343
rust-ini = "0.17.0"
4444
sbp = { version = "4.0.3", features = ["json", "link", "swiftnav"] }
45-
sbp-settings = "0.5.0"
45+
sbp-settings = "0.6.0"
4646
env_logger = { version = "0.9", optional = true }
4747
mimalloc = { version = "0.1", default-features = false }
4848

console_backend/src/main_tab.rs

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ use std::{
44
time::{Duration, Instant},
55
};
66

7-
use capnp::message::Builder;
87
use chrono::Local;
98
use log::error;
109
use sbp::Sbp;
@@ -15,7 +14,7 @@ use crate::constants::{
1514
};
1615
use crate::output::{CsvLogging, SbpLogger};
1716
use crate::shared_state::{create_directory, SharedState};
18-
use crate::utils::{bytes_to_human_readable, refresh_loggingbar, serialize_capnproto_builder};
17+
use crate::utils::{refresh_loggingbar, refresh_loggingbar_recording};
1918
use crate::{client_sender::BoxedClientSender, shared_state::ConnectionState};
2019
use crate::{common_constants::SbpLogging, shared_state::SbpLoggingStatsState};
2120

@@ -55,32 +54,6 @@ pub fn logging_stats_thread(
5554
})
5655
}
5756

58-
pub fn refresh_loggingbar_recording(
59-
client_sender: &BoxedClientSender,
60-
size: u64,
61-
duration: u64,
62-
filename: Option<String>,
63-
) {
64-
let mut builder = Builder::new_default();
65-
let msg = builder.init_root::<crate::console_backend_capnp::message::Builder>();
66-
67-
let mut logging_bar_status = msg.init_logging_bar_recording_status();
68-
logging_bar_status.set_recording_duration_sec(duration);
69-
logging_bar_status.set_recording_size(&bytes_to_human_readable(size as u128));
70-
if let Some(filename_) = filename {
71-
logging_bar_status
72-
.reborrow()
73-
.get_recording_filename()
74-
.set_filename(&filename_);
75-
} else {
76-
logging_bar_status
77-
.reborrow()
78-
.get_recording_filename()
79-
.set_none(());
80-
}
81-
client_sender.send_data(serialize_capnproto_builder(builder));
82-
}
83-
8457
pub struct MainTab {
8558
logging_directory: PathBuf,
8659
last_csv_logging: CsvLogging,

console_backend/src/utils.rs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,32 @@ pub fn refresh_loggingbar(client_sender: &BoxedClientSender, shared_state: &Shar
178178
client_sender.send_data(serialize_capnproto_builder(builder));
179179
}
180180

181+
pub fn refresh_loggingbar_recording(
182+
client_sender: &BoxedClientSender,
183+
size: u64,
184+
duration: u64,
185+
filename: Option<String>,
186+
) {
187+
let mut builder = Builder::new_default();
188+
let msg = builder.init_root::<crate::console_backend_capnp::message::Builder>();
189+
190+
let mut logging_bar_status = msg.init_logging_bar_recording_status();
191+
logging_bar_status.set_recording_duration_sec(duration);
192+
logging_bar_status.set_recording_size(size);
193+
if let Some(filename_) = filename {
194+
logging_bar_status
195+
.reborrow()
196+
.get_recording_filename()
197+
.set_filename(&filename_);
198+
} else {
199+
logging_bar_status
200+
.reborrow()
201+
.get_recording_filename()
202+
.set_none(());
203+
}
204+
client_sender.send_data(serialize_capnproto_builder(builder));
205+
}
206+
181207
pub fn signal_key_label(
182208
key: (SignalCodes, i16),
183209
extra: Option<&HashMap<i16, i16>>,

resources/BaselineTab.qml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ MainTab {
1717
height: parent.height
1818

1919
Rectangle {
20-
SplitView.minimumWidth: Constants.baselineTable.width
20+
SplitView.minimumWidth: Constants.baselineTable.minimumWidth
2121
SplitView.fillHeight: true
2222

2323
BaselineTabComponents.BaselineTable {
@@ -26,6 +26,7 @@ MainTab {
2626
}
2727

2828
BaselineTabComponents.BaselinePlot {
29+
SplitView.minimumWidth: Constants.baselinePlot.minimumWidth
2930
SplitView.fillWidth: true
3031
SplitView.fillHeight: true
3132
}

resources/Constants/Constants.qml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,7 @@ QtObject {
408408
}
409409

410410
baselinePlot: QtObject {
411+
readonly property int minimumWidth: 410
411412
readonly property int buttonSvgHeight: 15
412413
readonly property int navBarMargin: 10
413414
readonly property int navBarSpacing: 0
@@ -422,7 +423,7 @@ QtObject {
422423
}
423424

424425
baselineTable: QtObject {
425-
readonly property int width: 240
426+
readonly property int minimumWidth: 240
426427
readonly property int defaultColumnWidth: 100
427428
readonly property color tableBorderColor: "#000000"
428429
readonly property int tableBorderWidth: 1
@@ -437,6 +438,7 @@ QtObject {
437438
}
438439

439440
solutionPosition: QtObject {
441+
readonly property int minimumWidth: 410
440442
readonly property int buttonSvgHeight: 15
441443
readonly property int navBarMargin: 10
442444
readonly property int navBarSpacing: 0
@@ -461,6 +463,7 @@ QtObject {
461463
readonly property int pauseButtonPadding: 0
462464
readonly property string pauseButtonTooltip: "Pause Log Panel"
463465
readonly property string playButtonTooltip: "Resume Log Panel"
466+
readonly property string clearButtonTooltip: "Clear Log Panel"
464467
readonly property int logLevelMenuHeight: 100
465468
readonly property int dropdownButtonPadding: 0
466469
readonly property int dropdownButtonWidth: 20
@@ -483,7 +486,7 @@ QtObject {
483486
}
484487

485488
solutionTable: QtObject {
486-
readonly property int width: 240
489+
readonly property int minimumWidth: 240
487490
readonly property int defaultColumnWidth: 100
488491
readonly property color tableBorderColor: "#000000"
489492
readonly property int tableBorderWidth: 1
@@ -630,6 +633,7 @@ QtObject {
630633
readonly property string swiftLogoPath: "qrc:/images/icon.png"
631634
readonly property string swiftLogoWidePath: "qrc:/images/swiftLogoWide.svg"
632635
readonly property string folderPath: "qrc:/images/fontawesome/folder-regular.svg"
636+
readonly property string xPath: "qrc:/images/iconic/x.svg"
633637
}
634638

635639
insSettingsPopup: QtObject {

resources/LogPanel.qml

Lines changed: 37 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
import "./Constants"
2-
import "./TableComponents"
1+
import "BaseComponents"
2+
import "Constants"
33
import Qt.labs.qmlmodels 1.0
44
import QtQuick 2.15
55
import QtQuick.Controls 2.15
66
import SwiftConsole 1.0
7+
import "TableComponents"
78

89
Item {
910
property var logEntries: []
@@ -30,13 +31,43 @@ Item {
3031
anchors.rightMargin: Constants.logPanel.pauseButtonRightMargin
3132
z: Constants.logPanel.zAboveTable
3233

33-
RoundButton {
34-
id: baselinePauseButton
34+
SwiftButton {
35+
width: Constants.logPanel.pauseButtonWidth
36+
height: Constants.logPanel.pauseButtonWidth
37+
padding: Constants.logPanel.pauseButtonPadding
38+
icon.width: Constants.logPanel.pauseButtonWidth / 3
39+
icon.height: Constants.logPanel.pauseButtonWidth / 3
40+
icon.source: Constants.icons.xPath
41+
icon.color: Constants.materialGrey
42+
anchors.right: parent.right
43+
anchors.top: parent.top
44+
ToolTip.visible: hovered
45+
ToolTip.text: Constants.logPanel.clearButtonTooltip
46+
onClicked: {
47+
tableView.model.clear();
48+
var new_row = {
49+
};
50+
new_row[Constants.logPanel.timestampHeader] = "";
51+
new_row[Constants.logPanel.levelHeader] = "";
52+
new_row[Constants.logPanel.msgHeader] = "";
53+
logEntries = [new_row];
54+
tableView.model.setRow(0, new_row);
55+
tableView.forceLayout();
56+
}
57+
}
3558

59+
}
60+
61+
Item {
62+
anchors.fill: parent
63+
anchors.topMargin: Constants.genericTable.cellHeight * 2
64+
anchors.rightMargin: Constants.logPanel.pauseButtonRightMargin
65+
z: Constants.logPanel.zAboveTable
66+
67+
SwiftButton {
3668
visible: !consolePaused
3769
width: Constants.logPanel.pauseButtonWidth
3870
height: Constants.logPanel.pauseButtonWidth
39-
radius: Constants.logPanel.pauseButtonWidth / 3
4071
padding: Constants.logPanel.pauseButtonPadding
4172
icon.width: Constants.logPanel.pauseButtonWidth / 3
4273
icon.height: Constants.logPanel.pauseButtonWidth / 3
@@ -51,13 +82,10 @@ Item {
5182
}
5283
}
5384

54-
RoundButton {
55-
id: baselinePlayButton
56-
85+
SwiftButton {
5786
visible: consolePaused
5887
width: Constants.logPanel.pauseButtonWidth
5988
height: Constants.logPanel.pauseButtonWidth
60-
radius: Constants.logPanel.pauseButtonWidth / 3
6189
padding: Constants.logPanel.pauseButtonPadding
6290
icon.width: Constants.logPanel.pauseButtonWidth / 3
6391
icon.height: Constants.logPanel.pauseButtonWidth / 3

resources/LoggingBar.qml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Rectangle {
1919
let hours = Math.floor(duration / 3600).toFixed(0).padStart(2, 0);
2020
let minutes = Math.floor(duration / 60).toFixed(0).padStart(2, 0);
2121
let seconds = (duration % 60).toFixed(0).padStart(2, 0);
22-
return hours + ":" + minutes + ":" + seconds + " s";
22+
return hours + ":" + minutes + ":" + seconds;
2323
}
2424

2525
color: Constants.swiftControlBackground
@@ -275,8 +275,8 @@ Rectangle {
275275
mockRecordingSize += 15.15;
276276
recordingSize.text = bytesToString(mockRecordingSize);
277277
} else {
278-
if (loggingBarData.recording_size.length > 0)
279-
recordingSize.text = loggingBarData.recording_size;
278+
if (loggingBarData.recording_size > 0)
279+
recordingSize.text = bytesToString(loggingBarData.recording_size);
280280
else
281281
recordingSize.text = "0.00 MiB";
282282
}

resources/SettingsTab.qml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ MainTab {
153153
ColumnLayout {
154154
SplitView.fillWidth: true
155155
SplitView.fillHeight: true
156-
SplitView.minimumWidth: parent.width * 0.55 //Constants.settingsTable.minimumWidth
156+
SplitView.minimumWidth: parent.width * 0.55
157157
spacing: 3
158158

159159
RowLayout {

0 commit comments

Comments
 (0)