Skip to content

Commit 367fdfd

Browse files
Add command line flag to disable update notification prompts.
1 parent 1a20777 commit 367fdfd

File tree

5 files changed

+18
-5
lines changed

5 files changed

+18
-5
lines changed

console_backend/src/cli_options.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,10 @@ pub struct CliOptions {
140140
#[clap(long = "show-csv-log")]
141141
pub show_csv_log: bool,
142142

143+
/// Don't show prompts about firmware/console updates.
144+
#[clap(long = "no-prompts")]
145+
pub no_prompts: bool,
146+
143147
/// Set the height of the main window.
144148
#[clap(long)]
145149
pub height: Option<u32>,

resources/Constants/Globals.qml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ QtObject {
55
property string consoleVersion: "0.0.0"
66
property int currentRefreshRate: 5 // 5 Hz
77
property bool useOpenGL: true
8+
property bool showPrompts: true
89
property int initialMainTabIndex: 0 // Tracking
910
property int initialSubTabIndex: -1 // Not triggered unless greater than -1. Defaults to first tab.
1011
property bool showCsvLog: false

resources/UpdateNotifications.qml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ Item {
178178
running: true
179179
repeat: true
180180
onTriggered: {
181-
if (!popupLock) {
181+
if (!popupLock && Globals.showPrompts) {
182182
if (Globals.updateTabData.consoleVersionLatest) {
183183
if (!consoleVersionDialogAlready) {
184184
if (Globals.updateTabData.consoleOutdated) {

resources/UpdateTabComponents/FirmwareVersion.qml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,14 @@ Item {
115115
let fileioDestinationFilepath = null;
116116
let updateLocalFilename = null;
117117
data_model.update_tab([downloadLatestFirmware, updateFirmware, sendFileToDevice, serialPromptConfirm], updateLocalFilepath, downloadDirectory, fileioLocalFilepath, fileioDestinationFilepath, updateLocalFilename);
118-
if (isSerialConnected)
119-
dialog.open();
120-
118+
if (isSerialConnected) {
119+
if (Globals.showPrompts) {
120+
dialog.open();
121+
} else {
122+
serialPromptConfirm = true;
123+
data_model.update_tab([downloadLatestFirmware, updateFirmware, sendFileToDevice, serialPromptConfirm], updateLocalFilepath, downloadDirectory, fileioLocalFilepath, fileioDestinationFilepath, updateLocalFilename);
124+
}
125+
}
121126
}
122127

123128
Label {

swiftnav_console/main.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,8 @@ def handle_cli_arguments(args: argparse.Namespace, globals_: QObject):
764764
globals_.setProperty("showFileio", True) # type: ignore
765765
if args.no_opengl:
766766
globals_.setProperty("useOpenGL", False) # type: ignore
767+
if args.no_prompts:
768+
globals_.setProperty("showPrompts", False) # type: ignore
767769
if args.refresh_rate is not None:
768770
globals_.setProperty("currentRefreshRate", args.refresh_rate) # type: ignore
769771
if args.tab is not None:
@@ -798,7 +800,8 @@ def main(passed_args: Optional[Tuple[str, ...]] = None) -> int:
798800
parser = argparse.ArgumentParser(add_help=False, usage=argparse.SUPPRESS)
799801
parser.add_argument("--show-fileio", action="store_true")
800802
parser.add_argument("--show-file-connection", action="store_true")
801-
parser.add_argument("--no-opengl", action="store_false")
803+
parser.add_argument("--no-prompts", action="store_true")
804+
parser.add_argument("--no-opengl", action="store_true")
802805
parser.add_argument("--refresh-rate", type=int)
803806
parser.add_argument("--tab")
804807
parser.add_argument("--show-csv-log", action="store_true")

0 commit comments

Comments
 (0)